0

Is there way especially in math the user defined macros (even complicate definition) should get expand and the expanded version should stored in the respective equation.

Basically, this to retain the user defined macro expanded math as TeX equation in XHTML using TeX4ht.

Converting TeX to MathML and again converting to TeX gives more issues in conversion and unable to produce the user math output.

I also referred the discussion happened in LaTeX macro expander which is not dealing my requirement.

Here is an Example:

TeX:

\newcommand{\DelimiterGroup}[4]{\ifcase#1\relax#2 #4 #3  
\or\bigl#2 #4 \bigr#3\or\Bigl#2 #4 \Bigr#3\or\biggl#2 #4   \biggr#3\or\Biggl#2 #4 \Biggr#3\or
\left#2 #4 \right#3\else\fi}

\newcommand{\Par}[2][0]{\DelimiterGroup{#1}{(}{)}{#2}}

$L^{\infty}\Par{D}$

XHTML:

$L^{\infty}(D)$
Stephen
  • 3,826
RampSmart
  • 103
  • It is not easilly possible to only partially expand macros. Easier would be to export all LaTeX math in verbatim and pass definition of custom commands to MathJax. See this documentation page, in particular "Loading LaTeX command definitions from a file" section. – michal.h21 Nov 22 '23 at 13:42
  • Assuming a mechanism which processes a .tex-input file so that you don't get a .pdf-file/dvi-file and .log-files and axxiliary text files but a collection of records denoting unexpandable tokens, from each token you also need to get info about meaning and explicitness, because due to \let and \futurelet there is the possibility of different tokens denoting the same.There is also the possibility of the same token denoting different unexpandable things at different moments in time. – Ulrich Diez Nov 23 '23 at 16:34
  • Probably with LuaTeX something could be made up. Of course some information available as unexpandable tokens during typesetting would probably not be available when not typesetting but creating a record of info about tokens, e.g. page-numbers of cross-references. – Ulrich Diez Nov 23 '23 at 16:35
  • Another problem with converting from (La)TeX to XHTML is the need of keeping track of which tokens in TeX belong to what could be considered semantic markup and which tokens in TeX serve the purpose of giving sematic markup-structures a specific look and which tokens contain info to be presented as textual phrase or the like... – Ulrich Diez Nov 23 '23 at 16:45
  • Thank You michal.h21 and Ulrich for your response, obviously, i am trying to explore a solution to expand the user tokens or macro should be done by using LaTeX kernel itself if not then finally i have to go with building external scripts or modifying the existing available scripts as per my requirement. – RampSmart Nov 24 '23 at 05:50

0 Answers0