4

Im looking for a way to only show one of ISBN, ISSN or doi. It should prefer doi over ISSN over ISBN. My current approach as listed below is doing nothing, which gets me confused. Any help around?

Cheers

\renewbibmacro*{issn}{% 
    \iftoggle{bbx:doi} {\iffieldundef{doi}{\usebibmacro{issn}}{}} {}
}
2
  • Welcome to TeX.SX! What biblatex style are you using? Can you show us an MWE/MWEB of how you produce your bibliography at the moment so we can get started more quickly, please? Your question is reasonably clear even without an MWE, but it would greatly help us to see what you are doing at the moment to get started more quickly, make sure we all talk about the same thing and test our solution. An MWE is a good way to show that you care about those who want to help you.
    – moewe
    Jul 11, 2018 at 20:31
  • Did my answer below solve your problem? If so, you may want to consider accepting the answer to show that it answered your question: tex.stackexchange.com/help/someone-answers. If not, I would appreciate a comment and ideally an edit to the question with the requested MWE.
    – moewe
    Jul 13, 2018 at 11:15

1 Answer 1

6

A simple solution that should work almost universally is

\AtEveryBibitem{%
  \iffieldundef{doi}
    {\iffieldundef{issn}
       {}
       {\clearfield{isbn}}}
    {\clearfield{issn}%
     \clearfield{isbn}}%
}

For the standard styles the shorter

\AtEveryBibitem{%
  \iffieldundef{doi}
    {}
    {\clearfield{issn}%
     \clearfield{isbn}}%
}

should be enough since no entry shows both ISBN and ISSN - it is either or.

You can do the same thing with Biber's sourcemapping which stops the data from even reaching biblatex (this is usually preferred with data that could be used for things other than being printed directly - for example dates and names that could be used for sorting or label... fields).

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=doi, final]
      \step[fieldset=isbn, null]
      \step[fieldset=issn, null]
    }
  }
}

You must log in to answer this question.

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