From 27df40396e0e48a770a6df0761a7b228d5cb086c Mon Sep 17 00:00:00 2001 From: Quinn White Date: Fri, 30 Sep 2022 09:48:57 -0400 Subject: [PATCH] fix cslReferences error Resolve 'LatexError: environment cslReferences undefined'; update obtained from thesisdown template.tex. --- .../templates/thesis/skeleton/template.tex | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/inst/rmarkdown/templates/thesis/skeleton/template.tex b/inst/rmarkdown/templates/thesis/skeleton/template.tex index dc62f231..e0c44e4f 100644 --- a/inst/rmarkdown/templates/thesis/skeleton/template.tex +++ b/inst/rmarkdown/templates/thesis/skeleton/template.tex @@ -115,13 +115,34 @@ %Added by @MyKo101, code provided by @GerbrichFerdinands $if(csl-refs)$ +\newlength{\csllabelwidth} +\setlength{\csllabelwidth}{3em} \newlength{\cslhangindent} \setlength{\cslhangindent}{1.5em} +% for Pandoc 2.8 to 2.10.1 \newenvironment{cslreferences}% {$if(csl-hanging-indent)$\setlength{\parindent}{0pt}% \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}% {\par} -$endif$ +% For Pandoc 2.11+ +% As noted by @mirh [2] is needed instead of [3] for 2.12 +\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 \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces\fi +% set entry spacing +\ifnum #2 > 0 +\setlength{\parskip}{#2\baselineskip} + \fi +}% +{} +\usepackage{calc} % for calculating minipage widths +\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$ \renewcommand{\contentsname}{Table of Contents} % End of CII addition