3

Trying understand the difference in "visual" output from XeLaTeX and PdfLaTeX. MWE is as follows:

\documentclass[a4paper,12pt]{article}

\usepackage{amsmath}
\usepackage{csquotes}
\usepackage{microtype}

\usepackage{ifxetex}
\ifxetex
    % XeLaTeX
    \usepackage{polyglossia}
    \setmainlanguage{russian}
    \usepackage{fontspec}
    \usepackage[]{unicode-math}
    \setmainfont{CMU Serif}
\else
    % default: pdfLaTeX
    \usepackage[russian]{babel}
    \usepackage[T2A]{fontenc}
    \usepackage[utf8]{inputenc}
\fi

\begin{document}

\enquote{Текст.  \enquote{Другой текст.}}

\end{document}

This is output from PdfLaTeX

enter image description here

And this one comes from XeLaTeX:

enter image description here

As one can see from 2nd picture, position of quotation mark (inner left) w.r.t. the next letter Д is wrong (very close). What is the reason? Polyglossia vs Babel, or CM vs. CM Unicode?

3

I'm afraid it's a problem of bad kerning in CMU Serif; if you try with the “real” characters instead of \enquote, you get the same result.

You can add the required kerning manually:

\documentclass[a4paper,12pt]{article}

\usepackage{amsmath}

\usepackage{ifxetex}
\ifxetex
  % XeLaTeX
  \usepackage{polyglossia}
  \setmainlanguage{russian}
  \usepackage{fontspec}
  \usepackage[]{unicode-math}
  \setmainfont{CMU Serif}
\else
  % default: pdfLaTeX
  \usepackage[T2A]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage[russian]{babel}
\fi
\usepackage{csquotes}
\usepackage{microtype}

\ifxetex
  \DeclareQuoteStyle{russian}% verified
    {\guillemotleft\kern0.05em }
    {\kern0.05em \guillemotright}
    {\quotedblbase\kern0.1em }
    {\kern0.05em\textquotedblleft}
\fi

\begin{document}

\enquote{Текст.  \enquote{Другой текст.}}

\guillemotleft Текст. \quotedblbase Другой текст.\textquotedblleft\guillemotright

\end{document}

Adjust to suit your needs.

enter image description here

  • thank for your answer, though good result requires "manual work". I thought CMU fonts originate from the same source as cm-super, they should have similar properties ... In case of XeLaTeX I have to use CMU for text and math fonts being consistent. Another reason is that CMU Math are most complete, so e.g. Cambria Math still has no \perp symbol, etc. – Alx Aug 2 '16 at 11:54
  • @Alx I think that with OpenType fonts you can change the kerning based on language tags; unfortunately, it appears that the cm-unicode project is dead. – egreg Aug 2 '16 at 12:16
  • So, if CMU is dead what unicode math fonts could you suggest? I tried Charter, PT Serif for text, both give good results, but what about math fonts? I know of course about XITS -- an example of consistent Times-like fonts. – Alx Aug 2 '16 at 12:41
  • @Alx I'm not saying that you shouldn't use CMU, only that you cannot expect fixes for bad behavior. PT Serif is specifically studied for Cyrillic. – egreg Aug 2 '16 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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