pylatex.lists

This module implements the classes that deal with LaTeX lists.

These lists are specifically enumerate, itemize and description.

class List(*, options=None, arguments=None, start_arguments=None, **kwargs)[source]

Bases: pylatex.base_classes.containers.Environment

A base class that represents a list.

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 = True[source]

List environments cause compile errors when they do not contain items. This is why they are omitted fully if they are empty.

add_item(s)[source]

Add an item to the list.

Parameters:s (str or LatexObject) – The item itself.
class Enumerate(enumeration_symbol=None, *, options=None, **kwargs)[source]

Bases: pylatex.lists.List

A class that represents an enumerate list.

Parameters:
  • enumeration_symbol (str) – The enumeration symbol to use, see the enumitem documentation to see what can be used here. This argument is not escaped as it usually should usually contain commands, so do not use user input here.
  • options (str or list or Options) – Custom options to be added to the enumerate list. These options are merged with the options created by enumeration_symbol.
add_item(s)[source]

Add an item to the list.

Parameters:s (str or LatexObject) – The item itself.
omit_if_empty = True
class Itemize(*, options=None, arguments=None, start_arguments=None, **kwargs)[source]

Bases: pylatex.lists.List

A class that represents an itemize list.

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
add_item(s)[source]

Add an item to the list.

Parameters:s (str or LatexObject) – The item itself.
omit_if_empty = True
class Description(*, options=None, arguments=None, start_arguments=None, **kwargs)[source]

Bases: pylatex.lists.List

A class that represents a description list.

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
add_item(label, s)[source]

Add an item to the list.

Parameters:
  • label (str) – Description of the item.
  • s (str or LatexObject) – The item itself.
omit_if_empty = True