1

Forum,

I have problem with documents generated in LaTeX with Cyrillic symbols. I created the following file:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\begin{document}
ЛаТеХ\\LaTeX
\end{document}

And when I copy text in Cyrillic alphabet, I obtain some gibberish on the clipboard,

enter image description here

This makes my articles quite hard to quote. So my first question is, can I fix this and have proper copying process?

Also if I anyway type certain text and look for it in the document, it is not found in the document, being absolutely clear, that this text is there:

enter image description here

My second question is, can I make the document in such a way, that I can obtain returned the Cyrillic string, that I seek?

All this doesn't happen, if the letters are Latin. The Cyrillic letters, however, cause these problems and at this point I cannot use LaTeX due to these restrictions.

I will be happy to give further details, when needed.

Best regards.

PS: I use "MikTex", pdfLatex+MakeIndex+BibTex.

  • You probably will have to switch to xelatex or lualatex along with \usepackage{fontspec}\setmainfont{CMU Serif}. – Ulrike Fischer Aug 27 '17 at 21:20
  • Thank you, for the fast reply. Sadly, I don't manage to fix it, the way I understood your suggestion. If I switch to "XeLaTeX", "LuaLaTeX", " XeLaTeX+MakeIndex+BibTex" or " LuaLaTeX+MakeIndex+BibTex", without adding "\usepackage{fontspec}\setmainfont{CMU Serif}", it doesn't show the Cyrillic symbols. When I add it, the compiler returns an error: " Erroneous variable \c__fontspec_shape_n_n_tl used! l.3806 \emfontdeclare{ \emshape, \eminnershape }". – ecclesiastes Aug 27 '17 at 21:36
  • Sure that's why I wrote that you should add them. You need some font with cyrillic. – Ulrike Fischer Aug 27 '17 at 21:38
  • Wow, you are fast. I have edited my comment several times, please take a look at it, now it is completely ready. :) – ecclesiastes Aug 27 '17 at 21:41
  • You probably have an outdated fontspec. Run the update manager (admin + user version). – Ulrike Fischer Aug 27 '17 at 21:44
2

The problem here is that by default PdfLaTeX uses some 8-bit font encoding (T2 for Cyrillic) and doesn't provide the Unicode mapping for it. So your viewer thinks that these characters aren't Cyrillic but from latin1 encoding.

To add this Unicode mapping with PdfLaTeX you can use the cmap package:

\documentclass{article}
\usepackage{cmap}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\begin{document}
ЛаТеХ\\LaTeX
\end{document}

produces searchable and copyable Cyrillic text in the resulting PDF.

Alternatively, as Ulrike Fischer suggested, you can switch to XeLaTeX or LuaLaTeX and use fontspec with some OpenType or TrueType font which contains Cyrillic glyphs in it:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{CMU Serif}
\begin{document}
ЛаТеХ\\LaTeX
\end{document}

The latter approach might require some newer version of your TeX distribution because these new TeX engines and packages are being actively developed, so naturally they contain more bugs (which might be fixed in newer versions).

  • Thank you, Sergei. Your solution really answers my question properly. I believe, that I didn't manage to implement the other solution by Ulrike, but this is due to software insufficiency. – ecclesiastes Aug 28 '17 at 21:31

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.