pylatex.config

This module implements the ability to use of different configurations.

The current active configuration is pylatex.config.active. This variable can simply be changed to another configuration and that will be used.

It is also possible to use the use method to do this temporarily in a specific context.

class Version1(**kwargs)[source]

Bases: object

The config used to get the behaviour of v1.x.y of the library.

The default attributes are:

indent = True
booktabs = False
microtype = False
row_height = None
Parameters:kwargs – Key value pairs of the default attributes that should be overridden
indent = True[source]
booktabs = False[source]
microtype = False[source]
row_height = None[source]
use()[source]

Use the config temporarily in specific context.

A simple usage example:

with Version1(indent=False).use():
    # Do stuff where indent should be False
    ...
change(**kwargs)[source]

Override some attributes of the config in a specific context.

A simple usage example:

with pylatex.config.active.change(indent=False):
    # Do stuff where indent should be False
    ...
Parameters:kwargs – Key value pairs of the default attributes that should be overridden
Default[source]

The default configuration in this release. Currently the same as Version1

alias of Version1

class Version2(**kwargs)[source]

Bases: pylatex.config.Version1

The config used to get the behaviour of v2.x.y of the library.

The default attributes are:

indent = False
booktabs = True
microtype = True
row_height = 1.3
Parameters:kwargs – Key value pairs of the default attributes that should be overridden
indent = False[source]
booktabs = True[source]
microtype = True[source]
row_height = 1.3[source]
change(**kwargs)[source]

Override some attributes of the config in a specific context.

A simple usage example:

with pylatex.config.active.change(indent=False):
    # Do stuff where indent should be False
    ...
Parameters:kwargs – Key value pairs of the default attributes that should be overridden
use()[source]

Use the config temporarily in specific context.

A simple usage example:

with Version1(indent=False).use():
    # Do stuff where indent should be False
    ...
NextMajor[source]

The default configuration in the nxt major release. Currently the same as Version2.

alias of Version2

active = <pylatex.config.Version1 object>[source]

The current active configuration