diff --git a/data/templates/default.latex b/data/templates/default.latex index 6f73bbe..272ff76 100644 --- a/data/templates/default.latex +++ b/data/templates/default.latex @@ -1,7 +1,7 @@ \documentclass[10pt,a4paper,onecolumn]{article} \usepackage{marginnote} \usepackage{graphicx} -\usepackage[rgb]{xcolor} +\usepackage[rgb,svgnames]{xcolor} \usepackage{authblk,etoolbox} \usepackage{titlesec} \usepackage{calc} @@ -79,25 +79,38 @@ $endif$ \usepackage{fixltx2e} % provides \textsubscript $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} \newlength{\csllabelwidth} \setlength{\csllabelwidth}{3em} -\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 \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces\fi - % set entry spacing - \ifnum #2 > 0 - \setlength{\parskip}{#2\baselineskip} + \ifodd #1 + \setlength{\leftmargin}{\cslhangindent} + \setlength{\itemindent}{-1\cslhangindent} \fi - }% - {} + % set entry spacing + \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}\break} +\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$ diff --git a/data/templates/preprint.latex b/data/templates/preprint.latex index 2e8e3fd..7127589 100644 --- a/data/templates/preprint.latex +++ b/data/templates/preprint.latex @@ -127,7 +127,7 @@ $endif$ $if(verbatim-in-note)$ \usepackage{fancyvrb} $endif$ -\usepackage{xcolor} +\usepackage[rgb,svgnames]{xcolor} $if(listings)$ \usepackage{listings} \newcommand{\passthrough}[1]{#1} @@ -200,28 +200,38 @@ $if(pagestyle)$ \pagestyle{$pagestyle$} $endif$ $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} \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}\break} +\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$ $if(lang)$