Skip to content

Add mathtools support for tex reader/writer #249

@jgm

Description

@jgm

https://us.mirrors.cicku.me/ctan/macros/latex/contrib/mathtools/mathtools.pdf
is a package that extends/replaces amsmath.

New things:

% Adjustment of spacing

\mathllap[〈mathstyle〉]{〈math〉}
\mathrlap[〈mathstyle〉]{〈math〉}
\mathmbox{〈math〉}
\mathclap[〈mathstyle〉]{〈math〉}
\clap{〈text〉}
\mathmakebox[〈width〉][〈pos〉]{〈math〉}

\cramped[〈mathstyle〉]{〈math〉}


\crampedllap[〈mathstyle〉]{〈math〉}
\crampedclap[〈mathstyle〉]{〈math〉}
\crampedrlap[〈mathstyle〉]{〈math〉}


\begin{crampedsubarray}{〈col〉} 〈contents〉
\end{crampedsubarray}
\crampedsubstack{〈lines separated by
\\ 〉}

\smashoperator[〈pos〉]{〈operator with limits〉}

\adjustlimits{〈operator1〉}_{〈limit1〉} {〈operator2〉}_{〈limit2〉}

\SwapAboveDisplaySkip

% Tags and refs

\newtagform{〈name〉}[〈inner_format〉]{〈left〉}{〈right〉}
\renewtagform{〈name〉}[〈inner_format〉]{〈left〉}{〈right〉}
\usetagform{〈name〉}

\refeq{〈label〉}

\noeqref{〈label,label,. . . 〉}

% Extensible symbols

\xleftrightarrow[〈sub〉]{〈sup〉}
\xLeftarrow[〈sub〉]{〈sup〉}
\xhookleftarrow[〈sub〉]{〈sup〉}
\xmapsto[〈sub〉]{〈sup〉}
\xRightarrow[〈sub〉]{〈sup〉}
\xLeftrightarrow[〈sub〉]{〈sup〉}
\xhookrightarrow[〈sub〉]{〈sup〉}

\xrightharpoondown[〈sub〉]{〈sup〉}
\xleftharpoondown[〈sub〉]{〈sup〉}
\xrightleftharpoons[〈sub〉]{〈sup〉}
\xrightharpoonup[〈sub〉]{〈sup〉}
\xleftharpoonup[〈sub〉]{〈sup〉}
\xleftrightharpoons[〈sub〉]{〈sup〉}

\xlongrightarrow[〈sub〉]{〈sup〉}
\xlongleftarrow[〈sub〉]{〈sup〉}

\xLongrightarrow[〈sub〉]{〈sup〉}
\xLongleftarrow[〈sub〉]{〈sup〉}


\underbracket[〈rule thickness〉] [〈bracket height〉]{〈arg〉}
\overbracket[〈rule thickness〉] [〈bracket height〉]{〈arg〉}
\underbrace{〈arg 〉}
\LaTeXunderbrace{〈arg 〉}
\overbrace{〈arg 〉}
\LaTeXoverbrace{〈arg 〉}

% Math environments

\begin{matrix*} [〈col〉]〈contents〉\end{matrix*}
\begin{pmatrix*}[〈col〉] 〈contents〉
\end{pmatrix*}
\begin{bmatrix*}[〈col〉] 〈contents〉
\end{bmatrix*}
\begin{Bmatrix*}[〈col〉] 〈contents〉
\end{Bmatrix*}
\begin{vmatrix*}[〈col〉] 〈contents〉
\end{vmatrix*}
\begin{Vmatrix*}[〈col〉] 〈contents〉
\end{Vmatrix*}


