LaTeX Format¶
Utilities for formatting tex strings and text.
- exception disseminate.formats.tex.TexFormatError¶
Bases:
disseminate.formats.exceptions.FormattingError
Error in latex formatting.
- disseminate.formats.tex.tex_cmd(cmd, attributes='', formatted_content=None, indent=None)¶
Format a tex command.
- Parameters
- cmdOptional[str]
The name of the LaTeX command to format.
- attributesOptional[Union[
Attributes
, str]] The attributes of the tag.
- formatted_contentOptional[str]
The contents of the tex environment formatted as a string in LaTeX. If not specified, the tex_str will not be used as a LaTeX parameter
- indentOptional[int]
If specified, indent lines by the given number of spaces.
- Returns
- tex_envstr
The LaTeX environment string
- Raises
- TexFormatError
TexFormatError
A TexFormatError is raised if an non-allowed environment is used.
- TexFormatError
- disseminate.formats.tex.tex_env(env, attributes, formatted_content, min_newlines=False, indent=None)¶
Format a tex environment.
- Parameters
- envstr
The name of the LaTeX environment to format.
- attributesUnion[
Attributes
, str] The attributes of the tag.
- formatted_contentstr
The contents of the tex environment formatted as a string in LaTeX.
- min_newlinesOptional[bool]
If True, extra new lines before, after and in the environment will not be included.
- indentOptional[int]
If specified, indent lines by the given number of spaces.
- Returns
- tex_envstr
The LaTeX environment string
- Raises
- TexFormatError
TexFormatError
A TexFormatError is raised if an non-allowed environment is used.
- TexFormatError
- disseminate.formats.tex.tex_verb(formatted_content)¶
Format a tex verb command
- Parameters
- formatted_contentstr
The contents of the tex environment formatted as a string in LaTeX.
- Returns
- tex_verbstr
The LaTeX verb string