8

Problem

I am using biblatex together with the authortitle-dw style. As it is desired in most cases, citations show up in the footnotes in the form "name, shorttitle, pages (if indicated)".

However, as a historian, I work with a great amount of unpublished documents I've collected in various archives. To deal with these, I have modified the entrytype @unpublished in a rather dilettantish way (I guess).

The problem is that in the footnotes, as it is expectable, only the title of my unpublished documents appears, while in this special case a full citation in the form "title, in: archive, shelf, Bd. box" would be desirable.

The \fullcite command doesn't work for me here, because it doesn't allow the content of certain fields to be replaced by "ibid.", which is absolutely necessary.

Example

Here's my MWE:

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[
    style=authortitle-dw
]{biblatex}

\DefineBibliographyStrings{ngerman}{
  chapter = {Bd.}
}

\DeclareBibliographyDriver{unpublished}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{title}%
  \newunit
  \usebibmacro{in:}%
  \printlist{institution}%
  \newunit\newblock
  \printlist{location}%
  \newunit\newblock
  \printfield{chapter}%
  \newunit\newblock
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}

@unpublished {test1,
    title = {Source1},
    institution = {Archive1},
    location = {Shelf1},
    chapter = {Box1}
}

@unpublished {test2,
    title = {Source2},
    institution = {Archive1},
    location = {Shelf1},
    chapter = {Box2}
}

@unpublished {test3,
    title = {Source3},
    institution = {Archive1},
    location = {Shelf1},
    chapter = {Box2}
}

\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\footcite{test1}
\footcite{test2}
\footcite{test3}

\end{document}

This example produces the following output:

1 Source1
2 Source2
3 Source3

However, the way I'd like to have it is the following:

1 Source1, in: Archive1, Shelf1, Bd. Box1
2 Source2, in: ibid., Bd. Box2
3 Source3, in: ibid.

Is it possible to achieve this in any way?

8

By default, the authortitle-dw style makes "short" citations, i.e. something consisting of the author name and the title (and some other things, according to options set). Your @unpublished entries have only title as a "relevant" field for the short citation so this will be the only field printed.

As you've written your own bibliography driver for this format anyway, it will probably be easiest to use full citations and adapt your driver accordingly.

Looking into authortitle-dw.cbx, both \cite and \footcite call the bibmacro cite, which does the actual work. The original code is

\newbibmacro*{cite}{%
  \usebibmacro{cite:citepages}%
  \global\boolfalse{cbx:loccit}%
  \ifbool{cbx:firstfull}
    {\ifciteseen
      {\usebibmacro{cite:normal}}
      {\usebibmacro{cite:firstfull}}}
    {\usebibmacro{cite:normal}}}

i.e. if the option firstfull is given and the item is cited for the first time, the bibmacro cite:firstfull is called, otherwise cite:normal is called. We can adapt this slightly to force a full citation for every item of type @unpublished. This is done using the biblatex macro \ifentrytype. Note that this should occur before checking the option firstfull so that the behaviour is not affected by the (un)setting of that option.

\renewbibmacro*{cite}{%
  \usebibmacro{cite:citepages}%
  \global\boolfalse{cbx:loccit}%
  \ifentrytype{unpublished}%
     {\ifciteibid{\usebibmacro{cite:ibid}}%
                 {\usebibmacro{cite:firstfull}}}%
     {\ifbool{cbx:firstfull}%
        {\ifciteseen%
          {\usebibmacro{cite:normal}}
          {\usebibmacro{cite:firstfull}}}
        {\usebibmacro{cite:normal}}}%
  \usebibmacro{savestuff}%  
}

Note that in case the same item was cited just before, "ibid" (or your local alternative) is printed and nothing else, by use of the biblatex check \ifciteibid and the bibmacro cite:ibid. You may, in practice, want to combine this with \iffirstonpage to check if the preceding item was on the last (double) page and only use the ibid in case the item referred to is actually on the same page, i.e.

\ifthenelse{\ifciteibid\and\not\iffirstonpage}%
        {\usebibmacro{cite:ibid}}{\usebibmacro{cite:firstfull}}%

This will stop any citation being replaced by "ibid" if it is the first to occur on a new (double) page, i.e. on a different page than the citation being referenced by the "ibid".

This approach has the advantage that the bibliography driver you wrote is used for every citation so that is the only thing you need to worry about.

Next, you need to tell biblatex to replace repeating occurrences of your fields by "ibid" (or "idem" or whatever seems most appropriate ;)). As only the entire entry and the main fields (author, editor, title ...) are checked automatically, we need to do this manually, e.g. by defining a bibmacro

\newbibmacro{savestuff}{%
  \savelist{institution}{\lastinstitution}%
  \savelist{location}{\lastlocation}%
  \savefield{chapter}{\lastchapter}}

