I am compiling with XeLaTex.
Within the lstlistings
environment (provided by the listings package), special unicode characters appear to be misplaced.
This is a minimal demonstration. Code:
\documentclass{article}
\usepackage[mathrm=sym]{unicode-math}
\usepackage{listings}
\lstset{
inputencoding = utf8x
, extendedchars = \true
, mathescape = false
, escapechar = {$}
, basicstyle = \ttfamily
, numbers = left
}
\setmonofont[Scale=0.85]{Courier New}
\begin{document}
\begin{lstlisting}
(ζ).
( ζ).
(ζ ).
ζ
(abcζ).
(abc ζ).
( abcζ).
\end{lstlisting}
\end{document}
Output (cropped):
The special unicode char is the zeta. It appears that what's happening is that the zeta is printed to the left of word immediately previous to it (words are delimited up by spaces, line-breaks, and some characters).
In certain circumstances (e.g. lines 4 and 5) the special unicode character is shifted backward past a line-break.
Another odd behavior (e.g. line 1) is that when there is no line-break previous to the special unicode char, the backward-shift interferes with line-numbers' placement (indenting the "1" for line 1).
I honestly have no idea what is happening. What I'd like to preserve is the ability to enter unicode characters into lstlisting
environments without special decoration or padding with spaces.