6

I need some help rewriting a bibliography driver. But lets start from the beginning:

I'm using biblatex with the biblatex-dw style. In the footnotes my cites appear as name shorttitle and page

Additionally to the usual literature i work with a lot of unpublished material from archives. My problem is the organization of these sources.

They do not have a name at all, but are handled alone by their signature. There is always the name of the archive, the category, the subcategory and the box number:

For example: Archiv Newtown Dep 1 Ru 4 354 (No commata between the single parts)

So everytime such a unpublished source is used, the full signature has to appear in the footnote. And of course in the bibliography the sources should be in the right alphanumerical order.

Another point is, that in the citations within the text the Ibid. function should work. I mean if use the same source two times in a row it should give out Ibid. What i do not need is Ibid. within the signature (If e.g. the category, subcategory or box changes).

So within the text it should look like

--------------------------------------------
1 ArchNew Ho1 Ru8 356.
2 Mueller 1994, p. 18.
3 ArchNew Ho1 Ru8 356.
4 Ibid.
5 ArchNew FAS Ru7 321

and in the bibliography

**Literature**

Mueller, Claus: Something. Berlin 1994

**Sources**

*Archive Newtown*

ArchNew Ho1 Ru8 356
ArchNew FAS Ru7 321

I found a thread with nearly the same problem and a solution here, but I I' afraid I couldn't rewrite the code over there to match my needs.

The difference is that in this solution over there, the sources also have names and are therefore handled both by their name AND their signature. I only need the signature.

Additionally i also need another subcategory since my signatures are longer. Maybe i could use the now free name field for this purpose?

Could anybody help me out here? I'd be really, really grateful.

The code i need to alter looks like this:

\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 = {subcategory},
    institution = {Archive 1},
    location = {Category 1,
    chapter = {Box1}
}

@unpublished {test2,
    title = {subcategory},
    institution = {Archive 1},
    location = {Category 1},
    chapter = {Box2}
}

@unpublished {test3,
    title = {subcategory},
    institution = {Archive 1,
    location = {Category 2},
    chapter = {Box2}
}

@article{test4,
  title={Something},
  author={Mueller, Claus}
}

\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}
2
  • 1
    I think you would benefit from creating a new entry type @archive that can take archivename, category, subcategory and boxnumber as fields (and allow for short versions of these fields if necessary). The ibid part should be straightforward.
    – moewe
    Commented Apr 1, 2014 at 14:21
  • PS: The redefinition chapter = {Bd.} looks pretty fishy to me. Why do you need that?
    – moewe
    Commented Apr 2, 2014 at 8:43

2 Answers 2

5

As mentioned in my comment above, I think it is beneficial to create a new entry type @archive that is tailored exactly to your needs.

We will have to create a new data model file archives.dbx, put it somewhere LaTeX can find it (the same directory as your current file will certainly do).

\ProvidesFile{archives.dbx}[2014/04/02 supplement archive]
\RequireBiber[3]

\DeclareDatamodelEntrytypes{archive}
\DeclareDatamodelEntryfields[archive]{category,subcategory,archive,box}
\DeclareDatamodelConstraints[archive]{
  \constraint[type=mandatory]{
    \constraintfield{archive}
    \constraintfield{category}
    \constraintfield{box}
  }
}

\DeclareDatamodelFields[type=field,datatype=literal]{category}
\DeclareDatamodelEntryfields[archive]{category}
\DeclareDatamodelFields[type=field,datatype=literal]{subcategory}
\DeclareDatamodelEntryfields[archive]{subcategory}
\DeclareDatamodelFields[type=field,datatype=literal]{archive}
\DeclareDatamodelEntryfields[archive]{archive}
\DeclareDatamodelFields[type=field,datatype=literal]{box}
\DeclareDatamodelEntryfields[archive]{box}
\endinput

We define a new entry type @archive that takes the fields archive, category, box and subcategory (the former three are mandatory fields, subcategory is optional).

We then tell biblatex what to doe with the new entry type

\DeclareBibliographyDriver{archive}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \printfield{archive}%
  \setunit{\addspace}%
  \printfield{category}%
  \setunit{\addspace}%
  \printfield{subcategory}%
  \setunit{\addspace}%
  \printfield{box}%
  \newunit\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

This is very straightforward (and not very sophisticated at all): Just print all the fields separated by a space.

We will have to tell biblatex to use this datamodel via datamodel=archives (without the .dbx extension) in the loading-time options.

For sorting, we can define a custom sorting scheme called archive.

\DeclareSortingScheme{archive}{
  \sort{
    \field{archive}
  }
  \sort{
    \field{category}
  }
  \sort{
    \field{subcategory}
  }
  \sort{
    \field{box}
  }
}

It sorts by archive, category, subcategory, box as one would expect. In the bibliography, we use this sorting scheme by appending sorting=archive if necessary.

For citing in authortitle-dw, we have to redefine cite:normal

\renewbibmacro*{cite:normal}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifentrytype{archive}
         {\usedriver
          {\DeclareNameAlias{sortname}{default}}
          {\thefield{entrytype}}}
       {\ifthenelse{\ifciteidem\AND\NOT\boolean{cbx:noidem}%
                                 \AND\NOT\iffirstonpage}
           {\usebibmacro{cite:idem}%
            \usebibmacro{cite:title}%
            \usebibmacro{cite:save}}
           {\ifnameundef{labelname}
             {}
             {\usebibmacro{cite:name}}%
              \usebibmacro{cite:title}}%
            \ifbool{cbx:omiteditor}
              {}
              {\ifnameundef{labelname}
                {\newunit
                 \usebibmacro{cite:byeditor}}
                {}}%
           \usebibmacro{cite:save}}}}%
    {\ifbool{cbx:shorthandibid}%
       {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}%
         {\usebibmacro{cite:ibid}}
         {\usebibmacro{cite:shorthand}}}%
       {\usebibmacro{cite:shorthand}}}}

We just check whether the cited entry is of type @archive; if so, the whole citation is generated if needed (there is no such thing as a short form).*

In order to be able to separate the bibliography by archives we will define a new bibcategory for each archive like so

\DeclareBibliographyCategory{archive1}
\DeclareBibliographyCategory{archnew}

We then set up a check for the archive

\AtDataInput[archive]{
  \iffieldequalstr{archive}{Archive 1}
    {\addtocategory{archive1}{\thefield{entrykey}}}
    {}
  \iffieldequalstr{archive}{ArchNew}
    {\addtocategory{archnew}{\thefield{entrykey}}}
    {}
}

This test just checks if the archive field contains a particular string and if so adds the entry to the appropriate category.

Printing a divided bibliography is then as easy as

\printbibliography[category=archive1,heading=subbibliography,title={Archive 1},sorting=archive]
\printbibliography[category=archnew,heading=subbibliography,title={Archive Newtown},sorting=archive]
\printbibliography[nottype=archive,heading=subbibliography]

The full example (obviously archives.dbx is created here by filecontents if you use the file productively you will have saved a copy of the file at the appropriate place)

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[
    style=authortitle-dw,
    firstfull=true,
    datamodel=archives,
]{biblatex}
\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@archive{test1,
  subcategory = {subcategory},
  archive     = {Archive 1},
  category    = {Category 1},
  box         = {Box1},
}
@archive{test2,
  subcategory = {subcategory},
  archive     = {Archive 1},
  category    = {Category 1},
  box         = {Box2},
}
@archive{test3,
  subcategory = {subcategory},
  archive     = {Archive 1},
  category    = {Category 2},
  box         = {Box2},
}
@archive{test5,
  subcategory = {Ru7},
  archive     = {ArchNew},
  category    = {FAS},
  box         = {321},
}
@article{test4,
  title   = {Something},
  author  = {Mueller, Claus},
  journal = {A Journal},
}
\end{filecontents*}
\begin{filecontents*}{archives.dbx}
\ProvidesFile{archives.dbx}[2014/04/02 supplement archive]
\RequireBiber[3]

\DeclareDatamodelEntrytypes{archive}
\DeclareDatamodelEntryfields[archive]{category,subcategory,archive,box}
\DeclareDatamodelConstraints[archive]{
  \constraint[type=mandatory]{
    \constraintfield{archive}
    \constraintfield{category}
    \constraintfield{box}
  }
}

\DeclareDatamodelFields[type=field,datatype=literal]{category}
\DeclareDatamodelEntryfields[archive]{category}
\DeclareDatamodelFields[type=field,datatype=literal]{subcategory}
\DeclareDatamodelEntryfields[archive]{subcategory}
\DeclareDatamodelFields[type=field,datatype=literal]{archive}
\DeclareDatamodelEntryfields[archive]{archive}
\DeclareDatamodelFields[type=field,datatype=literal]{box}
\DeclareDatamodelEntryfields[archive]{box}
\endinput
\end{filecontents*}

\DeclareBibliographyDriver{archive}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \printfield{archive}%
  \setunit{\addspace}%
  \printfield{category}%
  \setunit{\addspace}%
  \printfield{subcategory}%
  \setunit{\addspace}%
  \printfield{box}%
  \newunit\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

\renewbibmacro*{cite:normal}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifentrytype{archive}
         {\usedriver
          {\DeclareNameAlias{sortname}{default}}
          {\thefield{entrytype}}}
       {\ifthenelse{\ifciteidem\AND\NOT\boolean{cbx:noidem}%
                                 \AND\NOT\iffirstonpage}
           {\usebibmacro{cite:idem}%
            \usebibmacro{cite:title}%
            \usebibmacro{cite:save}}
           {\ifnameundef{labelname}
             {}
             {\usebibmacro{cite:name}}%
              \usebibmacro{cite:title}}%
            \ifbool{cbx:omiteditor}
              {}
              {\ifnameundef{labelname}
                {\newunit
                 \usebibmacro{cite:byeditor}}
                {}}%
           \usebibmacro{cite:save}}}}%
    {\ifbool{cbx:shorthandibid}%
       {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}%
         {\usebibmacro{cite:ibid}}
         {\usebibmacro{cite:shorthand}}}%
       {\usebibmacro{cite:shorthand}}}}

\DeclareBibliographyCategory{archive1}
\DeclareBibliographyCategory{archnew}
\AtDataInput[archive]{
  \iffieldequalstr{archive}{Archive 1}
    {\addtocategory{archive1}{\thefield{entrykey}}}
    {}
  \iffieldequalstr{archive}{ArchNew}
    {\addtocategory{archnew}{\thefield{entrykey}}}
    {}
}


\DeclareSortingScheme{archive}{
  \sort{
    \field{archive}
  }
  \sort{
    \field{category}
  }
  \sort{
    \field{subcategory}
  }
  \sort{
    \field{box}
  }
}

\addbibresource{\jobname.bib}
\begin{document}
  Lorem\footcite{test3}
  ipsum\footcite{test3}
  dolor\footcite{test1}
  sit\footcite{test1}
  amet\footcite{test2}
  consecetur\footcite{test3}
  blah\footcite{test1}
  bleurg\footcite{test4}
  more\footcite{test5}

  \clearpage

  Trallala\footcite{test1}

  \printbibliography[category=archive1, heading=subbibliography, title={Archive 1}, sorting=archive]
  \printbibliography[category=archnew, heading=subbibliography, title={Archive Newtown}, sorting=archive]
  \printbibliography[nottype=archive, heading=subbibliography]
\end{document}

footnote citations split bibliography: now sorted correctly

* One could implement short forms as well, of you like.

4
  • That's AWESOME! Works flawless! I have just one further question. Is it possible to get the material in the right order?
    – Sascha
    Commented Apr 2, 2014 at 21:47
  • Arrg. I could not edit anymore. Is ist possible to get the sub-bibliography of the different archives in an ascending order? In your example of course it is, but I think thats because you cited the sources accordingly. In my case I have for example StaS Ho1 T8 73, then StaS Ho1 T7 962 followed by StaS Ho1 T8 85 and next is then StaS Ho1 T7 945. The best solution would be of course if everything could be in the right, ascending order. First all sorted by category and then (by subcategory and then) by box number.
    – Sascha
    Commented Apr 2, 2014 at 22:04
  • @Sascha I have added a custom sorting scheme for the bibliography, you now have to load the archive \printbibliographies with sorting=archive.
    – moewe
    Commented Apr 3, 2014 at 7:51
  • 1
    @Sascha If it works for you, you might consider accepting and/or upvoting this answer.
    – moewe
    Commented Apr 6, 2014 at 15:10
0

This should rather be a comment to moewe's answer. It only comes as an answer, because I'm not yet allowed to comment.

As the whole signature should appear in the footnotes every time an archival source is cited or, if it's cited two or more times in a row, it should be fully replaced by Ibid., wouldn't it be much easier to simply treat all the information (e.g. archive, shelf, box, document no.) as just the title of said source? For this purpose, you could use an already existing entry type, e.g. @misc:

@misc {test1,
    title = {ArchNew Ho1 Ru8 356}
}

@misc {test2,
    title = {ArchNew FAS Ru7 321}
}

This should produce the desired results for the footnotes without the need to alter the code.

To solve the second problem concerning the appearance of the sources cited within the bibliography, it might indeed be helpful to create a different entry type for each archive (e.g. @archnew, @archold etc.). That way, the different sources cited could be arranged according to their archive in the bibliography using the following commands:

\printbibliography[type=archnew,heading=subbibliography,title={Archive Newtown}]
\printbibliography[type=archold,heading=subbibliography,title={Archive Oldtown}]

I don't really have the possibility to test this right now, so it might be incomplete.

2
  • 1
    To be honest, I had not really thought about just using the title field (I like the more natural/semantic approach of using fields that actually say what they contain). Regarding your idea for the bibliography: I would not use entry types for that, but keywords or entrysubtypes or even \defbibcheck for the archive field.
    – moewe
    Commented Apr 2, 2014 at 11:20
  • Thanks for the suggestion Nicolas. This was actually my first idea too. But it did not really work out very well. I wrote that driver myself (or better tried to). An it worked poorly. The first citation (first full) always worked very well - but not the later omes.
    – Sascha
    Commented Apr 2, 2014 at 20:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .