5

I am writing an article in English, with some pages in Russian.

\documentclass[12pt]{article} 
\usepackage[T1,T2A]{fontenc} 
\usepackage[utf8]{inputenc} 
\usepackage[russian,english]{babel} 
\usepackage{newtxmath}
\usepackage{newtxtext}
\begin{document} 
hello \textbf{hello} 
\selectlanguage{russian} привет \textbf{привет} 
\end{document}

Output:

hello hello привет привет

I am using \selectlanguage{} to switch between languages when needed.

However, I noticed that when I try to use \textbf{} when in Russian language mode, it does not work because of newtxtext, which I am using for math formulas.

Does anyone know how to solve this problem?

Thank you.

8
  • 1
    A simple example based on your code (\documentclass[12pt]{article} \usepackage[T1,T2A]{fontenc} \usepackage[utf8]{inputenc} \usepackage[russian,english]{babel} \begin{document} hello \textbf{hello} \selectlanguage{russian} привет \textbf{привет} \end{document}; modulo line breaks) works for me. Please show us a small example document that shows what you are trying to do, a so-called MWE tex.meta.stackexchange.com/q/228/35864.
    – moewe
    Feb 2, 2019 at 17:01
  • @moewe, you are totally right, your example works fine. I've looked into the packages I use, and it seems that newtxtext package is creating the problem I have. Do you know how to solve this problem without deleting this package? Thank you. Feb 2, 2019 at 17:14
  • Please add that crucial piece of information to your question and consider turning the code fragment into a usable MWE (in the sense of the link above). Unfortunately, I don't know a lot about fonts, so you will have to wait for an expert to help you. But to my untrained eye it just seems as though the font does not have bold Cyrillic letters.
    – moewe
    Feb 2, 2019 at 20:37
  • @moewe, I was hoping that my problem is too trivial to add it. Sorry, my bad. I have updated my question. Thank you for your assistance. Feb 2, 2019 at 21:21
  • Strictly speaking the question might not require an MWE, but as you saw it is much easier if you include one because then you can be sure that we are all talking about the same thing and all seeing the same effect. The information about newtxtext was certainly crucial in understanding the issue.
    – moewe
    Feb 2, 2019 at 21:25

1 Answer 1

8

You get two warnings:

LaTeX Font Warning: Font shape `T2A/ntxtlf/m/n' undefined
(Font)              using `T2A/cmr/m/n' instead on input line 12.

LaTeX Font Warning: Font shape `T2A/ntxtlf/bx/n' undefined
(Font)              using `T2A/ntxtlf/m/n' instead on input line 12.

because newtxtext doesn't support Cyrillic. Thus the standard font family is substituted (first warning), but the second substitution points back to the same font, because LaTeX knows nothing about ntxtlf in T2A encoding.

Solution: substitute with a font family using Times, but supporting Cyrillic.

\documentclass[12pt]{article}
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian,english]{babel}
%\usepackage{newtxtext}
\usepackage{tempora} % this supports Cyrillic
\usepackage{newtxmath}


\begin{document}

English: hello \textbf{hello}

Russian: \foreignlanguage{russian}{привет \textbf{привет}}

\end{document}

Note that, in any case, newtxmath must be loaded after the font package for text, be it tempora or newtxtext.

enter image description here

You can use newtxtext, though, provided you set up Tempora for Cyrillic.

\documentclass[12pt]{article}
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian,english]{babel}
\usepackage{newtxtext}
\usepackage{newtxmath}
\usepackage{substitutefont}

\substitutefont{T2A}{\rmdefault}{Tempora-TLF}


\begin{document}

English: hello \textbf{hello}

Russian: \foreignlanguage{russian}{привет \textbf{привет}}

\end{document}
3
  • this did the trick, thank you! However I am getting a new error because of using amsthm package: LaTeX Error: Command \openbox already defined. Is there a way to solve it? I need this package in the article. Feb 4, 2019 at 6:45
  • 2
    @DarkTemplar Load amsmath and amsthm before newtxmath.
    – egreg
    Feb 4, 2019 at 7:47
  • Perfect solution. I didn't know about tempora.
    – Sigur
    Apr 4, 2019 at 0:29

You must log in to answer this question.

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