0

I'm using biblatex to organize my bibliography. In case that \textcite{ref} only references a single author, I want to display the shortened first name. See the following MWE.

\documentclass{report}

\usepackage{filecontents}
\usepackage[backend=biber, style=alphabetic, language=USenglish]{biblatex}

\begin{filecontents}{\jobname.bib}
@Article{ref1,
  Title                    = {Title 1},
  Author                   = {Duck, Donald and Mouse, Mickey and Goofy, Goofy and Duck, Daisy},
  Year                     = {2012},
  Month                    = {Oct},
  Number                   = {1},
}

@Article{ref2,
  Title                    = {The influenza virus M2 protein cytoplasmic tail interacts with the M1 protein and influences virus assembly at the site of virus budding},
  Author                   = {Duck, Donald},
  Year                     = {2008},
  Month                    = {Oct},
  Number                   = {20},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\textcite{ref1}

\textcite{ref2}
\end{document}

The output of \textcite{ref2} is Duck [Duc08]. However, I want it to be D. Duck [Duc08]. The style for more authors should not be changed.

2

This is quite an inconsistent style, but it is easily possible with stykle=alphabetic.

\DeclareNameFormat{labelname}{%
  \ifboolexpr{test {\ifnumequal{\value{listcount}}{1}}
    and test {\ifnumequal{\value{liststop}}{1}}
    and not test \ifmorenames}
    {\ifuseprefix
       {\usebibmacro{name:given-family}
         {\namepartfamily}
         {\namepartgiveni}
         {\namepartprefix}
         {\namepartsuffixi}}
       {\usebibmacro{name:given-family}
         {\namepartfamily}
         {\namepartgiveni}
         {\namepartprefixi}
         {\namepartsuffixi}}}
    {\usebibmacro{name:family}
       {\namepartfamily}
       {\namepartgiven}
       {\namepartprefix}
       {\namepartsuffix}}%
  \usebibmacro{name:andothers}}
  • How do I use this format? If I put it in the preamble of the document, the names do not show up at all. – W. Alpha Nov 20 '17 at 12:05
  • Ok. I figured it out. I think there is a \nameparts{#1} missing as the first line of the new format. – W. Alpha Nov 20 '17 at 12:27
  • @W.Alpha \nameparts{#1} is not needed any more in versions newer than 3.4, the current version is 3.8a. So you might want to think about an update. – moewe Nov 20 '17 at 17:30

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.