0

I'm trying to get the year and the author in bold for all in-text citations.

Thanks to @moewe I already managed to get my prefered style of the Bibliography and also to print the author in the in-text citation in bold. Now there is missing the last step to get my prefered format style.

I would be very happy if someone had a hint for me. I think it's only one line that is missing but I don't know how to edit the year.

This is what I get right now

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{csquotes}
\usepackage[backend=biber,
  citestyle=ext-authoryear,
  bibstyle=ext-authortitle,
  sorting=nyt,
  introcite=label, 
  maintitleaftertitle=true,
  maxcitenames=2,
  dashed=false
]{biblatex}

\setlength{\introcitewidth}{4cm} 
\setlength{\introcitesep}{\bibhang}

\DeclareFieldFormat{bbx@introcite}{\mkbibbold{#1}}
\DeclareNameAlias{sortname}{family-given}
\renewcommand*{\mkbibnamefamily}{\textbf}

% make square brackets around citation in text
\makeatletter
\newrobustcmd*{\parentexttrack}[1]{%
  \begingroup
  \blx@blxinit
  \blx@setsfcodes
  \blx@bibopenparen#1\blx@bibcloseparen
  \endgroup}
\AtEveryCite{%
  \let\parentext=\parentexttrack%
  \let\bibopenparen=\bibopenbracket%
  \let\bibcloseparen=\bibclosebracket}
\makeatother

\AtBeginBibliography{ 
  \renewcommand*{\mkbibnamefamily}[1]{\textsc{#1}}}
  
\begin{filecontents}{Bibliography.bib}
@book{Loftin80,
    title={Subsonic Aircraft: Evolution and the Matching of Size to Performance},
    author={Laurence K. Loftin},
    year={1980},
}
\end{filecontents}
\addbibresource{Bibliography.bib}

\begin{document}
The author and year should be in bold. \autocite{Loftin80}
\printbibliography
\end{document}
2
  • What about pre- and postnotes? What should be bold if you say \autocite[cf.][20-22]{Loftin80}? – moewe Jan 7 at 8:22
  • Only the author and year; pre- and postnotes not in bold – MoritzLo Jan 7 at 8:33
0

Unfortunately, there are no built-in formats to change the citation label in this way, so we have to redefine the cite bibmacro. The definition used by ext-authoryear.cbx is inherited from authoryear.cbx (ll. 10-18 in v3.16). We just add a \printtext[bold]{...} in the right place.

That code will automatically make the citation in the bibliography bold as well, so we can drop the \DeclareFieldFormat{bbx@introcite}{\mkbibbold{#1}}.

Note that with biblatex-ext it is much easier to get square brackets around citations than with the standard styles. You don't need \parentexttrack and friends. See my answer to Biblatex, author-year, square brackets, where you find \parentexttrack in the accepted answer.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{csquotes}
\usepackage[backend=biber,
  citestyle=ext-authoryear,
  bibstyle=ext-authortitle,
  sorting=nyt,
  introcite=label, 
  maintitleaftertitle=true,
  maxcitenames=2,
  dashed=false
]{biblatex}

\setlength{\introcitewidth}{4cm} 
\setlength{\introcitesep}{\bibhang}

\DeclareNameAlias{sortname}{family-given}

\DeclareOuterCiteDelims{parencite}{\bibopenbracket}{\bibclosebracket}

\renewbibmacro*{cite}{%
  \printtext[bold]{%
    \iffieldundef{shorthand}
      {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
         {\usebibmacro{cite:label}%
          \setunit{\printdelim{nonameyeardelim}}}
         {\printnames{labelname}%
          \setunit{\printdelim{nameyeardelim}}}%
       \usebibmacro{cite:labeldate+extradate}}
      {\usebibmacro{cite:shorthand}}}}

\AtBeginBibliography{%
  \renewcommand*{\mkbibnamefamily}{\textsc}}
  
\begin{filecontents}{\jobname.bib}
@book{Loftin80,
  title  = {Subsonic Aircraft: Evolution and the Matching of Size to Performance},
  author = {Laurence K. Loftin},
  year   = {1980},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
The author and year should be in bold. \autocite{Loftin80}
\printbibliography
\end{document}

The author and year should be in bold. [Loftin 1980]

1
  • Thank you so much for your time and help! Now it works exactly the way I want :) – MoritzLo Jan 7 at 9:47

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.