3

I've looked at many similar questions on TeX overflow to no avail. I've tried using both the polyglossia and the babel packages but neither had any effect. I'm assuming the issue lies a little deeper.

Here is a MWE:

\documentclass[10pt,a4paper]{article}
\usepackage{graphicx}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainfont{LMR12R-Gregory}
\setdefaultlanguage[variant=american]{english}
\setotherlanguage{russian}
\begin{document}

    \textrussian{Привет!}

\end{document}

Below is shown the text on the PDF generated by this code:

The text on the PDF

What causes this? The font has both latin and cyrillic characters. In WordPad it works correctly, so I'm not sure what's going on. Any help would be highly appreciated.

As per the comments below, here is a dropbox link to the font: https://www.dropbox.com/s/4grjkah8x6ldgul/LMR12R-Gregory.ttf?dl=0

Here is a pastebin of the log. There were no issues or errors shown in TeXStudio. https://pastebin.com/jCx7w7s1

  • 3
    if xetex doesn't show cyrillic it is quite probable that the font doesn't have the chars - applications like wordpad often use fallbacks in such cases. – Ulrike Fischer Jun 25 at 22:18
  • And welcome to TeX.SX! – Skillmon Jun 25 at 22:23
  • Welcome to TeX.SE! Thanks for adding a minimal example. It would help answer the question if the font were available. Barring that, can you add \tracinglostchars=2 and/or look in the log file for warnings about the font not containing the requested characters? – ShreevatsaR Jun 25 at 22:24
  • 3
    The file works for me with no issues (the font looks like a stylized/italic/cursive one.) Check the encoding in TeXStudio: is it using UTF-8 or something else? – ShreevatsaR Jun 25 at 22:48
  • 1
    Here is the picture of what I get – egreg Jun 25 at 22:57
0

ShreevatsaR found the issue - the encoding of TeXStudio was ISO-8859-1/latin1 instead of UTF-8. For anyone else with this issue, to change the encoding, go to the Edit menu and select "Change Encoding". UTF-8 should be at the top (you may have to scroll up to see it)

  • 1
    TeXstudio supports “magic comments”. While I generally do not use TeXstudio, I begin most of my documents with % !TEX TS-program = xelatex and % !TEX encoding = UTF-8, as quite a few compilers support this syntax. – Kess Vargavind Jun 26 at 0:02

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.