I've had a varying level of success converting LaTeX documents into HTML, but one of the major problems I've encountered is converting expressions which contain commands defined through the xparse package. For example,
\DeclareDocumentCommand\derivative{ s o m g d() }
{ % Total derivative
% s: star for \flatfrac flat derivative
% o: optional n for nth derivative
% m: mandatory (x in df/dx)
% g: optional (f in df/dx)
% d: long-form d/dx(...)
\IfBooleanTF{#1}
{\let\fractype\flatfrac}
{\let\fractype\frac}
\IfNoValueTF{#4}
{
\IfNoValueTF{#5}
{\fractype{\diffd \IfNoValueTF{#2}{}{\sp{#2}}}{\diffd #3\IfNoValueTF{#2}{}{\sp{#2}}}}
{\fractype{\diffd \IfNoValueTF{#2}{}{\sp{#2}}}{\diffd #3\IfNoValueTF{#2}{}{\sp{#2}}} \argopen(#5\argclose)}
}
{\fractype{\diffd \IfNoValueTF{#2}{}{\sp{#2}} #3}{\diffd #4\IfNoValueTF{#2}{}{\sp{#2}}}}
}
\DeclareDocumentCommand\dv{}{\derivative} % Shorthand for \derivative
is a command to typeset a derivative, so $\dv{x}{t}$
will produce a nicely formatted dx/dt notation. This example is taken from the physics package from CTAN, but I use a number of similar macros in day-to-day work. Is there a way to either convert these macros into standard tex markup before passing the file to e.g. pandoc, or is there a way to convert them as part of the html conversion process, so that they can be rendered in MathML or by MathJax?
\derivative
in javascript and add that javascript code as an extension in the mathjax customisation object.