[XeTeX] xetex + listings + inputencoding

M. Niedermair m_g_n at gmx.de
Wed Feb 4 10:43:42 CET 2009


Hi,

> \begingroup
> \XeTeXdefaultencoding latin1
> \lstinputlisting{list2.java}
> \endgroup

now it works. Thanks.
By Michael


% -------------------------------------------------------------
\documentclass{scrartcl}

\usepackage{xltxtra}

\usepackage[final,writefile]{listings}
\lstloadlanguages{java,HTML,[AlLaTeX]TeX,make}

\newcommand{\lstinputlistingutf}[2][]{\lstinputlisting[#1]{#2}}
\newcommand{\lstinputlistinglatin}[2][]{\begingroup\XeTeXdefaultencoding 
latin1\lstinputlisting[#1]{#2}\endgroup}

\begin{document}

Listing 1 (utf8)

\lstinputlistingutf[caption={Dies ist ein großes Beispiel}]{list1.java}


\lstinputlistingutf{list1.java}

\bigskip
Listing 2 (iso8859-1)

\lstinputlistinglatin[caption={Dies ist ein großes Beispiel}]{list2.java}


\end{document}




More information about the XeTeX mailing list