1

I want to show some nicely formatted source code, e.g.:

er ist ein bisschen ein ötto geworden

My document:

\documentclass[a4paper,10pt,ngerman]{scrartcl}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage[a4paper,margin=2.5cm]{geometry}
\usepackage{listings}

\begin{document}
Ünnormal diggi hä
\lstinputlisting[language = python]{testinclude.txt}
\end{document}

The text outside the listing works, but the txt file produces the error Package utf8x Error: Character182appearedalone.

How do I show code that contains special characters?

Like this thread suggested, I tried escaping the ö or setting a literate to \''o, but both times I only got this in utf8 and utf8x: weird looking ö

0 Answers0