Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

\bf or \textbf

151 views
Skip to first unread message

* Tong *

unread,
Mar 4, 2001, 5:33:38 PM3/4/01
to
Hi,

Sorry for a rather newbie question.

All the books I read (quite limited though :->) use \textbf for
bolding, but I also see people use \bf. So can somebody shed some
light on this topic? like where \bf is defined?, are they
interchangeable?, etc.

Thanks

--
Tong (remove underscore(s) to reply)
http://members.xoom.com/suntong001/
- All free contribution & collection & music from the heavens

Peter Flynn

unread,
Mar 4, 2001, 5:51:31 PM3/4/01
to * Tong *
* Tong * wrote:
>
> Hi,
>
> Sorry for a rather newbie question.
>
> All the books I read (quite limited though :->) use \textbf for
> bolding, but I also see people use \bf. So can somebody shed some
> light on this topic? like where \bf is defined?, are they
> interchangeable?, etc.

\bf was borrowed from plain TeX and is now obsolete in
LaTeX2e and should not be used.

The recommended syntax is \textbf{stuff} unless the stuff
is very long, in which case {\bfseries stuff} is better
because TeX won't fill up your memory looking for the }
of the argument.

///Peter

Rowland McDonnell

unread,
Mar 9, 2001, 7:35:45 PM3/9/01
to
Peter Flynn <pe...@silmaril.ie> wrote:

> * Tong * wrote:
> >
> > Hi,
> >
> > Sorry for a rather newbie question.
> >
> > All the books I read (quite limited though :->) use \textbf for
> > bolding, but I also see people use \bf. So can somebody shed some
> > light on this topic? like where \bf is defined?, are they
> > interchangeable?, etc.
>
> \bf was borrowed from plain TeX and is now obsolete in
> LaTeX2e and should not be used.

The reasons behind this are to do with the NFSS (New Font[1] Selection
Scheme) which gets round problems that \bf had. \bfseries and \textbf{}
work more smoothly - they actually switch you to the bold version of the
current fount, which is what the average user usually wants. \bf
doesn't. I can't remember exactly what it does (and Lamport's 1st
edition LaTeX book appears to not provide the details), but I do recall
it being a pain in the bum.

> The recommended syntax is \textbf{stuff} unless the stuff
> is very long, in which case {\bfseries stuff} is better
> because TeX won't fill up your memory looking for the }
> of the argument.

