hevea
hevea copied to clipboard
HTML tags and comments not recognized in listings
HEVEA fails to recognize the tag names and comments in HTML source code that is typeset using the listings package. The example input file to reproduce the problem is included below.
I processed the input file with pdflatex as follows.
$ pdflatex example.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian)
(preloaded format=pdflatex)
...
Output written on example.pdf (1 page, 172393 bytes).
Transcript written on example.log.
This command produced a PDF page that displays:

I processed the input file with hevea as follows.
$ ~/opt/hevea-2.32/bin/hevea -version
hevea 2.32+01 of 2018-07-04
library directory: /home/john/opt/hevea-2.32/lib/hevea
$ ~/opt/hevea-2.32/bin/hevea -fix -O -exec xxdate.exe -o example.html example.tex
Exclude comment 'comment'
./example.tex:42: Warning: keyval, unknown key: 'tag'
./example.tex:42: Warning: keyval, unknown key: 'MoreSelectCharTable'
Fixpoint reached in 1 step(s)
This command produced an HTML page that displays:

Notice that neither the opening and closing tags of the HTML elements nor the comment are highlighted in the HTML file as they are in the PDF.
The following LaTeX source was used as the example.tex input file.
\documentclass[12pt,a5paper]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[mono=false]{libertine}
\usepackage[sf]{titlesec}
\usepackage[usenames,dvipsnames]{color}
\usepackage{listings}
\usepackage{hevea}
%BEGIN LATEX
\lstset{basicstyle={\ttfamily\footnotesize}}
\lstset{showstringspaces=false}
\lstset{basewidth=0.5em}
%END LATEX
\newstyle{.source}{font-family:monospace;white-space:pre;}
\lstdefinestyle{syntax}{
keywordstyle={\color{NavyBlue}\bfseries},
commentstyle={\color{OliveGreen}\itshape},
stringstyle={\color{Maroon}\slshape}}
\lstnewenvironment{source}[1]{
\setenvclass{lstlisting}{source}
\lstset{language={#1},style=syntax}}{}
\begin{document}
\noindent
This is the source code of a Java program:
\begin{source}{Java}
public class HelloWorldApp {
public static void main(String[] args) {
// Prints the string to the console
System.out.println("Hello World!");
}
}
\end{source}
\noindent
This is a fragment of HTML source code:
\begin{source}{HTML}
<!-- Fleurons are stylized flowers. -->
<div class="center">
<img class="fleuron" src="images/fleuron.svg"
width="45" height="16" alt="* * *">
</div>
\end{source}
\end{document}