0

Suppose I use biblatex and that I cite two papers by two authors with the same last name, A. Smith (2019) and B. Smith (2020). If I use, say \textcite{Smith2020}, it may compile as

Lorem ipsum dolor sit amet, consectetur B.

Smith (2020) adipiscing elit, sed do eiusmod

How can I get it to compile as the following?

Lorem ipsum dolor sit amet, consectetur

B. Smith (2020) adipiscing elit, sed do eiusmod

1
  • Please provide a minimal working example with bibliography (MWEB).
    – epR8GaYuh
    May 25, 2023 at 18:10

1 Answer 1

1

The safest way is probably

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear]{biblatex}

\newbibmacro*{name:giveni-family}[4]{%
  \usebibmacro{name:delim}{#2#3#1}%
  \usebibmacro{name:hook}{#2#3#1}%
  \mkbibcompletenamegivenfamily{%
    \ifdefvoid{#2}
      {}
      {\mkbibnamegiven{#2}\isdot\addnbspace}%
    \ifdefvoid{#3}
      {}
      {\mkbibnameprefix{#3}\isdot
       \ifprefchar
         {}
         {\ifuseprefix{\bibnamedelimc}{\bibnamedelimd}}}%
    \mkbibnamefamily{#1}\isdot
    \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}}

\DeclareNameFormat{labelname}{%
  \ifcase\value{uniquename}%
    \usebibmacro{name:family}
      {\namepartfamily}
      {\namepartgiven}
      {\namepartprefix}
      {\namepartsuffix}%
  \or
    \ifuseprefix
      {\usebibmacro{name:giveni-family}
        {\namepartfamily}
        {\namepartgiveni}
        {\namepartprefix}
        {\namepartsuffixi}}
      {\usebibmacro{name:giveni-family}
        {\namepartfamily}
        {\namepartgiveni}
        {\namepartprefixi}
        {\namepartsuffixi}}%
  \or
    \usebibmacro{name:given-family}
      {\namepartfamily}
      {\namepartgiven}
      {\namepartprefix}
      {\namepartsuffix}%
  \fi
  \usebibmacro{name:andothers}}

\begin{filecontents}{\jobname.bib}
@book{aelk,
  author    = {Anne Elk},
  title     = {A Theory on Brontosauruses},
  year      = {1972},
  publisher = {Monthy \& Co.},
  location  = {London},
}
@book{celk,
  author    = {Catherine Elk},
  title     = {A Theory on Other Dionsaurs},
  year      = {2021},
  publisher = {Monthy \& Co.},
  location  = {London},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem ipsum dolor sit amet dolor sit amet igitur a \textcite{aelk}
ipsum \autocite{celk}

\printbibliography
\end{document}

Lorem ipsum dolor sit amet dolor sit amet igitur a A. Elk (1972) ipsum
(C. Elk 2021)

do note that using a nonbreakable space in this position does not necessarily guarantee that the whole name moves to the next line. You could also get an overful line.

You must log in to answer this question.

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