Skip to content

Instantly share code, notes, and snippets.

@JohnLukeBentley
Created February 21, 2017 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnLukeBentley/b50dc8ab9c8acc51eedaecbdcc60fab2 to your computer and use it in GitHub Desktop.
Save JohnLukeBentley/b50dc8ab9c8acc51eedaecbdcc60fab2 to your computer and use it in GitHub Desktop.
Biblatex Tester, Basic Examples. Tests style=authoryear, mergedate bugs.
% Common - Typical
@article{chalmers_1995_typical,
author = {Chalmers, David J.},
date = {1995},
title = {Typical citation of a modern work},
}
% Common - Approximate and uncertain
@book{galilei_1590_approximate,
author = {Galilei, Galileo},
date = {1590~},
title = {Approximate, circa 'ca.'},
}
@book{aquinas_1256_uncertain,
author = {Aquinas, Thomas},
date = {1256?},
title = {Uncertain},
}
@book{aquinas_1273_approximate_and_uncertain,
author = {Aquinas, Thomas},
date = {1273?~},
title = {Approximate and uncertain},
}
% Common - eras
@book{plato_2004_eras_bce,
author = {{Plato}},
date = {-0379~},
title = {Eras, before the year zero, 'BCE'},
}
@book{epictetus_1916_eras_ce,
author = {{Epictetus}},
date = {0125~},
title = {Eras, not long after the year zero, 'CE'},
}
% Precision finer than a year - Times
@book{simpson_2016_time_unspecified_timezone,
author = {Simpson, Lisa},
date = {2016-07-18T10:26:06},
title = {Time, unspecified time zone},
}
@article{barker_2016_time_local_timezone,
author = {Barker, Anne},
date = {2016-06-06T18:20:00+10:00},
title = {Time, local time zone},
}
@book{simpson_2016_time_zulu_timezone,
author = {Simpson, Lisa},
date = {2016-07-18T20:26:06Z},
title = {Time, zulu time zone},
}
% Precision finer than a year - Dates
@article{kennett_2008_date_month,
author = {Kennett, Jeanette},
date = {2008-01},
title = {Month precision date},
}
@article{mendelsohn_2010__date_day,
author = {Mendelsohn, Daniel},
date = {2010-01-25},
title = {Day precision date.},
}
% Precision finer than a year - Season
@book{sep_2016_season,
author = {{SEP}},
date = {2016-23},
title = {Season precision},
}
\documentclass[12pt,a4paper]{article}
\PassOptionsToPackage{%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Dates and Datetimes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% julian=true,% convert dates before gregorianstart to Julian Calendar
% gregorianstart=1582-10-15,% Default
alldates=ymd, % year, short, long, terse, comp, ymd, edtf. ymd = Year-Month-Day format
labeldate=year, % year, short, long, terse, comp, ymd, edtf. ymd = Year-Month-Day format
alldatesusetime=true, % print time components in non-compact date ranges
labeldateusetime=false,
alltimes=24h, % 12h, 24h, 24hcomp.
seconds=false,
timezones=true,
datezeros=true,
% dateera=astronomical (default), secular, christian
% astronomical dates, controlled by datezero
% secular (prints BCE/CE) controlled by dateerauto, datezeros
% christian prints BC/AD controlled by dateerauto, datezeros
dateera=secular,
dateeraauto=501, % Sets the max year ceiling for automatic printing of era
abbreviate=true, % prints full localisation strings
dateabbrev=false, % prints full date localisation strings
dateuncertain=true,
datecirca=true,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Style
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
style=authoryear,
sorting=none,
dashed=false,
url=false,
%refsection=section,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% style=authoryear option
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% mergedate= % false, minimum, basic, compact or true (default), maximum.
% See \doc\latex\biblatex\examples\50-style-authoryear-biber.pdf
% mergedate bug tests:
% alldates=ymd,
% labeldate=year,
% false (1,2), minimum (1,2), basic (1,2), compact (1,2:Fail?), true (1,2:Fail?), maximum (1,2:Fail?)
% alldates=ymd,
% labeldate=ymd
% false (), minimum (), basic (), compact (), true (), maximum ()
mergedate=true
}{biblatex}
\usepackage{biblatex}
\addbibresource{Biblatex-Tester-BasicExamples.bib}
% Seperation between time and timezone.
\DefineBibliographyExtras{english}{
\renewcommand*{\bibtimezonesep}{\space}
}
% Remove paragraph first line indenting for easy comparison
\setlength{\parindent}{0pt}
% Convenience command
\newcommand{\mycite}[1]{Lorem \autocite{#1}. \citetitle{#1}.\\}
\begin{document}
\begin{refsection}
\section{Common}
\subsection{Citations}
Typical:\\
\mycite{chalmers_1995_typical}
Approximate and uncertain:\\
\mycite{galilei_1590_approximate}
\mycite{aquinas_1256_uncertain}
\mycite{aquinas_1273_approximate_and_uncertain}
Eras:\\
\mycite{plato_2004_eras_bce}
\mycite{epictetus_1916_eras_ce}
\printbibliography[heading=subbibnumbered]
\end{refsection}
\clearpage
\begin{refsection}
\section{Precision finer than a year}
\subsection{Citations}
Times:\\
\mycite{simpson_2016_time_unspecified_timezone}
\mycite{barker_2016_time_local_timezone}
\mycite{simpson_2016_time_zulu_timezone}
Precision finer than a year - Dates:\\
\mycite{kennett_2008_date_month}
\mycite{mendelsohn_2010__date_day}
Precision finer than a year - Season:\\
\mycite{sep_2016_season}
\printbibliography[heading=subbibnumbered]
\end{refsection}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment