pylatex.position

This module implements the classes that deal with positioning.

Positions various elements on the page.

class HorizontalSpace(size, *, star=True)[source]

Bases: pylatex.base_classes.command.CommandBase

Add/remove the amount of horizontal space between elements.

Parameters:
  • size (str) – The amount of space to add
  • star (bool) – Use the star variant of the command. Enabling this makes sure the space is also added where page breaking takes place.
class VerticalSpace(size, *, star=True)[source]

Bases: pylatex.position.HorizontalSpace

Add the user specified amount of vertical space to the document.

Parameters:
  • size (str) – The amount of space to add
  • star (bool) – Use the star variant of the command. Enabling this makes sure the space is also added where page breaking takes place.
class Center(*, options=None, arguments=None, start_arguments=None, **kwargs)[source]

Bases: pylatex.base_classes.containers.Environment

Centered environment.

Parameters:
  • options (str or list or Options) – Options to be added to the \begin command
  • arguments (str or list or Arguments) – Arguments to be added to the \begin command
  • start_arguments (str or list or Arguments) – Arguments to be added before the options
omit_if_empty = False
class FlushLeft(*, options=None, arguments=None, start_arguments=None, **kwargs)[source]

Bases: pylatex.position.Center

Left-aligned environment.

Parameters:
  • options (str or list or Options) – Options to be added to the \begin command
  • arguments (str or list or Arguments) – Arguments to be added to the \begin command
  • start_arguments (str or list or Arguments) – Arguments to be added before the options
omit_if_empty = False
class FlushRight(*, options=None, arguments=None, start_arguments=None, **kwargs)[source]

Bases: pylatex.position.Center

Right-aligned environment.

Parameters:
  • options (str or list or Options) – Options to be added to the \begin command
  • arguments (str or list or Arguments) – Arguments to be added to the \begin command
  • start_arguments (str or list or Arguments) – Arguments to be added before the options
omit_if_empty = False
class MiniPage(*, width=NoEscape(textwidth), pos=None, height=None, content_pos=None, align=None, fontsize=None, data=None)[source]

Bases: pylatex.base_classes.containers.Environment

A class that allows the creation of minipages within document pages.

Parameters:
  • width (str) – width of the minipage
  • pos (str) – The vertical alignment of the minipage relative to the baseline (center(c), top(t), bottom(b))
  • height (str) – height of the minipage
  • content_pos (str) – The position of the content inside the minipage (center(c), bottom(b), top(t), spread(s))
  • align (str) – alignment of the minibox
  • fontsize (str) – The font size of the minipage
  • data (str or LatexObject) – The data to place inside the MiniPage element
omit_if_empty = False
class TextBlock(width, horizontal_pos, vertical_pos, *, indent=False, data=None)[source]

Bases: pylatex.base_classes.containers.Environment

A class that represents a textblock environment.

Make sure to set lengths of TPHorizModule and TPVertModule

Parameters:
  • width (float) – Width of the text block in the units specified by TPHorizModule
  • horizontal_pos (float) – Horizontal position in units specified by the TPHorizModule
  • indent (bool) – Determines whether the text block has an indent before it
  • vertical_pos (float) – Vertical position in units specified by the TPVertModule
  • data (str or LatexObject) – The data to place inside the TextBlock element
omit_if_empty = False