\begin{smallmatrix*} [〈col〉]〈contents〉\end{smallmatrix*}
\begin{psmallmatrix} 〈contents〉
\end{psmallmatrix}
\begin{psmallmatrix*}[〈col〉] 〈contents〉
\end{psmallmatrix*}
\begin{bsmallmatrix} 〈contents〉
\end{bsmallmatrix}
\begin{bsmallmatrix*}[〈col〉] 〈contents〉
\end{bsmallmatrix*}
\begin{Bsmallmatrix} 〈contents〉
\end{Bsmallmatrix}
\begin{Bsmallmatrix*}[〈col〉] 〈contents〉
\end{Bsmallmatrix*}
\begin{vsmallmatrix} 〈contents〉
\end{vsmallmatrix}
\begin{vsmallmatrix*}[〈col〉] 〈contents〉
\end{vsmallmatrix*}
\begin{Vsmallmatrix} 〈contents〉
\end{Vsmallmatrix}
\begin{Vsmallmatrix*}[〈col〉] 〈contents〉
\end{Vsmallmatrix*}

\begin{multlined}[〈pos〉][〈width〉] 〈contents〉
\end{multlined}
\shoveleft[〈dimen〉]{〈arg 〉}
\shoveright[〈dimen〉]{〈arg 〉}

\begin{dcases}\end{dcases}
\begin{dcases*}\end{dcases*}
\begin{rcases}\end{rcases}
\begin{rcases*}\end{rcases*}
\begin{drcases}\end{drcases}
\begin{drcases*}\end{drcases*}
\begin{cases*}\end{cases*}

\MoveEqLeft[〈number〉]

\Aboxed{〈left hand side Example & right hand side〉}

\MakeAboxedCommand\Aboxedname\boxmacro

\ArrowBetweenLines[〈symbol〉]
\ArrowBetweenLines*[〈symbol〉]

\vdotswithin{〈symbol〉}
\shortvdotswithin{〈symbol〉}
\shortvdotswithin*{〈symbol〉}
\MTFlushSpaceAbove
\MTFlushSpaceBelow

\intertext{〈text 〉}
\shortintertext{〈text 〉}

\DeclarePairedDelimiter{〈cmd〉}{〈left_delim〉}{〈right_delim〉}


\DeclarePairedDelimiterX{〈cmd〉}[〈num args〉]{〈left_delim〉}{〈right_delim〉}{〈body〉}
\delimsize

\DeclarePairedDelimiterXPP{〈cmd〉}[〈num args〉]{〈pre code〉}{〈left_delim〉}
{〈right_delim〉}{〈post code〉}{〈body〉}

%expert use:
\reDeclarePairedDelimiterInnerWrapper{〈macro name〉}%
{〈star or nostarnonscaled or nostarscaled〉}{〈code〉}

% Special symbols


\lparen
\rparen

\vcentcolon
\ordinarycolon

% This affects typesetting of the string :=

\mathtoolsset{centercolon}
\mathtoolsset{centercolon=false}

\dblcolon ::
\coloneq :=
\Coloneq ::=
\colonapprox :≈
\Colonapprox ::≈
% Legacy duplicate names:
\coloneqq :=
\eqqcolon =:
% Extra symbols added Summer 2022:
\approxcolon ≈:
\Approxcolon ≈::
\colondash :−
\Colondash ::−
\eqcolon
\colonsim
\Coloneqq
\simcolon
\dashcolon
=:
\Eqcolon =:: :∼
\Colonsim ::∼
::=
\Eqqcolon =::
∼:
\Simcolon ∼:: −:
\Dashcolon −::

\nuparrow
\ndownarrow
\bigtimes

% Left sub/supscripts

\prescript{〈sup〉}{〈sub〉}{〈arg〉}

\DeclareMathSizes{〈dimen〉}{〈dimen〉}{〈dimen〉}{〈dimen〉}

% more:

\begin{spreadlines}{〈dimen〉} 〈contents〉 \end{spreadlines}

\splitfrac{〈start line〉}{〈continuation〉} \splitdfrac{〈start line〉}{〈continuation〉}

\xmathstrut[〈depth increase〉]{〈increase〉}

Some of these would essentially just need to be ignored (fine-grained spacing). The Special symbols would need to be added to the ToTeX.hs records structure.

For discussion see jgm/pandoc#10558

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions