I'm writing some non-technical text that I'm trying to typeset using XeLaTeX. For simplicity, I'm keeping the actual text in plain text files which after certain modifications (e.g. escaping %
, \
and $
, although I don't use these characters right now) become a subset of LaTeX. Something like this:
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit.
I'm using Unicode characters for things like quotes and dashes (“
, ”
, –
, —
, etc.) When I used LaTeX, this worked fine. But when I switched to XeLaTeX, it no longer puts spaces after the quotes. I wrote a script that manually converts all the characters to their equivalents (two backticks, ''
, --
, ---
, etc.) which worked as a workaround.
For example, when I have the following code:
“It's a big problem,” he said.
``What's the problem,'' I asked.
It's rendered as:
“It’s a big problem,”he said.
“What’s the problem,” I asked.
My question is, is there a way to make XeLaTeX work properly without replacing all those characters?
The preamble of my .tex
files follows (although it's merely temporary, as I'm still working on the content).
\documentclass[a5paper,10pt]{book}
\usepackage{fullpage}
\usepackage[serbian,english,french]{babel}
\usepackage{fontspec}
\usepackage{xltxtra}
\usepackage{xeCJK}
\setCJKmainfont{Sazanami Mincho}
\usepackage[a5paper]{geometry}
babel
with XeLaTeX. Did you mean to loadpolyglossia
?fontspec
package and thexeCJK
package to show the problem, nothing else. This shows that the problem is with thexeCJK
package, which explicitly removes spacing after punctuation. It's supposed to do this only with CJK characters. Secondly, you shouldn't usebabel
withxelatex
; you should usepolyglossia
instead. See this question.xeCJK
package, and yeah, I'll remember to provide a full example next time -- the problem is gone (or rather... different, I get bigger spaces) when I add\setCJKmainfont{...}
which I added after adding the character replacement and I mistakenly included here. Shame on me. :)xeCJK
: East Asian ideographs (CJK texts), don't use space between words at all. ThusxeCJK
ignore all spaces between CJK symbols, to prevent extra spaces introduced by line wrapping.xeCJK
also make it possilbe to break line after CJK ideographs, and imporves the spacing for the CJK punctuations. There are some ambiguous width characters used both in CJK text and western text, such as double quotes. — This is the problem you meet.