TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Hevea to translate TeX to HTML. I want to convert all the formulas enclosed by $ ... $ to images. But I'm trying to avoid the using of:

  $ ... $ 
\end{toimage} \imageflush

There is some way to redefine the dollar sign, (perhaps using a \hevea macro) so as append all the toimage environments in a transparent way? I mean just using the dollar sign. Nothing else.

I've tried the approach described in here but the macro cannot be parsed by hevea.

Example added:

I just want to translate everything like (this is an example, I want every formula written in math mode to be modified).

    $ \textbf{\overrightarrow{x}} = ( \frac{3}{2} x,y,z) $


    $ \textbf{\overrightarrow{x}} = ( \frac{3}{2} x,y,z) $
    %\end{toimage} \imageflush

Because is the way I know to make hevea translates something written in math mode to an image. Hevea parse that commets %\begin{toimage}, etc and generate the images. I don't know is there a options of hevea to make that. But i couldn't find it so i try this approach, i.e. modifying the dollar sign.

share|improve this question
Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Qrrbrbirlbel Mar 4 '13 at 3:50

I do not have a clue how hevea works, what it does and how to use it, but the following MWE does get compiled by pdfLaTeX.

It would be easier to do, if you use the LaTeX macros \( and \) for inline math and \[ and \] for display math.


    \gdef\@doubledollar$#1$${\begin{toimage}""#1""\end{toimage}}%        display math
    \gdef\@singledollar#1${\begin{toimage}"#1"\end{toimage}\imageflush}% inline math

    $ \vec{x} = \left( \frac{3}{2} x,y,z\right) $
share|improve this answer
Thanks for the answer. That code fails with hevea because it could not understand the \active command. I think you are right, it going to be easier rewriting the \( and \). Hevea almost understand the translation but fails too, (less catastrophically although, the translation finishes throwing some warnings). I used this macro \let\oldO\( \let\oldC\) \renewcommand{\(}{ %\begin{toimage} \oldO } \renewcommand{\)}{ \oldC % \end{toimage}} I'm going to write in their mailing list, to see if they can help me. – Luciano Lorenti Mar 4 '13 at 19:52
@LucianoLorenti Does your solution work? Post it as an answer than. Self-answers are perfectly admissible, and a well-written answer may earn you reputation. If it does not work edit your approach in your question. (I will delete my answer soon.) – Qrrbrbirlbel Mar 4 '13 at 20:59

Your Answer


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.