Pandoc converting Latex document with package \lstinputlisting in .html

46 views Asked by At

I tried to convert a Latex document with pandoc in html and I get the following error:

unexpected 

\lstinputlisting[

Is it possible to use \lstinputlisting with Pandoc?

My code main.tex as follows:

\usepackage{listings}
\lstinputlisting[
    float,
    language=Java,
    caption={My very first program in Java},
    label={lst:helloworld},
]{listings/HelloWorld.java}

in \Cref{lst:helloworld}, we describe an hello world program in Java.
1

There are 1 answers

0
Igor On

I solved adding --listings to Pandoc conversion and removing the new lines in the arguments. Looks like Latex can interpret them but not Pandoc.

\usepackage{listings}

\lstinputlisting[float,language=Java,caption={My very first program in Java},label={lst:helloworld},]{listings/HelloWorld.java}

in \Cref{lst:helloworld}, we describe an hello world program in Java.