% 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.
%
% 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: large sans-serif bold uppercase, with the
%%% tight before/after spacing the original memo style used.
\usepackage{titlesec}

\titleformat{\section}
  {\normalsize\sffamily\bfseries\MakeUppercase}{\thesection.}{0.5em}{}
\titlespacing*{\section}{0pt}{*1.5}{1pt}

\titleformat{\subsection}
  {\small\sffamily\bfseries\MakeUppercase}{\thesubsection.}{0.5em}{}
\titlespacing*{\subsection}{0pt}{*1}{1pt}

\titleformat{\subsubsection}[runin]
  {\footnotesize\sffamily\bfseries}{\thesubsubsection.}{0.5em}{}[\hskip 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.
\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}}

%%% 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
