From a9937b6a3b14b638a29b639e046f36300676f944 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Fri, 16 Oct 2020 11:48:18 +0200 Subject: [PATCH 1/5] add the CSLReferences environment to all Latex templates to support Pandoc 2.11 new citeproc Pandoc 2.11 introduced this new environment while introducing new --citeproc argument (https://github.com/jgm/pandoc/commit/e0984a43a99231e72c02a0a716c8d0315de9abdf#diff-64a9e5fa4509dce2699276c9e39993b4474e2446c3e86941a2f78a379f8c4079) This follows a previous change we made when Pandoc 2.8 went out (https://github.com/rstudio/rticles/commit/ee529ada1ee5dc144300383aa8f88364108b6679). --- .../templates/acm/resources/template.tex | 22 +++++++++++++ .../templates/acs/resources/template.tex | 22 +++++++++++++ .../templates/aea/resources/template.tex | 22 +++++++++++++ .../templates/agu/resources/template.tex | 22 +++++++++++++ .../templates/amq/resources/template.tex | 22 +++++++++++++ .../templates/ams/resources/template.tex | 22 +++++++++++++ .../templates/arxiv/resources/template.tex | 26 ++++++++++++++++ .../templates/asa/resources/template.tex | 22 +++++++++++++ .../bioinformatics/resources/template.tex | 31 +++++++++++++++++++ .../biometrics/resources/template.tex | 24 +++++++++++++- .../copernicus/resources/template.tex | 22 +++++++++++++ .../templates/elsevier/resources/template.tex | 22 +++++++++++++ .../frontiers/resources/template.tex | 23 +++++++++++++- .../templates/ieee/resources/template.tex | 22 +++++++++++++ .../templates/joss/resources/template.tex | 22 +++++++++++++ .../templates/jss/resources/template.tex | 22 +++++++++++++ .../templates/mdpi/resources/template.tex | 22 +++++++++++++ .../templates/mnras/resources/template.tex | 22 +++++++++++++ .../templates/oup/resources/template.tex | 23 +++++++++++++- .../templates/peerj/resources/template.tex | 22 +++++++++++++ .../templates/plos/resources/template.tex | 22 +++++++++++++ .../templates/pnas/resources/template.tex | 22 +++++++++++++ .../rjournal/resources/RJwrapper.tex | 31 +++++++++++++++++++ .../templates/rsos/resources/template.tex | 22 +++++++++++++ .../templates/rss/resources/template.tex | 22 +++++++++++++ .../templates/sage/resources/template.tex | 22 +++++++++++++ .../templates/sim/resources/template.tex | 22 +++++++++++++ .../templates/springer/resources/template.tex | 22 +++++++++++++ .../templates/tf/resources/template.tex | 22 +++++++++++++ 29 files changed, 661 insertions(+), 3 deletions(-) diff --git a/inst/rmarkdown/templates/acm/resources/template.tex b/inst/rmarkdown/templates/acm/resources/template.tex index 28cdbc9e1..a293b328c 100644 --- a/inst/rmarkdown/templates/acm/resources/template.tex +++ b/inst/rmarkdown/templates/acm/resources/template.tex @@ -62,13 +62,35 @@ $highlighting-macros$ $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/acs/resources/template.tex b/inst/rmarkdown/templates/acs/resources/template.tex index 9808f1f1d..c683c5855 100644 --- a/inst/rmarkdown/templates/acs/resources/template.tex +++ b/inst/rmarkdown/templates/acs/resources/template.tex @@ -60,13 +60,35 @@ \pdfstringdefDisableCommands{\renewcommand{\sout}{}} $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ % pandoc header diff --git a/inst/rmarkdown/templates/aea/resources/template.tex b/inst/rmarkdown/templates/aea/resources/template.tex index c37dd6079..aab5741b3 100644 --- a/inst/rmarkdown/templates/aea/resources/template.tex +++ b/inst/rmarkdown/templates/aea/resources/template.tex @@ -25,13 +25,35 @@ \usepackage{hyperref} +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/agu/resources/template.tex b/inst/rmarkdown/templates/agu/resources/template.tex index 292be2456..311439e7c 100644 --- a/inst/rmarkdown/templates/agu/resources/template.tex +++ b/inst/rmarkdown/templates/agu/resources/template.tex @@ -64,13 +64,35 @@ \journalname{$journal$} +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/amq/resources/template.tex b/inst/rmarkdown/templates/amq/resources/template.tex index 9ca8df7a8..fba6a7ff7 100644 --- a/inst/rmarkdown/templates/amq/resources/template.tex +++ b/inst/rmarkdown/templates/amq/resources/template.tex @@ -237,13 +237,35 @@ \everymath{\displaystyle} +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/ams/resources/template.tex b/inst/rmarkdown/templates/ams/resources/template.tex index 91b54504f..e68aca589 100644 --- a/inst/rmarkdown/templates/ams/resources/template.tex +++ b/inst/rmarkdown/templates/ams/resources/template.tex @@ -63,13 +63,35 @@ $endif$ $endfor$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ % pandoc header diff --git a/inst/rmarkdown/templates/arxiv/resources/template.tex b/inst/rmarkdown/templates/arxiv/resources/template.tex index 720e800c3..7f88d4c75 100644 --- a/inst/rmarkdown/templates/arxiv/resources/template.tex +++ b/inst/rmarkdown/templates/arxiv/resources/template.tex @@ -30,13 +30,39 @@ $endfor$ } +$if(highlighting-macros)$ +$highlighting-macros$ +$endif$ + +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ \begin{document} diff --git a/inst/rmarkdown/templates/asa/resources/template.tex b/inst/rmarkdown/templates/asa/resources/template.tex index 67e51755e..c7248ce2b 100644 --- a/inst/rmarkdown/templates/asa/resources/template.tex +++ b/inst/rmarkdown/templates/asa/resources/template.tex @@ -28,13 +28,35 @@ $highlighting-macros$ $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/bioinformatics/resources/template.tex b/inst/rmarkdown/templates/bioinformatics/resources/template.tex index e9ef5f8be..9bf81be7c 100644 --- a/inst/rmarkdown/templates/bioinformatics/resources/template.tex +++ b/inst/rmarkdown/templates/bioinformatics/resources/template.tex @@ -9,6 +9,37 @@ \usepackage{longtable} $endif$ +% Pandoc citation processing +$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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ + $for(header-includes)$ $header-includes$ $endfor$ diff --git a/inst/rmarkdown/templates/biometrics/resources/template.tex b/inst/rmarkdown/templates/biometrics/resources/template.tex index 96f28f160..1f66454ab 100644 --- a/inst/rmarkdown/templates/biometrics/resources/template.tex +++ b/inst/rmarkdown/templates/biometrics/resources/template.tex @@ -41,13 +41,35 @@ $highlighting-macros$ $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ % tightlist command for lists without linebreak @@ -62,7 +84,7 @@ \author{$for(author)$ $author.name$ \email{$author.email$} \\ $author.affiliation$ $sep$ \and $endfor$ } - + $for(header-includes)$ $header-includes$ $endfor$ diff --git a/inst/rmarkdown/templates/copernicus/resources/template.tex b/inst/rmarkdown/templates/copernicus/resources/template.tex index 618ef3f60..256c5c1ad 100644 --- a/inst/rmarkdown/templates/copernicus/resources/template.tex +++ b/inst/rmarkdown/templates/copernicus/resources/template.tex @@ -74,13 +74,35 @@ %\usepackage{subfig} %\usepackage{rotating} +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ % The "Technical instructions for LaTex" by Copernicus require _not_ to insert any additional packages. diff --git a/inst/rmarkdown/templates/elsevier/resources/template.tex b/inst/rmarkdown/templates/elsevier/resources/template.tex index 51a855d06..293e0e1cf 100644 --- a/inst/rmarkdown/templates/elsevier/resources/template.tex +++ b/inst/rmarkdown/templates/elsevier/resources/template.tex @@ -127,13 +127,35 @@ \setcounter{secnumdepth}{0} $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ % Pandoc header diff --git a/inst/rmarkdown/templates/frontiers/resources/template.tex b/inst/rmarkdown/templates/frontiers/resources/template.tex index 3e1f410d9..6308bd1f7 100644 --- a/inst/rmarkdown/templates/frontiers/resources/template.tex +++ b/inst/rmarkdown/templates/frontiers/resources/template.tex @@ -71,15 +71,36 @@ %% END MACROS SECTION +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ - $for(header-includes)$ $header-includes$ $endfor$ diff --git a/inst/rmarkdown/templates/ieee/resources/template.tex b/inst/rmarkdown/templates/ieee/resources/template.tex index 248668b9d..155967121 100644 --- a/inst/rmarkdown/templates/ieee/resources/template.tex +++ b/inst/rmarkdown/templates/ieee/resources/template.tex @@ -394,13 +394,35 @@ $highlighting-macros$ $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ % Pandoc header diff --git a/inst/rmarkdown/templates/joss/resources/template.tex b/inst/rmarkdown/templates/joss/resources/template.tex index 6742a3829..99910986b 100644 --- a/inst/rmarkdown/templates/joss/resources/template.tex +++ b/inst/rmarkdown/templates/joss/resources/template.tex @@ -274,13 +274,35 @@ \fi $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/jss/resources/template.tex b/inst/rmarkdown/templates/jss/resources/template.tex index a2bca5f3a..3cb49e0da 100644 --- a/inst/rmarkdown/templates/jss/resources/template.tex +++ b/inst/rmarkdown/templates/jss/resources/template.tex @@ -57,13 +57,35 @@ $endfor$ } +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ % Pandoc header diff --git a/inst/rmarkdown/templates/mdpi/resources/template.tex b/inst/rmarkdown/templates/mdpi/resources/template.tex index 7a74891b7..631528cb0 100644 --- a/inst/rmarkdown/templates/mdpi/resources/template.tex +++ b/inst/rmarkdown/templates/mdpi/resources/template.tex @@ -150,13 +150,35 @@ %\setcounter{secnumdepth}{4} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/mnras/resources/template.tex b/inst/rmarkdown/templates/mnras/resources/template.tex index 8930b3a38..30b0a2d6b 100644 --- a/inst/rmarkdown/templates/mnras/resources/template.tex +++ b/inst/rmarkdown/templates/mnras/resources/template.tex @@ -53,13 +53,35 @@ % Please keep new commands to a minimum, and use \newcommand not \def to avoid % overwriting existing commands. Example: +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/inst/rmarkdown/templates/oup/resources/template.tex b/inst/rmarkdown/templates/oup/resources/template.tex index 529a15731..afa4e413e 100644 --- a/inst/rmarkdown/templates/oup/resources/template.tex +++ b/inst/rmarkdown/templates/oup/resources/template.tex @@ -75,15 +75,36 @@ $endif$ % Part for indenting CSL refs +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ - % Pandoc header $for(header-includes)$ $header-includes$ diff --git a/inst/rmarkdown/templates/peerj/resources/template.tex b/inst/rmarkdown/templates/peerj/resources/template.tex index 5e264b3e0..130c925f1 100644 --- a/inst/rmarkdown/templates/peerj/resources/template.tex +++ b/inst/rmarkdown/templates/peerj/resources/template.tex @@ -30,13 +30,35 @@ $highlighting-macros$ $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ % Pandoc Header diff --git a/inst/rmarkdown/templates/plos/resources/template.tex b/inst/rmarkdown/templates/plos/resources/template.tex index 7584a7468..a2142990a 100644 --- a/inst/rmarkdown/templates/plos/resources/template.tex +++ b/inst/rmarkdown/templates/plos/resources/template.tex @@ -173,13 +173,35 @@ $highlighting-macros$ $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/pnas/resources/template.tex b/inst/rmarkdown/templates/pnas/resources/template.tex index 1dba1378e..527c83cf9 100644 --- a/inst/rmarkdown/templates/pnas/resources/template.tex +++ b/inst/rmarkdown/templates/pnas/resources/template.tex @@ -15,13 +15,35 @@ \usepackage{longtable} $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/rjournal/resources/RJwrapper.tex b/inst/rmarkdown/templates/rjournal/resources/RJwrapper.tex index 53ea4ae11..9f197e8df 100644 --- a/inst/rmarkdown/templates/rjournal/resources/RJwrapper.tex +++ b/inst/rmarkdown/templates/rjournal/resources/RJwrapper.tex @@ -8,6 +8,37 @@ \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} +% Pandoc citation processing +$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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ + $for(header-includes)$ $header-includes$ $endfor$ diff --git a/inst/rmarkdown/templates/rsos/resources/template.tex b/inst/rmarkdown/templates/rsos/resources/template.tex index ebb200e84..609588d9e 100644 --- a/inst/rmarkdown/templates/rsos/resources/template.tex +++ b/inst/rmarkdown/templates/rsos/resources/template.tex @@ -15,13 +15,35 @@ \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/rss/resources/template.tex b/inst/rmarkdown/templates/rss/resources/template.tex index e54e314dc..dd23a92d9 100644 --- a/inst/rmarkdown/templates/rss/resources/template.tex +++ b/inst/rmarkdown/templates/rss/resources/template.tex @@ -36,13 +36,35 @@ \usepackage[authoryear]{natbib} \bibpunct{(}{)}{;}{a}{}{,} +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/sage/resources/template.tex b/inst/rmarkdown/templates/sage/resources/template.tex index 1f0b13c8c..c6dd24190 100644 --- a/inst/rmarkdown/templates/sage/resources/template.tex +++ b/inst/rmarkdown/templates/sage/resources/template.tex @@ -7,13 +7,35 @@ \usepackage{longtable} $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/sim/resources/template.tex b/inst/rmarkdown/templates/sim/resources/template.tex index d7577f866..77527cc5b 100644 --- a/inst/rmarkdown/templates/sim/resources/template.tex +++ b/inst/rmarkdown/templates/sim/resources/template.tex @@ -4,13 +4,35 @@ \usepackage{longtable} $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/springer/resources/template.tex b/inst/rmarkdown/templates/springer/resources/template.tex index fd59c1c66..4aef8bf75 100644 --- a/inst/rmarkdown/templates/springer/resources/template.tex +++ b/inst/rmarkdown/templates/springer/resources/template.tex @@ -34,13 +34,35 @@ $highlighting-macros$ $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $for(header-includes)$ diff --git a/inst/rmarkdown/templates/tf/resources/template.tex b/inst/rmarkdown/templates/tf/resources/template.tex index 7e1185881..ff379e553 100644 --- a/inst/rmarkdown/templates/tf/resources/template.tex +++ b/inst/rmarkdown/templates/tf/resources/template.tex @@ -30,13 +30,35 @@ $highlighting-macros$ $endif$ +% Pandoc citation processing $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} +% 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}{#3\baselineskip} + \fi + }% + {} +\usepackage{calc} % for \widthof, \maxof +\newcommand{\CSLBlock}[1]{#1\hfill\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$ $if(header-includes)$ From bb1c67daef8d28338af214b6832a50e20b112ad5 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Fri, 16 Oct 2020 12:12:02 +0200 Subject: [PATCH 2/5] test also Pandoc devel --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2f2155619..7021c6d76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,3 +17,13 @@ addons: before_install: - wget -qO- https://github.com/yihui/tinytex/raw/master/tools/download-travis-linux.sh | sh + +jobs: + include: + - r: release + name: R release / Pandoc devel + env: PATH=$HOME/bin:$PATH + before_install: + - wget -qO- https://github.com/rstudio/rmarkdown/raw/master/tools/install-pandoc.sh | sh + - r: release + name: R release / default Pandoc From 226c311f9f23d8d590f9715b53eb38a57aca7ebe Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Fri, 16 Oct 2020 12:17:08 +0200 Subject: [PATCH 3/5] use bionic like rmarkdown --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7021c6d76..e6e88478e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +dist: bionic language: r cache: packages: true From 6c29193543539ba17659f91b9aa460697bd2fcf5 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Fri, 16 Oct 2020 12:37:16 +0200 Subject: [PATCH 4/5] we need dev rmarkdown for Pandoc 2.11 --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index bd2eb03e1..d40bb5e47 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -49,10 +49,11 @@ Authors@R: c( Description: A suite of custom R Markdown formats and templates for authoring journal articles and conference submissions. License: GPL-3 -Imports: utils, rmarkdown (>= 1.18), knitr (>= 1.30), yaml, tinytex (>= 0.19), xfun +Imports: utils, rmarkdown (>= 2.4.6), knitr (>= 1.30), yaml, tinytex (>= 0.19), xfun SystemRequirements: GNU make URL: https://github.com/rstudio/rticles BugReports: https://github.com/rstudio/rticles/issues RoxygenNote: 7.1.1 Suggests: testit, bookdown, xtable Encoding: UTF-8 +Remotes: rstudio/rmarkdown From 07b74ac880522d37b8d8d12839cecaca3302eaa2 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Fri, 16 Oct 2020 13:00:06 +0200 Subject: [PATCH 5/5] use before_script to all have tinytex installed --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e6e88478e..8479865c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,13 +18,14 @@ addons: before_install: - wget -qO- https://github.com/yihui/tinytex/raw/master/tools/download-travis-linux.sh | sh + - tlmgr --version jobs: include: - r: release name: R release / Pandoc devel env: PATH=$HOME/bin:$PATH - before_install: + before_script: - wget -qO- https://github.com/rstudio/rmarkdown/raw/master/tools/install-pandoc.sh | sh - r: release name: R release / default Pandoc