summaryrefslogtreecommitdiff
path: root/pandoc/templates
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-04-08 13:22:34 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2024-04-08 13:22:34 +0200
commitee8bdd41c711013aa67183fce2886f597dbddf2d (patch)
tree9f37118fe58900de206f11b1d1fe83bd77799ec3 /pandoc/templates
parent32d5e8c976afceb4390c305c21586a91f85451d3 (diff)
Implement bibliography and references
Diffstat (limited to 'pandoc/templates')
-rw-r--r--pandoc/templates/elenq-article.latex57
-rw-r--r--pandoc/templates/elenq-book.latex58
2 files changed, 115 insertions, 0 deletions
diff --git a/pandoc/templates/elenq-article.latex b/pandoc/templates/elenq-article.latex
index ee19f6c..e84f165 100644
--- a/pandoc/templates/elenq-article.latex
+++ b/pandoc/templates/elenq-article.latex
@@ -154,6 +154,33 @@ $endif$]{$documentclass$}
\end{tikzpicture}
}
+% References
+$if(csl-refs)$
+\newlength{\cslhangindent}
+\setlength{\cslhangindent}{1.5em}
+\newlength{\csllabelwidth}
+\setlength{\csllabelwidth}{3em}
+\newlength{\cslentryspacingunit} % times entry-spacing
+\setlength{\cslentryspacingunit}{\parskip}
+\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
+ {% don't indent paragraphs
+ \setlength{\parindent}{0pt}
+ % turn on hanging indent if param 1 is 1
+ \ifodd #1
+ \let\oldpar\par
+ \def\par{\hangindent=\cslhangindent\oldpar}
+ \fi
+ % set entry spacing
+ \setlength{\parskip}{#2\cslentryspacingunit}
+ }%
+ {}
+\usepackage{calc}
+\newcommand{\CSLBlock}[1]{#1\hfill\break}
+\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
+\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
+\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
+$endif$
+
$if(lang)$
% Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic)
\usepackage{polyglossia}
@@ -192,6 +219,18 @@ $endif$
]
\newcommand{\euro}{€}
+% Bibliography
+$if(natbib)$
+\usepackage[$natbiboptions$]{natbib}
+\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
+$endif$
+$if(biblatex)$
+\usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}
+$for(bibliography)$
+\addbibresource{$bibliography$}
+$endfor$
+$endif$
+
% Pretty hyperlinks
\usepackage{hyperref}
$if(colorlinks)$
@@ -454,6 +493,24 @@ $if(lof)$
$endif$
$body$
+%% Bibliography
+$if(natbib)$
+$if(bibliography)$
+$if(biblio-title)$
+ $if(has-chapters)$
+ \renewcommand\bibname{$biblio-title$}
+ $else$
+ \renewcommand\refname{$biblio-title$}
+ $endif$
+ \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
+$endif$
+$endif$
+$endif$
+
+$if(biblatex)$
+\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
+$endif$
+
$for(include-after)$
$include-after$
$endfor$
diff --git a/pandoc/templates/elenq-book.latex b/pandoc/templates/elenq-book.latex
index 01290ee..f1dae0f 100644
--- a/pandoc/templates/elenq-book.latex
+++ b/pandoc/templates/elenq-book.latex
@@ -152,6 +152,34 @@ $endif$]{$documentclass$}
\end{scope}
\end{tikzpicture}}
+% References
+$if(csl-refs)$
+\newlength{\cslhangindent}
+\setlength{\cslhangindent}{1.5em}
+\newlength{\csllabelwidth}
+\setlength{\csllabelwidth}{3em}
+\newlength{\cslentryspacingunit} % times entry-spacing
+\setlength{\cslentryspacingunit}{\parskip}
+\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
+ {% don't indent paragraphs
+ \setlength{\parindent}{0pt}
+ % turn on hanging indent if param 1 is 1
+ \ifodd #1
+ \let\oldpar\par
+ \def\par{\hangindent=\cslhangindent\oldpar}
+ \fi
+ % set entry spacing
+ \setlength{\parskip}{#2\cslentryspacingunit}
+ }%
+ {}
+\usepackage{calc}
+\newcommand{\CSLBlock}[1]{#1\hfill\break}
+\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
+\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
+\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
+$endif$
+
+
$if(lang)$
% Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic)
\usepackage{polyglossia}
@@ -191,6 +219,18 @@ $endif$
]
\newcommand{\euro}{€}
+% Bibliography
+$if(natbib)$
+\usepackage[$natbiboptions$]{natbib}
+\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
+$endif$
+$if(biblatex)$
+\usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}
+$for(bibliography)$
+\addbibresource{$bibliography$}
+$endfor$
+$endif$
+
% Pretty hyperlinks
\usepackage{hyperref}
$if(colorlinks)$
@@ -482,6 +522,24 @@ $if(lof)$
$endif$
$body$
+%% Bibliography
+$if(natbib)$
+$if(bibliography)$
+$if(biblio-title)$
+ $if(has-chapters)$
+ \renewcommand\bibname{$biblio-title$}
+ $else$
+ \renewcommand\refname{$biblio-title$}
+ $endif$
+ \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
+$endif$
+$endif$
+$endif$
+
+$if(biblatex)$
+\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
+$endif$
+
$for(include-after)$
$include-after$
$endfor$