Running the code posted in this question, the first code shown there, posted by the accepted answer by Andrew Swann. When running the code through htlatex on texlive 2012 debian, I get the error

htlatex index.tex
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian) restricted \write18 enabled. entering extended mode LaTeX2e <2011/06/27>


(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) ! Missing $ inserted. $ l.28 \end{align*} ?

No errors when running latex nor pdflatex on the same code.

Any idea what causes this error? ps. here is a copy of the code just in case. (it will be nice if one can have a direct links at stackexchange to posted code fragments within messages, so that it is easier to point someone to a specific code on a web page).



\newcommand{\mydmath}[1]{\( \m@th\displaystyle #1 \)}
\newcommand{\mydmathtowd}[2]{\hbox to #1{\mydmath{#2}}}



  & = 0 \\
  & = 0 \\
  \usebox\mytmpbox & = 0

  • Works like a charm, here. Have you tried updating your packages?
    – jub0bs
    May 23, 2013 at 22:00
  • @Jubobs I am on debian system, and hence I use texlive debian. I have latest version 2012. I can't use the texlive update package tlmgr tug.org/texlive/tlmgr.html to update. I have to use debian package manager and so I am stuck until the repository there is updated to texlive 2013? I would not know how to update specific pakcages and all that with debian texlive. I need to go search to see if/when texlive 2013 can be used on my linux (it is mint/debian OS linux)
    – Nasser
    May 23, 2013 at 22:05
  • I would be very surprised if it didn't work out of the box, but I understand if you want to stick to the package manager. Besides, @Jubobs, it should be noted that the linked question received an accepted answer well before TL2013 went public, so there shouldn't be any issues. Jul 23, 2013 at 14:55
  • (And nice idea about the point-to-code-fragment feature! Might I suggest you give that a shout-out over at meta.SO?) Jul 23, 2013 at 14:57
  • 1
    I do see the issue here with a bang-up-to-date TL2013.
    – Joseph Wright
    Aug 17, 2013 at 7:32

1 Answer 1


Two issues:

  • \(..\) in \mydmath definition. Change into \ensuremath{..}.
  • \adjustlimits gives trouble for tex4ht. The idea is to define it as \relax for tex4ht. This can be done via configuration file, e.g.,


    Run tex4ht with configuration: htlatex index.tex "foo,html"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .