# biblatex 'cited as' entry field for bibliography

I want to add a biblatex entry field that if activated prints how something is being cited. So in the bibliography I'd have something like that:

So the idea is, to have a dedicated entry field. "howcited" for example:

@COMMENTARY{beck.ok,
MAINTITLE       = {Beck'scher Online-Kommentar BGB},
SHORTTITLE      = {},
EDITOR          = {Bamberger, Heinz Georg and Roth, Herbert and Hau, Wolfgang and Poseck, Roman},
SHORTHAND       = {BeckOK},
VOLUME          = {},
TITLE           = {},
YEAR            = {2018},
EDITION         = {45},
HOWCITED        = {1},
}


This field would act as a switch. If the entry would be "1", the field would print the following text first:

"(zitiert als:"

Then it would either take the shorthand entry and print it followed by "/Bearbeiter)"

So in the end I would be left with something like "(zitiert als: shorthand/Bearbeiter)"

See attached picture.

Any ideas how I can do it? Thanks a lot in advance!

It seems more natural to me to define an entry option instead of a field with a throwaway value.

After we have defined the entry option howcited, you can enable the "howcited" feature with options = {howcited=true}, or the short options = {howcited}, in your .bib entry. Below the option is also implemented per-type and globally, so you enable "howcited" for all entries of type @commentary or for all entries at once without having to set the option in the .bib file. Since the macro checks for a shorthand before it does anything, you can probably set the option on a per-type basis:

\ExecuteBibliographyOptions[commentary]{howcited}


That saves you the work of having to add the option to every entry in the .bib file.

The bibmacro-side of things is fairly straightforward and actually a bit of a rip-off of the shorthandintro macro in biblatex.def. Here I hooked the macro into finentry, but since you seem to have a fully customised style anyway, you may find a more elegant place for it.

\documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

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

\newtoggle{tnbcbx@howcited}
\DeclareEntryOption[boolean]{howcited}[true]{\settoggle{tnbcbx@howcited}{#1}}
\DeclareBibliographyOption[boolean]{howcited}[true]{\settoggle{tnbcbx@howcited}{#1}}
\DeclareTypeOption[boolean]{howcited}[true]{\settoggle{tnbcbx@howcited}{#1}}

\newbibmacro{howcited}{%
\iftoggle{tnbcbx@howcited}
{\iffieldundef{shorthand}
{}
\printtext[parens]{%
\bibstring{citedas}%
\printfield{shorthand}%
\bibstring[\emph]{bearbeiter}}}}
{}}

\renewbibmacro{finentry}{\usebibmacro{howcited}\finentry}

\NewBibliographyString{bearbeiter}
\DefineBibliographyStrings{ngerman}{
citedas    = {zitiert als},
bearbeiter = {Bearbeiter},
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@collection{beck.ok,
maintitle = {Beck'scher Online-Kommentar BGB},
editor    = {Bamberger, Heinz Georg and Roth, Herbert and Hau, Wolfgang and Poseck, Roman},
shorthand = {BeckOK},
date      = {2018},
edition   = {45},
options   = {howcited},
}
\end{filecontents}


• If I'd change this bibmacro to also print the author name. I'd use \printnames{labelname}. If I'd already defined the family name format like this: \AtEveryBibitem{% \ifentrytype{incollection}{% \renewcommand*{\mkbibnamefamily}[1]{\textsc{#1}}% }{}% } how can I change the format to simpy \emph only for that howcited usage. I didn't want to open another question only for that. Because the rest is mainly the same. – texnewbie Jul 30 '18 at 14:58
• @texnewbie There is no useful labelname for beck.ok that would be shown in the citations, so what do you want to add where? Since there seems to be additional code involved a new question makes sense to me. Please add a complete MWE with the relevant modifications. – moewe Jul 30 '18 at 15:04