More or less. {\bfseries ...} also works a bit more quickly and
therefore has two reasons to be preferred by class and package writers
who don't have to ensure that their class and package files are easily
comprehensible (and in the case of the LaTeX team itself, seem to
delight in writing the most incomprehensible code possible - or maybe
I'm just stupid. Or maybe both).

In Lamport's 1st edition LaTeX book, the recommended procedure is to not
use such commands at all in body text, but to define commands that
describe structural information and use the type style commands inside
them. For example, the \url{} command provided by the url package
switches to \ttfamily by default when typesetting a url.

I often define commands describing structure that do nothing but select
a different type style. Something like:

\newcommand{\realperson}[1]{{\textbf #1}}

\newcommand{\fictionalperson}[1]{{\textit #1}}

It has the advantage that I can leave thinking about *which* type style
is the most appropriate for *that* document element until after I've
written the bloody thing and seen how it looks on paper. On top of
that, when I come back to the document years later and want to re-use
text, I can change type style to match whatever I want to use the text
for with a single easy-to-apply change for each logical element rather
than having to read the entire document, figure out what the hell I was
on at the time, and then manually change each instance of type styling
to suit the new document.

I've written package documentation that uses similar commands for
elements like documentclass name, package name, file name, and so on.
Many of these elements end up being typeset identically - but if I ever
change my mind, I can change the style of a single kind of element with
a single change and almost no effort.

Rowland.

[1] See? I'm not stuck on fount.

--
Remove the animal for email address: rowland....@dog.physics.org
PGP pub key A680B89D Sorry - the spam got to me
http://www.mag-uk.org
UK biker? Join MAG and help keep bureaucracy at bay

Giuseppe Bilotta

unread,
Mar 10, 2001, 11:02:25 AM3/10/01
to
Rowland McDonnell wrote:
> Peter Flynn <pe...@silmaril.ie> wrote:
>
> > * Tong * wrote:
> > >
> > > Hi,
> > >
> > > Sorry for a rather newbie question.
> > >
> > > All the books I read (quite limited though :->) use \textbf for
> > > bolding, but I also see people use \bf. So can somebody shed some
> > > light on this topic? like where \bf is defined?, are they
> > > interchangeable?, etc.
> >
> > \bf was borrowed from plain TeX and is now obsolete in
> > LaTeX2e and should not be used.
>
> The reasons behind this are to do with the NFSS (New Font[1] Selection
> Scheme) which gets round problems that \bf had. \bfseries and \textbf{}
> work more smoothly - they actually switch you to the bold version of the
> current fount, which is what the average user usually wants. \bf
> doesn't. I can't remember exactly what it does (and Lamport's 1st
> edition LaTeX book appears to not provide the details), but I do recall
> it being a pain in the bum.

FWIW, I find the \bf, \it, etc shortcuts comfortable. And since I like
the NFSS idea to use the correct style of the correct font, I hacked
(in my documents) the definitions like this:

\DeclareOldFontCommand{\rm}{\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\bfseries}{\mathbf}
\DeclareOldFontCommand{\it}{\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\scshape}{\@nomath\sc}

(the latter two require \makeatletter ... \makeatother or a style file
wrapper) which allows for {\bf {\it bold italic} bold} things.


--
Giuseppe Bilotta

Axiom I of the Giuseppe Bilotta
theory of IT:
Anything is better than MS

Robin Fairbairns

unread,
Mar 12, 2001, 6:32:42 AM3/12/01
to
Giuseppe Bilotta <bilo...@hotpop.com> wrote:
>FWIW, I find the \bf, \it, etc shortcuts comfortable. And since I like
>the NFSS idea to use the correct style of the correct font, I hacked
>(in my documents) the definitions like this:
>
>\DeclareOldFontCommand{\rm}{\rmfamily}{\mathrm}
>\DeclareOldFontCommand{\sf}{\sffamily}{\mathsf}
>\DeclareOldFontCommand{\tt}{\ttfamily}{\mathtt}
>\DeclareOldFontCommand{\bf}{\bfseries}{\mathbf}
>\DeclareOldFontCommand{\it}{\itshape}{\mathit}
>\DeclareOldFontCommand{\sl}{\slshape}{\@nomath\sl}
>\DeclareOldFontCommand{\sc}{\scshape}{\@nomath\sc}
>
>(the latter two require \makeatletter ... \makeatother or a style file
>wrapper) which allows for {\bf {\it bold italic} bold} things.

you will, i trust, understand why latex can't do that sort of thing
for you as default (changing the interpretation of _so_ many users'
files would create havoc).

the essence of what you're doing is achievable by using the newlfont
package (in the distribution) but that doesn't attempt to make the
commands usable in maths mode. this is because newlfont attempts to
emulate the original (mightily confusing) nfss for latex2.09.
--
Robin Fairbairns, Cambridge

Giuseppe Bilotta

unread,
Mar 13, 2001, 4:18:13 AM3/13/01
to
Robin Fairbairns wrote:
> Giuseppe Bilotta <bilo...@hotpop.com> wrote:
> >FWIW, I find the \bf, \it, etc shortcuts comfortable. And since I like
> >the NFSS idea to use the correct style of the correct font, I hacked
> >(in my documents) the definitions like this:
> >
> >\DeclareOldFontCommand{\rm}{\rmfamily}{\mathrm}
> >\DeclareOldFontCommand{\sf}{\sffamily}{\mathsf}
> >\DeclareOldFontCommand{\tt}{\ttfamily}{\mathtt}
> >\DeclareOldFontCommand{\bf}{\bfseries}{\mathbf}
> >\DeclareOldFontCommand{\it}{\itshape}{\mathit}
> >\DeclareOldFontCommand{\sl}{\slshape}{\@nomath\sl}
> >\DeclareOldFontCommand{\sc}{\scshape}{\@nomath\sc}
> >
> >(the latter two require \makeatletter ... \makeatother or a style file
> >wrapper) which allows for {\bf {\it bold italic} bold} things.
>
> you will, i trust, understand why latex can't do that sort of thing
> for you as default (changing the interpretation of _so_ many users'
> files would create havoc).

Of course! And that's why I never asked for LaTeX to do it for me. I
just exposed the way I personally like the thing to work, and how I
settled for it.

0 new messages