listings
package. But it can be solved with the verbments
package.“. – So I will accept your answer. :) (I keep using the listings
package and try to avoid typographical question marks.) listings
package. But it can be solved with the verbments
package.“. – So I will accept your answer. :) (I keep using the listings
package and try to avoid typographical question marks.) verbments
package works very well. But I was looking for a solution for the listings
package, so I can't accept this as an answer … :-/ Also I'm missing many options with the verbments
package that I'm using wit the listings
package. But I really like the lexer method used by pygmentize
! Thanks for your hints about compatibility and not recommended packages, too. :) \defaultfontfeatures
behind \setmonofont
fixed the 2nd question. :) I just want to include some sourcecode by using the listings
package wit XeTeX.
Here is my minimal example:
% !TEX TS-program = XeLaTeX
% !TEX encoding = UTF-8 Unicode
\documentclass[xetex]{scrreprt}
\usepackage{xltxtra}
\defaultfontfeatures{Mapping=tex-text}
\setmonofont[Scale=.8]{Inconsolata}
\usepackage{bold-extra}
\usepackage{upquote}
\usepackage{listings}
\lstset{
basicstyle=\ttfamily\scriptsize,
keywordstyle=\bfseries,
numbers=left,
inputencoding=utf8x,
extendedchars=true,
showlines=true,
upquote=true,
showstringspaces=false
}
\lstdefinelanguage{turtle} {
morekeywords={@prefix,@base,@forSome,@forAll,@keywords},
% literate=%
% *{``}{``}{1}
% {''}{''}{1}
% {„}{``}{1}
% {“}{''}{1},
}
\begin{document}
\begin{lstlisting}[language=turtle]
@prefix crm: <http://www.cidoc-crm.org/cidoc-crm/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<http://my.domain/object/1>
rdf:type
crm:E22_Man-Made_Object ;
rdfs:label
"„David“ Skulptür …", "This is another ‚test‘ …" ;
crm:P102_has_title
<http://my.domain/title/1> ;
crm:P108i_was_produced_by
<http://my.domain/production/1> ;
crm:P31i_was_modified_by
<http://my.domain/modification/1> .
\end{lstlisting}
\end{document}
This produces te following output:
As you can see in line 8
(the last sign at the end) and line 9
(after the first quotation mark; in front of the word test
) the quotation marks are wrong/incorrect. – David
should be surrounded by (German) double quotation marks („David“
) and test
with (German) single quotation marks (‚test‘
).
→ Does someone know how to fix that/produce that?
Another problem in line 9
is the display of typographical quotation marks (opening and closing) for the whole string ("„David“ Skulptür …
").
I can only fix this by commenting out \defaultfontfeatures{Mapping=tex-text}
in the preamble.
→ Again: Does someone know how to fix that (without disabling \defaultfontfeatures
)?
Thanks a lot and best regards!
PS:
The disabled literate
option in the MWE doesn't change anything if is enabled …
fontenc
instead of xltxtra
and added \defaultfontfeatures
after my font definitions, but that didn't change anything. :-/ (Maybe now I'm a little bit more future-proof?)