3

Additionally to the standard required fields biblatex lists in chapter 2.1, I would like to define my own required fields. So e.g. for book where biblatex only requires author, title, year/date I also would like publisher and location to be required and to give a warning if it's not present.

Is it possible to do that with biblatex or biber dependent on the bib type (different required fields for e.g. book, article, ...)?

  • You might be interested in §4.5.3 Data Model Specification of the biblatex docs and the file biblatex-dm.def on your machine. (See also What does the mandatory constraint type in biblatex do?) – moewe Dec 15 '15 at 17:18
  • @moewe Great, thank you. It seems that I've searched for the wrong key words within the biblatex docs and missed that section. – user2653422 Dec 15 '15 at 17:59
  • If you can find an answer yourself, please do not hesitate to answer this question here yourself. If you run against any walls, consider adding to your question the more concrete problem you were facing. – moewe Dec 16 '15 at 7:25
2

Following the advise of @moewe I post what I've done to create a custom model specification which adds some simple rules I need for my bibliography.

I've created a custom custom.dbx file in my user texmf folder as it is described in section §4.5.3 of the biblatex documentation. Don't forget to refresh the FNDB e.g. by using the MikTex settings menu. To load this file one way is to add datamodel=custom to the package options of biblatex. The other ways are described in the documentation. Also add --validate_datamodel "%tm" as arguments given to biber. To the data model file I added more constraints to some of the entry types. The constraints will be appended to the already existing ones.

For books and collections I wanted a publisher and location to be mandatory in addition to the already mandatory author, title, year/date. Also if a series is given a number field have to be provided.

\DeclareDatamodelConstraints[book,collection]{
  \constraint[type=mandatory]{
    \constraintfield{publisher}
    \constraintfield{location}
    \constraint[type=conditional]{
        \antecedent[quantifier=all]{
            \constraintfield{series}
        }
        \consequent[quantifier=all]{
            \constraintfield{number}
        }
    }
  }
}

For incollections and inproceedings pages should be given so I've added:

\DeclareDatamodelConstraints[incollection,inproceedings]{
  \constraint[type=mandatory]{
    \constraintfield{pages}
  }
}

In the standard configuration eprint, eprintclass and eprinttype are not specified for the online entrytype. To change this I added:

\DeclareDatamodelEntryfields[online]{
  eprint,
  eprintclass,
  eprinttype,
  archiveprefix
}

And last I wanted all entry types to contain the langid field and when the publisher field is given also the location field has to be present:

\DeclareDatamodelConstraints[
  article,
  book,
  inbook,
  bookinbook,
  suppbook,
  booklet,
  collection,
  incollection,
  suppcollection,
  manual,
  misc,
  mvbook,
  mvcollection,
  online,
  patent,
  periodical,
  suppperiodical,
  proceedings,
  inproceedings,
  reference,
  inreference,
  report,
  set,
  thesis,
  unpublished]{
    \constraint[type=mandatory]{
        \constraintfield{langid}
    }
    \constraint[type=conditional]{
        \antecedent[quantifier=all]{
            \constraintfield{publisher}
        }
        \consequent[quantifier=all]{
            \constraintfield{location}
        }
    }
  }

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.