I want to make a hierarchy for printing doi, url, isbn and issn in BiBTeX. Something like this (here "real" means that the bib-field is availably/valid):
if "doi" real
print doi
else
if "url" real
print url
else
if "isbn" real
print isbn
else
if "issn" real
print issn
end
end
end
end
So "doi" is the most important field to print!
I have looked at Redundancy in bib file: conditionally suppress url if same as doi? and Biblatex: Print ISBN only if DOI is not defined to get some idears, but no luck.
MWE: tex-file
\documentclass{article}
\usepackage{natbib}
\begin{document}
\bibliographystyle{testplainnat}
\citep{test1,test2,test3,test4,test5,test6,test7,test8,test9,test10}
\bibliography{testbib}
\end{document}
BIB: BIB-file
@Article{test1,
author = {Author, A},
title = {Title A},
journal = {journal},
year = 2001,
doi = {no.},
note = {(doi only!)}
}
@Article{test2,
author = {Author, B},
title = {Title B},
journal = {journal},
year = 2002,
url = {no.},
note = {(url only!)}
}
@Article{test3,
author = {Author, C},
title = {Title C},
journal = {journal},
year = 2003,
isbn = {no.},
note = {(isbn only!)}
}
@Article{test4,
author = {Author, D},
title = {Title D},
journal = {journal},
year = 2004,
issn = {no.},
note = {(issn only!)}
}
@Article{test5,
author = {Author, E},
title = {Title E},
journal = {journal},
year = 2005,
url = {no.},
doi = {no.},
note = {(doi and url)}
}
@Article{test6,
author = {Author, F},
title = {Title F},
journal = {journal},
year = 2006,
isbn = {no.},
doi = {no.},
url = {no.},
note = {(doi, url and isbn)}
}
@Article{test7,
author = {Author, G},
title = {Title G},
journal = {journal},
year = 2007,
isbn = {no.},
issn = {no.},
doi = {no.},
url = {no.},
note = {(doi, url, isbn and issn)}
}
@Article{test8,
author = {Author, H},
title = {Title H},
journal = {journal},
year = 2008,
isbn = {no.},
doi = {no.},
note = {(doi and isbn)}
}
@Article{test9,
author = {Author, I},
title = {Title I},
journal = {journal},
year = 2009,
issn = {no.},
doi = {no.},
note = {(doi and issn)}
}
@Article{test10,
author = {Author, J},
title = {Title J},
journal = {journal},
year = 2010,
isbn = {no.},
url = {no.},
note = {(url and isbn)}
}
bst: