2

I cannot get to work my special chars in listings, my texmaker is configurated to use utf8 in options, but I get error:

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

With XeLatex i dont get any errors but it doesn't show any ą in pdf. Could i import the content of file.txt and show it in C# colors without copy-paste to .tex file?

\documentclass[titlepage, a4paper]{mwart}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{polski}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{xcolor}
\lstdefinestyle{sharpc}{language=[Sharp]C, frame=lr, rulecolor=\color{blue!80!black}}
\begin{document}
ą
\begin{lstlisting}
ą
\end{lstlisting}


\end{document}

2 Answers2

2

From Section 2.5 of documentation simply use

\begin{lstlisting}[extendedchars=false]
ą
\end{lstlisting}

enter image description here

Sigur
  • 37,330
2

You can use literate to replace the char with a suitable command:

\documentclass[titlepage, a4paper]{mwart}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{polski}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{xcolor}
\lstdefinestyle{sharpc}{language=[Sharp]C, frame=lr, rulecolor=\color{blue!80!black}}

\lstset{literate=%
    {ą}{{\k a}}1    
}
\begin{document}
ą 
\begin{lstlisting}
ą
\end{lstlisting}

\end{document}
Ulrike Fischer
  • 327,261