[XeTeX] Listings and copy/paste
Le Farfadet Spatial
le.farfadet.spatial at free.fr
Mon Jul 26 19:39:46 CEST 2010
Hello everybody out there!
I am a French user of LaTeX and I am now discovering XeLaTeX, which
is really great! Anyway, I have discovered a strange behaviour of
"listings" environment with XeLaTeX. After several posts on
fr.comp.text.tex, I have been recommended to post here.
Even with the option "upquote", both simple and double quotes are
composed with non-ASCII characters. Though quite aesthetic, this is
troublesome when doing copy/paste from the PDF. Also, when
copying/pasting, indentation disappears. This happens either by using
Evince or Acroread and pasting in GNU Emacs or Gedit.
An example at the end of this message.
Regards.
Yoann Le Bars
\documentclass{article}
\usepackage{xltxtra}
\usepackage{fancyvrb}
\usepackage{xcolor}
\usepackage{listings}
\lstloadlanguages{C++}
\lstset{
fancyvrb=true,
language=C++,
basicstyle=\ttfamily,
stringstyle=\ttfamily\color{green!50!black},
keywordstyle=\color{blue}\bfseries,
commentstyle=\color{red!50!black}\itshape,
showspaces=false,
showstringspaces=true,
fontadjust=true,
keepspaces=true,
flexiblecolumns=true,
frame=single,
upquote=true
}
\setmonofont[Mapping=tex-text]{DejaVu Sans Mono}
\begin{document}
\begin{lstlisting}
#include <iostream>
int main () {
std::cout << "Test" << '\n';
return 0;
}
\end{lstlisting}
\end{document}
--
L'antre du farfadet :
http://le.farfadet.spatial.free.fr/
Textes, musiques et peintures
More information about the XeTeX
mailing list