From a16f22881841e57f2652f2a17b7f60b5106b2e60 Mon Sep 17 00:00:00 2001
From: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Date: Wed, 7 Feb 2018 20:37:15 +0100
Subject: First commit to the reproduction pipeline template

Let's start working on this pipeline independently with this first
commit. It is based on my previous experiences, but I had never made a
skeleton of a pipeline before, it was always within a working analysis.

But now that the pipeline has a separate repository for its self, we will
be able to work on it and use it as a base for future work and modify it to
make it even better. Hopefully in time (and with the help of others), it
will grow and become much more robust and useful.
---
 tex/preamble-biblatex.tex | 115 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 115 insertions(+)
 create mode 100644 tex/preamble-biblatex.tex

(limited to 'tex/preamble-biblatex.tex')

diff --git a/tex/preamble-biblatex.tex b/tex/preamble-biblatex.tex
new file mode 100644
index 0000000..757f007
--- /dev/null
+++ b/tex/preamble-biblatex.tex
@@ -0,0 +1,115 @@
+%% Biblatex settings.
+%%
+%% Since the preamble settings necessary to make the bibliography with
+%% Biblatex is a little long and unclean, and might be used in other places
+%% separately later, it is easier to have it here as a separate file.
+%%
+%% USAGE:
+%%
+%%  - `tex/ref.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/ref.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}
-- 
cgit v1.2.1

