I am a novice-level user of latex. I can produce simple tex file and
can see it. But a tricky problem makes me crasy.
In the tex document, if I wanted to make raw mode, i.e, wanted to
produce the text as it appears in my input file, I think the proper way
was by using \begin{verbatim}, or \verb|... Here is my question.
How can I change the default font of the verbatim mode? By the limited
knowledge of latex, I can not find the solution. I'd like to change
the default font to the font that is extensively used when printing
source of a program, a font that is used at programming language texts,
for example, K&R's /C programming Language/, or Rich Stevens' /UNIX
network programming/. I think its name is somewhat courier font. How
can I change the default font of \verbatim to this courier font?
PLEASE help me.
Thank you
This is trickier than you might imagine, because the default fonts
(Knuth's CM fonts) don't actually permit verbatim use in many of the
obvious ways one wants.
Unless you've got some odd LaTeX (e.g. Y&Y, which has its own
encodings) you need to use the EC fonts (or DC fonts if you've got
those already), which have `uniform' encodings throughout.
Having got the EC fonts installed, you need to get the verbatim
package: if you've got a decent LaTeX installation, you'll have that
already, since it's part of the `tools' distribution. You have to
change the definition of \verbatim@font
Suppose you want your verbatim text to be in a sans face: you need to
say:
\usepackage[T1]{fontenc}% selects EC fonts
\usepackage{verbatim}% configurable verbatim
\makeatletter
\def\verbatim@font{\normalfont\sffamily% select the font
\let\do\do@noligs
\verbatim@nolig@list}
\makeatother
IMHO, you shouldn't need to be using internal commands at the end
there, but that's the way it is.
Note, since the EC fonts (and the DC fonts before them) were designed
to support European languages, it's entirely possible that you don't
have them. I have no idea how one might do verbatim in Korean, or
whatever: you'll need to talk to a local expert about that.
--
Robin (Campaign for Real Radio 3) Fairbairns r...@cl.cam.ac.uk
U of Cambridge Computer Lab, Pembroke St, Cambridge CB2 3QG, UK
Home page: http://www.cl.cam.ac.uk/users/rf/robin.html