Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

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

share|improve this answer
    
Thanks a lot! That definitely solved my problem :-) –  Robert Mar 25 '12 at 15:48
    
@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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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