Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

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}
share|improve this answer
    
I used above code still same pblm. –  Manish Dec 7 '12 at 1:43
    
@Manish: Did you use exactly my code or some adaption? In the first case: Put the log-file and the pdf somewhere for inspection. –  Ulrike Fischer Dec 7 '12 at 9:10

The example by Fischer works for me but conflicts with Sweave package. After compiling .Rnw file and creating .tex file I had to comment Sweave (%\usepackage{Sweave}) in .tex file and after compiling .tex to a .PDF file bold font showed up in output.

share|improve this answer
    
Welcome to TeX.SX! A tip: You can use backticks ` to mark your inline code as I did in my edit. –  Christian Hupfer Jun 18 at 7:54

The problem with font encoding has been solved in the Sweave package. You should use param [noae] in header, like \usepackage[noae]{Sweave}. This param forces Sweave to use T1 encoding and the problem with bold russian fonts is gone. For additional info, see the R newsletter, page 42.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.