[tex4ht] request for a new feature for tex4ht. Adding basic translation support for dmath and dgroup from breqn package.

Nasser M. Abbasi nma at 12000.org
Mon Oct 25 19:18:06 CEST 2021


I now make heavy use of breqn package since many of the
equations generated from computer algebra systems are long
and breqn package is the only way to break them without manual
editing which is not possible since these equations are
auto generated each time my program runs.

breqn is only needed in pdf mode due to limited page width
and not in HTML mode. tex4ht does not support breqn, which is OK,
as not really needed for HTML.

But it means  my Latex code is full of things like the following

\ifdefined\HCode
     \begin{align*}
        LHS &= RHS\\
        LHS &= RHS
     \end{align}
\else
     \begin{dgroup*}
     \begin{dmath*}
        LHS = RHS
     \end{dmath*}
     \begin{dmath*}
        LHS = RHS
     \end{dmath*}
     \end{dgroup*}
\fi

So all the equations are duplicated everywhere. It will be
great to be able to just write the dgroup or dmath parts only,
and have tex4ht automatically convert them to use align
internally (may be using macro or lua code?).

This will also work in both mathjax mode and non-mathjax mode.

Since the full breqn features are not needed in HTML, only translation
would be needed.  Is this something possible?

Only the following constructs are needed for now.

1)
\begin{dmath*}               \begin{align*}
    LHS = RHS         ---->      LHS &= RHS
\end{dmath*}                 \end{align*}

2)
\begin{dmath}[number=label]      \begin{align}
    LHS = RHS               ---->    LHS &= RHS \tag{label}
\end{dmath}                       \end{align}

3)
     \begin{dgroup*}
     \begin{dmath*}               \begin{align*}
        LHS = RHS                   LHS &= RHS \\
     \end{dmath*}         ------>   LHS &= RHS
     \begin{dmath*}               \end{align*}
        LHS = RHS
     \end{dmath*}
     \end{dgroup*}
     
4)
     \begin{dgroup}[number=label]
     \begin{dmath*}               \begin{align*}\tag{label}
        LHS = RHS                   LHS &= RHS \\
     \end{dmath*}         ------>   LHS &= RHS
     \begin{dmath*}               \end{align*}
        LHS = RHS
     \end{dmath*}
     \end{dgroup*}
     
I am not good in lua programming or Latex macros to do this
and also how to tell tex4ht to do this translation only when running
in tex4ht mode without using \ifdefined\HCode.

Is the above possible to do by any chance without a very great
effort and time?  Or there is something technically which would
this translation  not possible to do at run time?

Thanks
--Nasser


More information about the tex4ht mailing list.