seutil.latex package
Submodules
seutil.latex.File module
- class seutil.latex.File.File(path: pathlib.Path, is_append: bool = False)[source]
Bases:
object
- append(line: str) seutil.latex.File.File [source]
Appends one line of text into the file.
- append_comment(line: str) seutil.latex.File.File [source]
- append_macro(macro: seutil.latex.Macro.Macro) seutil.latex.File.File [source]
- load_macros_from_file(file: pathlib.Path) seutil.latex.File.File [source]
- logger = <Logger latex.File (WARNING)>
seutil.latex.Macro module
- class seutil.latex.Macro.Macro(key: str, value: Optional[seutil.latex.Macro.T] = None, value_func: Optional[Callable[[Dict[str, seutil.latex.Macro.Macro]], seutil.latex.Macro.T]] = None, tostring_func: Optional[Callable[[seutil.latex.Macro.T], str]] = None)[source]
Bases:
object
- RE_DEF_MACRO = re.compile('\\\\DefMacro{(?P<key>[^}]+)}{(?P<value>[^}]*)}')
- T
alias of TypeVar(‘T’)
- classmethod define(key: str, value_fmt: Union[str, Any], *values, **values_items) seutil.latex.Macro.Macro [source]
- eval_content(macros_indexed: Dict[str, seutil.latex.Macro.Macro]) str [source]
Evaluates the latex macro, and formats to a string that defines the macro (i.e., DefMacro{key}{value}). If both value and value_func are defined, will use the value_func to update the value.
- Parameters
macros_indexed – the indexed dictionary of {macro.key, macro}.
- Requires
not (self.value is None and self.value_func is None)
- Returns
the string representation of the macro.
- classmethod load_from_file(file: pathlib.Path) Dict[str, seutil.latex.Macro.Macro] [source]
Loads the macros from a latex file. Will convert the value of the macros to int or float, if possible.
- Parameters
file – the latex file.
- Returns
the indexed dictionary of {macro.key, macro}.
- logger = <Logger latex.Macro (WARNING)>
seutil.latex.Table module
Module contents
- class seutil.latex.File(path: pathlib.Path, is_append: bool = False)[source]
Bases:
object
- append(line: str) seutil.latex.File.File [source]
Appends one line of text into the file.
- append_comment(line: str) seutil.latex.File.File [source]
- append_macro(macro: seutil.latex.Macro.Macro) seutil.latex.File.File [source]
- is_append: bool
- items: List[Union[str, seutil.latex.Macro.Macro, seutil.latex.Table.Table]]
- load_macros_from_file(file: pathlib.Path) seutil.latex.File.File [source]
- logger = <Logger latex.File (WARNING)>
- macros_indexed: Dict[str, seutil.latex.Macro.Macro]
- old_content: str
- path: pathlib.Path
- class seutil.latex.Macro(key: str, value: Optional[seutil.latex.Macro.T] = None, value_func: Optional[Callable[[Dict[str, seutil.latex.Macro.Macro]], seutil.latex.Macro.T]] = None, tostring_func: Optional[Callable[[seutil.latex.Macro.T], str]] = None)[source]
Bases:
object
- RE_DEF_MACRO = re.compile('\\\\DefMacro{(?P<key>[^}]+)}{(?P<value>[^}]*)}')
- T
alias of TypeVar(‘T’)
- classmethod define(key: str, value_fmt: Union[str, Any], *values, **values_items) seutil.latex.Macro.Macro [source]
- eval_content(macros_indexed: Dict[str, seutil.latex.Macro.Macro]) str [source]
Evaluates the latex macro, and formats to a string that defines the macro (i.e., DefMacro{key}{value}). If both value and value_func are defined, will use the value_func to update the value.
- Parameters
macros_indexed – the indexed dictionary of {macro.key, macro}.
- Requires
not (self.value is None and self.value_func is None)
- Returns
the string representation of the macro.
- key: str
- classmethod load_from_file(file: pathlib.Path) Dict[str, seutil.latex.Macro.Macro] [source]
Loads the macros from a latex file. Will convert the value of the macros to int or float, if possible.
- Parameters
file – the latex file.
- Returns
the indexed dictionary of {macro.key, macro}.
- logger = <Logger latex.Macro (WARNING)>
- tostring_func: Optional[Callable[[seutil.latex.Macro.T], str]]
- value: Optional[seutil.latex.Macro.T]
- value_func: Optional[Callable[[Dict[str, seutil.latex.Macro.Macro]], seutil.latex.Macro.T]]