1

I have a document using a custom environment in the listings package. So I have code embedded like so

\begin{tawny}
(println "hello")
\end{tawny}

My plan is to use some Javascript syntax high-lighter to render this. So I have added this into my cf.cfg file.

\Preamble{html}
\ConfigureEnv{tawny}
{\HCode{<stuff>}}
{\HCode{</stuff>}}{}{}
\begin{document}
\EndPreamble

Obviously I want to change to something sane later. At the moment, though, this does not seem to be affected the rendering of the {tawny} environment. Have I got something wrong with my cf.cfg?

0

1 Answer 1

2

So, I have an answer. First the config must come before the \begin{document} section in cf.cfg. And second, I need to switch listings off for HTML or I get my markup AND everything else.

So, minimal small.tex

\documentclass{article}

\ifx \HCode\Undef
\usepackage{listings}
\lstnewenvironment{tawny}{\lstset{language=lisp}}{}
\else
\newenvironment{tawny}%
{}%
{}%
\fi

\begin{document}

\begin{tawny}
(println "hello")
\end{tawny}

\end{document}

Minimal cf.cfg

\Preamble{html}
\ConfigureEnv{tawny}
{\HCode{<stuff>}}
{\HCode{</stuff>}}{}{}
\begin{document}
\EndPreamble

Which after

htlatex small cf

produces

<!--l. 14--><p class="noindent" ><stuff>(println &#8221;hello&#8221;)</stuff>

Obviously, I intend to replace "stuff" within something useful to get the source highlighter to work.

I'd rather not have the non-breaking spaces, but I can live with this.

You must log in to answer this question.

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