3

Although there are already some discussions on this issue, I can't get any of the proposed solutions to work for me.

Take this document and compile it with xelatex:

\documentclass[12pt,a4paper,parskip=half+,ngerman]{scrartcl}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{german}
\usepackage[babel,german=quotes]{csquotes}

\usepackage{listings} \setmonofont{Consolas} \lstset{ breaklines=true, extendedchars=true, frame=single, keepspaces=true, showspaces=false, showstringspaces=false, }

\begin{document} Test \lstinputlisting[language=SQL,numbers=none,firstline=1,lastline=1]{code.sql} Test \lstinputlisting[language=SQL,numbers=none,firstline=2,lastline=2]{code.sql} Test \lstinputlisting[language=SQL,numbers=none,firstline=3,lastline=3]{code.sql} Test \lstinputlisting[language=SQL,numbers=none,firstline=4,lastline=4]{code.sql}

\end{document}

Code.sql:

Adélaïde de Maiziére
Mikuláš Frashëri
Petrė Meier
Şimşek Đurić

The result looks like this:
enter image description here

I tried the suggestion from The 'listings' package and UTF-8 and copied the given code into my document (do I maybe need to customize the hex-codes? What do they mean?). The result stays exactly the same.

Then, I tried the solution using literate from Having problems with listings and UTF-8. Can it be fixed? by adding the following line:

literate={á}{{\'a}}1 {é}{{\'e}}1 {Ş}{{\c S}}1 {ş}{{\c s}}1 {ć}{{\'c}}1 {ï}{{\"i}}1 {Đ}{{D}}1 {š}{{s}}1,

The result (note the additional spacing in the first line and the incorrect handling of the other characters).
enter image description here

What can I do?

Matthias
  • 365
  • 3
    In my answer in your first link you need the extend the line ^^^^20ac^^^^0153^^^^0152% nouveau pour xetex with more code. E.g. ^^^^20ac is for the euro sign (U+20AC). For "s cedille" (U+015F) you would have to add ^^^^015F. It is also possible to enter the chars directly €Œœ% nouveau pour xetex. The code works only if you use extendedchars=true! – Ulrike Fischer Mar 11 '14 at 09:09
  • Thanks! Do you know if there is a way to make this work for combined characters, too (such as ę̐, ...)? I've switched to Arial Unicode MS and added the diacritical marks (^^^^0310^^^^0328) to the definition but they are not combined with the base character as Latex seems to insert a space between them. – Matthias Mar 11 '14 at 10:18
  • I don't think that it can work with combined characters. Imho you will have to use literate for this. – Ulrike Fischer Mar 11 '14 at 10:50

0 Answers0