[Tex/LaTex] Bold font problem while using Russian fonts

boldr

This refers to my previous question

not able to write bold characters using textbf

I installed the cm-extra font package but still there is a problem with boldface due to \usepackage[english,russian]{babel}.

\documentclass[11pt,table,a4paper]{article}
\usepackage{bold-extra}
\usepackage[T1,T2A]{fontenc}
\usepackage{CJKutf8}
\usepackage[english,russian]{babel}
\usepackage{fancyvrb}
\usepackage{myboldtt}
\def\n{\textbackslash n}
\begin{document}
  Regular text. \textbf{Bold}.
\begin{Verbatim}[commandchars=\\\{\}]
%chunk = 1
<<echo=FALSE,results=tex>>=
cat("dataset","\n")
cat("\textbf{dataset}","\n")   # it should be bold 
@
\end{Verbatim}
\end{document}

Please help me out in fixing this problem as I'm in great need.

Best Answer

The problem is that the cm-super-fonts don't provide a bold typewriter font. But the lmodern fonts do but only for T1-encoding. So you should temporarly switch the font encoding to T1 (or the language to english). On the other side the lmodern font don't provide a bold T2A-font (needed for the regular text). So you should switch only the typewriter font e.g. to lmodern or to the luximono fonts (which have a more distinctive bold version):

\documentclass[11pt,table,a4paper]{article}
\usepackage[T1,T2A]{fontenc}
\usepackage[english,russian]{babel}
\usepackage{fancyvrb}
%typewriter is lmodern:
\renewcommand\ttdefault{lmtt}
%Alternative:
%\usepackage[scaled]{luximono}

\def\n{\textbackslash n}
\begin{document}
Regular text. \textbf{Bold}.

\begingroup
\fontencoding{T1}\selectfont
\begin{Verbatim}[commandchars=\\\{\}]
%chunk = 1
<<echo=FALSE,results=tex>>=
cat("dataset","\n")
cat("\textbf{dataset}","\n")   # it should be bold
@
\end{Verbatim}
\endgroup
\end{document}