4

I've been using the following answers in my document:

This doesn't work correctly when I have multiple works from the same author (and the same shortauthor).

Here's a minimal working example:

\documentclass{report}

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

\renewbibmacro*{begentry}{%
    \ifkeyword{Key}{\sffamily}{}%
    \iffieldundef{shorthand}{}{%
        \printfield{shorthand}:\space}%
    \ifnameundef{shortauthor}%
    {}%
    {\printnames{shortauthor}%
        \addspace\textendash\space}}

\DeclareSortingScheme{nyt}{%
    \sort{\field{presort}}
    \sort[final]{\field{sortkey}}
    \sort{%
        \field{shorthand}
        \name{sortname}\name{author}\name{editor}\name{translator}
        \field{sorttitle}\field{title}}
    \sort{\field{sortyear}\field{year}}
    \sort{\field{sorttitle}\field{title}}
    \sort{%
        \field[padside=left,padwidth=4,padchar=0]{volume}
        \literal{0000}}}

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
    @report{IATA2009,
        author = {{International Air Transport Association}},
        date = {2009-03},
        title = {Standard Schedules Information Manual},
        shortauthor = {IATA}
    }


    @report{IATA2015,
        author = {{International Air Transport Association}},
        date = {2015-08},
        title = {Worldwide Slot Guidelines},
        shortauthor = {IATA}
    }

    @report{IATA2016,
        author = {{International Air Transport Association}},
        date = {2015-09},
        title = {Airport Guide},
        shortauthor = {IATA},
        shorthand = {Shorthand}
        }
\end{filecontents*}

\addbibresource{\jobname.bib}

\begin{document}

\nocite{*}
\printbibliography


\end{document}

As a result, it gives:

IATA – International Air Transport Association (2009). Standard Schedules In- formation Manual.
IATA – — (2015a). Worldwide Slot Guidelines.
Shorthand: IATA – — (2015b). Airport Guide.

What it should give is:

IATA – International Air Transport Association (2009). Standard Schedules In- formation Manual.
— (2015a). Worldwide Slot Guidelines.
Shorthand: — (2015b). Airport Guide.

(Actually, I'm not sure about whether the last line should rather be

Shorthand: IATA – International Air Transport Association (2015b). Airport Guide.

Which one looks better?)

How do I achieve this?

5

Try the following

\makeatletter
\renewbibmacro*{begentry}{%
  \ifkeyword{Key}{\sffamily}{}%
  \iffieldundef{shorthand}
    {}
    {\global\undef\bbx@lasthash
     \printfield{shorthand}%
     \addcolon\space}%
  \ifboolexpr{test {\usebibmacro{bbx:dashcheck}} or test {\ifnameundef{shortauthor}}}%
    {}%
    {\printnames{shortauthor}%
     \addspace\textendash\space}}
\makeatother

With this definition we don't print the shortauthor field if bbx:dashcheck returns true (i.e. if the last author was the same). If we have a shorthand we automatically print the name no matter if it coincides with the last name (I liked that better, you can turn off that behaviour by commenting out the line \global\undef\bbx@lasthash).

MWE

\documentclass{article}
\usepackage[style=authoryear-comp,backend=biber]{biblatex} 

\makeatletter
\renewbibmacro*{begentry}{%
  \ifkeyword{Key}{\sffamily}{}%
  \iffieldundef{shorthand}
    {}
    {\global\undef\bbx@lasthash
     \printfield{shorthand}%
     \addcolon\space}%
  \ifboolexpr{test {\usebibmacro{bbx:dashcheck}} or test {\ifnameundef{shortauthor}}}%
    {}%
    {\printnames{shortauthor}%
     \addspace\textendash\space}}
\makeatother

\DeclareSortingScheme{nyt}{%
    \sort{\field{presort}}
    \sort[final]{\field{sortkey}}
    \sort{%
        \field{shorthand}
        \name{sortname}\name{author}\name{editor}\name{translator}
        \field{sorttitle}\field{title}}
    \sort{\field{sortyear}\field{year}}
    \sort{\field{sorttitle}\field{title}}
    \sort{%
        \field[padside=left,padwidth=4,padchar=0]{volume}
        \literal{0000}}}

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@report{IATA2009,
  author = {{International Air Transport Association}},
  date = {2009-03},
  title = {Standard Schedules Information Manual},
  shortauthor = {IATA},
}

@report{IATA2015,
  author = {{International Air Transport Association}},
  date = {2015-08},
  title = {Worldwide Slot Guidelines},
  shortauthor = {IATA},
}

@report{IATA2016,
  author = {{International Air Transport Association}},
  date = {2015-09},
  title = {Airport Guide},
  shortauthor = {IATA},
  shorthand = {Shorthand},
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\begin{document}

\nocite{*}
\printbibliography
\end{document}

example output

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.