0

I am using the authoryear-icomp biblatex style. For some publications by institutions with long names, I would like to use shortauthor. However, the style authoryear-icomp simply uses shortauthor from the first citation onwards, like so:

enter image description here

I would like it to work as it does in style=apa, which uses the full author name for the first citation and introduces the short name in square brackets, which it then uses for all further citations (even for other publications of the same author).

This is the output if I change the style to apa: enter image description here

Is there any way to achieve this behaviour with authoryear-icomp?

This is the MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage[style=authoryear-icomp, % alternatively: style=apa
  bibstyle=authoryear,
  autocite=inline,
  backend=biber
  ]
 {biblatex}

\usepackage{filecontents}

\begin{filecontents*}{testbib.bib}

@online{test1,
  author = {{Institution Long Name}},
  shortauthor = {ILN},
  title = {Test title},
  year = {2020}
}

@online{test2,
  author = {{Institution Long Name}},
  shortauthor = {ILN},
  title = {Another test title},
  year = {2020}
}

\end{filecontents*}

\addbibresource{testbib.bib}


\begin{document}

Citation number one \autocite{test1}.

Citation number two \autocite{test1}.

Third citation with a different publication by the same author \autocite{test2}.

\end{document}
3
  • 1
    Have a look at tex.stackexchange.com/q/449052/35864.
    – moewe
    Jan 8, 2020 at 7:20
  • 1
    I made sure my answer to tex.stackexchange.com/q/449052/35864 works again and I checked that it also works with style=authoryear-icomp,. So I suggest you check out tex.stackexchange.com/a/449082/35864 because as I understand it your question is pretty much answered by the solution there.
    – moewe
    Jan 9, 2020 at 20:14
  • Thanks. I haven't been able to try it yet, but from what I understand of the code, it uses the author field and divides it in long and short name parts. My whole bib file, however, uses the shortauthor field, so I imagine it would not work 'out of the box' without adapting my bib?
    – anbeck
    Jan 10, 2020 at 8:44

1 Answer 1

1

You can do something like this - I took some code from APA style. You may need to make this more in line with cite from the authoryear-icomp style for more general use but this gets you what you want as a start:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage[style=authoryear-icomp, % alternatively: style=apa
  bibstyle=authoryear,
  autocite=inline,
  backend=biber
  ]
 {biblatex}

\usepackage{filecontents}

\begin{filecontents*}{testbib.bib}

@online{test1,
  author = {{Institution Long Name}},
  shortauthor = {ILN},
  title = {Test title},
  year = {2020}
}

@online{test2,
  author = {{Institution Long Name}},
  shortauthor = {ILN},
  title = {Another test title},
  year = {2020}
}

\end{filecontents*}

\addbibresource{testbib.bib}

\makeatletter
\DeclareCiteCommand{\parencite}[\mkbibparens]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{metacite}%
   \usebibmacro{cite:post}}
  {}
  {\usebibmacro{cite:postnote}}

\newbibmacro*{cite:post}{%
  \xifinlist{\thefield{fullhash}}{\cbx@names}
    {}
    {\listxadd{\cbx@names}{\thefield{fullhash}}}}

\global\let\cbx@names\@empty
\def\cbx@ifnamesaved{%
  \xifinlist{\thefield{fullhash}}{\cbx@names}
    {\@firstoftwo}
    {\@secondoftwo}}

\newbibmacro*{metacite}{%
  \ifnameundef{shortauthor}
    {\usebibmacro{cite}}
    {\usebibmacro{sacite}}}

\newbibmacro*{sacite}{%
  \cbx@ifnamesaved
    {\printnames{shortauthor}}
    {\printnames{author}%
     \addspace\mkbibbrackets{\printnames[sabrackets]{shortauthor}}}%
  \setunit{\printdelim{nameyeardelim}}%
  \usebibmacro{cite:labeldate+extradate}%
  \savefield{namehash}{\cbx@lasthash}%
  \savefield{labelyear}{\cbx@lastyear}%
  \setunit{\multicitedelim}}

\makeatother

\begin{document}

Citation number one \autocite{test1}.

Citation number two \autocite{test1}.

Third citation with a different publication by the same author \autocite{test2}.

\end{document}

2
  • This works great for the initial citation! I just realized, however, that the subsequent citations only show shortauthor and not the year (e.g., "2020b") --- which is probably what you referred to when you said further adjustments might be necessary. I've taken a long look at the cbx file, but have to admit I'm rather overwhelmed. Could you point me to where to go from here?
    – anbeck
    Jan 18, 2020 at 17:52
  • 1
    My mistake - I have corrected the sacite macro above.
    – PLK
    Jan 18, 2020 at 18:26

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.