I want to retain the equations unchanged (for later usage), i tried with the help of Tex4ht leaving equations unchanged, it is working for inline equations, I need to retain for display equations such as like $$...$$, \begin{equation}/\begin{align}.... how to configure these environment to unchanged.

my MWE is

  text $a+b$ and \(a+b\alpha\beta\)
  Sample text
  Sample text
 Sample text

and my cfg file is






I compiled through the calling command htlatex filename "sample.cfg"

Note: When I am using the option xhtml in the htlatex filename "xhtml,sample.cfg" the equations are changed to htmlcoding, without using html/xhtml option the equations are unchanged. Why equations are changing to html code when i am using the option xhtml?


The following code is based on MathJax support package from the Helpers4ht bundle:


  \Configure{verbatim}{}{} % suppress <br /> tags
    \texttt{\string\begin\{#1\}}\HCode{\Hnewline}% we need to use \texttt to get all characters right



\detokenize is used for verbatim output of the basic math commands instead of \toks register. It seems to be easier to handle.

For math environments, \VerbMath command is introduced. It redefines the environment to print it's content in verbatim and to print \begin{env name} ... \end{...} around it. It uses verbatim package for that.

This is the result from your code:

<!--l. 4--><p class="noindent" >text \(a+b\) and \(a+b\alpha \beta \)
 Sample text  \begin{equation} 

Sample text  \begin{align} 

Sample text </p> 
  • when i am using the option xhtml in the calling command the equations are converting to HTML format, how to retain this in the xhtml option
    – vctu
    Mar 25 '17 at 4:05
  • & alignment characters are changed to unicode characters in your output, but in my output it is changed to &amp; this will give wrong output
    – vctu
    Mar 25 '17 at 4:36
  • @VenkatesanRamachandiran I use make4ht with -u option, it requests Unicode output. @amp; is correct, isn't it? You can't have & character in a xml file. What do you mean by HTML format?
    – michal.h21
    Mar 25 '17 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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