Expand description
Raw TeX block parsing (LaTeX commands and non-math environments)
This module handles block-level raw TeX content:
- LaTeX commands:
\DeclareMathOperator,\newcommand, etc. - Non-math environments:
\begin{tabular},\begin{figure}, etc.
Math environments (equation, align, etc.) are handled as INLINE content in paragraphs, not as blocks. See INLINE_MATH_ENVIRONMENTS list below.
Per Pandoc behavior:
- Consecutive LaTeX command lines are grouped into a single TEX_BLOCK
- Non-math environments become TEX_BLOCK
- Math environments are parsed inline (in paragraphs)
- Blank lines or non-LaTeX content terminate the block
- Only enabled when
raw_texextension is active
Functions§
- can_
start_ raw_ block - Check if content could start a raw TeX block.
- extract_
environment_ name - Extract environment name from
\begin{name}line. Returns None if not a valid \begin{…} line. - is_
inline_ math_ environment - Check if an environment name is an inline math environment.
- parse_
raw_ tex_ block - Parse a raw TeX block from lines array.