6

I am using biblatex to make the citation numbers bold by redefining \citesetup to include a \bfseries:

\renewcommand*{\citesetup}{%
\bfseries
\biburlsetup
\frenchspacing}

This makes the reference \cite{key} appear as

[1]

as desired. The problem is that sometimes I want to use \textcite to also include the author's name, but still with a bold citation number, i.e., the command \textcite{key} should produce

author's name [1]

With my redefined \citesetup this is not achieved since it makes the author's name as well as the citation number bold, i.e.,

author's name [1]

Does anybody know of a good way to achieve the desired effect with a partial bold reference?

6

Here's a solution that redefines the textcite bibmacro (as found in the numeric citestyle), defines a new \mkbibboldbrackets command and applies it to various citation commands (replacing \mkbibbrackets). Note that this way pre- and postnotes still will be typeset in bold.

\documentclass{article}

\usepackage{biblatex}

\makeatletter

\renewbibmacro*{textcite}{%
  \iffieldequals{namehash}{\cbx@lasthash}
    {\multicitedelim}
    {\cbx@tempa
     \ifnameundef{labelname}
       {\printfield[citetitle]{labeltitle}}
       {\printnames{labelname}}%
%     \addspace\bibopenbracket}% DELETED
     \addspace\begingroup\bfseries\bibopenbracket}% ADDED
  \ifnumequal{\value{citecount}}{1}
    {\usebibmacro{prenote}}
    {}%
  \usebibmacro{cite}%
  \savefield{namehash}{\cbx@lasthash}%
%  \gdef\cbx@tempa{\bibclosebracket\multicitedelim}}% DELETED
  \gdef\cbx@tempa{\textbf{\bibclosebracket}\multicitedelim}}% ADDED

\DeclareCiteCommand{\textcite}
  {\let\cbx@tempa=\empty
   \undef\cbx@lasthash}
  {\usebibmacro{citeindex}%
   \usebibmacro{textcite}}
  {}
  {\usebibmacro{postnote}%
%   \bibclosebracket}% DELETED
   \bibclosebracket\endgroup}% ADDED

\newrobustcmd{\mkbibboldbrackets}[1]{%
  \begingroup
  \blx@blxinit
  \blx@setsfcodes
  \bfseries\bibopenbracket#1\bibclosebracket
  \endgroup}

\makeatother

\DeclareCiteCommand{\cite}[\mkbibboldbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\parencite}[\mkbibboldbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\smartcite}[\iffootnote\mkbibboldbrackets\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareMultiCiteCommand{\cites}[\mkbibboldbrackets]{\cite}{\multicitedelim}
\DeclareMultiCiteCommand{\parencites}[\mkbibboldbrackets]{\parencite}{\multicitedelim}
\DeclareMultiCiteCommand{\smartcites}[\iffootnote\mkbibboldbrackets\mkbibfootnote]{\smartcite}{\multicitedelim}

\addbibresource{biblatex-examples.bib}

\begin{document}

Some text about \textcite{companion} and \textcite[see][99]{knuth:ct:a}.

\printbibliography

\end{document}

enter image description here

An alternative that typesets only the label (and not the surrounding brackets) in bold is:

\documentclass{article}

\usepackage{biblatex}

\renewbibmacro*{cite}{%
  \textbf{% ADDED
  \printtext[bibhyperref]{%
    \printfield{prefixnumber}%
    \printfield{labelnumber}%
    \ifbool{bbx:subentry}
      {\printfield{entrysetcount}}
%      {}}}% DELETED
      {}}}}% ADDED

\addbibresource{biblatex-examples.bib}

\begin{document}

Some text about \textcite{companion} and \textcite[see][99]{knuth:ct:a}.

\printbibliography

\end{document}

enter image description here

2
  • @Robert Please also upvote my answer -- this has to be done separately from accepting it. – lockstep Mar 25 '12 at 15:50
  • Sorry for my late response, lockstep. It has been upvoted now. – Robert Mar 29 '12 at 19:06

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.