Skip to content

Commit

Permalink
Make compatible with pandoc 2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
lcreteig committed Dec 12, 2020
1 parent 4d9841e commit 403c868
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions inst/rmarkdown/templates/thesis/skeleton/template.tex
Original file line number Diff line number Diff line change
Expand Up @@ -204,33 +204,39 @@
\fi
$endif$

% LS 25-11-2020 add new statement similar to thesisdown bugfix:
% https://github.com/ismayc/thesisdown/pull/79#issue-384204665
% LS 25-11-2020 note: fix didn't work: I went to the raw pandoc version and copied and pasted the following lines.
% copied from https://github.com/jgm/pandoc/blob/master/data/templates/default.latex
% LCR fix for new required cslreferences environment in pandoc
% from https://github.com/rstudio/rticles/pull/335/commits/a9937b6
% originally proposed by LS: https://github.com/LDSamson/amsterdown/commit/4d9841e
% Pandoc citation processing
$if(csl-refs)$
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
\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}
% For Pandoc 2.11+
\newenvironment{CSLReferences}[3] % #1 hanging-ident, #2 entry sp
{% 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 line spacing
% set entry spacing
\ifnum #2 > 0
\setlength{\parskip}{#2\baselineskip}
\setlength{\parskip}{#3\baselineskip}
\fi
}%
{}
\usepackage{calc}
\usepackage{calc} % for \widthof, \maxof
\newcommand{\CSLBlock}[1]{#1\hfill\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\maxof{\widthof{#1}}{\csllabelwidth}}{#1}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth}{#1}}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$
% LS 25-11-2020 end of addition to solve bug

%%% Use protect on footnotes to avoid problems with footnotes in titles
\let\rmarkdownfootnote\footnote%
Expand Down

0 comments on commit 403c868

Please sign in to comment.