Files
John MacFarlane 0bbbdbcdb6 LaTeX reader/writer: change handling of math environments.
Certain environments in LaTeX will trigger math mode and can't
occur within math mode: e.g., `align` or `equation`.  Previously
we "downshifted" these, parsing an `align` environment as a
Math element with `aligned`, and an `equation` environment as a
regular display math element.  With this shift, we put these in
Math inlines but retain the original environments.

This works because:

1) texmath handles these environments just fine,
2) and so does MathJax;
3) when writing LaTeX we detect these environments in Math elements
   and emit them verbatim instead of putting them in `$..$` or
   `$$..$$`.

Closes #9711. Closes #9296.
2025-08-11 17:40:41 -07:00

1.5 KiB

% pandoc -t native -f latex
\begin{equation*}
[d,\delta]=0.
\end{equation*}
^D
[ Para
    [ Math
        DisplayMath
        "\\begin{equation*}\n[d,\\delta]=0.\n\\end{equation*}"
    ]
]
% pandoc -t native -f latex
\begin{table}[htb]
  \begin{tabular}{|c|c|}
       $W$      & rel. err. \\[0mm]
       [$\mu$m] & [\%]\\
  \end{tabular}
\end{table}
^D
[ Table
    ( "" , [] , [] )
    (Caption Nothing [])
    [ ( AlignCenter , ColWidthDefault )
    , ( AlignCenter , ColWidthDefault )
    ]
    (TableHead ( "" , [] , [] ) [])
    [ TableBody
        ( "" , [] , [] )
        (RowHeadColumns 0)
        []
        [ Row
            ( "" , [] , [] )
            [ Cell
                ( "" , [] , [] )
                AlignDefault
                (RowSpan 1)
                (ColSpan 1)
                [ Plain [ Math InlineMath "W" ] ]
            , Cell
                ( "" , [] , [] )
                AlignDefault
                (RowSpan 1)
                (ColSpan 1)
                [ Plain [ Str "rel." , Space , Str "err." ] ]
            ]
        , Row
            ( "" , [] , [] )
            [ Cell
                ( "" , [] , [] )
                AlignDefault
                (RowSpan 1)
                (ColSpan 1)
                [ Plain [ Str "[" , Math InlineMath "\\mu" , Str "m]" ]
                ]
            , Cell
                ( "" , [] , [] )
                AlignDefault
                (RowSpan 1)
                (ColSpan 1)
                [ Plain [ Str "[%]" ] ]
            ]
        ]
    ]
    (TableFoot ( "" , [] , [] ) [])
]