1

I want a custom biblatex cite command that prints first last (year) where first is author's first name last is authors last name and year is publication year.

The following questions have got me on the right track, but since they don't explain what is going on I can't figure out how to edit these custom definitions to suit what I need:

Citing author's full name in biblatex

Biblatex custom cite command

EDIT: MWE with answers below:

\documentclass{report}

\usepackage{epigraph}
\usepackage{blindtext}

\setlength\epigraphwidth{8cm}
\setlength\epigraphrule{0pt}

\usepackage{etoolbox}

\makeatletter
\patchcmd{\epigraph}{\@epitext{#1}}{\itshape\@epitext{#1}}{}{}
\makeatother

\usepackage{filecontents}
\begin{filecontents}{mytestbib.bib}
  @UNPUBLISHED{mumford:quote,
    author={Mumford, David},
    title={ICM 2002 plenary talk},
    month={9},
    year={2002}
  }
\end{filecontents}


\usepackage[backend=biber, style=authoryear]{biblatex}
\addbibresource{mytestbib.bib}

%% From https://tex.stackexchange.com/questions/24979/citing-authors-full-name-in-biblatex
\DeclareCiteCommand{\citeauthorfirstlast}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \DeclareNameAlias{labelname}{first-last}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   \printnames{labelname}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

%% From @moewe
\DeclareCiteCommand{\citetwfn}
  {\DeclareNameAlias{labelname}{given-family}%
   \boolfalse{cbx:parens}}
  {\usebibmacro{citeindex}%
   \iffirstcitekey
     {\setcounter{textcitetotal}{1}}
     {\stepcounter{textcitetotal}%
      \textcitedelim}%
   \usebibmacro{textcite}}
  {\ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}}
  {\usebibmacro{textcite:postnote}}


\begin{document}

  \chapter{Introduction}
  \setlength{\epigraphwidth}{0.5\textwidth} 

  %% solution from @gusbrs
  \epigraph{``The world is continuous, but the mind is discrete.``}{---\textup{\citeauthorfirstlast{mumford:quote} (\cite*{mumford:quote})}}

  %% solution from @moewe
  \epigraph{``The world is continuous, but the mind is discrete.``}{---\textup{\citetwfn{mumford:quote} }}

  %% solution from @moewe
  \AtNextCite{\AtEachCitekey{\DeclareNameAlias{labelname}{given-family}}}

  \epigraph{``The world is continuous, but the mind is discrete.``}{---\textup{\textcite{mumford:quote}}}


  \blindtext \textcite{mumford:quote}.

  \printbibliography

\end{document}

enter image description here

6
  • 1
    If you are not gonna need it too frequently, you could try \citeauthorfirstlast{key} \cite*{key}, where \citeauthorfirstlast is as defined in the link you provided. Of course, this is not a "custom cite command", but gives the desired result quite conveniently.
    – gusbrs
    Mar 16, 2017 at 23:55
  • 2
    Please provide a minimal working example. Please show us what you've tried. You can look up anything you don't know by searching the manual for the relevant macro or environment name. (It seems not to have an index, but searching works fine.)
    – cfr
    Mar 17, 2017 at 2:23
  • 1
    This is somewhat 'style' dependent. As cfr wrote, a MWE is important here because we need to know your starting point. Really, your file probably only needs only to include the biblatex details (but embeded in a full, but minimal .tex file).
    – jon
    Mar 17, 2017 at 3:50
  • 1
    It would really be helpful to get an MWE as cfr and jon pointed out, a solution will heavily depend on the style and options you use. It might also be helpful if you can give an example of why you need such a command. If it is just to disambiguate between 'Laura Smith' and 'Leonora Smith' there are more elegant ways to achieve that.
    – moewe
    Mar 17, 2017 at 9:23
  • It might be a bit confusing to include the answers you got in the MWE. This kind of breaks the separation between question and answer on this site.
    – moewe
    Mar 17, 2017 at 16:06

1 Answer 1

6

We just need

\DeclareNameAlias{labelname}{given-family}

to always get the full name in 'first last' format instead of the default format that shows the last name and additional name parts - either initials or the full first name - only if necessary for disambiguation as requested by uniquename.

If you don't plan on using this very often, you can just put

\AtNextCite{\AtEachCitekey{\DeclareNameAlias{labelname}{given-family}}}

before \textcite{mumford:quote}:

\AtNextCite{\AtEachCitekey{\DeclareNameAlias{labelname}{given-family}}}\textcite{mumford:quote}

Of course that could also be put into a style-agnostic command

\newrobustcmd*{\citetwfn}{%
  \AtNextCite{%
    \AtEachCitekey{%
      \DeclareNameAlias{labelname}{given-family}}}%
  \textcite}

if you decide that you want to use it more often after all.

You can then simply use it as

\citetwfn{mumford:quote}

Alternatively, we can simply copy the definition of \textcite from authoryear-ibid.cbx (which is the style you use) and insert the redefinition of the name format at the appropriate place. With

\DeclareCiteCommand{\citetwfn}
  {\DeclareNameAlias{labelname}{given-family}%
   \boolfalse{cbx:parens}}
  {\usebibmacro{citeindex}%
   \iffirstcitekey
     {\setcounter{textcitetotal}{1}}
     {\stepcounter{textcitetotal}%
      \textcitedelim}%
   \usebibmacro{textcite}}
  {\ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}}
  {\usebibmacro{textcite:postnote}}

you get the output of \textcite from authoryear-ibid, but the author name is always given in 'first last' format.

3
  • Can you explain your \citetwfn? Or provide me with a place to start to learn how to understand it? I have no idea what to even look up.
    – bdeonovic
    Mar 17, 2017 at 14:27
  • 1
    @bdeonovic The crucial thing is the \DeclareNameAlias{labelname}{given-family}. That makes sure that you always get the full name in 'first last' format. Normally you get only the last name there possibly more if needed for disambiguation as requested by uniquename. The rest is just a copy of \textcite from authoryear-ibid where I inserted \DeclareNameAlias{labelname}{given-family} in the appropriate place.
    – moewe
    Mar 17, 2017 at 15:58
  • 2
    @bdeonovic I have restructured my answer to make the style-agnostic version more prominent: It is also easier to understand what happens there. The other definition still works, but it depends on the style you use - you cannot use the exact same code with another style (you'd have to copy the new style's \textcite definition).
    – moewe
    Mar 17, 2017 at 16:05

You must log in to answer this question.

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