Richard Heck wrote:
> Steve Litt wrote:
>
>> My code, and yours, work well assuming the charcter style is applied to body
>> text or something of a similar size. However, if applied to a section
>> heading, it will print out at 12 point when the rest of the section heading
>> prints out at 24 point or whatever.
>>
>> In other words, I'm looking for a way to make something like the cmff
>> equivalent of \texttt{text} or \textsf{text}.
>>
> Have a look at this: http://www.latex-project.org/guides/fntguide.pdf.
> You don't have to set all the attributes when you select a new font: So
> you can do something like:
> \newcommand\specialfont{\fontfamily{cmtt}\selectfont}. Note, though,
> that using this in section headings can cause problems. At a miminum,
> you will need to \protect it.
>
> And sadly, by the way, cmff cannot be selected this way, apparently, at
> least not without some additional setup. You would need to create an
> ot1cmff.fd file. See $TEXMF/tex/latex/psnfss/*.fd for some examples, and
> the previously referenced .pdf file for the details. WARNING: I don't
> know anything about this!
>
I played around a bit with this. It seems to me I ought to know about
fonts. Here's a very quick hack.
Put this in the file t1cmff.fd:
\ProvidesFile{t1cmtt.fd}
\DeclareFontFamily{T1}{cmff}{}
\DeclareFontShape{T1}{cmff}{m}{n}{<-> cmff10}{}
and save it somewhere appropriate (e.g., $LOCALTEXMF/tex/latex/base/).
Run texhash to update the database.
Now try this:
%Begin example file
\documentclass[12pt]{book}
\usepackage{newcent}
\newcommand\specialfont{\fontencoding{T1}\fontfamily{cmff}\selectfont}{}
\begin{document}
This is the normal font.
\section{\protect\specialfont This is the special font}
This is the normal font.
This is the normal font {\specialfont with special font
embedded} in the normal font.
\end{document}
%End example file
If the font sizes don't seem quite right (it looks a bit big to me), you
can add a scaling factor in t1cmff.fd thus:
\DeclareFontShape{T1}{cmff}{m}{n}{<-> [0.95] cmff10}{}
Again, see http://www.latex-project.org/guides/fntguide.pdf for more ideas.
Richard
--
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto