Newer
Older
LaTeX / lecturecommon.sty
\def\filedate{27 October 2022}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Common definitions shared across the various lecture document classes.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Version History
% v1.0   Initial version.
% v1.0.1 Fixed incorrect provided package name.
% v1.0.2 Increased number of tab stops in codesyntaxblock environment.
% v1.1   Added Unicode/XeLaTeX support.
%        Added exercise environment.
% v1.2   Switched to "class" instead of "chapter".
% v1.2.1 Fixed fontspec option clash and made font handling consistent with XML framework.
% v1.2.2 Fixed incorrect Roman font in math mode.
% v1.2.3 Switched XeLaTeX fonts to new University standard (Minion Pro + Open Sans).
% v1.2.4 Fixed "class number plus one" so that it can be passed as a number to other macros.
% v1.2.5 Disabled Mapping=tex-text for mono font to eliminate automatic curly quotes.
% v1.2.6 Enabled unicode option for hyperref when using Xe(La)TeX.
% v1.2.7 Reverted unicode option for hyperref due to option clash error.
% v1.3   Switched to otagofonts.sty for font configuration.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}[2001/06/01]
\ProvidesPackage{lecturecommon}[2022/10/27 INFO standard lecture setup v1.3]


% Standard packages common to ALL lecture documents.

\RequirePackage{amsmath} % needs to be loaded before mathspec

\RequirePackage{otagofonts}

\RequirePackage{boxedminipage}
\RequirePackage{graphicx}
\RequirePackage{hyperref}

\hypersetup{pdfpagemode=UseNone}


% Standard macros and package configuration common to ALL lecture notes
% documents.

% graphicx setup.
\graphicspath{{images/}}

% Simple code listing setup.
\newcommand{\keyword}[1]{\texttt{\uppercase{#1}}}
\newcommand{\nonterminal}[1]{\textit{\texttt{#1}}}
% Note: maximum 13 tab stops in a tabbing environment. (Bah.)
\newenvironment{codesyntaxblock}[1][\normalsize]%
    {\begingroup\ttfamily#1\begin{tabbing}mm\=mm\=mm\=mm\=mm\=mm\=mm\=mm\=mm\=mm\=mm\=mm\=mm\=\kill}%
    {\end{tabbing}\endgroup}


% Environment for boxed exercises.
\newcounter{exercise}
\setcounter{exercise}{0}
% Arguments: #1 width of box to set the exercise text in (defaults to \columnwidth).
\newenvironment{exercise}[1][\columnwidth]%
    {\noindent\refstepcounter{exercise}\begin{boxedminipage}{#1}\textbf{Exercise \theexercise: }}%
    {\end{boxedminipage}}
% Starred form produces an unnumbered exercise.
\newenvironment{exercise*}[1][\columnwidth]%
    {\noindent\begin{boxedminipage}{#1}\textbf{Exercise: }}%
    {\end{boxedminipage}}


% Standard variables for various things, and macros for initialising them.
% These can be used (or not) as necessary.


% Paper variables: subject code.
\newcommand{\SubjectCode}{UNDEFINED}
\newcommand{\SetSubjectCode}[1]{\renewcommand{\SubjectCode}{#1}}


% Paper number.
\newcommand{\PaperNumber}{UNDEFINED}
\newcommand{\SetPaperNumber}[1]{\renewcommand{\PaperNumber}{#1}}


% Convenience macro for printing out the full paper code.
\newcommand{\PaperCode}{\SubjectCode~\PaperNumber}


% Paper title.
\newcommand{\PaperTitle}{UNDEFINED}
\newcommand{\SetPaperTitle}[1]{\renewcommand{\PaperTitle}{#1}}


% Department name.
\newcommand{\DepartmentName}{UNDEFINED}
\newcommand{\SetDepartmentName}[1]{\renewcommand{\DepartmentName}{#1}}


% Teaching period.
\newcommand{\TeachingPeriod}{UNDEFINED}
\newcommand{\SetTeachingPeriod}[1]{\renewcommand{\TeachingPeriod}{#1}}


% Year offered.
\newcommand{\YearOffered}{UNDEFINED}
\newcommand{\SetYearOffered}[1]{\renewcommand{\YearOffered}{#1}}


% Oracle version.
\newcommand{\Oracle}{UNDEFINED}
\newcommand{\SetOracleVersion}[1]{\renewcommand{\Oracle}{#1}}


% Class number.
\newcounter{chapterplusone}
\newcommand{\ClassNumber}{\thechapter}
\newcommand{\ClassNumberPlusOne}{\thechapterplusone}
\newcommand{\SetClassNumber}[1]{%
    \setcounter{chapter}{#1}%
    \setcounter{chapterplusone}{#1}%
    \stepcounter{chapterplusone}%
}

% Backwards compatibility with the old syntax
\newcommand{\ChapterNumber}{\ClassNumber}
\newcommand{\ChapterNumberPlusOne}{\ClassNumberPlusOne}
\newcommand{\SetChapterNumber}[1]{\SetClassNumber{#1}}


% Class title.
\newcommand{\ClassTitle}{UNDEFINED}
\newcommand{\SetClassTitle}[1]{\renewcommand{\ClassTitle}{#1}}

\newcommand{\ShortClassTitle}{UNDEFINED}
\newcommand{\SetShortClassTitle}[1]{\renewcommand{\ShortClassTitle}{#1}}

% Backwards compatibility with the old syntax
\newcommand{\ChapterTitle}{\ClassTitle}
\newcommand{\SetChapterTitle}[1]{\SetClassTitle{#1}}
\newcommand{\ShortChapterTitle}{\ShortClassTitle}
\newcommand{\SetShortChapterTitle}[1]{\SetShortClassTitle{#1}}


% Class type.
\newcommand{\ClassType}{Lecture}
\newcommand{\SetClassType}[1]{\renewcommand{\ClassType}{#1}}


\endinput