0

I'm trying to write bold Cyrillic letters in my document but can't achieve a satisfactory solution.

I found an example on CTAN.org with source code here using the substitutefont package.

What I want to do is write Cyrillic with a CM-like font, just as they did on the "bf" line of the PDF. What I have so far :

\documentclass[11pt,a4paper]{exam}

\usepackage[T2A,T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[russian,french]{babel} \usepackage{lmodern}

%%%%%%% Other packages used %%%%%%% \usepackage[style=ddmmyyyy,datesep=/]{datetime2} % Pour formater la date \usepackage{graphicx} % Pour l'import d'image \usepackage[export]{adjustbox} % Pour l'alignement des images \usepackage{tikz} % Pour créer des graphes \usepackage{tabularx} % Extension pour les tables (tabular) \usepackage{enumitem} % Extension pour les listes (itemize) \usepackage{svg} % Pour importer des images SVG \usepackage{multicol} % pour afficher des portions de textes sur plusieurs colonnes \setlength{\columnsep}{2.5cm} \usepackage{caption} \usepackage{makecell} \usepackage{tcolorbox} \usepackage{amsmath} \usepackage{alltt} \usepackage{colortbl} \usepackage{zref-savepos} \usepackage{multirow} \usepackage{xhfill} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{substitutefont}

\substitutefont{T2A}{lmr}{fcm} \substitutefont{T2A}{lmss}{fcs} \substitutefont{T2A}{lmtt}{fct}

% [...] %

% Used to write answers in red and bold \printanswers\unframedsolutions\SolutionEmphasis{\bfseries\color{red}}\renewcommand{\solutiontitle}{}\CorrectChoiceEmphasis{\bfseries\color{red}}

\begin{document}

% [...] %

\pointsinrightmargin \noindent En répondant correctement à cette question bonus, vous pouvez obtenir directement la note maximale de $\frac{10}{10}$. Malheureusement elle n'est pas écrite en français. \qformat{\textbf{Question Bonus} \thequestiontitle(\thepoints) :\hfill} \begin{questions} \titledquestion{}[10] % "Тим Бернерс-Ли" doesn't show up in bold \foreignlanguage{russian}{Кто изобрел Всемирную паутину?} \ifprintanswers \fillin[\foreignlanguage{russian}{Тим Бернерс-Ли} (Tim Berners-Lee)][9.15cm] \else \hrulefill \fi \end{questions} \end{document}

So I'm using the exam document class and use the command \printanswers to write down answers in red and bold. It works perfectly for Latin text but the Russian text doesn't show up in bold.

I used the example I found on CTAN.org but it doesn't seems to work. I keep getting these errors:

No declaration for shape T2A/fcm/m/n. sub@sfcnt ...e forspace shapespace mandatory@arg }
No declaration for shape T2A/fcm/bx/n. sub@sfcnt ...e forspace shapespace mandatory@arg }

What's wrong with my code?

Nicryc
  • 125
  • 4

3 Answers3

2

You could improve the answer in the link to use the babel package, or directly use it. The answer in the link invoking fonts in the newcomputermodern package may be the best one so far as now (which could invoke Russian letters with different shapes and weights in Computer Modern fonts) to write the document mixing English or another language with Russian.

Also, the answer in the link gives a way to invoke any font on the computer for any other language. For example, we have good choices to Times fonts for English, and if we want to invoke similar Times fonts for Greek or Russian in such way, then we just need to install the similar Times fonts for Greek or Russian on our computer which are already existed in the world in my mind.

M. Logic
  • 4,214
1

Use the la fonts (the Cyrillic version of cm):

\documentclass[11pt,a4paper]{exam}

\usepackage[T2A,T1]{fontenc} \usepackage[russian,french]{babel} \usepackage{lmodern} \usepackage{xcolor}

\DeclareFontFamilySubstitution{T2A}{lmr}{cmr} \DeclareFontFamilySubstitution{T2A}{lmss}{cmss} \DeclareFontFamilySubstitution{T2A}{lmtt}{cmtt}

% [...] %

% Used to write answers in red and bold \printanswers \unframedsolutions \SolutionEmphasis{\bfseries\color{red}} \renewcommand{\solutiontitle}{} \CorrectChoiceEmphasis{\bfseries\color{red}}

\begin{document}

\pointsinrightmargin

\noindent En répondant correctement à cette question bonus, vous pouvez obtenir directement la note maximale de $\frac{10}{10}$. Malheureusement elle n'est pas écrite en français.

\qformat{\textbf{Question Bonus} \thequestiontitle(\thepoints) :\hfill}

\begin{questions} \titledquestion{}[10] % "Тим Бернерс-Ли" doesn't show up in bold \foreignlanguage{russian}{Кто изобрел Всемирную паутину?} \ifprintanswers \fillin[\foreignlanguage{russian}{Тим Бернерс-Ли} (Tim Berners-Lee)][9.15cm] \else \hrulefill \fi \end{questions}

\end{document}

enter image description here

But I get a very similar result with

\DeclareFontFamilySubstitution{T2A}{lmr}{fcm}
\DeclareFontFamilySubstitution{T2A}{lmss}{fcs}
\DeclareFontFamilySubstitution{T2A}{lmtt}{fct}

enter image description here

egreg
  • 1,121,712
  • Ok thanks it works. I understood my mistake, I just didn't have the cm-lgc font installed as it is this one that is used in the example I found. Since it was a little too much effort to install it in MiKTeX I installed cm-super instead and used the font code "cmr" as you did. A little question for you, how do you know the right font code to use like "cmr", "cmss", "cmtt"? – Nicryc May 28 '22 at 12:47
  • Also I supposed the la is an alternative to cm-super. What is the name of the package on CTAN or MiKTeX I can't find it? – Nicryc May 28 '22 at 12:50
  • 1
    @Nicryc You need nothing; cm-super is a container of Type1 versions of the CM and LA fonts, but just using the default fonts you get them. – egreg May 28 '22 at 13:08
0

CM Unicode .otf font contains Latin and Cyrillic (and Greek):

CMU

and is available as part of the distribution (in .../texmf-dist/fonts/opentype/public/cm-unicode/), so a fontspec-(xe/lua)latex solution is possible:

TBL

MWE

\documentclass[11pt,a4paper]{exam}

\usepackage{fontspec} \setmainfont{CMU Serif}

\usepackage[russian,french]{babel} \usepackage{xcolor}

% Used to write answers in red and bold \printanswers \unframedsolutions \SolutionEmphasis{\bfseries\color{red}} \renewcommand{\solutiontitle}{} \CorrectChoiceEmphasis{\bfseries\color{red}}

\begin{document}

\pointsinrightmargin

\noindent En répondant correctement à cette question bonus, vous pouvez obtenir directement la note maximale de $\frac{10}{10}$. Malheureusement elle n'est pas écrite en français.

\qformat{\textbf{Question Bonus} \thequestiontitle(\thepoints) :\hfill}

\begin{questions} \titledquestion{}[10] % "Тим Бернерс-Ли" doesn't show up in bold \foreignlanguage{russian}{Кто изобрел Всемирную паутину?} \ifprintanswers \fillin[\foreignlanguage{russian}{Тим Бернерс-Ли} (Tim Berners-Lee)][9.15cm] \else \hrulefill \fi \end{questions}

\end{document}

Cicada
  • 10,129