4

For a math report, we often use name of a category in bold letters, ie, Set. Out of laziness, i found that just writing $\bf Set$ seems to do the trick without apparent side effects. Is this okay to do and why?

3
  • 14
    No. \bf has been depreciated since 1993! Use \mathbf{Set} or define \Set to be \mathbf{Set} which is even faster.
    – daleif
    Mar 8, 2022 at 14:44
  • 6
    But it’s okay with Plain TeX. Mar 8, 2022 at 15:30
  • maybe you want to define a macro, like \newcommand*\Set{\mathbf{Set}}.
    – plante
    Mar 8, 2022 at 23:55

2 Answers 2

14

LaTeX itself hasn't defined \bf in the format since LaTeX2e was introduced in 1993.

So depending on the document class you use

  • You may find that \bf is defined for compatibility with documents from the 1980's, or
  • It may work but warn and suggest correct markup, or
  • It may give an error that \bf is not defined.

Whether that is "OK" is up to you to decide, but there isn't really much of an advantage to using this over \mathbf{set} in math or \textbf{set}in text.

4
  • It was not good decision to leave \bf macro from plain TeX, because we cannot show simple format independent pieces of the code where we need to select bold o italics.
    – wipet
    Mar 9, 2022 at 7:08
  • 1
    @wipet so you say, but you don't agree with most of the latex design. millions of users have shown you are wrong, and choose latex as the most usable of the available tex formats. \bf is not a good syntax in math where you almost never want to make the rest of a group bold, just apply to a single identifier. To show code working in both formats it would be better to define a macro with argument if not already defined so it works in plain as well as latex. But for most people most of the time, having code that works in two formats is completely uninteresting as they only use one format. Mar 9, 2022 at 7:58
  • Maybe million users are using a suboptimal software (this is not unusual, see MS win for example) but this is not an evidence that the software is good. Many people can be frustrated by this software. We can see here at this site: desperate questions, codes where we see misunderstanding of basic principles of TeX, because LaTeX often hides these principles.
    – wipet
    Mar 11, 2022 at 8:07
  • @wipet I was expecting a windows comparison in reply:-) Mar 11, 2022 at 10:57
2

TeX concept is based (among others) on groups. Setting of whatever is typically local in the group. Setting of current font is local too. So {\it italics}, (for example) follows perfectly the TeX concept. Math typesetting is in the group too, so first $ opens a group and second $ closes the group. The setting math alphabets is implemented slightly different than selecting normal text fonts, but the group concept is kept here too. So $\bf test$ is perfectly correct, because \bf does two selections in parallel: it selects the text font and math alphabet too, both is local in current group.

LaTeX does not recommend to use groups in typical cases. It recommends obscure macros instead: \mathbf, \texttt, \textit etc. LaTeX hides the basic principles of groups from end user. But TeX users use groups. And most LaTeX users are confused because the {} have different meaning in the group concept: {\it ...} and when they are used as the macro parameter delimiters: \textit{...}.

3
  • 4
    Very opinionated. I find it more obscure to use \bf in two very different meanings: boldface in math is a different thing than in text (albeit the realization might be the same). Semantics is more important than efficiency obtained by obscurity. And \textbf{text} does much more than {\bfseries text}, which is the main reason for the different syntax. And in plain TeX you have the same ambiguity with {\it text} and \pmatrix{...}, don't you?
    – egreg
    Mar 8, 2022 at 22:05
  • 3
    you miss the fact that \bf is not defined in latex by default (it is in the standard article/report/book) for compatibiliy reasons but it isn't defined in other popular classes. Using an undefiend command is not something that is just "recommended" not to do. Mar 8, 2022 at 22:10
  • 4
    \pmatrix is a macro which is not implemented for selecting fonts. So, confusion is not probable. But \textbf, \bfseries \bf are here for selecting fonts and they have different syntax. We see confused users here at this site, they write, for example \bfseries{text}, \bf{text}.
    – wipet
    Mar 9, 2022 at 6:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .