3

Is there a way to permanently set \bf to \textbf? The .bbl file I use uses \bf which leads to errors and me having to reset every entry manually to \textbf. Each time I add a new citation, each time the .bbl file changes, I have to redo everything, otherwise I can't continue working. For example the following:

\harvarditem{Wurm}{2004}{Wurm2004}
Wurm, F.~M.  \harvardyearleft 2004\harvardyearright , `{Production of
  recombinant protein therapeutics in cultivated mammalian cells}', {\em Nature
  Biotechnology} {\bf 22}(11),~393--398.
\newline\harvardurl{https://doi.org/10.1038/nbt1026}

\documentclass[12pt,a4paper]{scrreprt}
\usepackage{natbib}
\bibliography{Mendeley}
\bibliographystyle{agsm}
  • Please tell us which document class you employ. Also, which bibliography style do you use? – Mico Aug 8 '17 at 20:24
9

the syntax of \bf and \textbf are different, it would be better to make \bf be \bfseries which you can do via

\renewcommand\bf{\bfseries}
  • Thanks, your solution worked. Just one follow up question. How exactly doe they differ in their syntax? I thought both could be used to make text bold and \bf was simply older/from an older package. – Han Aug 8 '17 at 20:13
  • \bf is a declaration which charges the state within the enclosing group while \texbf is a command which takes an argument and sets it in bold. – Herb Schulz Aug 8 '17 at 20:17
  • 2
    @Han look at the example you posted: {\bf 22} makes 22 but {\textbf 22} would be the same as {\textbf{2}2} and make 22 – David Carlisle Aug 8 '17 at 20:23
5

Assuming that get the error because you are using one of the KOMA classes, you can add definitions for the old font commands by copying them from e.g. article.cls:

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

Since you're using the agsm bibliography style, another way to achieve your objective is to modify this bibliography style so that it uses \bfseries instead of \bf. Fortunately, this is easy to do. I suggest you proceed as follows:

  • Find the file agsm.bst in your TeX distribution. Make a copy of this file and call the copy, say, agsm-bfseries.bst. (You are obviously free to choose a different, presumably easier, file name.)

  • Open the file agsm-bfseries.bst in a text editor; the program you use to edit your tex files will do fine.

  • Inside agsm-bfseries.bst, locate the function called embolden. It should look like this:

    FUNCTION {embolden}
    { duplicate$ empty$
        { pop$ "" }
        { "{\bf " swap$ * "}" * }
      if$
    }
    

    In this function, change \bf to \bfseries. (Yes, that's really all that has to be changed!)

  • Save the file agsm-bfseries.bst, either in the directory where your main tex file is located or in a directory that's searched by BibTeX. If you choose the latter option, be sure to update the filename database of your TeX distribution as well.

  • In your main tex file, change the instruction

    \bibliographystyle{agsm}
    

    to

    \bibliographystyle{agsm-bfseries}
    

    Then, re-run LaTeX, BibTeX, and LaTeX twice more to fully propagate all changes.

Happy BibTeXing!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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