# Biblatex abbrevation for no author/editor/year/etc. in alphabetic style

I use an alphabetic citestyle with biblatex. Sometimes I have entries where no author or editor or year is given. For example there is often no editor for a proceeding. At the moment I leave the entry for editor empty, but I would like to change this behavior so that biblatex automatically prints ‘s.ed.’ (lat. sine editore) in the bibliography if the field is empty.

When I just write this into the editor field I get s.ed. (Ed.). So I need to prevent the output of (Ed.), but I have no idea where to implement this.

In the same way the following entries should be printed (see link in german) when the field is usually required for the type of entry:

• ‘s.a.’ (lat. sine auctore "without author")
• ‘s.ed.’ (lat. sine editore "without editor")
• ‘s.a.’ (lat. sine anno "without year")
• ‘s.t.’ (lat. sine titulo "without title")
• ‘s.l.’ (lat. sine loco "without location")
• ‘s.ed.’ (lat. sine editore "without publisher")

At the moment I have no idea how to handle a missing author or year for the citations within the text, because sth. like [ABCs.a.] doesn't look good. Therefore, suggestions are welcome ;)

MWE:

The MWE illustrates the different cases of missing entries. I always wrote the abbreviation into the field (except for the second entry) by hand to illustrate what the output should look like. The output is correct except for the case where no editor is given, because the output is s.ed., ed. but it should be s.ed.. That is the first point where I need help to fix it.

If I want to change the abbreviation from latin to english later it would be a complicated task. So this is the second point where I need help with a solution for the following problem:

What I would like to achieve is to tell biblatex that I don't have a value for a specific field and I want to print the appropriate abbreviation to state to the reader that no information is available for that field (maybe a command like \noauthor). If I just leave the field empty it should be interpreted as ignoring the field like biblatex already do for the second entry noAuthor2 WARN - The field 'author' in entry 'noAuthor2' cannot be null, deleting it.

\documentclass{article}
\usepackage[backend=biber,style=alphabetic, autocite=footnote]{biblatex}

\begin{filecontents*}{bibliography.bib}
% Example for no author
@BOOK{noAuthor,
author = {s.a.},
title = {Rocket Propulsion and Spaceflight Dynamics},
year = {1979},
location = {New York},
publisher = {Pitman},
}
% Example for no author and field left empty
@BOOK{noAuthor2,
author = {},
title = {Rocket Propulsion and Spaceflight Dynamics},
year = {1979},
location = {New York},
publisher = {Pitman},
}
% Example for no editor
@Collection{noEditor,
editor                  = {s.ed.},
title                       = {Book of light},
year                        = {1985},
publisher               = {Springer Science+Business Media, LLC},
location                = {New York}
}
% Example for an incollection where the collection has no editor
@Incollection{noEditor,
crossref                = {noEditor},
author                  = {Wayne, John},
title                   = {Some nice title},
pages                   = {10--20},
bookpagination          = {page},
}
% Example for no year
@BOOK{noYear,
author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
title = {Rocket Propulsion and Spaceflight Dynamics},
year = {s.a.},
location = {New York},
publisher = {Pitman},
}
% Example for no title
@BOOK{noTitle,
author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
title = {s.t.},
year = {1979},
location = {New York},
publisher = {Pitman},
}
% Example for no location
@BOOK{noLocation,
author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
title = {Rocket Propulsion and Spaceflight Dynamics},
year = {1979},
location = {s.l.},
publisher = {Pitman},
}
% Example for no publisher
@BOOK{noPublisher,
author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
title = {Rocket Propulsion and Spaceflight Dynamics},
year = {1979},
location = {New York},
publisher = {s.ed.},
}
\end{filecontents*}

\nocite{*}

\begin{document}
\null
\vfill

\printbibliography
\end{document}

• sound like a case for the \AtEveryBibitem directive... Just don't know how exactly right now. – Benedikt Bauer Nov 25 '14 at 20:24
• @BenediktBauer I found this question which is related. But I still have the problem that not every entry has e.g. an editor field and the mentioned problem with the citation within the text. – user2653422 Nov 26 '14 at 14:48
• Could you please add some minimal working example (MWE) which contains also bibentries with the required properties (i.e. a proceeding without editor, an article without author and so on)? This would ease playing a round with the problem a lot. – Benedikt Bauer Nov 26 '14 at 15:22
• @BenediktBauer Sorry I didn't have time to create the MWE earlier. I hope with the given MWE it is clear now what I would like to achieve. – user2653422 Nov 30 '14 at 11:25

This is a beginning. It is not a full solution but is too long for a comment. It does not solve the editor issue completely although it does work for entries similar to those in the question's MWE.

Basically, the idea is to create a series of bibliography strings in your biblatex.cfg (which you may have to create if you've never used it before - mine is under tex/latex/config/ in my TEXMFHOME). You then specify the value of these strings for each language you need and create some macros to produce the strings. The macros will produce whichever string is appropriate for the active language. In your .bib file, you use the new macros e.g. \noauthor. When processed, these are replaced with the specified strings for the relevant language e.g. s.a. for english or whatever.

If later you decide you want different strings for a given language, you can edit the strings in biblatex.cfg i.e. one edit is required per string you wish to redefine. If you need to use a new language, you can add an additional set of strings for the appropriate language without overwriting the existing ones.

\documentclass[english]{article}
\usepackage{filecontents}
\begin{filecontents}{biblatex.cfg}
\NewBibliographyString{noauthor}
\NewBibliographyString{noeditor}
\NewBibliographyString{nodate}
\NewBibliographyString{notitle}
\NewBibliographyString{nolocation}
\NewBibliographyString{nopublisher}
\DefineBibliographyStrings{english}{%
}
\newcommand*\nosomethings{noauthor,noeditor,nodate,notitle,nolocation,nopublisher}
\@for \xx:=\nosomethings \do {%
\expandafter\ifcsname\xx\endcsname\relax\else
\expandafter\expandafter\expandafter\expandafter\edef\csname\xx\endcsname{\noexpand\bibstring{\xx}}%
\fi}
\end{filecontents}

\usepackage[backend=biber, style=alphabetic, autocite=footnote]{biblatex}

\begin{filecontents}{bibliography.bib}
% Example for no author
@BOOK{noAuthor,
author = {\noauthor},
title = {Rocket Propulsion and Spaceflight Dynamics},
year = {1979},
location = {New York},
publisher = {Pitman},
}
% Example for no author and field left empty
@BOOK{noAuthor2,
author = {},
title = {Rocket Propulsion and Spaceflight Dynamics},
year = {1979},
location = {New York},
publisher = {Pitman},
}
% Example for no editor
@Collection{noEditor,
editor                  = {\noeditor},
title                       = {Book of light},
year                        = {1985},
publisher               = {Springer Science+Business Media, LLC},
location                = {New York}
}
@Collection{noEditor2,
editor                  = {\noeditor},
title                       = {Book of Darkness},
year                        = {1945},
publisher               = {Oxford University Press},
location                = {Oxford},
isbn = {01234556789X}
}
@Collection{noEditor3,
editor                  = {\noeditor},
title                       = {Book of Greyness},
year                        = {1045},
publisher               = {Cambridge University Press},
location                = {Cambridge},
isbn = {01234879890789X}
}
@Collection{Editor,
editor                  = {Ditor, E.},
title                       = {Book of light},
year                        = {1985},
publisher               = {Springer Science+Business Media, LLC},
location                = {New York}
}
% Example for no year
@BOOK{noYear,
author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
title = {Rocket Propulsion and Spaceflight Dynamics},
year = {\nodate},
location = {New York},
publisher = {Pitman},
}
% Example for no title
@BOOK{noTitle,
author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
title = {\notitle},
year = {1979},
location = {New York},
publisher = {Pitman},
}
% Example for no location
@BOOK{noLocation,
author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
title = {Rocket Propulsion and Spaceflight Dynamics},
year = {1979},
location = {\nolocation},
publisher = {Pitman},
}
% Example for no publisher
@BOOK{noPublisher,
author = {Cornelisse, J. W. and Schoeyer, H. Ferry R. and Wakker, Karel F.},
title = {Rocket Propulsion and Spaceflight Dynamics},
year = {1979},
location = {New York},
publisher = {\nopublisher},
}
\end{filecontents}

\newif\ifuseeditorstg
\useeditorstgfalse
\useeditorstgtrue

\renewbibmacro*{editor}{%
\ifboolexpr{
test \ifuseeditor
and
not test {\ifnameundef{editor}}
}
{\printnames{editor}%
\mystringtestnamehash\ifuseeditorstg\usebibmacro{editorstrg}\fi%
\clearname{editor}}
{}}

\renewbibmacro*{editor+others}{%
\ifboolexpr{
test \ifuseeditor
and
not test {\ifnameundef{editor}}
}
{\printnames{editor}%
\mystringtestnamehash\ifuseeditorstg\usebibmacro{editorstrg}\fi%
\clearname{editor}}
{}}

% based on Andrew Swann's answer at http://tex.stackexchange.com/a/169379
\newcommand*\mystringtestnamehash{%
\edef\tempa{\strfield{namehash}}%
\ifx\noeditornamehash\tempa\useeditorstgfalse\else\useeditorstgtrue\fi}

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


• Really nice thank you :). I think the problem with entries which have an editor could be solved by redefining the appropriate BibliographyDriver with a test for the existence of the new command noeditor which will prevent the output of ed. or eds.. Or like in this post with the command \AtEveryBibitem which should be easier. The problem is that I don't know how to test for the fact that the command noeditor is within the editor field or not. – user2653422 Dec 1 '14 at 10:24
• @user2653422 Those answers don't help, I don't think, because the problem is not changing the content of the field itself but changing something in the driver layout when, and only when, the field has a certain value. And it would be better not to change it at the driver level if possible, because you'd need to repeat it for all affected drivers. – cfr Dec 1 '14 at 22:13
• I read the thread I linked again and agree that the question asked there and the solution provided is different from the problem here. I also agree with you that changing the driver level could be difficult. However, what options to achieve the desired output are left? It must be something at the driver level, because there the additional string for the editor/editors is added, isn't it? – user2653422 Dec 1 '14 at 23:11
• @user2653422 I can figure out how to switch the (ed.) bit on and off globally using a conditional i.e. if I write \useeditorstgfalse, I don't get the addition, and if I write \useeditortrue, I do get the addition. But I cannot figure out how to compare the value of the field with the \noeditor so as to ever get a boolean set to true. No matter what I try, the test is always false. Probably because I don't really understand what I'm doing :(. If you can figure out how to do the comparison, you can use \AtEveryBibItem to toggle the conditional, and use that conditional... – cfr Dec 1 '14 at 23:56
• to patch or redefine relevant bibmacros. These are used in drivers but are building blocks for drivers rather than being drivers themselves. – cfr Dec 1 '14 at 23:57