Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to let tex4ht leave the equations unchanged. Using the tip given at tex4ht leaving equations unchanged, it works for $ and $$ equations. In the case of \[...\] and \(...\) equations it does not work.

How do I have to modify the provided my.cfg to work in the case of following document?

\documentclass {article}
\begin{document}
\[a*b^3\]
\end{document}

my.cfg:

\Preamble{html}
\newtoks\eqtoks 
\def\AltMath#1${\eqtoks{$#1$}% 
   \HCode{\the\eqtoks}$}
\Configure{$}{}{}{\expandafter\AltMath}  
\begin{document} 
\EndPreamble

\Configure{[]} seems to take only two arguments. Using \Configure{[]}{$}{$} does not help. This leads to

Runaway argument?
a*b^3\] \end {document}
! File ended while scanning use of \AltMath.

For a complete test, the following file should work:

\documentclass {article}
\begin{document}
\begin{math}
math^3
\end{math}
\begin{displaymath}
math^3
\end{displaymath}
\begin{equation*}
equation*^3
\end{equation*}
\end{document}
share|improve this question
    
Welcome to TeX.sx! A tip: You can use backticks ` to mark your inline code as I did in my edit. –  Caramdir Nov 5 '11 at 0:29
    
Do you mean this question? Please refer to it. –  krlmlr Mar 22 '12 at 22:12
    
@user946850 Yes, I meant that question. I included a reference in the text. –  koppor Mar 23 '12 at 11:35
add comment

1 Answer

Inspired by the mentioned answer there is a partiala, b solution of the question. The following configurations will accept \(...\) and \[...\] shorthands solely:

\Preamble{html}
    \newtoks\eqtoks
    \def\AltlMath#1\){\eqtoks{\(#1\)}% 
        \HCode{\the\eqtoks}}
    \Configure{()}{\AltlMath}{}
    \def\AltlDisplay#1\]{\eqtoks{\[#1\]}%
        \HCode{\the\eqtoks}}
    \Configure{[]}{\AltlDisplay}{}
\begin{document}
\EndPreamble


a The TeX shorthand configurations and these LaTeX shorthand configurations will not work together.

b The environment configurations are missing.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.