paper_template (knitr): port to master's article + lualatex stack
Bring the knitr paper template up to date with the typography work
on master. The preamble now mirrors master's paper_template/text.tex:
- \DocumentMetadata{pdfstandard=ua-2} + tagpdf instead of the old
memoir / pdfmanagement-only setup
- article class with cdsc-paper.sty (the article-class replacement
for cdsc-memoir.sty added on master)
- fontspec with EB Garamond and TeX Gyre Heros, plus
\defaultfontfeatures{Ligatures=TeX} so --, ---, ``, '' work
- Makefile builds with latexmk -lualatex instead of -pdf
The knitr-specific bits are preserved unchanged:
- <<init>>= chunk for knit_hooks and resources/preamble.R
- <<test_table>>= chunk demonstrating kable inside a table float
- %.tex: %.Rtex pattern rule for knit() in the Makefile
verapdf --flavour ua2: 0 failures, 1723 passed rules.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
110
paper_template/cdsc-paper.sty
Normal file
110
paper_template/cdsc-paper.sty
Normal file
@@ -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 <mako@atdot.cc>
|
||||
% Copyright 2008-2009 Kieran Healy <kjhealy@soc.duke.edu>
|
||||
|
||||
% 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
|
||||
Reference in New Issue
Block a user