Igor
Igor

Reputation: 21

Pandoc converting Latex document with package \lstinputlisting in .html

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.

Upvotes: -1

Views: 71

Answers (1)

Igor
Igor

Reputation: 21

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.

Upvotes: 0

Related Questions