Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a large set of references and I in most cases do have either

  • ISBN
  • DOI
  • DOI and ISBN

I'd like to setup a filter that prints the ISBN only when the DOI does not exist.

How can I set up a filter that performs this conditional printing (I read this thread but didn't find a command to check whether an entry exists)

If necessary I could also define empty DOI entries but this would be plenty of work.

share|improve this question
add comment

1 Answer 1

up vote 11 down vote accepted

You can use biblatex source remapping features. The code checks whether the doi field is non-null and if it is it clears the isbn field so that it is not printed.

\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{t.bib}
\DeclareSourcemap{
  \maps[datatype=bibtex]{
     \map{
        \step[fieldsource=doi,final]
        \step[fieldset=isbn,null]
        }
      }
}

\begin{document}
\cite{test1,test2,test3}
\printbibliography
\end{document}

with t.bib

@Book{test1,
  author =   {Author, First},
  title =    {Title One},
  publisher =    {Publisher},
  year =     2000,
  doi =      {doi:field},
  note =     {doi only}
}

@Book{test2,
  author =   {Author, Gareth},
  title =    {Title Two},
  publisher =    {Publisher},
  year =     2005,
  isbn =     {isbn number},
  note =     {isbn only}
}

@Book{test3,
  author =   {Author, Last},
  title =    {Title Three},
  publisher =    {Publisher},
  year =     2007,
  isbn =     {isbn number},
  doi =      {doi:field},
  note =     {isbn and doi}
}

gives

Sample output

share|improve this answer
    
Works like a charm and is much more elegant than the solution suggested in the other thread (which I didn't find; sorry). Thanks a lot. –  louis cypher Oct 14 '12 at 14:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.