我对以下 (Xe)LaTeX 代码有疑问,我想在标点符号周围获得正确的法语间距。
开始:
\documentclass{standalone}
\usepackage{polyglossia}
\setmainlanguage{french}
% \usepackage{ucharclasses}
\begin{document}
Ceci est un test: «avec des guillemets»
\end{document}
这产生了正确的渲染:
但是,如果我取消注释该ucharclasses
包,那么间距就会变得不正确:
我甚至不需要加载出错Latin
选项。我很想不责怪任何人,让事情正常运转,但不知道从哪里开始!ucharclasses
答案1
该ucharclass
包改变了拉丁字符的类别,但polyglossia
假定该类别为 0。
您可以尝试
\documentclass{standalone}
\usepackage{ucharclasses}
\usepackage{polyglossia}
\setmainlanguage{french}
\makeatletter
\appto\french@punctuation{%
\ifluatex\else
\XeTeXinterchartoks \BasicLatinClass \french@punctthin = {\nobreak\thinspace}%
\XeTeXinterchartoks \BasicLatinClass \french@punctthick = {\nobreakspace}%
\XeTeXinterchartoks \french@punctguillstart \BasicLatinClass = {\nobreakspace}% "«a" -> "« a"
\XeTeXinterchartoks \BasicLatinClass \french@punctguillend = {\nobreakspace}% "a»" -> "a »"
\XeTeXinterchartoks \LatinSupplementClass \french@punctthin = {\nobreak\thinspace}%
\XeTeXinterchartoks \LatinSupplementClass \french@punctthick = {\nobreakspace}%
\XeTeXinterchartoks \french@punctguillstart \LatinSupplementClass = {\nobreakspace}% "«a" -> "« a"
\XeTeXinterchartoks \LatinSupplementClass \french@punctguillend = {\nobreakspace}% "a»" -> "a »"
\fi
}
\makeatother
\begin{document}
Ceci est un test: «avec des guillemets»
\end{document}