1

I just noted that XeLaTeX yields wrong accents over cyrillic letters if I use

Arno Pro

or

Myriad Pro

fonts. I mean the command like these: \'{o}, `{o}, \~{o}, \c{o}, \d{o}, e.c.t. They produce correct output if o is Latin but do not work as expected for cyrilic letters (I tried а, о, в). This problem is absent if I take other fonts (I tried Cambria, Calibri).

It seems that fontspec package should be patched to correct this problem but also there is a question of how to bypass the problem before that package right now.

My code is attached below.

% !Mode:: "TeX:UTF-8"
\documentclass{article}
\usepackage{ifpdf,ifxetex,ifluatex}

\ifxetex
\usepackage{polyglossia}
    \setdefaultlanguage{russian}
    %\setotherlanguages{english,german,french}
\usepackage{fontspec}
    \defaultfontfeatures{Ligatures={TeX}}
    \setmainfont{Arno Pro}% wrong accents
    %\setmainfont{Cambria}
    %\setmainfont{Calibri}
    \setsansfont{Myriad Pro}
    \setmonofont{Consolas}
\usepackage[math-style=TeX]{unicode-math}
    %\setmathfont{Cambria Math}
    \setmathfont{Asana Math}
\fi

\ifluatex
\usepackage[russian]{babel}
\usepackage{fontspec}
    \defaultfontfeatures{Renderer=Basic,Ligatures={TeX}}
    \setmainfont{Arno Pro}
    \setsansfont{Myriad Pro}
    \setmonofont{Consolas}
\usepackage[math-style=TeX]{unicode-math}
    %\setmathfont{Cambria Math}
    \setmathfont{Asana Math}

 \fi

\begin{document}%

\ifluatex
    This is LuaTeX.
\else\ifxetex
    This is XeTeX.
\else\ifpdf
    This is PDFLaTeX.
\else
    This is LaTeX.
\fi\fi\fi

    \begin{table}[h]
    \def\MacroFont{\fontencoding\encodingdefault
           \fontfamily\ttdefault
           \fontseries\mddefault
           \fontshape\updefault
           \selectfont}%
    \def\PrintMacroName#1{{\strut\MacroFont\string #1}}
    \newcommand{\X}[1][1]{\ensuremath{^{#1)}}}%
    \newcommand{\XX}{\X[2]}%
    \newcommand{\tac}[2][o]{\texttt{\PrintMacroName{#2}\string{#1\string}}}%
    \vspace{-0.5\baselineskip}
    \begin{center}
    \caption{Latin Letter o}
    \begin{tabular}{@{}*{4}{ll@{\hspace{6ex}}}ll@{}}
    \`{o} & \tac{\`}     & \~{o} & \tac{\~}  & \v{o} & \tac{\v}     & \c{o} & \tac{\c}
        & \"{o} & \verb§\"{o}§ \\
    \'{o} & \tac{\'}     & \={o} & \tac{\=}  & \H{o} & \tac{\H}     & \d{o} & \tac{\d}
        & \u{o} & \tac{\u} \\
    \^{o} & \tac{\^}     & \.{o} & \tac{\.}  & \r{o}& \tac{\r}      & \b{o} & \tac{\b}
        & \t{oo}& \tac[oo]{\t} \\
    \end{tabular}

    \caption{Cyrillic Letter о}
    \begin{tabular}{@{}*{4}{ll@{\hspace{6ex}}}ll@{}}
    \`{о} & \tac{\`}     & \~{о} & \tac{\~}  & \v{о} & \tac{\v}     & \c{о} & \tac{\c}
        & \"{о} & \verb§\"{о}§ \\
    \'{о} & \tac{\'}     & \={о} & \tac{\=}  & \H{о} & \tac{\H}     & \d{о} & \tac{\d}
        & \u{о} & \tac{\u} \\
    \^{о} & \tac{\^}     & \.{о} & \tac{\.}  & \r{о}& \tac{\r}      & \b{о} & \tac{\b}
        & \t{oo}& \tac[oo]{\t} \\
    \end{tabular}

    \caption{Cyrillic Letter в}
    \begin{tabular}{@{}*{4}{ll@{\hspace{6ex}}}ll@{}}
    \`{в} & \tac{\`}     & \~{в} & \tac{\~}  & \v{в} & \tac{\v}     & \c{в} & \tac{\c}
        & \"{в} & \verb§\"{в}§ \\
    \'{в} & \tac{\'}     & \={в} & \tac{\=}  & \H{в} & \tac{\H}     & \d{в} & \tac{\d}
        & \u{в} & \tac{\u} \\
    \^{в} & \tac{\^}     & \.{в} & \tac{\.}  & \r{в}& \tac{\r}      & \b{в} & \tac{\b}
        & \t{oo}& \tac[oo]{\t} \\
    \end{tabular}
    \end{center}
    \end{table}
\end{document}
2

1 Answer 1

4

You should try the package xunicode, which has more suitable definitions for the accent macros.

There may be something wrong, because the following document gives two different results when xunicode is loaded before or after fontspec:

\documentclass{article}
\usepackage{xunicode}

\usepackage{fontspec}
\setmainfont{Linux Libertine O}

\begin{document}

Latin Letter o

\`{o}\~{o}\v{o}\c{o}\"{o}\'{o}\={o}\H{o}\d{o}\u{o}\^{o}\.{o}\r{o}\b{o}

\bigskip

Cyrillic Letter о

\`{о}\~{о}\v{о}\c{о}\"{о}\'{о}\={о}\H{о}\d{о}\u{о}\^{о}\.{о}\r{о}\b{о}

\bigskip

Cyrillic Letter в

\`{в}\~{в}\v{в}\c{в}\"{в}\'{в}\={в}\H{в}\d{в}\u{в}\^{в}\.{в}\r{в}\b{в}

\end{document}

With xunicode before fontspec

enter image description here

Without \usepackage{xunicode}:

enter image description here

6
  • 3
    A new fontspec will automatically use xunicode. And it is quite possible that some accent commands don't work as expected with certain fonts if e.g. a combining char is missing in the font. One must reset the definition in such cases. There are discussion about this in the archives of the xetex mailing list. Commented Sep 10, 2011 at 8:19
  • It's quite strange that if I load xunicode before fontspec the result is better.
    – egreg
    Commented Sep 10, 2011 at 8:41
  • @Ulrike and egreg: I tried to load xunicode before fontspec. Results are better but not excelent. Now \'{в} outputs accented в with extra space after в. Without xunicode same command outputs в (without accent) and crossed rectangle. Commented Sep 10, 2011 at 13:08
  • 1
    If you load xunicode before fontspec it will set up its definitions for the encoding "U" (unknown) and not for the encoding used by fontspec. This will disable most definitions. Don't do. You must change some definitions after you loaded fontspec/xunicode. Search the archive of the xetex list (I don't have the time this week). Commented Sep 11, 2011 at 9:00
  • @Ulrike: if I load \usepackage{xunicode}` explicitely ahead of \use{polyglossia}\setdefaultlanguage{russian}. Then all troubles with accents go away. However Xelatex complains that Command \AA unavailable in encoding EU1. Same is for \copyright. So, inded it is not good way to load xunicode before fontspec. However currently I cannot figureout what definitions should I change after fontspec. Should it be someting like \DeclareTextAccent...? Commented Sep 12, 2011 at 6:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .