# Abbreviate author's name biblatex

In academic presentations, it can be customary to not write one's full name in citing one of one's own papers.

E.g., in a beamer presentation given by John Smith, a citation of a paper written by this person and a co-author, Mary Taylor say, should appear like (JS and Taylor 2016). I'm looking for a way that avoids touching the .bib file, which is generated by some other means anyway.

Here is a MWE;

\documentclass{beamer}

\usepackage{filecontents}
\begin{filecontents}{biblio.bib}
@article{publication1,
author  = "John Smith and Mary Taylor",
title   = "title",
year    = "2016",
journal = "some journal",
}  \end{filecontents}
\usepackage[backend=biber,citestyle=authoryear,bibstyle=authortitle]{biblatex}
\begin{document}

\begin{frame}
Here is the citation; (\cite{publication1})

I would want instead that it shows automatically (JS and Taylor 2016)
\end{frame}

\end{document}


• Related tex.stackexchange.com/a/22263/36296 but I guess the syntax has changed in the mean time. – samcarter_is_at_topanswers.xyz Jul 1 '16 at 16:28
• Personally I find this habit a bit annoying, since it requires the audience to actually remember the name of the speaker... – Hans Lundmark Jul 8 '16 at 9:01
• @ Hans Lundmark ; I'm also not completely sure to which extent it makes sense. I don't feel like this is pretentious when not done, and actually I find it rather the opposite, as it puts the emphasis on the fact that this is one of the author's publications. Maybe there is a question somewhere in academia stackexchange or something. – picop Jul 11 '16 at 15:05

We can use biblatex's name hashes to compare the name. You will need to know the hash for your name. That can be found in the .bbl file as described in Highlight an author in bibliography using biblatex allowing bibliography style to format it. For "John Smith" we have 5d0ddda3a367ceb26fbaeca02e391c22 in our MWE.

We then only need to modify the labelname format to check for "John Smith". Replace 5d0ddda3a367ceb26fbaeca02e391c22 by the hash for your name and JS by your abbreviation.

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


MWE

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{publication1,
author  = "John Smith and Mary Taylor",
title   = "title",
year    = "2016",
journal = "some journal",
}  \end{filecontents}
\usepackage[backend=biber,citestyle=authoryear,bibstyle=authortitle]{biblatex}

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

\begin{document}
\parencite{publication1} vs.\ (JS and Taylor 2016)
\end{document}


gives

(JS and Taylor 2016) vs. (JS and Taylor 2016)

Here is a solution using the new Data Annotation feature of biblatex 3.5/biber 2.6 (currently in Development folders on Sourceforge). It is a more general solution in that does not need to know any internals like hashes and you can enable the behaviour by just annotating your name in the .bib (which could also be automated by a sourcemap):

\documentclass{article}
\usepackage[style=authoryear]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{publication1,
author  = "John Smith and Mary Taylor",
author+an  = "1=me",
title   = "title",
year    = "2016",
journal = "some journal",
}
\end{filecontents}

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

\renewcommand*{\mkbibnamegiven}[1]{%
\ifitemannotation{me}
{\StrLeft{#1}{1}}
{#1}}

\renewcommand*{\mkbibnamefamily}[1]{%
\ifitemannotation{me}
{\StrLeft{#1}{1}}
{#1}}

\begin{document}

\cite{publication1} = JS and Taylor 2016

\end{document}

• Thanks Philip. I tried to get this method to work when the question was first posted, but failed, so it's nice to see a worked out example. – Alan Munn Jul 5 '16 at 0:35