diff --git a/paper_template/Makefile b/paper_template/Makefile index 595c370..a0f7312 100644 --- a/paper_template/Makefile +++ b/paper_template/Makefile @@ -5,8 +5,8 @@ all: $(patsubst %.Rtex,%.pdf,$(wildcard *.Rtex)) %.tex: %.Rtex Rscript -e "library(knitr); knit('$<')" -%.pdf: %.tex - latexmk -f -pdf $< +%.pdf: %.tex + latexmk -f -lualatex $< clean: latexmk -C *.tex diff --git a/paper_template/cdsc-memoir.sty b/paper_template/cdsc-memoir.sty deleted file mode 100644 index 3735dc5..0000000 --- a/paper_template/cdsc-memoir.sty +++ /dev/null @@ -1,209 +0,0 @@ -% Some article styles and page layout tweaks for the LaTeX Memoir -% class. -% -% Copyright 2009-2018 Benjamin Mako Hill -% Copyright 2008-2009 Kieran Healy - -% Distributed as free software under the GNU GPL v3 - -% This file was originally based on one by Kieran Healy -% available here: http://github.com/kjhealy/latex-custom-kjh/ - -%%% Custom styles for headers and footers -%%% Basic - -\makepagestyle{cdsc-page} -%\makeevenfoot{cdsc-page}{\thepage}{}{} -%\makeoddfoot{cdsc-page}{}{}{\thepage} -%\makeheadrule{cdsc-page}{\textwidth}{\normalrulethickness} -\newcommand{\@cdscmarks}{% - \let\@mkboth\markboth - \def\chaptermark##1{% - \markboth{% - \ifnum \c@secnumdepth >\m@ne - \if@mainmatter - \thechapter. \ % - \fi - \fi - ##1}{}} - \def\sectionmark##1{% - \markright{##1}} -} -\makepsmarks{cdsc-page}{\@cdscmarks} -\makepsmarks{cdsc-page}{} -\makeevenhead{cdsc-page}{}{}{\scshape\thepage} -\makeoddhead{cdsc-page}{}{}{\scshape\thepage} - -%%% version control info in footers; requires vc package -% Make the style for vc-git revision control headers and footers -\makepagestyle{cdsc-page-git} -\newcommand{\@gitmarks}{% - \let\@mkboth\markboth - \def\chaptermark##1{% - \markboth{% - \ifnum \c@secnumdepth >\m@ne - \if@mainmatter - \thechapter. \ % - \fi - \fi - ##1}{}} - \def\sectionmark##1{% - \markright{##1}} -} -\makepsmarks{cdsc-page-git}{\@gitmarks} -\makeevenhead{cdsc-page-git}{}{}{\scshape\thepage} -\makeoddhead{cdsc-page-git}{}{}{\scshape\thepage} -\makeevenfoot{cdsc-page-git}{}{\texttt{\footnotesize{\textcolor{BrickRed}{git revision \VCRevision\ on \VCDateTEX}}}}{} -\makeoddfoot{cdsc-page-git}{}{\texttt{\footnotesize \textcolor{BrickRed}{git revision \VCRevision\ on \VCDateTEX}}}{} - -%%% print a datestamp from ShareLaTeX -\makepagestyle{cdsc-page-overleaf} -\newcommand{\@slmarks}{% - \let\@mkboth\markboth - \def\chaptermark##1{% - \markboth{% - \ifnum \c@secnumdepth >\m@ne - \if@mainmatter - \thechapter. \ % - \fi - \fi - ##1}{}} - \def\sectionmark##1{% - \markright{##1}} -} -\makepsmarks{cdsc-page-overleaf}{\@slmarks} -\makeevenhead{cdsc-page-overleaf}{}{}{\scshape\thepage} -\makeoddhead{cdsc-page-overleaf}{}{}{\scshape\thepage} -\makeevenfoot{cdsc-page-overleaf}{}{\texttt{\footnotesize{\textcolor{BrickRed}{Buildstamp/Version:~\pdfdate}}}}{} -\makeoddfoot{cdsc-page-overleaf}{}{\texttt{\footnotesize{\textcolor{BrickRed}{Buildstamp/Version:~\pdfdate}}}}{} - -%% Create a command to make a note at the top of the first page describing the -%% publication status of the paper. -\newcommand{\published}[1]{% - \gdef\puB{#1}} - \newcommand{\puB}{} - \renewcommand{\maketitlehooka}{% - \par\noindent\footnotesize \puB} - -\makepagestyle{cdsc-page-memo} -\makeevenhead{cdsc-page-memo}{}{}{} -\makeoddhead{cdsc-page-memo}{}{}{} -\makeevenfoot{cdsc-page-memo}{}{\scshape \thepage/\pageref{LastPage}}{} -\makeoddfoot{cdsc-page-memo}{}{\scshape \thepage/\pageref{LastPage}}{} - -\usepackage{lastpage} -\usepackage{datetime} - -% blank footnote -% Use \symbolfootnote[0]{Footnote text} for a blank footnote. -% Useful for initial acknowledgment note. -\long\def\symbolfootnote[#1]#2{\begingroup% -\def\thefootnote{\fnsymbol{footnote}}\footnote[#1]{#2}\endgroup} - -% put a period after the section numbers -\setsecnumformat{\csname the#1\endcsname.\enspace} - -% set fonts to garamond and helvetica -\renewcommand{\rmdefault}{ugm} -\renewcommand{\sfdefault}{phv} - -% material shared between the two modes - -\setsubsecheadstyle{\normalsize\itshape} -\setaftersubsubsecskip{-1em} -\setsubsubsecheadstyle{\small\bfseries} -\renewcommand{\printchaptername}{} -\renewcommand{\chapternamenum}{} -\renewcommand{\chapnumfont}{\chaptitlefont} -\renewcommand{\printchapternum}{\chapnumfont \thechapter\space} -\renewcommand{\afterchapternum}{} -\renewcommand{\printchaptername}{\secheadstyle} -\renewcommand{\cftchapterfont}{\normalfont} -\renewcommand{\cftchapterpagefont}{\normalfont\scshape} -\renewcommand{\cftchapterpresnum}{\scshape} -\captiontitlefont{\small} - -% turn off chapter numbering -\counterwithout{section}{chapter} -\counterwithout{figure}{chapter} -\counterwithout{table}{chapter} - -% supress chapter numbers -\maxsecnumdepth{chapter} -\setsecnumdepth{chapter} - -% for numbered sections and subsections: -% (a) comment out the above stanza; (b) uncomment the one below -% \maxsecnumdepth{subsection} -% \setsecnumdepth{subsection} - -% set name of bibliography to 'references' -\renewcommand{\bibname}{References} - -% >> cdsc-article << -\makechapterstyle{cdsc-article}{ - - % section heading sytle - \setsecheadstyle{\large\scshape} - - % reduce skip after section heading - \setaftersecskip{1.7ex} - - % Title flush left - \pretitle{\flushleft\LARGE \itshape} - \posttitle{\par\vskip 0.5em} - \preauthor{\flushleft \large \lineskip 1em} - \postauthor{\par\lineskip 1em} - \predate{\flushleft\footnotesize\vspace{0.65em}} - \postdate{\par\vskip 1em} - - % 'abstract' title, bigger skip from title - \renewcommand{\abstractname}{Abstract:} - \renewcommand{\abstractnamefont}{\normalfont\small\bfseries} - \renewcommand{\abstracttextfont}{\normalfont\small} - \setlength{\absparindent}{0em} - \setlength{\abstitleskip}{-1.5em} - \abstractrunin - - % this is the default page style for chapters - \pagestyle{cdsc-page} - -} - -% >> cdsc-memo << -\makechapterstyle{cdsc-memo}{ - - % section heading sytle - \setsecheadstyle{\large\sffamily\bfseries\MakeUppercase} - - % reduce skip after section heading - \setaftersecskip{1pt} - \setbeforesecskip{-1em} - \setaftersubsecskip{1pt} - \setbeforesubsecskip{-1em} - % \setaftersubsubsecskip{1pt} - % \setbeforesubsubsecskip{-1em} - - - % 'abstract' title, bigger skip from title - % \renewcommand{\maketitle}{\{\preauthor \theauthor\} \hfill \thetitle} - \renewcommand{\maketitle}{ - {\Large\sffamily\bfseries\MakeUppercase\thetitle} \hfill - {\Large\sffamily\MakeUppercase\theauthor} - \vskip 0.7em} - \renewcommand{\abstractname}{\normalfont\scriptsize\noindent} - \renewcommand{\abstracttextfont}{\normalfont\scriptsize} - \abstractrunin - - % set name of bibliography to 'references' - \renewcommand{\bibname}{References} - - \parindent 0pt - - % this is the default page style for chapters - \pagestyle{cdsc-page-memo} - -} - -\endinput - diff --git a/paper_template/cdsc-paper.sty b/paper_template/cdsc-paper.sty new file mode 100644 index 0000000..672ee09 --- /dev/null +++ b/paper_template/cdsc-paper.sty @@ -0,0 +1,110 @@ +% Article-class styles and page layout for CDSC paper documents. +% +% This file replaces the older cdsc-memoir.sty. It targets the +% standard `article' class so the LaTeX tagging-project can produce +% tagged, accessible PDFs --- memoir is currently incompatible with +% that work. The look-and-feel is kept as close to the previous +% cdsc-article chapterstyle as is practical. +% +% Copyright 2009-2026 Benjamin Mako Hill +% Copyright 2008-2009 Kieran Healy + +% Distributed as free software under the GNU GPL v3 + +\usepackage{lastpage} +\usepackage{datetime} +\usepackage{xcolor} + +%%% Page styles (replaces memoir's \makepagestyle / \makeevenhead etc.) +\usepackage{fancyhdr} +\setlength{\headheight}{14.5pt} +\addtolength{\topmargin}{-2.5pt} + +% Basic: page number in small caps in the upper-right corner +\fancypagestyle{cdsc-page}{% + \fancyhf{}% + \fancyhead[R]{\scshape\thepage}% + \renewcommand{\headrulewidth}{0pt}% +} + +% Variant with git revision info in the footer (requires the vc package). +\fancypagestyle{cdsc-page-git}{% + \fancyhf{}% + \fancyhead[R]{\scshape\thepage}% + \fancyfoot[C]{\texttt{\footnotesize\textcolor{BrickRed}{git revision \VCRevision\ on \VCDateTEX}}}% + \renewcommand{\headrulewidth}{0pt}% +} + +% Variant with a build timestamp in the footer (useful on Overleaf/etc.) +\fancypagestyle{cdsc-page-overleaf}{% + \fancyhf{}% + \fancyhead[R]{\scshape\thepage}% + \fancyfoot[C]{\texttt{\footnotesize\textcolor{BrickRed}{Buildstamp/Version:~\today}}}% + \renewcommand{\headrulewidth}{0pt}% +} + +\pagestyle{cdsc-page} + +%%% Section heading styles (replaces memoir's \setsecheadstyle etc.) +\usepackage{titlesec} + +% Sections: large small caps; period after the number +\titleformat{\section} + {\large\scshape}{\thesection.}{0.5em}{} +\titlespacing*{\section}{0pt}{*2}{1.7ex} + +% Subsections: italic +\titleformat{\subsection} + {\normalsize\itshape}{\thesubsection.}{0.5em}{} + +% Subsubsections: small bold, runin (matches memoir's negative skip behavior) +\titleformat{\subsubsection}[runin] + {\small\bfseries}{\thesubsubsection.}{0.5em}{}[\hskip 0.5em] + +% By default, suppress numbering at the section level (matches the +% memoir template's default of \setsecnumdepth{chapter}). To enable +% numbered sections and subsections, comment the line below and +% uncomment the alternative. +\setcounter{secnumdepth}{0} +% \setcounter{secnumdepth}{2} + +%%% Title block (titling package replaces memoir's title hooks) +\usepackage{titling} + +% Title flush left, italic, large +\pretitle{\flushleft\LARGE\itshape} +\posttitle{\par\vskip 0.5em} +\preauthor{\flushleft\large\lineskip 1em} +\postauthor{\par\lineskip 1em} +\predate{\flushleft\footnotesize\vspace{0.65em}} +\postdate{\par\vskip 1em} + +%% \published{...}: a note about the publication status, printed in +%% small type at the very top of the title block. Use this for +%% draft/working-paper notices. +\newcommand{\puB}{} +\newcommand{\published}[1]{\gdef\puB{#1}} +\renewcommand{\maketitlehooka}{\par\noindent\footnotesize\puB} + +%%% Abstract: runin style ("**Abstract:** the quick brown fox..."), +%%% indented from both margins (via the quote environment, which gives +%%% the side indent without adding first-line paragraph indentation). +\renewenvironment{abstract}% + {\par\addvspace{\medskipamount}\small + \begin{quote}\noindent\textbf{Abstract:}\hspace{0.5em}\ignorespaces}% + {\end{quote}\par\medskip} + +%%% List spacing (replaces memoir's \firmlists --- tighter lists) +\usepackage{enumitem} +\setlist{topsep=0pt, partopsep=0pt} + +%%% Caption font +\usepackage{caption} +\captionsetup{font=small} + +%%% Footnote symbol command (for \thanks{} footnotes that should not +%%% have a numeric mark). Use as \symbolfootnote[0]{Footnote text}. +\long\def\symbolfootnote[#1]#2{\begingroup% + \def\thefootnote{\fnsymbol{footnote}}\footnote[#1]{#2}\endgroup} + +\endinput diff --git a/paper_template/text.Rtex b/paper_template/text.Rtex index f527322..476d6e5 100644 --- a/paper_template/text.Rtex +++ b/paper_template/text.Rtex @@ -1,14 +1,17 @@ -\documentclass[12pt]{memoir} +% Tagged PDF (PDF/UA-2) accessibility setup. The article class works +% with the LaTeX tagging-project, so we use the full \DocumentMetadata +% path here. +\DocumentMetadata{ + pdfversion=2.0, + pdfstandard=ua-2, + lang=en-US, +} -\usepackage{cdsc-memoir} -% there are two chapter styles: cdsc-article and cdsc-memo -% memo assumes that you remove the "\\" and the email address from the -% \author field below as well as that you will comment out the -% \published tag -\chapterstyle{cdsc-article} +\documentclass[12pt]{article} -\usepackage[utf8]{inputenc} -\usepackage{wrapfig} +\usepackage{cdsc-paper} +\usepackage{tagpdf} +\tagpdfsetup{activate-all} <>= knit_hooks$set(document = function(x) { @@ -21,9 +24,14 @@ opts_chunk$set(fig.path="figures/knitr-") source("resources/preamble.R") @ -\usepackage[T1]{fontenc} -\usepackage{textcomp} -\usepackage[garamond]{mathdesign} +\usepackage{fontspec} +% fontspec disables the classic TeX input ligatures by default +% (-- => en-dash, --- => em-dash, `` and '' => curly quotes), so +% re-enable them globally for every font loaded below. +\defaultfontfeatures{Ligatures=TeX} +\setmainfont{EB Garamond} +\setsansfont{TeX Gyre Heros} +\usepackage{wrapfig} \usepackage[letterpaper,left=1.65in,right=1.65in,top=1.3in,bottom=1.2in]{geometry} @@ -39,8 +47,15 @@ source("resources/preamble.R") % import and customize urls \usepackage[dvipsnames]{xcolor} \usepackage[breaklinks]{hyperref} + +% pdftitle/pdfauthor populate PDF and XMP metadata; keep these in sync +% with \title{} and \author{} below. UA-2 requires dc:title in XMP. \hypersetup{colorlinks=true, linkcolor=Black, citecolor=Black, filecolor=Blue, - urlcolor=Blue, unicode=true} + urlcolor=Blue, unicode=true, + pdftitle={Title}, + pdfauthor={Your Name}, + pdflang={en-US}, + pdfdisplaydoctitle=true} % list of footnote symbols for \thanks{} \makeatletter @@ -50,7 +65,7 @@ source("resources/preamble.R") \makeatother \newcommand*\samethanks[1][\value{footnote}]{\footnotemark[#1]} -% add bibliographic stuff +% add bibliographic stuff \usepackage[american]{babel} \usepackage{csquotes} \usepackage[natbib=true, style=apa, backend=biber]{biblatex} @@ -60,15 +75,11 @@ source("resources/preamble.R") \defbibheading{secbib}[\bibname]{% \section*{#1}% \markboth{#1}{#1}% - \baselineskip 14.2pt% - \prebibhook} + \baselineskip 14.2pt} \def\citepos#1{\citeauthor{#1}'s (\citeyear{#1})} \def\citespos#1{\citeauthor{#1}' (\citeyear{#1})} -% memoir function to take out of the space out of the whitespace lists -\firmlists - % LATEX NOTE: these lines will import vc stuff after running `make vc` which % will add version control information to the bottom of each page. This can be % useful for keeping track of which version of a document somebody has: @@ -117,7 +128,7 @@ fox jumps over the lazy dog. % between 45-90 characters and a rule of thumb for typesetting is that you % should be able to fit between 2-3 alphabets on one line. Generally speaking, % the shorter the line length, the better -- and the smaller the linespacing -% can become. The following line is 3 alphabets (73 characters). +% can become. The following line is 3 alphabets (73 characters). abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz @@ -137,14 +148,6 @@ brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog \citep{989866}. -The quick brown fox jumps over the lazy dog. The quick brown fox jumps -over the lazy dog. The quick brown fox jumps over the lazy dog. The -quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick -brown fox jumps over the lazy dog. The quick brown fox jumps over the -lazy dog. The quick brown fox jumps over the lazy dog. The quick brown -fox jumps over the lazy dog \citep{989866}. - \begin{table} \centering <>= @@ -170,38 +173,6 @@ brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog \citep{989866}. -The quick brown fox jumps over the lazy dog. The quick brown fox jumps -over the lazy dog. The quick brown fox jumps over the lazy dog. The -quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick -brown fox jumps over the lazy dog. The quick brown fox jumps over the -lazy dog. The quick brown fox jumps over the lazy dog. The quick brown -fox jumps over the lazy dog \citep{989866}. - -The quick brown fox jumps over the lazy dog. The quick brown fox jumps -over the lazy dog. The quick brown fox jumps over the lazy dog. The -quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick -brown fox jumps over the lazy dog. The quick brown fox jumps over the -lazy dog. The quick brown fox jumps over the lazy dog. The quick brown -fox jumps over the lazy dog \citep{989866}. - -The quick brown fox jumps over the lazy dog. The quick brown fox jumps -over the lazy dog. The quick brown fox jumps over the lazy dog. The -quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick -brown fox jumps over the lazy dog. The quick brown fox jumps over the -lazy dog. The quick brown fox jumps over the lazy dog. The quick brown -fox jumps over the lazy dog \citep{989866}. - -The quick brown fox jumps over the lazy dog. The quick brown fox jumps -over the lazy dog. The quick brown fox jumps over the lazy dog. The -quick brown fox jumps over the lazy dog. The quick brown fox jumps over -the lazy dog. The quick brown fox jumps over the lazy dog. The quick -brown fox jumps over the lazy dog. The quick brown fox jumps over the -lazy dog. The quick brown fox jumps over the lazy dog. The quick brown -fox jumps over the lazy dog \citep{989866}. - % bibliography here \setcounter{biburlnumpenalty}{9001} \printbibliography[title = {References}, heading=secbib] @@ -209,4 +180,4 @@ fox jumps over the lazy dog \citep{989866}. \end{document} -% LocalWords: +% LocalWords: