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'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:

\begin{toimage} 
  $ ... $ 
\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).

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\begin{document}        
    $ \textbf{\overrightarrow{x}} = ( \frac{3}{2} x,y,z) $
\end{document}

to

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\begin{document}
    %\begin{toimage} 
    $ \textbf{\overrightarrow{x}} = ( \frac{3}{2} x,y,z) $
    %\end{toimage} \imageflush
\end{document}

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

1 Answer 1

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.

Code

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{hevea}
\catcode`$=\active
\makeatletter
\begingroup
    \catcode`\"=3
    \protected\gdef${\@ifnextchar$\@doubledollar\@singledollar}
    \gdef\@doubledollar$#1$${\begin{toimage}""#1""\end{toimage}}%        display math
    \gdef\@singledollar#1${\begin{toimage}"#1"\end{toimage}\imageflush}% inline math
\endgroup
\makeatother

\begin{document}
    $ \vec{x} = \left( \frac{3}{2} x,y,z\right) $
\end{document}
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

 
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.