saving all the current values of fields to macros to be compared to in the next citation. This should be called not only in this bibliography driver but whenever anything is cited or put in the bibliography, otherwise the next @unpublished will be compared to the last @unpublished, not to the previous citation/bibliography entry. For citations, this can be achieved by placing it into the (redefined) cite bibmacro. To "automatically" have it included in all bibliography drivers, one can append it to the finentry bibmacro which seems to be called by all authortitle-dw bibliography drivers. This can be done with the help of the xpatch package (see also biblatex: Is it possible to patch macros created with \newbibmacro?)

\xapptobibmacro{finentry}{\usebibmacro{savestuff}}{}{}

Now, instead of just saying

  \printlist{location}%

you should say something like

  \iflistequals{institution}{\lastinstitution}%
    {\bibstring{ibidem}}%
    {\printlist{institution}}%

to replace the field institution by the bibstring associated to ibidem.

As I understand it, for the fields location and chapter, you want to either print the field if it contains "new" information or omit it entirely, if it matches the preceding entry. This can be achieved by nesting tests:

  \iflistequals{institution}{\lastinstitution}%
    {\bibstring{ibidem}%
     \newunit\newblock%
     \iflistequals{location}{\lastlocation}%
       {\iffieldequals{chapter}{\lastchapter}%
         {}{\printfield{chapter}}}%
       {\printlist{location}\newunit\newblock%
        \iffieldequals{chapter}{\lastchapter}%
          {\bibstring{ibidem}}%
          {\printfield{chapter}}}%
    }%
    {\printlist{institution}\newunit\newblock%
     \iflistequals{location}{\lastlocation}%
       {\bibstring{ibidem}\newunit\newblock%
         \iffieldequals{chapter}{\lastchapter}%
           {}{\printfield{chapter}}}%
       {\printlist{location}\newunit\newblock%
        \iffieldequals{chapter}{\lastchapter}%
          {\bibstring{ibidem}}%
          {\printfield{chapter}}}%
    }%

(Possibly a "cleaner" solution is available, similar to the use of the punctuation tracker of biblatex ....).

To ensure that this complies with the "no ibid for the first entry on a page" rule, either all conditionals should be extended (as above) to also check \iffirstonpage or, alternatively, we can check \iffirstonpage at the beginning of the bibliography driver and if this is the case, simply delete (or put something "impossible" into) the stored data so the comparison will be negative, e.g.

  \iffirstonpage{\def\lastinstitution{}%
    \def\lastlocation{}%
    \def\lastchapter{}}{}%

In any case, this is the complete file (with the biblatex-dw option firstfull):

\documentclass{article}
\usepackage[ngerman]{babel}

\usepackage{xpatch}

\usepackage[
    style=authortitle-dw,
    firstfull=true
]{biblatex}

\DefineBibliographyStrings{ngerman}{
  chapter = {Bd.}
}

\renewbibmacro*{cite}{%
  \usebibmacro{cite:citepages}%
  \global\boolfalse{cbx:loccit}%
  \ifentrytype{unpublished}%
     {\ifthenelse{\ifciteibid\and\not\iffirstonpage}%
        {\usebibmacro{cite:ibid}}{\usebibmacro{cite:firstfull}}}%
     {\ifbool{cbx:firstfull}%
        {\ifciteseen%
          {\usebibmacro{cite:normal}}
          {\usebibmacro{cite:firstfull}}}
        {\usebibmacro{cite:normal}}}%
  \usebibmacro{savestuff}%  
}

\newbibmacro{savestuff}{%
  \savelist{institution}{\lastinstitution}%
  \savelist{location}{\lastlocation}%
  \savefield{chapter}{\lastchapter}}

\xapptobibmacro{finentry}{\usebibmacro{savestuff}}{}{}

\DeclareBibliographyDriver{unpublished}{%
  \iffirstonpage{\def\lastinstitution{}%
    \def\lastlocation{}%
    \def\lastchapter{}}{}%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{title}%
  \newunit
  \usebibmacro{in:}%
  \iflistequals{institution}{\lastinstitution}%
    {\bibstring{ibidem}%
     \newunit\newblock%
     \iflistequals{location}{\lastlocation}%
       {\iffieldequals{chapter}{\lastchapter}%
         {}{\printfield{chapter}}}%
       {\printlist{location}\newunit\newblock%
        \iffieldequals{chapter}{\lastchapter}%
          {\bibstring{ibidem}}%
          {\printfield{chapter}}}%
    }%
    {\printlist{institution}\newunit\newblock%
     \iflistequals{location}{\lastlocation}%
       {\bibstring{ibidem}\newunit\newblock%
         \iffieldequals{chapter}{\lastchapter}%
           {}{\printfield{chapter}}}%
       {\printlist{location}\newunit\newblock%
        \iffieldequals{chapter}{\lastchapter}%
          {\bibstring{ibidem}}%
          {\printfield{chapter}}}%
    }%
  \newunit\newblock%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}

