Last active
September 17, 2015 13:43
-
-
Save reitzig/7991f77df96e0ef6671f to your computer and use it in GitHub Desktop.
A small MWE for testing SE BibTeX export with biblatex+biber vs bibtex+natbib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\def\testmode{old} | |
\def\testmode{new} | |
\usepackage{xifthen,url} | |
\newcommand{\ifnew}[2]{\ifthenelse{\equal{\testmode}{new}}{#1}{#2}} | |
\ifnew{% | |
\usepackage[backend=biber]{biblatex} | |
\addbibresource{setest.bib} | |
% Print nameaddon if it exists | |
\renewbibmacro{author}{% | |
\printnames{author}% | |
\iffieldundef{nameaddon}{}{% | |
\ (\printfield{nameaddon})% | |
}% | |
} | |
}{% | |
\usepackage{natbib} | |
} | |
\usepackage{filecontents} | |
\begin{filecontents}{setest.bib} | |
@MISC{30073, | |
TITLE = {Cutting equal sticks from different sticks}, | |
AUTHOR = {Erel Segal-Halevi (http://cs.stackexchange.com/users/1342/erel-segal-halevi)}, | |
HOWPUBLISHED = {Computer Science Stack Exchange}, | |
NOTE = {URL:http://cs.stackexchange.com/q/30073 (version: 2015-02-16)}, | |
EPRINT = {http://cs.stackexchange.com/q/30073}, | |
URL = {http://cs.stackexchange.com/q/30073} | |
} | |
@online{cs.SE:30073, | |
title = {Cutting equal sticks from different sticks}, | |
author = {Erel Segal-Halevi}, | |
nameaddon = {\url{http://cs.stackexchange.com/users/1342}}, | |
howpublished = {Computer Science Stack Exchange}, | |
url = {http://cs.stackexchange.com/q/30073}, | |
urldate = {2014-11-26}, | |
date = {2014-09-17}, | |
year = {2014}, | |
month = {9} | |
} | |
\end{filecontents} | |
\usepackage{hyperref} | |
\begin{document} | |
Let's do a test. This is the old one~\cite{30073}, and this | |
the new one~\cite{cs.SE:30073}! | |
\ifnew{% | |
\printbibliography | |
}{% | |
\bibliographystyle{plainnat} | |
\bibliography{setest} | |
} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment