3

UPDATED MWE

I want to cite articles from an encyclopedia, with using the shorthand of the encyclopedia: Like

Lastname, Firstname. Art. articltitle. In: NG, Vol. 11, pp. 30–40, p. 35.

I want to use this in the cites as in the bibliography.

My code so far (MWE):

\documentclass{article}
\usepackage[style = verbose-ibid]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@mvreference{NG,
title={The new Grove dictionary of music and musicians},
editor={Stanley Sadie},%begr. von Grove, George
year={1980},
volumes={20},
shorthand={NG}
}

@reference{NG-BD11,
crossref={NG},
title={Lindeman - Mean-tone},
volume={11},
year={1980},
location={London},
publisher={Macmillan}
}

@inreference{author-NG-ML,
crossref={NG-BD11},
author={Firstname Lastname},
title={articletitle},
pages={30--40}
}

\end{filecontents}
\addbibresource{\jobname.bib}

%what to print out?
\DeclareBibliographyDriver{inreference}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \printtext{Art.}%added
  \newunit%added
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \iffieldundef{shorthand}{%added
    \usebibmacro{maintitle+booktitle}}%
    {\printfield{mainshorthand}}%added, here I want the shorthand from the mvreference (NG)
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{edition}%
  \newunit
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}


\begin{document}
\nocite{*}
\noindent{}The author wrote something about my subject.\autocite[35]{author-NG-ML}
\printshorthands
\printbibliography[nottype=mvreference, nottype=reference]
\end{document}



Output:

Lastname, Firstname. Art. articletitle. In: The new Grove dictionary of music and musicians. Vol. 11: Lindeman - Mean-tone. Ed. by Stanley Sadie. 20 vols. London: Macmillan, 1980, pp. 30–40.

I've experimented with the command \DeclareDataInheritance, to inherit the shorthand, but couldn't get it to work.

  • For suppressing the page field in citations with a postnote, see The verbose-ibid style, have a look at the citepages option, you probably want citepages=suppress or citepages=omit. – moewe Apr 4 '14 at 9:54
  • I just noticed that your \DeclareDataInheritance is from a mvreference to a reference but your example contains a mvreference and an inreference. So naturally the \noinherit rules you have specified there will not apply. Furthermore the field mainshorthand does not exist so you will have trouble using it (you could define it in a custom data model though). It also seems strange to me that you specify the pages (5-35) in the inreference and then claim to want to suppress that. – moewe Apr 4 '14 at 10:04
  • Thanks, good to know. But shouldn't it be suppressed, too, if it's not inherited? (\noinherit{pages}) That's why I mentioned it. – musicman Apr 4 '14 at 10:05
  • 1
    I'm working on a "real life" example – musicman Apr 4 '14 at 11:38
  • 1
    Thanks, it certainly looks clearer now, I will investigate. – moewe Apr 4 '14 at 12:32
4

This solution might be quite specific to your needs.

As mentioned in the comments, it is probably best to have a mainshorthand for the inreference that can be inherited from the mvreference.

This is done via a custom data model file called refinherit.dbx, you will have to place this file somewhere LaTeX can find it.

\ProvidesFile{refinherit.dbx}[2014/04/03]
\RequireBiber[3]

\DeclareDatamodelFields[type=field,datatype=literal]{mainshorthand}
\DeclareDatamodelEntryfields{mainshorthand}
\endinput

In the MWE below this is achieved with filecontents, obviously you will have the file in an appropriate place in your actual use case.

We load this datamodel via the datamodel option

\usepackage[style=verbose-ibid, backend=biber, datamodel=refinherit]{biblatex}

We then declare the inheritance

\DeclareDataInheritance{mvreference}{inreference,reference}{%
  \inherit{shorthand}{mainshorthand}
  \noinherit{volumes}
}

That is, mvreference's shorthand becomes inreference's mainshorthand

Finally, we modify the inreference driver to omit some information and print the mainshorthand instead if that is available

\DeclareBibliographyDriver{inreference}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \printtext{Art.}%added
  \newunit%added
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \iffieldundef{mainshorthand}
    {\usebibmacro{maintitle+booktitle}%
     \usebibmacro{byeditor+others}%
     \newunit\newblock
     \printfield{edition}}%
    {\printfield{mainshorthand}}%
  \newunit
  \printfield{volume}%
  \printfield{part}%
  \newunit
  \iffieldundef{mainshorthand}
    {\printfield{volumes}%
     \newunit\newblock
     \usebibmacro{series+number}%
     \newunit\newblock
     \printfield{note}%
     \newunit\newblock
     \usebibmacro{publisher+location+date}}%
    {}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

MWE

\documentclass[ngerman]{article}
\usepackage{filecontents}
\begin{filecontents*}{refinherit.dbx}
\ProvidesFile{refinherit.dbx}[2014/04/03]
\RequireBiber[3]

\DeclareDatamodelFields[type=field,datatype=literal]{mainshorthand}
\DeclareDatamodelEntryfields{mainshorthand}
\endinput
\end{filecontents*}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=verbose-ibid, backend=biber, datamodel=refinherit]{biblatex}

\begin{filecontents*}{\jobname.bib}
@mvreference{NG,
  title       = {The new Grove dictionary of music and musicians},
  editor      = {Stanley Sadie},
  editora     = {Grove, George},
  editoratype = {founder},
  year        = {1980},
  volumes     = {20},
  shorthand   = {NG},
  location    = {London},
  publisher   = {Macmillan},
}

@reference{NG-BD11,
  crossref  = {NG},
  title     = {Lindeman -- Mean-tone},
  volume    = {11},
  year      = {1980},
}

@inreference{author-NG-ML,
  crossref  = {NG-BD11},
  author    = {Arnold Uthor},
  title     = {Firstname Lastname},
  pages     = {30--40},
}

\end{filecontents*}
\addbibresource{\jobname.bib}

\DeclareDataInheritance{mvreference}{inreference,reference}{%
  \inherit{shorthand}{mainshorthand}
  \noinherit{volumes}
}

%what to print out?
\DeclareBibliographyDriver{inreference}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \printtext{Art.}%added
  \newunit%added
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \iffieldundef{mainshorthand}
    {\usebibmacro{maintitle+booktitle}%
     \usebibmacro{byeditor+others}%
     \newunit\newblock
     \printfield{edition}}%
    {\printfield{mainshorthand}}
  \newunit
  \printfield{volume}%
  \printfield{part}%
  \newunit
  \iffieldundef{mainshorthand}
    {\printfield{volumes}%
     \newunit\newblock
     \usebibmacro{series+number}%
     \newunit\newblock
     \printfield{note}%
     \newunit\newblock
     \usebibmacro{publisher+location+date}}%
    {}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}


\begin{document}
\nocite{*}
\noindent{}The author wrote something about my subject.\autocite[35]{author-NG-ML}
\printshorthands
\printbibliography[nottype=mvreference, nottype=reference]
\end{document}

enter image description here

  • This solutions is exactly what I needed. Thank you very much! Also thx for the editora-field :) Still a lot to learn.. And sorry for the confusion. Just one thing, I think the dbx-filecontent must stand before biblatex is included, or you don't get the right result. – musicman Apr 4 '14 at 13:14
  • @musicman Yes, the .dbx file has to be present in order for biblatex to work, in the MWE the file should therefore have been created before loading biblatex. In a normal document though, that should be no problem since you would not create refinherit.dbx via filecontents, but create it and save it somewhere LaTeX can find it. – moewe Apr 4 '14 at 15:24

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.