michal-h21 / make4ht

Build system for tex4ht
137 stars 15 forks source link

Package 'mathtools': \DeclarePairedDelimiter #126

Closed yalguzaq closed 12 months ago

yalguzaq commented 1 year ago

LaTeX

See for instance https://thecodergeek.com/post/420

\documentclass[10pt]{article}
\usepackage{mathtools}

\begin{document}
\DeclarePairedDelimiter{\paren}{(}{)}
$$\paren*{\frac{m}{n}}^2$$
\end{document}

make4ht

make4ht file.tex 'mathjax'

Desired output

image

Erroneous output

image

Comment

If this is unsolvable, then the text file can be alternatively modified to replace \delimiter or \delimiter* with the opening parenthesis and the closing bracket with the closing parenthesis.

michal-h21 commented 1 year ago

You need to declare the command for MathJax, for example using this config file:

\Preamble{xhtml} 
\Configure{@BODY}{\HCode{\detokenize{$$\DeclarePairedDelimiter{\paren}{(}{)}$$}}}

\begin{document} 
\EndPreamble