3

I'm trying to get a bibliography driver working correctly. I used the code from this previous post, with some minor changes: Need help configuring entry type driver for biblatex-dw. Different citation style sa for different entry types

My version is in the MWE below.

What I want to accomplish, that the previous question did not deal with, is to suppress one of the bib entries (e.g. the one I call box in my MWE. The suppression works fine, but the result is that I get two or more similar lines in the bibliography. Is there a way to get a list of unique entries, while still suppressing the box field?

MWE:

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

\begin{filecontents*}{\jobname.bib}
@archive{test1,
  subcategory = {Foo},
  category     = {StateArchive},
  box         = {130},
}

@archive{test2,
  subcategory = {Foo},
  category     = {StateArchive},
  box         = {131},
}

\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}
  more\footcite{test1}
  more\footcite{test2}

  \clearpage
\DeclareFieldFormat[archive]{box}{}

  \printbibliography
\end{document}

Current output (bibliography only, as it's the one I'm having problems with):

bibliography

So, I only want one line, not two similar lines.

Edit: to be clear, I need the box field to be visible in the footnotes.

1 Answer 1

1

This only comes as an answer because I don't have enough reputation to comment yet.

I doubt there's an easy way to achieve automatically what you'd like to achieve, because those different entries you're citing are treated by biblatex as just what they are: different entries that happen to have the same content.

What you could do would be to manually suppress every entry citing sources from the same archive but one using the skipbib option, e.g.:

@archive{test1,
  subcategory  = {Foo},
  category     = {StateArchive},
  box          = {130}
}

@archive{test2,
  subcategory  = {Foo},
  category     = {StateArchive},
  box          = {131},
  options      = {skipbib=true}
}

@archive{test3,
  subcategory  = {Foo},
  category     = {StateArchive},
  box          = {132},
  options      = {skipbib=true}
}

This works fine if you only have a limited number of archival sources you cite from but could be really painful otherwise.

1
  • Yay! Thanks Nicholas. That works for me, despite the little extra effort needed.
    – rigor
    Jan 12, 2015 at 18:39

You must log in to answer this question.

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