3

This question already has an answer here:

Using: XeTeX 3.1415926-2.5-0.9999.3 (TexLive 2013) on openSuse 13.1

Setting up a multilingual buddhist glossary I have encountered the problem that closing (German) typographical quotation marks “ are being moved to the right with a space inserted. Additionally -- is no longer converter to ndash. (I have played around with removing certain packages, various fonts or \XeTeXlinebreaklocale to no avail.)

Kindly enough the documentation for xeCJK is Chinese only (/usr/local/texlive/2013/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf apologies, I only read Japanese). The XeTeX main doc (xetex-languages.tex,v: 2.02 2009/06/15) does explain the package somewhat (ch. 3.4.1, p. 79), although some options do through errors. What vexes me a bit is the concluding paragraph:

3.4.2.3 Compatibility eoretically, zhspacing should be compatible with all macro packages, except those who change the definition of \hskip and \penalty, in which case special treatment should be applied. I haven’t found any conflict when using common packages such as hyperref and fancyhdr. However, ulem redefineds \hskip and \penalty, and causes unexpected output. Use zhulem provided along with zhspacing instead.

Back to the problem:

Code (Lao, khmer, and birman omitted for this example)

\documentclass[10pt,a5paper]{book}
\usepackage[inner=2cm,outer=3cm,top=2cm,bottom=4cm]{geometry}
\usepackage{layout}
\usepackage[CJKnumber]{xeCJK}
  \setCJKmainfont{Bitstream CyberCJK}
  \punctstyle{plain}
\usepackage[babelshorthands]{polyglossia}
\setmainlanguage{german} 
\setotherlanguage{sanskrit} 
\setotherlanguage{english}
\setotherlanguage[numerals=thai]{thai}
    \newfontfamily\thaifont[Script=Thai]{FreeSerif}
    \XeTeXlinebreaklocale ’th_TH’ 

 \usepackage{setspace}
\usepackage{xspace}
\usepackage{textcomp}
\usepackage[hyphens,obeyspaces,spaces]{url} 
        \usepackage[colorlinks,filecolor=black,linkcolor=black,citecolor=black,urlcolor=black,breaklinks]{hyperref}
\usepackage{color}
\usepackage{wrapfig}
\usepackage{microtype}
\widowpenalty=10000
\clubpenalty=10000
\flushbottom
% +++ Fonts  % using the Free-family Fonts saves UTF-8 hassles as most characters (e.g ā) are included. The following NOT pertinent for example, just layout
 \setmainfont{FreeSerif}
 \setsansfont{FreeSans}
 \defaultfontfeatures{Ligatures=TeX}
 \renewcommand{\headrulewidth}{0pt}
 \renewcommand{\footrulewidth}{0pt}
 \fancyfoot[LO,RE]{\bfseries\thepage}
 \usepackage[compact]{titlesec} 
 \usepackage[font=footnotesize]{caption}

 \usepackage{enumitem} % Zeilenabstand Listen
 \setlist[itemize]{itemsep=-3pt}
 \setlist[description]{itemsep=-3pt}
 \setlist[enumerate]{itemsep=-3pt}
 \setlength{\leftmargini}{1em} 

 \begin{document}

 \begin{description}
 % Some CJK and "--" here
  \item[Āgama] ({\scriptsize ch./jap.:} 阿含經.) Das chinesische Analogon der Texte des Pāli-Kanons. Die Übersetzungen, meist aus dem Sanskrit, basieren auf teilweise älteren Texten als denen der Theravadins. Quellenangaben üblicherweise aus den ersten beiden Bänden (Nr. 1--155) des 大正新修大蔵経 \textit{Taishō shinshū daizōkyō;} Tōkyō 1922--32
 % some "shifted" “ in this
\item[Ariya pugalla.] A) Ein Erleuchteter, im modernen Thailand als buddhistischer „Heiliger“ Verehrter. („Erleuchtung“ wird einem Mönch üblicherweise erst nach seinem Tode nachgesagt. Von sich selbst zu behaupten, man besäße mehr übernatürliche Kräfte als man tatsächlich hat wäre für einen Ordinierten ein \textit{Pārājikā}-Vergehen.)
% some Thai, lao etc, to add more confusion
 \item[Jātaka(m) (Wiedergeburtsgeschichten).] (\textthai{ชาดก}, \textit{chadok}, {\scriptsize Skt.:} जातक, {\scriptsize Birm.:} ဇာတ်တော်; {\scriptsize Khmer:} ជាតក, \textit{cietɑk;} {\scriptsize Lao:} (\textlao{ຊາດົກ}, \textit{sadok,} {\scriptsize Jap.:} 本生)
\end{description}
 \end{document}

Screenshot 1: CJK ON, troublespots highlighted

Screenshot 2: CJK OFF, “ correctly spaced

Any suggestions? a) What might cause it or b) workaround?

marked as duplicate by Leo Liu, Jesse, Guido, Svend Tveskæg, Thorsten Feb 6 '14 at 12:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • TeX engine XeTeX would disable translating -- to en-dash (also em-dash) as default, and you should put \defaultfontfeatures{Ligatures=TeX} just after loading xeCJK to affect all font that specified by commands provided by xeCJK and fontspec. – Ch'en Meng Jan 17 '14 at 11:27
  • The quote signs in Chinese text are similar to those are in English text (but full width, zankaku width in Japanese). If you need the upright quotes, say and , you have to input these quotes directly. – Ch'en Meng Jan 17 '14 at 11:35
  • And because there are no ជាតក in the font you were selected for main text font, say Bitstream CyberCJK for CJK chars and FreeSerif for others, you got some question marks. What you have to do to fix this problem is specifing a font that contain these chars. – Ch'en Meng Jan 17 '14 at 11:42
  • For this particular question, it seems that only a few CJK characters are used. Therefore, it is reasonable not to use xeCJK package but only use \newfontfamily for Chinese and Japanese fonts. – Leo Liu Feb 7 '14 at 3:47
1

You are misplacing \defaultfontfeatures and make sure the font you're using have the requested characters.

For the quotes, there is a strange behavior when is used; but you can input as a double backquote: ``, the low quotes can be input as a double comma ,,.

In the code below I have removed the inessential packages and added fonts so the glyphs are correct (on my system). For Birmanian the result is poor, but I know nothing about it, so I'll leave it as is.

\documentclass[10pt,a5paper]{book}
\usepackage[inner=2cm,outer=3cm,top=2cm,bottom=4cm]{geometry}

\usepackage[CJKnumber]{xeCJK}
\defaultfontfeatures{Ligatures=TeX}
\setCJKmainfont{Hiragino Mincho Pro}
\punctstyle{plain}

\setmainfont{Times New Roman}
\setsansfont{FreeSans}

\usepackage[babelshorthands]{polyglossia}
\setmainlanguage{german} 
\setotherlanguage{sanskrit} 
\setotherlanguage{english}
\setotherlanguage[numerals=thai]{thai}
\setotherlanguage{lao}
%\setotherlanguage{khmer} % unfortunately it doesn't exist
\newfontfamily\sanskritfont{Devanagari Sangam MN}
\newfontfamily\thaifont[Script=Thai]{FreeSerif}
\newfontfamily\khmerfont{Khmer Sangam MN}
\newfontfamily\laofont{Lao Sangam MN}
\newfontfamily\myanmarfont{Myanmar Sangam MN}
%\XeTeXlinebreaklocale ’th_TH’ 

% +++ Fonts

\begin{document}

\begin{description}
% Some CJK and "--" here
\item[Āgama] ({\scriptsize ch./jap.:} 阿含經.) Das chinesische Analogon der Texte des 
Pāli-Kanons. Die Übersetzungen, meist aus dem Sanskrit, basieren auf teilweise älteren 
Texten als denen der Theravadins. Quellenangaben üblicherweise aus den ersten beiden Bänden 
(Nr. 1--155) des 大正新修大蔵経 \textit{Taishō shinshū daizōkyō;} Tōkyō 1922--32

% some "shifted" “ in this
\item[Ariya pugalla.] A) Ein Erleuchteter, im modernen Thailand als buddhistischer 
,,Heiliger`` Verehrter. (,,Erleuchtung`` wird einem Mönch üblicherweise erst nach seinem Tode 
nachgesagt. Von sich selbst zu behaupten, man besäße mehr übernatürliche Kräfte als man 
tatsächlich hat wäre für einen Ordinierten ein \textit{Pārājikā}-Vergehen.)

% some Thai, lao etc, to add more confusion
\item[Jātaka(m) (Wiedergeburtsgeschichten).] (\textthai{ชาดก}, \textit{chadok}, {\scriptsize 
Skt.:} {\sanskritfont जातक}, {\scriptsize Birm.:} {\myanmarfont ဇာတ်တော်}; {\scriptsize Khmer:}
{\khmerfont ជាតក}, \textit{cietɑk;} 
{\scriptsize Lao:} (\textlao{ຊາດົກ}, \textit{sadok,} {\scriptsize Jap.:} 本生)

\end{description}
\end{document}

enter image description here

  • Thanks for the replies: I knew about the Khmer/Burmese bit as mentioned I just hadn't tackled it, but included to show the complexity of the document. \defaultfontfeatures sorted out the -- Problem. Alas, having to use `` is a bit self-defeating if one wants to use utf-8. Anyway it works, although I am not 100% sure why. Much appreciated your help. In case anybody should know where to find an full English xeCJK doc I'd appreciate that, too. Seems to be a packet with some more interesting features. – Zenwort Jan 17 '14 at 14:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.