@unpublished {test1,
    title = {Source1},
    institution = {Archive1},
    location = {Shelf1},
    chapter = {Box1}
}

@unpublished {test2,
    title = {Source2},
    institution = {Archive1},
    location = {Shelf1},
    chapter = {Box2}
}

@unpublished {test3,
    title = {Source3},
    institution = {Archive1},
    location = {Shelf1},
    chapter = {Box2}
}

@article{test4,
  title={something},
  author={someone}
}

\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\footcite{test1}
\footcite{test1}
\footcite{test4}
\footcite{test1}
\footcite{test2}
\footcite{test3}
\footcite{test1}
\footcite{test4}
\clearpage
\footcite{test1}

\printbibliography

\end{document}

and the result (in footnotes):

footnotes from page 1 of compiled pdf

The footnote on the second page contains no "ibid" because even though identical to the previous one, its the first on its page (note that this requires two run-throughs to work!):

Footnote on page 2

The bibliography looks like this:

compiled file (bibliography)

Note: This solution produces identical behaviour in the bibliography and citations. If this is not desired (especially regarding the ibidem stuff), use the biblatex checks \ifcitation and \ifbibliography, respectively, to treat the various sub-cases.

| improve this answer | |
  • This works almost perfectly. Thank you so much! One minor problem remains, though: If I cite another entry type (e. g. @article) in between two citations of the @unpublished type, the second citation of the @unpublished type produces an "ibid" refering to the first citation of the same type, thus ignoring the @article type citation in between. Is there a way to avoid this? – Nicholas Aug 24 '13 at 16:33
  • 1
    @Nicholas Thank you for pointing this out. I fixed it in the edit. – Jonathan Aug 24 '13 at 16:53
  • This works out fine now. Thank you! One additional question: If I want biblatex to check via \iffirstonpage whether the preceeding entry cited is on the very same page to make sure "ibid" is used only if this is true, where and how do I have to insert this command? – Nicholas Aug 24 '13 at 17:37
  • 1
    @Nicholas I added it into the code, possibly it's better to actually set the \last... values to something like -1 so that this isn't messed up by empty entries, but this should show the general idea of how the behaviour can be achieved. – Jonathan Aug 24 '13 at 18:11
  • 1
    @Nicholas yes, as \ifbool{cbx:fullcite} came before \ifentry{unpublished} that distinction was ignored if the option fullcite was set and the standard behaviour occured. Checking entrytype first and option later solves the problem. I've updated the answer. – Jonathan Aug 26 '13 at 20:01
2

Great work @Jonathan! I followed the hint in your note and inserted \ifcitation in the driver declaration to fix the bibliography. It is not very elegant, but it works.

\DeclareBibliographyDriver{unpublished}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{title}%
  \newunit
  \usebibmacro{in:}%
  \ifcitation{% <- here
    \iflistequals{institution}{\lastinstitution}%
      {\bibstring{ibidem}%
       \newunit\newblock%
       \iflistequals{location}{\lastlocation}%
         {\iffieldequals{chapter}{\lastchapter}%
           {}{\printfield{chapter}}}%
         {\printlist{location}\newunit\newblock%
          \iffieldequals{chapter}{\lastchapter}%
            {\bibstring{ibidem}}%
            {\printfield{chapter}}}%
      }%
      {\printlist{institution}\newunit\newblock%
       \iflistequals{location}{\lastlocation}%
         {\bibstring{ibidem}\newunit\newblock%
           \iffieldequals{chapter}{\lastchapter}%
             {}{\printfield{chapter}}}%
         {\printlist{location}\newunit\newblock%
          \iffieldequals{chapter}{\lastchapter}%
            {\bibstring{ibidem}}%
            {\printfield{chapter}}}%
      }%
  }{% <- else
    \printlist{institution}%
    \newunit\newblock
    \printlist{location}%
    \newunit\newblock
    \printfield{chapter}%
  }%
  \newunit\newblock%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

As a result the bibliography looks like this:

Modified bibliography

While the footnotes still look like that:

The footnotes

(I am posting this as an answer only because the code is too long for a comment.)

| improve this answer | |
  • Do you have any idea how to simplify the ugly conditional block? – Jonathan Aug 24 '13 at 18:12
  • 1
    Perhaps \ifboolexpr from the etoolbox package would be less "ugly" – Oleg Domanov Aug 25 '13 at 6:36
  • @OlegDomanov But you still need to treat all the special cases, don't you? Only the syntax is slightly different ... I thought that maybe there is a solution similar to the punctuation tracker of biblatex that lets you print some text depending on whether something was printed before ... – Jonathan Aug 25 '13 at 7:40
  • 1
    @Jonathan Yes, you need. It may just look a bit cleaner:) As for the tracker, I actually made one for the biblatex-gost style (you may also look at our discussion with Audrey at github). But I don't think this is a way to go in this case. Maybe someone knows an easier solution. – Oleg Domanov Aug 25 '13 at 10:52

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.