The tagging code hooks \@startsection to emit the H1/H2/H3 tags that a screen reader navigates by. titlesec replaces \section wholesale rather than going through that hook, so every heading vanished from the structure tree --- with no error to say so, which is why this went unnoticed. titling separately left an unclosed trivlist behind its \flushleft declarations, producing "the number of automatic begin and end text-unit para hooks differ" and a mis-nested tree. Both files now style headings through \@startsection and the title block through \@maketitle, using the class's own hooks. The style argument of \@startsection is applied to the whole heading, so the memo's uppercase headings append \MakeUppercase to it; the tagging code wraps the section number in \NoCaseChange so the number is left alone. Vertical spacing was matched against the previous output page by page: the memo now renders identically bar one heading a pixel off, and the paper's title block lands within two pixels. datetime is dropped from cdsc-paper.sty. Only \today was ever used from it and that is built in. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
114 lines
3.8 KiB
TeX
114 lines
3.8 KiB
TeX
% Memo-style page layout for CDSC documents.
|
|
%
|
|
% Article-class equivalent of the old cdsc-memo chapterstyle that
|
|
% lived in cdsc-memoir.sty. Targets the standard `article' class so
|
|
% the LaTeX tagging project can produce tagged, accessible PDFs.
|
|
%
|
|
% Look-and-feel: sans-serif uppercase title and author on a single
|
|
% line, sans-serif uppercase section headings, no paragraph indent,
|
|
% and a small-caps "page/total" footer.
|
|
%
|
|
% Headings come from the article class's own \@startsection hook
|
|
% rather than from titlesec. The tagging code hooks into
|
|
% \@startsection to emit the H1, H2, and H3 tags a screen reader
|
|
% navigates by; titlesec bypasses that hook, so loading it silently
|
|
% produces a PDF with no headings in the structure tree. See the
|
|
% Accessibility section of the README.
|
|
%
|
|
% 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{xcolor}
|
|
|
|
%%% Page style: empty header; "page/total" centered in the footer.
|
|
\usepackage{fancyhdr}
|
|
\setlength{\headheight}{14.5pt}
|
|
\addtolength{\topmargin}{-2.5pt}
|
|
|
|
\fancypagestyle{cdsc-page-memo}{%
|
|
\fancyhf{}%
|
|
\fancyfoot[C]{\scshape\thepage/\pageref*{LastPage}}%
|
|
\renewcommand{\headrulewidth}{0pt}%
|
|
}
|
|
|
|
% Variant with git revision info in the footer (requires the vc package).
|
|
\fancypagestyle{cdsc-page-memo-git}{%
|
|
\fancyhf{}%
|
|
\fancyfoot[C]{\texttt{\footnotesize\textcolor{BrickRed}{git revision \VCRevision\ on \VCDateTEX}}}%
|
|
\renewcommand{\headrulewidth}{0pt}%
|
|
}
|
|
|
|
\pagestyle{cdsc-page-memo}
|
|
|
|
%%% Section headings: sans-serif bold uppercase, with the tight
|
|
%%% before/after spacing the original memo style used.
|
|
%%%
|
|
%%% \@startsection takes {name}{level}{indent}{beforeskip}{afterskip}
|
|
%%% {style}. The style argument is applied to the whole heading as an
|
|
%%% argument, so \MakeUppercase can be appended to it; the tagging
|
|
%%% code wraps the section number in \NoCaseChange so the number is
|
|
%%% left alone. A negative afterskip makes a heading run in to the
|
|
%%% paragraph that follows it.
|
|
|
|
\makeatletter
|
|
|
|
\renewcommand\section{\@startsection{section}{1}{\z@}%
|
|
{-1.8ex \@plus -1ex \@minus -.2ex}%
|
|
{1pt}%
|
|
{\normalsize\sffamily\bfseries\MakeUppercase}}
|
|
|
|
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
|
|
{-1.3ex \@plus -1ex \@minus -.2ex}%
|
|
{1pt}%
|
|
{\small\sffamily\bfseries\MakeUppercase}}
|
|
|
|
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
|
|
{-1ex \@plus -1ex \@minus -.2ex}%
|
|
{-0.5em}%
|
|
{\footnotesize\sffamily\bfseries}}
|
|
|
|
% Period after the section number, when numbering is switched on below
|
|
\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname.\hspace{0.5em}}
|
|
|
|
% By default, suppress section numbering. To enable numbered sections
|
|
% and subsections, comment the line below and uncomment the alternative.
|
|
\setcounter{secnumdepth}{0}
|
|
% \setcounter{secnumdepth}{2}
|
|
|
|
%%% Title block: "TITLE [...] AUTHOR" on a single line, no date.
|
|
%%
|
|
%% \published{...}: a note about publication status, printed in small
|
|
%% type at the very top of the title block.
|
|
\newcommand{\puB}{}
|
|
\newcommand{\published}[1]{\gdef\puB{#1}}
|
|
|
|
\renewcommand{\maketitle}{%
|
|
\par\noindent\footnotesize\puB\par
|
|
{\large\sffamily\bfseries\MakeUppercase{\@title}}\hfill
|
|
{\large\sffamily\MakeUppercase{\@author}}%
|
|
\par\vskip 0.7em%
|
|
}
|
|
|
|
\makeatother
|
|
|
|
%%% List spacing
|
|
\usepackage{enumitem}
|
|
\setlist{topsep=0pt, partopsep=0pt}
|
|
|
|
%%% Caption font
|
|
\usepackage{caption}
|
|
\captionsetup{font=small}
|
|
|
|
%%% No paragraph indent (memos use a blank-line paragraph break style).
|
|
\setlength{\parindent}{0pt}
|
|
|
|
%%% 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
|