aboutsummaryrefslogtreecommitdiff
path: root/tex/src/preamble-biblatex.tex
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2019-02-06 02:45:41 +0000
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2019-02-06 02:45:41 +0000
commit33e00f02d4ecd28ea5084fc553d2ad182a11ca52 (patch)
tree5505e4badcf844cfe9f3f12b2817db737053811c /tex/src/preamble-biblatex.tex
parente19c7d38f00fe3612a8c499f8ac4c965f52cb86b (diff)
Better management for .tex directories to build from tarball
In order to collaborate effectively in the project, even project members that don't necessarily want (or have the capacity) to do the whole analysis must be able to contribute to the project. Until now, the users of the distributed tarball could only modify the text and not the figures (built with PGFPlots) of the paper. With this commit, the management of TeX source files in the pipeline was slightly modified to allow this as cleanly as I could think of now! In short, the hand-written TeX files are now kept in `tex/src' and for the pipeline's generated TeX files (in particular the old `tex/pipeline.tex'), we now have a `tex/pipeline' symbolic-link/directory that points to the `tex' directory under the build directory. When packaging the project, `tex/pipeline' will be a full directory with a copy of all the necessary files. Therefore as far as LaTeX is concerned, having a build-directory is no longer relevant. Many other small changes were made to do this job cleanly which will just make this commit message too long! Also, the old `tarball' and `zip' targets are now `dist' and `dist-zip' (as in the standard GNU Build system).
Diffstat (limited to 'tex/src/preamble-biblatex.tex')
-rw-r--r--tex/src/preamble-biblatex.tex116
1 files changed, 116 insertions, 0 deletions
diff --git a/tex/src/preamble-biblatex.tex b/tex/src/preamble-biblatex.tex
new file mode 100644
index 0000000..bd99502
--- /dev/null
+++ b/tex/src/preamble-biblatex.tex
@@ -0,0 +1,116 @@
+%% Biblatex settings.
+%%
+%% Settings necessary to make the bibliography with Biblatex. Keeping all
+%% BibLaTeX settings in a separate preamble was done in the spirit of
+%% modularity to 1) easily managable, 2) If a similar BibLaTeX
+%% configuration is necessary in another LaTeX compilation, this file can
+%% just be copied there and used.
+%%
+%% USAGE:
+%% - `tex/src/references.tex': the file containing Bibtex source of each
+%% reference. The file suffix doesn't have to be `.bib'. This naming
+%% helps in clearly identifying the files and avoiding places that
+%% complain about `.bib' files.
+
+
+
+
+
+%% To break up highlighted text (for example texttt when some it is on the
+%% line break) and also to no underline emphasized words (like journal
+%% titles in the references).
+\usepackage[normalem]{ulem}
+
+
+
+
+
+% Basic BibLaTeX settings
+\usepackage[
+ doi=false,
+ url=false,
+ dashed=false,
+ eprint=false,
+ maxbibnames=4,
+ minbibnames=1,
+ hyperref=true,
+ maxcitenames=2,
+ mincitenames=1,
+ style=authoryear,
+ uniquelist=false,
+ backend=biber,natbib]{biblatex}
+\DeclareFieldFormat[article]{pages}{#1}
+\DeclareFieldFormat{pages}{\mkfirstpage[{\mkpageprefix[bookpagination]}]{#1}}
+\addbibresource{tex/src/references.tex}
+\renewbibmacro{in:}{}
+\renewcommand*{\bibfont}{\footnotesize}
+\DefineBibliographyStrings{english}{references = {References}}
+
+%% Include the adsurl field key into those that are recognized:
+\DeclareSourcemap{
+ \maps[datatype=bibtex]{
+ \map{
+ \step[fieldsource=adsurl,fieldtarget=iswc]
+ \step[fieldsource=gbkurl,fieldtarget=iswc]
+ }
+ }
+}
+
+%% Set the color of the doi link to mymg (magenta) and the ads links
+%% to mypurp (or purple):
+\definecolor{mypurp}{cmyk}{0.75,1,0,0}
+\newcommand{\doihref}[2]{\href{#1}{\color{magenta}{#2}}}
+\newcommand{\adshref}[2]{\href{#1}{\color{mypurp}{#2}}}
+\newcommand{\blackhref}[2]{\href{#1}{\color{black}{#2}}}
+
+%% Define a format for the printtext commands in
+%% DeclareBibliographyDriver to make links for the doi, ads link and
+%% arxiv link:
+\DeclareFieldFormat{doilink}{
+ \iffieldundef{doi}{#1}{\doihref{http://dx.doi.org/\thefield{doi}}{#1}}}
+\DeclareFieldFormat{adslink}{
+ \iffieldundef{iswc}{#1}{\adshref{\thefield{iswc}}{#1}}}
+\DeclareFieldFormat{arxivlink}{
+ \iffieldundef{eprint}{#1}{\href{http://arxiv.org/abs/\thefield{eprint}}{#1}}}
+
+\DeclareListFormat{doiforbook}{
+ \iffieldundef{doi}{#1}{\doihref{http://dx.doi.org/\thefield{doi}}{#1}}}
+\DeclareFieldFormat{googlebookslink}{
+ \iffieldundef{iswc}{#1}{\adshref{\thefield{iswc}}{#1}}}
+
+%% Set the formatting to make the last three values into the
+%% appropriate link. Note that the % signs are necessary. Without
+%% them, the items will be indented.
+\DeclareBibliographyDriver{article}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+ \newunit%
+ \ifdefined\makethesis\printtext{\usebibmacro{title}}\fi%
+ \newunit%
+ \printtext[doilink]{\usebibmacro{journal}}%
+ \addcomma%
+ \printtext[adslink]{\printfield{volume}}%
+ \addcomma%
+ \printtext[arxivlink]{\printfield{pages}}%
+ \addperiod%
+}
+
+\DeclareBibliographyDriver{book}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+ \newunit%
+ \printtext{\usebibmacro{title}}%
+ \addperiod%
+ \addspace%
+ \printlist[doiforbook]{publisher}%
+ \addcomma%
+ \addspace%
+ \printfield[googlebookslink]{edition}%
+ \printtext{ ed.}%
+ \addperiod%
+}
+
+%% In order to have et al. instead of et al.,:
+\renewcommand*{\nameyeardelim}{\addspace}