aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--structure/book/en/00-header.yml13
-rw-r--r--templates/tufte-handout.tex85
2 files changed, 78 insertions, 20 deletions
diff --git a/structure/book/en/00-header.yml b/structure/book/en/00-header.yml
index f56c37a..bea655a 100644
--- a/structure/book/en/00-header.yml
+++ b/structure/book/en/00-header.yml
@@ -30,7 +30,18 @@ papersize: b5paper
# Use "symmetric" in the classoption if you want margin notes in alternating sides
#classoption: "symmetric,justified"
#classoption: "twoside,symmetric,justified"
-classoption: "justified"
+classoption:
+ # Justified content
+ - "justified"
+
+ # Disable natbib in the underlying Tufte LaTeX
+ # Without this option, the following error is thrown:
+ #
+ # ! Package natbib Error: Bibliography not compatible with author-year citations.
+ #
+ # This is related to pandoc now using cite and bibitem even with citeproc:
+ # https://github.com/jgm/pandoc/issues/9031
+ - "nobib"
# Header includes
header-includes:
diff --git a/templates/tufte-handout.tex b/templates/tufte-handout.tex
index 93dbfce..67c63ee 100644
--- a/templates/tufte-handout.tex
+++ b/templates/tufte-handout.tex
@@ -3,6 +3,11 @@
% ams
\usepackage{amssymb,amsmath}
+% Workardound for "MakeTextLowerCase" error:
+% https://github.com/Tufte-LaTeX/tufte-latex/issues/64
+% https://github.com/rstudio/tufte/commit/40a3d5d07e649083870ec12e8684d1fe16886466
+\usepackage{soul}
+
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
@@ -85,35 +90,77 @@ $for(bibliography)$
$endfor$
$endif$
+% Citeproc handling up to Pandoc 2.17.1.1 (at least)
+%$if(csl-refs)$
+%\newlength{\cslhangindent}
+%\setlength{\cslhangindent}{1.5em}
+%% For Pandoc 2.8 to 2.11
+%\newenvironment{cslreferences}%
+% {$if(csl-hanging-indent)$\setlength{\parindent}{0pt}%
+% \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}%
+% {\par}
+%% For pandoc 2.11+ using new --citeproc
+%\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}}
+%\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
+%$endif$
+
+% For recent Pandoc (like 3.1.11.1)
+% Details at https://github.com/jgm/pandoc/issues/9031#issuecomment-1694744040
+% Sample block at https://github.com/jgm/pandoc/issues/9031#issuecomment-1694744040
+% The following was copied from /usr/share/pandoc/data/templates/default.latex
+% on a Debian trixie package.
$if(csl-refs)$
+% definitions for citeproc citations
+\NewDocumentCommand\citeproctext{}{}
+\NewDocumentCommand\citeproc{mm}{%
+ \begingroup\def\citeproctext{#2}\cite{#1}\endgroup}
+\makeatletter
+ % allow citations to break across lines
+ \let\@cite@ofmt\@firstofone
+ % avoid brackets around text for \cite:
+ \def\@biblabel#1{}
+ \def\@cite#1#2{{#1\if@tempswa , #2\fi}}
+\makeatother
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
-% For Pandoc 2.8 to 2.11
-\newenvironment{cslreferences}%
- {$if(csl-hanging-indent)$\setlength{\parindent}{0pt}%
- \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}%
- {\par}
-% For pandoc 2.11+ using new --citeproc
\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}
+\newenvironment{CSLReferences}[2] % #1 hanging-indent, #2 entry-spacing
+ {\begin{list}{}{%
+ \setlength{\itemindent}{0pt}
+ \setlength{\leftmargin}{0pt}
+ \setlength{\parsep}{0pt}
% turn on hanging indent if param 1 is 1
\ifodd #1
- \let\oldpar\par
- \def\par{\hangindent=\cslhangindent\oldpar}
+ \setlength{\leftmargin}{\cslhangindent}
+ \setlength{\itemindent}{-1\cslhangindent}
\fi
% set entry spacing
- \setlength{\parskip}{#2\cslentryspacingunit}
- }%
- {}
+ \setlength{\itemsep}{#2\baselineskip}}}
+ {\end{list}}
\usepackage{calc}
-\newcommand{\CSLBlock}[1]{#1\hfill\break}
-\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
-\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}}
+\newcommand{\CSLBlock}[1]{\hfill\break\parbox[t]{\linewidth}{\strut\ignorespaces#1\strut}}
+\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{\strut#1\strut}}
+\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{\strut#1\strut}}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$