# How to get abbreviations of the bibliography into the list of shorthands?

I wish to build a list of shorthands that also contains abbreviations used inside the bibliography (I am especially thinking of the shortjournal-field).

Consider the following example:

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

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

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{Lutzeier1983,
Author = {Peter Rolf Lutzeier},
Journal = {Zeitschrift f{\"u}r Sprachwissenschaft},
Shortjournal = {ZfS},
Pages = {45-71},
Shorttitle = {Wortfelder},
Title = {Wortfelder als Ma{\ss}stab f{\"u}r Interpretationen an Beispielen des Feldes der Stimmungen im Deutschen},
Volume = {2},
Year = {1983},
}
\end{filecontents}

\begin{document}

\cite{Lutzeier1983}

\printshorthands
\printbibliography
\end{document}


I would like biblatex to build up the list of shorthands automatically by using the fields journal and shortjournal. How can I tell biblatex to treat the field shortjournal in a similar way like the field shorthand?

The only possibility I can think of is to manually add an entry like

@book{AbkZfS,
Options = {skipbib=true},
Shorthand = {ZfS},
Title = {Zeitschrift f{\"u}r Sprachwissenschaft}}


to the bib-file and the command

\nocite{AbkZfS}


to the tex-file. Is there a more convenient way to get a list of shorthands including a line like "Zfs = Zeitschrift f{\"u}r Sprachwissenschaft"?

Thank you!

-
I seem to be adding a lot of comments like "this will be possible in the future" and this appears to be another example ... in biblatex 2.0/biber 1.0 this will be possible as we will allow arbitrary differently sorted "lists" (read bibliographies, shorthand lists etc.) in any refsection. So you could print a "list" which consists of a filtered shorthand list of just these fields. It's not completely clear how the interface will look but the backend part in biber is already implemented. –  PLK Sep 21 '11 at 20:42
@PLK Thanks for keeping us updated. Is there any chance that these lists will be able to draw more than just one item from a single entry? –  Audrey Sep 22 '11 at 0:01
Yes, I think we'll aim for a customisable interface. Currently a "list" is either a normal reference list or a shorthands list. I suspect we'll abstract the "shorthand" list type into something more generic so people can construct lists of based on a chosen set of fields. Probably an extension of the biblatex entry filters for printbibliography. –  PLK Sep 22 '11 at 10:12
@PLK: With biblatex 2.8a being released, has there been an update to this question? –  doncherry Mar 16 at 11:56
Good question. Not yet - it's still "todo". It needs some changes to the biblatex internals. –  PLK Mar 16 at 15:30
show 1 more comment

Considering PLK's comment, here is a workaround you can use in the meantime. Unfortunately shorthands for journal titles will still need to be specified as separate entries (of the type customa), but it takes care of invoking \nocite for you.

The solution also allows you to omit journaltitle in article entries with a shortjournal field. The long title can be recovered using \entrydata. This is demonstrated below with Muller's article.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{csquotes}
\usepackage[german]{babel}
\usepackage[style=authoryear,sorting=nty]{biblatex}

\DeclareBibliographyDriver{customa}{%
\printfield{title}%
\nopunct}

\AtEveryCitekey{%
\iffieldundef{shortjournal}
{}
{\nocite{\thefield{shortjournal}}}}

\renewbibmacro*{journal}{%
\iffieldundef{shortjournal}
{\iffieldundef{journaltitle}
{}
{\printtext[journaltitle]{%
\printfield[titlecase]{journaltitle}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{journalsubtitle}}}}
{\printfield{shortjournal}}}

\newbibmacro*{journal:long}{%
\iffieldundef{journaltitle}
{\iffieldundef{shortjournal}
{}
{\entrydata{\thefield{shortjournal}}
{\printtext[journaltitle]{\printfield[titlecase]{title}}}}}
{\printtext[journaltitle]{\printfield[titlecase]{journaltitle}}}}

\AtBeginShorthands{%
\renewbibmacro*{journal}{\usebibmacro{journal:long}}}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@customa{WMQ,
Shorthand = {WMQ},
Title = {William and Mary Quarterly}}
@customa{ZfS,
Shorthand = {ZfS},
Title = {Zeitschrift f{\"u}r Sprachwissenschaft}}
@customa{ZHF,
Shorthand = {ZHF},
Title = {Zeitschrift für historische Forschung}}
@article{Muller,
Author = {J{\"o}rn M{\"u}ller},
Shorthand = {Ergon},
Shortjournal = {ZHF},
Pages = {513-542},
Title = {Ergon und eudaimonia},
Volume = {57,4},
Year = {2003}}
@book{companion,
Author = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
Title = {The LaTeX Companion},
Edition = {1},
Year = {1994}}
@article{Reese,
Author = {Reese, Trevor R.},
Title = {Georgia in Anglo-Spanish Diplomacy, 1736-1739},
Journaltitle = {William and Mary Quarterly},
Shortjournal = {WMQ},
Volume = {15},
Series = {3},
Date = {1958},
Pages = {168--190}}
@article{Lutzeier,
Author = {Peter Rolf Lutzeier},
Shorthand = {PRL},
Journal = {Zeitschrift f{\"u}r Sprachwissenschaft},
Shortjournal = {ZfS},
Pages = {45-71},
Shorttitle = {Wortfelder},
Title = {Wortfelder als Ma{\ss}stab f{\"u}r Interpretationen an
Beispielen des Feldes der Stimmungen im Deutschen},
Volume = {2},
Year = {1983}}
\end{filecontents}

\begin{document}
\cite{companion,Muller,Lutzeier,Reese}
\printshorthands
\printbibliography[nottype=customa]
\end{document}


-
Thank you very much for your solution! I have a question concerning it: How would it be possible to exclude all entries from the list of shorthands that do not contain the field shorthand? Right now every cited entry appears twice, even those that do not have abbreviations. –  hubi Sep 22 '11 at 8:55
@hubi Whoops. That is an obvious bug. Thanks for catching it. I've updated the solution to include a category that will filter the shorthand list. –  Audrey Sep 22 '11 at 13:01
Thank you again, still another question: I want to use the shortjournal-field inside the bibliography, but the journaltitle-field inside the list of shorthands. If I use the following command, biblatex changes every journaltitle-field into the shortjournal-field. Is there a way only to change the biblography? \AtEveryBibitem{% \iffieldundef{shortjournal}{} {\savefield{shortjournal}{\temptitle}% \restorefield{journaltitle}{\temptitle}}% }% –  hubi Sep 22 '11 at 13:52
@hubi That hook will affect titles in both the list of shorthands and the bibliography. A better way might be to edit the journal bibliography macro - authoryear uses the generic definition found in biblatex.def. I've updated my answer to demonstrate this approach. –  Audrey Sep 22 '11 at 14:19
(this intended as comment, not as answer, but I dont know how to produce a comment) @Audrey Thanks again! Unfortunately I always detect new troubles while trying to solve my problem. Now there's a problem concerning the sorting of the list of shorthands. I suppose I should really wait for the official biblatex-enhancement, but anyway, consider the following entry: @article{Muller2003, Author = {J{\"o}rn M{\"u}ller}, Journal = {Zeitschrift für historische Forschung}, Shortjournal = {ZHF}, Keywords = {Aristoteles; Werk}, Pages = {513-542}, Subtitle = {Pl{\"a}doyer f{\"u}r eine unifizierende Inte –  hubi Sep 22 '11 at 20:48

This is now possible in the DEV biblatex 2.9/biber 1.9 versions. The whole \printshorthands facility has been revised and generalised when using biber. All the details are in the PDF manual and there is a new example file (92-bibliographylists.tex) that comes with biblatex. \printshorthands is now implemented in terms of this new system. Here is an example.

\documentclass{article}
\usepackage{fontspec}
\usepackage[style=authoryear]{biblatex}
\begin{filecontents}{\jobname.bib}
@ARTICLE{test1,
AUTHOR = {John Smith},
TITLE = {A Tremendously Interesting Opinion},
SHORTHAND = {JSTIP},
SHORTTITLE = {TIP},
JOURNALTITLE = {Journal of Tremendously Interesting Opinions},
SHORTJOURNAL = {JTIO},
VOLUME = {1},
NUMBER = {1},
YEAR = {1947}
}
@ARTICLE{test2,
AUTHOR = {John Tumble},
TITLE = {A Tremendously Interesting Idea},
SHORTHAND = {JSTII},
SHORTTITLE = {TII},
JOURNALTITLE = {Journal of Tremendously Interesting Ideas},
SHORTJOURNAL = {JTII},
VOLUME = {1},
NUMBER = {1},
YEAR = {1946}
}
\end{filecontents}

\DeclareBibliographyDriver{shortjournal}{%
\printfield{journaltitle}}

\DeclareBibliographyDriver{shorttitle}{%
\printfield{title}}

\begin{document}
\nocite{*}

\printshorthands% With biber, just an alias for \printbiblist{shorthand}
\printbiblist[title={Journal Shorthands}]{shortjournal}
\printbiblist[title={Title Shorthands}]{shorttitle}
\printbibliography
\end{document}


Which results in:

-