The lang.latex module

LaTeX language and transformation definition.

class Latex[source]

Bases: Latex

Latex language definition.

classmethod get_environment_target(name)[source]

Return environment target for environment name.

Can be overridden to support special environments.

classmethod common()[source]
option = Latex.option
test_lilypond_option = Latex.test_lilypond_option
class LatexTransform[source]

Bases: Transform

Transform Latex quickly.dom.

root(items)[source]

Process the root context.

brace(items)[source]

Process the brace context; returns a Brace node.

option(items)[source]

Process the option context.

Returns a two-tuple(options, head_origin).

The options is a list of objects that are finished Option nodes, only the first might be incomplete because of a missing opening token. In that case the first object is a tuple (contents, tail_origin). (The tail_origin might be empty in the case of an imcomplete source text).

The head_origin is normally empty, only for the \lilypond[opts]{ command, it is the brace that starts the braced expression.

environment_option(items)[source]

Process the environment_option context.

Returns a tuple(option, envname), where option is a list like the first value returned by option() and envname an EnvironmentName node it it was there at the end of the options list, otherwise None.

environment_math(items)[source]

Process the environment_math context.

environment(items)[source]

Process the environment context.

Returns a list of nodes, the last is the \end command.

math(items)[source]

Process the math context; return a Math node.

comment(items)[source]

Process the comment context.

test_lilypond_option = None
common(items)[source]

Compose and yield Latex nodes; used in most contexts.

class LatexAdHocTransform[source]

Bases: AdHocTransform, LatexTransform

LatexTransform that does not keep the origin tokens.