Newer
Older
LaTeX / lectures / deprecated / lecturenotes.cls
\def\filedate{21 July 2020}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Document class for lecture slide notes.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Version History
% v1.0   Initial version
% v1.0.1 Changed package loading order to ensure that hyperref is last.
% v1.0.2 Changed punctuation of header.
% v1.0.3 Corrected the provided class!
% v1.1   Added nochapters option.
% v1.2   Added support for configurable class types.
% v1.3   Replaced deprecated fancyhdr macros.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}[2001/06/01]
\ProvidesClass{lecturenotes}%
         [2020/07/21 INFO lecture notes style, v1.3]


% "Stream of conciousness" chapters vs. explicit individual classes. NOTE:
% you can't have both chapters and classes! This is because we use the same
% chapter macros for both cases, but they're applied differently (e.g., if
% nochapters is set, then \insertchapternumber represent the class number).
\newif\if@chapters \@chapterstrue
\DeclareOption{nochapters}{\@chaptersfalse}


\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
\LoadClass{article}


% The article class doesn't have a chapter counter.
\newcounter{chapter}


% Load required packages.
\RequirePackage{pdfpages}
\RequirePackage[a4paper,pdftex]{geometry}
\RequirePackage{fancyhdr}
% DO NOT REMOVE THE NEXT LINE! The lecturesetup package loads a bunch
% of other packages, some of which are referenced below.
\RequirePackage{lecturecommon}


% Fix margins.
\geometry{vmargin=0.9in,hmargin=0.25in}

\raggedright


\if@chapters
    \SetClassType{Chapter}
\fi


% hyperref setup. We have to use a slightly convoluted method, because the
% macros referenced here haven't been set yet. Define the hyperref setup
% as a new macro, and call this AFTER initialising the paper and chapter
% variables.
\newcommand{\inithyperref}{%
	\hypersetup{%
		pdftitle={\PaperCode\ \ClassType\ \thechapter\ Speaker Notes},%
		pdfsubject={\ShortClassTitle},%
		colorlinks=false%
	}%
}


% Set up fancy headings.
\fancyhf{}
\fancyhead[C]{\Huge\sffamily\bfseries \PaperCode, \TeachingPeriod, \YearOffered}

\fancyfoot[L]{\large\sffamily\bfseries \ClassType\ \thechapter: \ShortClassTitle\ --- Notes}
\fancyfoot[R]{\large\sffamily\bfseries\thepage}

\renewcommand{\footrulewidth}{0mm}
\renewcommand{\headrulewidth}{0mm}

% Ensure first page footer is correctly positioned.
% (see https://tex.stackexchange.com/a/442558)
\setlength{\headheight}{30pt}

\pagestyle{fancy}


\endinput