Tuesday, December 14, 2010

TTH and listings

TTH is a beautiful TeX/LaTeX to HTML converter. Its main focus is converting math formulas without resorting to images. An example can be seen here.

It is easy to use, easy to install and work acceptably. The only trouble I had so far regards including source codes. TTH supports verbatim but does not support lstlisting. Consequently I defined the conditional \iftth with
\iftth
It is by default false (under latex) but it is true when running tth. This way I can have conditional commands such as:
\newcommand
    \sourceinclude[1]
    {\iftth \verbatiminput{#1} \else \lstinputlisting{#1} \fi}

No comments: