Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
See discussion of my later [question][1] for answer. [1]: tex.stackexchange.com/questions/28227/… –  Igor Kotelnikov Sep 14 '11 at 0:44
    
See discussion of the [following question][1] for answer. [1]: tex.stackexchange.com/questions/28227/… –  Igor Kotelnikov Sep 14 '11 at 0:45
add comment

1 Answer

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

share|improve this answer
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. –  Ulrike Fischer Sep 10 '11 at 8:19
    
It's quite strange that if I load xunicode before fontspec the result is better. –  egreg Sep 10 '11 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. –  Igor Kotelnikov Sep 10 '11 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). –  Ulrike Fischer Sep 11 '11 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...? –  Igor Kotelnikov Sep 12 '11 at 6:30
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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