Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML tags and comments not recognized in listings #9

Open
jgneff opened this issue Jan 11, 2020 · 0 comments
Open

HTML tags and comments not recognized in listings #9

jgneff opened this issue Jan 11, 2020 · 0 comments

Comments

@jgneff
Copy link

jgneff commented Jan 11, 2020

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:

pdflatex

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:

hevea

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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant