diff --git a/memo_template/cdsc-memo.sty b/memo_template/cdsc-memo.sty index 3f7d704..0332b9e 100644 --- a/memo_template/cdsc-memo.sty +++ b/memo_template/cdsc-memo.sty @@ -2,12 +2,19 @@ % % 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. +% 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 % Copyright 2008-2009 Kieran Healy @@ -36,20 +43,35 @@ \pagestyle{cdsc-page-memo} -%%% Section headings: large sans-serif bold uppercase, with the -%%% tight before/after spacing the original memo style used. -\usepackage{titlesec} +%%% 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. -\titleformat{\section} - {\normalsize\sffamily\bfseries\MakeUppercase}{\thesection.}{0.5em}{} -\titlespacing*{\section}{0pt}{*1.5}{1pt} +\makeatletter -\titleformat{\subsection} - {\small\sffamily\bfseries\MakeUppercase}{\thesubsection.}{0.5em}{} -\titlespacing*{\subsection}{0pt}{*1}{1pt} +\renewcommand\section{\@startsection{section}{1}{\z@}% + {-1.8ex \@plus -1ex \@minus -.2ex}% + {1pt}% + {\normalsize\sffamily\bfseries\MakeUppercase}} -\titleformat{\subsubsection}[runin] - {\footnotesize\sffamily\bfseries}{\thesubsubsection.}{0.5em}{}[\hskip 0.5em] +\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. @@ -57,20 +79,21 @@ % \setcounter{secnumdepth}{2} %%% Title block: "TITLE [...] AUTHOR" on a single line, no date. -\usepackage{titling} - -\renewcommand{\maketitle}{% - \par\noindent\footnotesize\puB\par - {\large\sffamily\bfseries\MakeUppercase\thetitle}\hfill - {\large\sffamily\MakeUppercase\theauthor}% - \par\vskip 0.7em% -} - +%% %% \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} diff --git a/paper_template/cdsc-paper.sty b/paper_template/cdsc-paper.sty index 672ee09..ee532e0 100644 --- a/paper_template/cdsc-paper.sty +++ b/paper_template/cdsc-paper.sty @@ -1,18 +1,23 @@ % 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 +% 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. % +% Headings and the title block are built from the article class's own +% \@startsection and \@maketitle hooks rather than from titlesec and +% titling. 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 % 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.) @@ -45,21 +50,39 @@ \pagestyle{cdsc-page} -%%% Section heading styles (replaces memoir's \setsecheadstyle etc.) -\usepackage{titlesec} +%%% Section heading styles. +%%% +%%% Each heading is declared through \@startsection, which takes: +%%% {name}{level}{indent}{beforeskip}{afterskip}{style} +%%% A negative beforeskip suppresses the paragraph indent that would +%%% otherwise follow the heading; a negative afterskip makes the +%%% heading run into the paragraph text rather than sit on its own +%%% line. The style argument receives the whole heading as its +%%% argument, so a case-changing command may be appended to it. -% Sections: large small caps; period after the number -\titleformat{\section} - {\large\scshape}{\thesection.}{0.5em}{} -\titlespacing*{\section}{0pt}{*2}{1.7ex} +\makeatletter + +% Sections: large small caps +\renewcommand\section{\@startsection{section}{1}{\z@}% + {-1.8ex \@plus -1ex \@minus -.2ex}% + {1.7ex \@plus .2ex}% + {\large\scshape}} % Subsections: italic -\titleformat{\subsection} - {\normalsize\itshape}{\thesubsection.}{0.5em}{} +\renewcommand\subsection{\@startsection{subsection}{2}{\z@}% + {-3.25ex \@plus -1ex \@minus -.2ex}% + {1.5ex \@plus .2ex}% + {\normalsize\itshape}} -% Subsubsections: small bold, runin (matches memoir's negative skip behavior) -\titleformat{\subsubsection}[runin] - {\small\bfseries}{\thesubsubsection.}{0.5em}{}[\hskip 0.5em] +% Subsubsections: small bold, run in to the following paragraph +% (the negative afterskip is what makes it run in) +\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}% + {-3.25ex \@plus -1ex \@minus -.2ex}% + {-0.5em}% + {\small\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 numbering at the section level (matches the % memoir template's default of \setsecnumdepth{chapter}). To enable @@ -68,23 +91,37 @@ \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} - +%%% Title block: flush left, italic title, author below it. +%% %% \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} + +% \raggedright rather than \flushleft: the flushleft environment is a +% trivlist, and starting one as a bare declaration leaves a list open +% in the structure tree. That produces "the number of automatic begin +% and end text-unit para hooks differ" and a mis-nested PDF. +% The vertical skips reproduce what titling's \pretitle/\posttitle, +% \preauthor/\postauthor, and \predate/\postdate produced. The date +% slot keeps its space even when \date{} is empty, which is what the +% previous title block did and what the template's spacing assumes. +\renewcommand{\@maketitle}{% + \null + \vskip 2em% + \par\noindent\footnotesize\puB\par + \vskip 0.79em% + {\raggedright\LARGE\itshape\@title\par}% + \vskip 1.04em% + {\raggedright\large\lineskip 1em\@author\par}% + \vskip 0.79em% + {\raggedright\footnotesize\@date\par}% + \vskip 1em% + \par\vskip 2.44em% +} + +\makeatother %%% Abstract: runin style ("**Abstract:** the quick brown fox..."), %%% indented from both margins (via the quote environment, which gives