1

I have a problem with inserting a comment in lstlisting environment.

LaTeX says:

! Package inputenc Error: Unicode char \u8:�\expandafter not set up for use with LaTeX.

See the inputenc package documentation for explanation.

Type H for immediate help.

...

l.49 \%komentář

Your command was ignored.

I want the character % to start a comment which ends at end of line.

I tried \lstset{morecomment=[l]\%} but I get the error above.

Here is a MWE:

\documentclass[12pt,a4paper,oneside,openany,titlepage]{report}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage{listings}
...
\begin{document}
\lstset{
language=Matlab,
comment=[l]{\%}
}
...
\begin{lstlisting}[title=Výpočet]
%komentář
code
\end{lstlisting}
...
\end{document}
Eliz
  • 81

0 Answers0