Last active
February 3, 2018 04:08
-
-
Save Fylwind/fc95b5e040eabb44ebbb35ee4dff1e11 to your computer and use it in GitHub Desktop.
Tweak biblatex for astronomy
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[12pt]{article} | |
\usepackage[ | |
backend=biber, | |
bibencoding=utf-8, | |
natbib, | |
style=authoryear, | |
maxcitenames=9, % use "et al" for > 9 (citations) | |
maxbibnames=9, % use "et al" for > 9 (references) | |
giveninits, % initialize given names | |
uniquename=init, | |
dashed=false, % don't use dash for repeated names | |
]{biblatex} | |
% Remove "p."/"pp." in citations and references | |
\DefineBibliographyStrings{english}{% | |
page = {}, | |
pages = {}, | |
} | |
% Use "&" instead of "and" | |
\let\origparencite\parencite | |
\renewrobustcmd{\parencite}{% | |
\AtNextCite{% | |
\renewcommand*{\finalnamedelim}{% | |
\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% | |
\addspace\&\space}% | |
}% | |
\origparencite% | |
} | |
\AtBeginBibliography{% | |
\renewcommand*{\finalnamedelim}{% | |
\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% | |
\addspace\&\space}% | |
} | |
\DeclareNameAlias{labelname}{family-given} % in citations | |
\DeclareNameAlias{sortname}{family-given} % in references | |
% remove "in:" before journal names in references | |
\renewbibmacro{in:}{} | |
% remove "URL:" before URLs | |
\DeclareFieldFormat{url}{\url{#1}} | |
% Remove parentheses around year | |
\usepackage{xpatch} | |
\xpatchbibmacro{date+extradate}{% | |
\printtext[parens]% | |
}{% | |
\setunit*{\addperiod\space}% | |
\printtext% | |
}{}{} | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Remaining part of file is for testing only | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
\usepackage{hyperref} | |
\usepackage{filecontents} | |
\begin{filecontents*}{foobar.bib} | |
@Article{einstein, | |
author = {Albert Einstein and John Smith and Jane Collins and Mary Antoine}, | |
title = {Zur Elektrodynamik bewegter Körper.}, | |
year = 1905, | |
volume = 322, | |
number = 10, | |
pages = {891-921}, | |
journaltitle = {Annalen der Physik}, | |
doi = {10.1002/andp.19053221004} | |
} | |
@Article{einstein2, | |
author = {Albert Einstein and John Smith and Jane Collins and Mary Antoine}, | |
title = {The quick brown fox.}, | |
year = 1905, | |
volume = 3, | |
number = 14, | |
pages = 15926, | |
journaltitle = {American Astronomy of Societies}, | |
archivePrefix = {arXiv}, | |
eprint = {0902.0885}, | |
url = {https://google.com} | |
} | |
\end{filecontents*} | |
\addbibresource{foobar.bib} | |
\begin{document} | |
The quick brown fox jumps over the lazy dog.\parencite[arfarf][12345]{einstein} | |
Hello world.\parencite[awoo][12345]{einstein2} | |
\printbibliography | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment