phystool.latex

Module Contents

Classes

LogFileMessage

Helper class that stores log file messages.

BadBoxMessage

InfoMessage

WarningMessage

ErrorMessage

Latex3Message

LogMessageList

LatexLogParser

LatexLogParser parses a LaTeX log file to generate lists of errors, warnings, infos and bad boxes. Each message is stored as a LogFileMessage in the corresponding list.

PdfLatex

Data

logger

API

phystool.latex.logger

“getLogger(…)”

class phystool.latex.LogFileMessage(match: Match[str], context: list[str], tex_file: pathlib.Path)

Bases: abc.ABC

Helper class that stores log file messages.

Initialization

PATTERN: Pattern

None

VERBOSE

False

classmethod toggle_verbose_mode() None
class phystool.latex.BadBoxMessage(match: Match[str], context: list[str], tex_file: pathlib.Path)

Bases: phystool.latex.LogFileMessage

PATTERN

“compile(…)”

class phystool.latex.InfoMessage(match: Match[str], context: list[str], tex_file: pathlib.Path)

Bases: phystool.latex.LogFileMessage

PATTERN

“compile(…)”

class phystool.latex.WarningMessage(match: Match[str], context: list[str], tex_file: pathlib.Path)

Bases: phystool.latex.LogFileMessage

PATTERN

“compile(…)”

should_recompile: bool

None

class phystool.latex.ErrorMessage(match: Match[str], context: list[str], tex_file: pathlib.Path)

Bases: phystool.latex.LogFileMessage

PATTERN

“compile(…)”

class phystool.latex.Latex3Message(match: Match[str], context: list[str], tex_file: pathlib.Path)

Bases: phystool.latex.LogFileMessage

PATTERN

“compile(…)”

class phystool.latex.LogMessageList(klass: type[T])

Initialization

add(line: str, lines_iterable: phystool.helper.ContextIterator[str], tex_file: pathlib.Path) bool
as_log() None
stats() str
class phystool.latex.LatexLogParser(texfile: pathlib.Path, message_types: list = [BadBoxMessage, InfoMessage, WarningMessage, ErrorMessage, Latex3Message])

LatexLogParser parses a LaTeX log file to generate lists of errors, warnings, infos and bad boxes. Each message is stored as a LogFileMessage in the corresponding list.

To properly parse the log file, “texmf.cnf” must be configured so that filenames are written on single line (“max_print_line=1000”)

Paramètres:
  • texfile – LaTeX file for which the log should be parsed

  • message_types – selection of LogfileMessage to parse and display

Initialization

TEX_FILE_PATTERN

“compile(…)”

process() None

Main method that parses each line of the LaTeX logfile and checks for a matching pattern. When a pattern is matched, a new message is created and added to the correct LogMessageList according to its type.

should_recompile() bool

True if any WarningMessage is flagged as “should_recompile”

as_log() None

Logs all messages sorted by type and add a general summary

as_text() str

Returns a concatenated string of all messages sorted by type

warning() phystool.latex.LogMessageList[phystool.latex.WarningMessage]

Returns WarningMessage

error() phystool.latex.LogMessageList

Returns ErrorMessage

latex3() phystool.latex.LogMessageList

Returns Latex3Message

class phystool.latex.PdfLatex(fullname: pathlib.Path)

Initialization

classmethod output(as_string: str) pathlib.Path
full_compile(dest: pathlib.Path | None, can_recompile: bool) bool
compile(env: dict[str, str] | None = None) None
compilation_command() list[str]
convert_pdf_to_png(dest_files: list[pathlib.Path] = [], cropped: bool = False) None
clean(extensions: list[str]) None
move_pdf(dest: pathlib.Path | None) None