GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
LaTeX
Browse code
Merge commit '
402b8e9
'
master
commit
c1b6a0e564611ac08a1f39302ca0521c6215e9cd
2 parents
79ed4a4
+
402b8e9
Nigel Stanger
authored
on 2 May
Patch
Showing
2 changed files
lectures/otagofonts.sty
lectures/otagoslides.cls
Ignore Space
Show notes
View
lectures/otagofonts.sty
\def\filedate{2 May 2024} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Set up official Otago fonts based on what’s available. Fall back to close % facsimiles where possible. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Version History % v1.0 Initial version, rebuilt from deprecated lecturecommon package. % v1.1 Refactored font checking mechanism. % v1.2 Fixed sans-serif scaling, added Noto Sans. % v1.3 Added new Wickliffe fonts and fallbacks. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e}[2001/06/01] \ProvidesPackage{otagofonts}[2024/05/02 Otago standard fonts v1.3] \RequirePackage{etoolbox} \RequirePackage{ifxetex} \RequirePackage{amsmath} % needs to be loaded before mathspec \ifxetex \RequirePackage[no-math]{fontspec} \RequirePackage{mathspec} \RequirePackage{xunicode} \RequirePackage{xltxtra} % Try a few different fonts that are either the official Otago font, or a reasonable % facsimile thereof. Effectively done via a bunch of nested ifs. I did try using % etoolbox's list looping macros, but the tricky part was making it generic for all % three categories of font (primary, sans, mono), and I could only successfully make % work for the first one encountered. The set of fonts is limited, so this is OK. % % Note: Explicitly specify Mapping=tex-text only for the primary and sans fonts, % otherwise curly quotes will automatically appear in the mono font. Since % this is pretty much exclusively used for code listings, this is a bad thing. % Primary font (body text, maths). \newbool{foundprimaryfont} \PackageInfo{otagofonts}{Looking for suitable primary font} \renewcommand*{\do}[1]{% \PackageInfo{otagofonts}{Trying #1...} \IfFontExistsTF{#1}{% % The following line is equivalent to: % \setmainfont{fontname}[options] % \setmathsfont(Latin,Digits){fontname} % \setmathrm{fontname} \setprimaryfont[Mapping=tex-text]{#1}% \PackageInfo{otagofonts}{Using #1 for primary font}% \booltrue{foundprimaryfont}% \listbreak% }{}% } \docsvlist{Wickliffe,Minion Pro,Crimson Pro,Crimson Text,Georgia,Times New Roman} \ifbool{foundprimaryfont}{% % Hack to prevent digits in hyperlinks from being set in the main font instead of the mono font. % Note: doesn't matter if this is executed multiple times. Only works if you use \setprimaryfont % or \setmathsfont first. From https://tex.stackexchange.com/a/99774. \makeatletter% \DeclareMathSymbol{0}{\mathalpha}{\eu@DigitsArabic@symfont}{`0}% \DeclareMathSymbol{1}{\mathalpha}{\eu@DigitsArabic@symfont}{`1}% \DeclareMathSymbol{2}{\mathalpha}{\eu@DigitsArabic@symfont}{`2}% \DeclareMathSymbol{3}{\mathalpha}{\eu@DigitsArabic@symfont}{`3}% \DeclareMathSymbol{4}{\mathalpha}{\eu@DigitsArabic@symfont}{`4}% \DeclareMathSymbol{5}{\mathalpha}{\eu@DigitsArabic@symfont}{`5}% \DeclareMathSymbol{6}{\mathalpha}{\eu@DigitsArabic@symfont}{`6}% \DeclareMathSymbol{7}{\mathalpha}{\eu@DigitsArabic@symfont}{`7}% \DeclareMathSymbol{8}{\mathalpha}{\eu@DigitsArabic@symfont}{`8}% \DeclareMathSymbol{9}{\mathalpha}{\eu@DigitsArabic@symfont}{`9}% \makeatother% }{% \PackageWarning{otagofonts}{% Could not find any suitable primary font.\MessageBreak% Falling back to LaTeX default.\MessageBreak% Recommended fonts:\MessageBreak% \space\space Minion Pro (official, commercial)\MessageBreak% \space\space Crimson Pro (https://fonts.google.com/specimen/Crimson+Pro)% \space\space Crimson Text (https://fonts.google.com/specimen/Crimson+Text)% }% } % Sans-serif font. \newbool{foundsansfont} \PackageInfo{otagofonts}{Looking for suitable sans-serif font} % font-specific defaults \defaultfontfeatures[Wickliffe Sans Light]{BoldFont={Wickliffe Sans}} \defaultfontfeatures[Open Sans Light]{BoldFont={Open Sans}} \defaultfontfeatures[Noto Sans Light]{BoldFont={Noto Sans}} \defaultfontfeatures[Roboto Light]{BoldFont={Roboto}} \renewcommand*{\do}[1]{% \PackageInfo{otagofonts}{Trying #1...} \IfFontExistsTF{#1}{% % Scale=Match{Upper|Lower}case doesn't work very well for the sans fonts. % By experimentation Scale=0.912 seems a good compromise, and eliminates the % weird upscaling of sans fonts in Texlive 2020, which didn't seem to affect % the serif or monospace fonts (?!?!). \setsansfont{#1}[Scale=0.912]% \PackageInfo{otagofonts}{Using #1 for sans-serif font}% \booltrue{foundsansfont}% \listbreak% }{}% } \docsvlist{Wickliffe Sans Light,Open Sans Light,Noto Sans Light,Roboto Light,Arial} \ifbool{foundsansfont}{}{% \PackageWarning{otagofonts}{Could not find any suitable sans-serif font.\MessageBreak% Falling back to LaTeX default.\MessageBreak% Recommended fonts:\MessageBreak% \space\space Open Sans (https://fonts.google.com/specimen/Open+Sans)\MessageBreak% \space\space Roboto (https://fonts.google.com/specimen/Roboto)% }% } % Monospaced font, mainly for code listings. \newbool{foundmonofont} \PackageInfo{otagofonts}{Looking for suitable monospaced font} % font-specific defaults \defaultfontfeatures[Iosevka Light]{RawFeature={+ss03;-calt}} \renewcommand*{\do}[1]{% \PackageInfo{otagofonts}{Trying #1...} \IfFontExistsTF{#1}{% \setmonofont{#1}[Scale=MatchUppercase]% \PackageInfo{otagofonts}{Using #1 for monospaced font}% \booltrue{foundmonofont}% \listbreak% }{}% } \docsvlist{Iosevka Light,Letter Gothic 12 Pitch,Inconsolata} \ifbool{foundmonofont}{}{% \PackageWarning{otagofonts}{Could not find any suitable monospaced font.\MessageBreak% Falling back to LaTeX default.\MessageBreak% Recommended fonts:\MessageBreak% \space\space Iosevka (https://github.com/be5invis/Iosevka/releases, but complex!)\MessageBreak% \space\space Inconsolata (https://fonts.google.com/specimen/Inconsolata)% }% } \else % assume PDFLaTeX otherwise \RequirePackage[T1]{fontenc} \RequirePackage{textcomp} \RequirePackage{lmodern} \RequirePackage{mathpazo} \PackageWarning{otagofonts}{% Otago-compatible fonts are not yet supported for LaTeX\MessageBreak% or PDFLaTeX. XeLaTeX is preferred% } % Gill Sans to come... % \renewcommand{\sfdefault}{} % \renewcommand{\ttdefault}{blg} \fi \endinput
\def\filedate{20 January 2023} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Set up official Otago fonts based on what’s available. Fall back to close % facsimiles where possible. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Version History % v1.0 Initial version, rebuilt from deprecated lecturecommon package. % v1.1 Refactored font checking mechanism. % v1.2 Fixed sans-serif scaling, added Noto Sans. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e}[2001/06/01] \ProvidesPackage{otagofonts}[2023/01/20 Otago standard fonts v1.2] \RequirePackage{etoolbox} \RequirePackage{ifxetex} \RequirePackage{amsmath} % needs to be loaded before mathspec \ifxetex \RequirePackage[no-math]{fontspec} \RequirePackage{mathspec} \RequirePackage{xunicode} \RequirePackage{xltxtra} % Try a few different fonts that are either the official Otago font, or a reasonable % facsimile thereof. Effectively done via a bunch of nested ifs. I did try using % etoolbox's list looping macros, but the tricky part was making it generic for all % three categories of font (primary, sans, mono), and I could only successfully make % work for the first one encountered. The set of fonts is limited, so this is OK. % % Note: Explicitly specify Mapping=tex-text only for the primary and sans fonts, % otherwise curly quotes will automatically appear in the mono font. Since % this is pretty much exclusively used for code listings, this is a bad thing. % Primary font (body text, maths). \newbool{foundprimaryfont} \PackageInfo{otagofonts}{Looking for suitable primary font} \renewcommand*{\do}[1]{% \PackageInfo{otagofonts}{Trying #1...} \IfFontExistsTF{#1}{% % The following line is equivalent to: % \setmainfont{fontname}[options] % \setmathsfont(Latin,Digits){fontname} % \setmathrm{fontname} \setprimaryfont[Mapping=tex-text]{#1}% \PackageInfo{otagofonts}{Using #1 for primary font}% \booltrue{foundprimaryfont}% \listbreak% }{}% } \docsvlist{Minion Pro,Crimson Pro,Crimson Text,Times New Roman} \ifbool{foundprimaryfont}{% % Hack to prevent digits in hyperlinks from being set in the main font instead of the mono font. % Note: doesn't matter if this is executed multiple times. Only works if you use \setprimaryfont % or \setmathsfont first. From https://tex.stackexchange.com/a/99774. \makeatletter% \DeclareMathSymbol{0}{\mathalpha}{\eu@DigitsArabic@symfont}{`0}% \DeclareMathSymbol{1}{\mathalpha}{\eu@DigitsArabic@symfont}{`1}% \DeclareMathSymbol{2}{\mathalpha}{\eu@DigitsArabic@symfont}{`2}% \DeclareMathSymbol{3}{\mathalpha}{\eu@DigitsArabic@symfont}{`3}% \DeclareMathSymbol{4}{\mathalpha}{\eu@DigitsArabic@symfont}{`4}% \DeclareMathSymbol{5}{\mathalpha}{\eu@DigitsArabic@symfont}{`5}% \DeclareMathSymbol{6}{\mathalpha}{\eu@DigitsArabic@symfont}{`6}% \DeclareMathSymbol{7}{\mathalpha}{\eu@DigitsArabic@symfont}{`7}% \DeclareMathSymbol{8}{\mathalpha}{\eu@DigitsArabic@symfont}{`8}% \DeclareMathSymbol{9}{\mathalpha}{\eu@DigitsArabic@symfont}{`9}% \makeatother% }{% \PackageWarning{otagofonts}{% Could not find any suitable primary font.\MessageBreak% Falling back to LaTeX default.\MessageBreak% Recommended fonts:\MessageBreak% \space\space Minion Pro (official, commercial)\MessageBreak% \space\space Crimson Pro (https://fonts.google.com/specimen/Crimson+Pro)% \space\space Crimson Text (https://fonts.google.com/specimen/Crimson+Text)% }% } % Sans-serif font. \newbool{foundsansfont} \PackageInfo{otagofonts}{Looking for suitable sans-serif font} % font-specific defaults \defaultfontfeatures[Open Sans Light]{BoldFont={Open Sans}} \defaultfontfeatures[Noto Sans Light]{BoldFont={Noto Sans}} \defaultfontfeatures[Roboto Light]{BoldFont={Roboto}} \renewcommand*{\do}[1]{% \PackageInfo{otagofonts}{Trying #1...} \IfFontExistsTF{#1}{% % Scale=Match{Upper|Lower}case doesn't work very well for the sans fonts. % By experimentation Scale=0.912 seems a good compromise, and eliminates the % weird upscaling of sans fonts in Texlive 2020, which didn't seem to affect % the serif or monospace fonts (?!?!). \setsansfont{#1}[Scale=0.912]% \PackageInfo{otagofonts}{Using #1 for sans-serif font}% \booltrue{foundsansfont}% \listbreak% }{}% } \docsvlist{Open Sans Light,Noto Sans Light,Roboto Light,Arial} \ifbool{foundsansfont}{}{% \PackageWarning{otagofonts}{Could not find any suitable sans-serif font.\MessageBreak% Falling back to LaTeX default.\MessageBreak% Recommended fonts:\MessageBreak% \space\space Open Sans (https://fonts.google.com/specimen/Open+Sans)\MessageBreak% \space\space Roboto (https://fonts.google.com/specimen/Roboto)% }% } % Monospaced font, mainly for code listings. \newbool{foundmonofont} \PackageInfo{otagofonts}{Looking for suitable monospaced font} % font-specific defaults \defaultfontfeatures[Iosevka Light]{RawFeature={+ss03;-calt}} \renewcommand*{\do}[1]{% \PackageInfo{otagofonts}{Trying #1...} \IfFontExistsTF{#1}{% \setmonofont{#1}[Scale=MatchUppercase]% \PackageInfo{otagofonts}{Using #1 for monospaced font}% \booltrue{foundmonofont}% \listbreak% }{}% } \docsvlist{Iosevka Light,Letter Gothic 12 Pitch,Inconsolata} \ifbool{foundmonofont}{}{% \PackageWarning{otagofonts}{Could not find any suitable monospaced font.\MessageBreak% Falling back to LaTeX default.\MessageBreak% Recommended fonts:\MessageBreak% \space\space Iosevka (https://github.com/be5invis/Iosevka/releases, but complex!)\MessageBreak% \space\space Inconsolata (https://fonts.google.com/specimen/Inconsolata)% }% } \else % assume PDFLaTeX otherwise \RequirePackage[T1]{fontenc} \RequirePackage{textcomp} \RequirePackage{lmodern} \RequirePackage{mathpazo} \PackageWarning{otagofonts}{% Otago-compatible fonts are not yet supported for LaTeX\MessageBreak% or PDFLaTeX. XeLaTeX is preferred% } % Gill Sans to come... % \renewcommand{\sfdefault}{} % \renewcommand{\ttdefault}{blg} \fi \endinput
Ignore Space
Show notes
View
lectures/otagoslides.cls
\def\filedate{2 May 2024} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Document class for lecture slides. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Version History % v1.0 Initial version, rebuilt from deprecated lectureslides class. % v1.0.1 Stopped hyperref complaining about invalid tokens in PDF metadata. % v1.1 Added bibliography customisations. % v1.2 Switched to fontawesome5 % v1.3 Revamped colour control % v1.3.1 fontawesome5 no longer defaults to regular style % v1.4 Generalised department type % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e}[2001/06/01] \ProvidesClass{otagoslides}% [2024/05/02 Otago lecture slides style, v.1.4] % "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 represents the class number). \newif\if@chapters \@chapterstrue \DeclareOption{nochapters}{\@chaptersfalse} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{beamer}} \ProcessOptions \LoadClass{beamer} % Load required packages. \RequirePackage{tikz} % \RequirePackage{pgf} % DEPRECATED: only included for backwards compatibility \RequirePackage[normalem]{ulem} \RequirePackage{pifont} \RequirePackage{xr} \RequirePackage{multido} \RequirePackage{boxedminipage} \RequirePackage{graphicx} \RequirePackage{hyperref} \RequirePackage{otagofonts} % \RequirePackage{otagologo} % fontawesome5 must load after otagofonts to avoid fontspec option clash \RequirePackage{fontawesome5} % Check that the UO logo files are installed somewhere in the TeX path. \IfFileExists{OU-Logo-Colour.pdf}{}{% \PackageError{otagoslides}{The University of Otago logo images are not installed}{% You should be able to download a bundle of the UO logo images from\MessageBreak% the same place you got this document class. The files should be\MessageBreak% put in a folder somewhere inside your local LaTeX tree.% } } \hypersetup{% pdfpagemode=UseNone,% colorlinks=true,% linkcolor=,% anchorcolor=,% citecolor=,% filecolor=,% menucolor=,% runcolor=,% urlcolor=blue% } % 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{\DepartmentType}{Department of} \newcommand{\SetDepartmentType}[1]{\renewcommand{\DepartmentType}{#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}} % Beamer setup. \mode<presentation> { \usetheme{OtagoPlain} \setbeamertemplate{navigation symbols}{} } \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\ Slides},% pdfsubject={\ShortClassTitle}% }% } % Disable certain commands in PDF metadata to stop hyperref complaining % about invalid tokens. This is caused by \insertchapternumber in the % Otago Beamer theme, which calls \usebeamerfont and \usebeamercolor. \pdfstringdefDisableCommands{% \def\usebeamercolor#1{}% \def\usebeamerfont#1{}% } % Document setup. \author{} \if@chapters \title{\PaperCode} \else \title{\PaperCode \\ \PaperTitle} \fi \subtitle{\ClassType\ \insertchapternumber: \ClassTitle} \institute{\DepartmentType\ \DepartmentName} \date{\TeachingPeriod, \YearOffered} % Some useful miscellaneous macros. % B-I-G braces {} with a text label % % Arguments: [#1] height of brace; if missing, defaults to the height of the label box % {#2} width of box for label % {#3} the text of the label % % TODO: This could possibly be refactored into a single macro with a l/r argument? \newcommand{\BIGL}[3][]{% \( \left\}% \ifx&\else\parbox[c][#1]{0cm}{}\right.\fi% \begin{minipage}{#2}\flushleft\mbox{}#3\end{minipage}% \ifx&\right.\fi% \)% } \newcommand{\BIGR}[3][]{% \( \ifx&\left.\fi% \begin{minipage}{#2}\flushright\mbox{}#3\end{minipage}% \ifx&\else\left.\parbox[c][#1]{0cm}{}\fi% \right\{% \)% } % Bold-face text using the structure or alert colour. \newcommand<>{\structurebf}[1]{\structure#2{\textbf{#1}}} \newcommand<>{\alertbf}[1]{\alert#2{\textbf{#1}}} % Define the standard beamer colours as actual colours, as we use them % in \color and \textcolor rather a lot. \usebeamercolor*[fg]{structure}\colorlet{beamerstructure}{fg} \usebeamercolor*[fg]{alerted text}\colorlet{beameralert}{fg} % Beamer-aware strikeout. \newcommand<>{\strikeout}[1]{\alt#2{\sout{#1}}{#1}} % Coloured highlighting of text (via Mark George). % \vphantom gives correct ascender and descender height for box. \newcommand{\highlight}[2][yellow!75]{\setlength{\fboxsep}{1pt}\hskip-1pt\colorbox{#1}{\vphantom{dy}#2}\hskip-1pt} % Uses the same spacing as \highlight, but does no highlighting. Use on the % original code when using incremental highlighting. \newcommand{\nohighlight}[1]{\highlight[white!0]{#1}} \newcommand{\error}[1]{\highlight[red!75]{#1}} % Create an "invisible" cell in a table for consistent spacing purposes. % It does so by taking the width of the supplied text and generating an % empty box 1pt wider. \newcommand{\InvisibleCell}[2]{% \multicolumn{1}{#1}{\makebox[\widthof{#2} + 1pt]{}}% } % Draw a grid to aid PGF picture drawing/debugging. % DEPRECATED: Use \DrawGridTikZ instead. \newcommand{\DrawGrid}[2]{% \begin{pgfscope}% \color{lightgray}% \pgfsetlinewidth{0.5pt}% \pgfpathgrid[step={\pgfxy(0.2,0.2)}]{\pgfxy(0,0)}{\pgfxy(#1,#2)}% \pgfusepath{stroke}% \pgfsetlinewidth{1pt}% \pgfpathgrid[step={\pgfxy(1,1)}]{\pgfxy(-0.1,-0.1)}{\pgfxy(#1+0.1,#2+0.1)}% \pgfusepath{stroke}% \pgfputat{\pgfxy(0,-0.2)}{\pgfbox[center,top]{\tiny 0}}% \pgfputat{\pgfxy(-0.2,0)}{\pgfbox[right,center]{\tiny 0}}% \multido{\nx=1+1}{#1}{\pgfputat{\pgfxy(\nx,-0.2)}{\pgfbox[center,top]{\tiny\nx}}}% \multido{\ny=1+1}{#2}{\pgfputat{\pgfxy(-0.2,\ny)}{\pgfbox[right,center]{\tiny\ny}}}% \end{pgfscope}% } % Draw a grid to aid TikZ picture drawing/debugging. \newcommand{\DrawGridTikZ}[2]{% \begin{scope}[color=lightgray] \draw[thin,step=1mm] (0.0,0.0) grid (#1,#2);% \draw[thick,step=1cm] (-0.1,-0.1) grid (#1+0.1,#2+0.1);% \pgftext[top,at={\pgfxy(0.0,-0.2)}]{\tiny 0}% \pgftext[right,at={\pgfxy(-0.2,0.0)}]{\tiny 0}% \foreach \x in {1,...,#1} {\pgftext[top,at={\pgfxy(\x,-0.2)}]{\tiny\x}}% \foreach \y in {1,...,#2} {\pgftext[right,at={\pgfxy(-0.2,\y)}]{\tiny\y}}% \end{scope} } % For numbered notes, add note number references to the slides when generating notes. \ifbeamer@notes \newcounter{noteitem}[page] \newcommand<>{\noteitem}[1]{\only#2{\refstepcounter{noteitem}\unskip\ \fbox{\textbf{\scriptsize\thenoteitem}}\note[item]{#1}}} \else \newcommand<>{\noteitem}[1]{\only#2{\note[item]{#1}}} \fi % Sometimes we want to put a comment in tiny text on the next line, but the default line skip % will insert too much vertical space. Put a \tinyskip at the end of the line instead. \def\tinyskip{\\[-0.33\baselineskip]} % Increase item separation of level 1 list items. Can't use enumitem because it breaks beamer lists :(. % See: <https://tex.stackexchange.com/a/31524> \makeatletter \patchcmd{\@listI}{\itemsep3\p@}{\itemsep6\p@}{}{} \makeatother % Bibliography customisations for beamer. Uses FontAwesome icons. % Use: \setbeamertemplate{bibliography item}[faArticle] \setbeamercolor{bibliography item}{use=normal text,fg=normal text.fg} \setbeamercolor{bibliography entry author}{use=normal text,fg=normal text.fg} \setbeamercolor{bibliography entry location}{use=normal text,fg=normal text.fg} \setbeamercolor{bibliography entry note}{use=normal text,fg=normal text.fg} \setbeamertemplate{bibliography entry title}{} \setbeamertemplate{bibliography entry location}{} \setbeamertemplate{bibliography entry note}{} \defbeamertemplate{bibliography item}{faArticle}{\hfill\faNewspaper} \defbeamertemplate{bibliography item}{faBook}{\hfill\faBook} \defbeamertemplate{bibliography item}{faDocument}{\hfill\faFile*} \defbeamertemplate{bibliography item}{faImage}{\hfill\faImage} \defbeamertemplate{bibliography item}{faLink}{\hfill\faLink} \defbeamertemplate{bibliography item}{faMovie}{\hfill\faFilm} \defbeamertemplate{bibliography item}{faWeb}{\hfill\faCloud} \defbeamertemplate{bibliography item}{faWikipedia}{\hfill\faWikipediaW} \endinput
\def\filedate{11 August 2023} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Document class for lecture slides. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Version History % v1.0 Initial version, rebuilt from deprecated lectureslides class. % v1.0.1 Stopped hyperref complaining about invalid tokens in PDF metadata. % v1.1 Added bibliography customisations. % v1.2 Switched to fontawesome5 % v1.3 Revamped colour control % v1.3.1 fontawesome5 no longer defaults to regular style % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e}[2001/06/01] \ProvidesClass{otagoslides}% [2023/08/11 Otago lecture slides style, v.1.3.1] % "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 represents the class number). \newif\if@chapters \@chapterstrue \DeclareOption{nochapters}{\@chaptersfalse} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{beamer}} \ProcessOptions \LoadClass{beamer} % Load required packages. \RequirePackage{tikz} % \RequirePackage{pgf} % DEPRECATED: only included for backwards compatibility \RequirePackage[normalem]{ulem} \RequirePackage{pifont} \RequirePackage{xr} \RequirePackage{multido} \RequirePackage{boxedminipage} \RequirePackage{graphicx} \RequirePackage{hyperref} \RequirePackage{otagofonts} % \RequirePackage{otagologo} % fontawesome5 must load after otagofonts to avoid fontspec option clash \RequirePackage{fontawesome5} % Check that the UO logo files are installed somewhere in the TeX path. \IfFileExists{OU-Logo-Colour.pdf}{}{% \PackageError{otagoslides}{The University of Otago logo images are not installed}{% You should be able to download a bundle of the UO logo images from\MessageBreak% the same place you got this document class. The files should be\MessageBreak% put in a folder somewhere inside your local LaTeX tree.% } } \hypersetup{% pdfpagemode=UseNone,% colorlinks=true,% linkcolor=,% anchorcolor=,% citecolor=,% filecolor=,% menucolor=,% runcolor=,% urlcolor=blue% } % 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}} % Beamer setup. \mode<presentation> { \usetheme{OtagoPlain} \setbeamertemplate{navigation symbols}{} } \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\ Slides},% pdfsubject={\ShortClassTitle}% }% } % Disable certain commands in PDF metadata to stop hyperref complaining % about invalid tokens. This is caused by \insertchapternumber in the % Otago Beamer theme, which calls \usebeamerfont and \usebeamercolor. \pdfstringdefDisableCommands{% \def\usebeamercolor#1{}% \def\usebeamerfont#1{}% } % Document setup. \author{} \if@chapters \title{\PaperCode} \else \title{\PaperCode \\ \PaperTitle} \fi \subtitle{\ClassType\ \insertchapternumber: \ClassTitle} \institute{Department of \DepartmentName} \date{\TeachingPeriod, \YearOffered} % Some useful miscellaneous macros. % B-I-G braces {} with a text label % % Arguments: [#1] height of brace; if missing, defaults to the height of the label box % {#2} width of box for label % {#3} the text of the label % % TODO: This could possibly be refactored into a single macro with a l/r argument? \newcommand{\BIGL}[3][]{% \( \left\}% \ifx&\else\parbox[c][#1]{0cm}{}\right.\fi% \begin{minipage}{#2}\flushleft\mbox{}#3\end{minipage}% \ifx&\right.\fi% \)% } \newcommand{\BIGR}[3][]{% \( \ifx&\left.\fi% \begin{minipage}{#2}\flushright\mbox{}#3\end{minipage}% \ifx&\else\left.\parbox[c][#1]{0cm}{}\fi% \right\{% \)% } % Bold-face text using the structure or alert colour. \newcommand<>{\structurebf}[1]{\structure#2{\textbf{#1}}} \newcommand<>{\alertbf}[1]{\alert#2{\textbf{#1}}} % Define the standard beamer colours as actual colours, as we use them % in \color and \textcolor rather a lot. \usebeamercolor*[fg]{structure}\colorlet{beamerstructure}{fg} \usebeamercolor*[fg]{alerted text}\colorlet{beameralert}{fg} % Beamer-aware strikeout. \newcommand<>{\strikeout}[1]{\alt#2{\sout{#1}}{#1}} % Coloured highlighting of text (via Mark George). % \vphantom gives correct ascender and descender height for box. \newcommand{\highlight}[2][yellow!75]{\setlength{\fboxsep}{1pt}\hskip-1pt\colorbox{#1}{\vphantom{dy}#2}\hskip-1pt} % Uses the same spacing as \highlight, but does no highlighting. Use on the % original code when using incremental highlighting. \newcommand{\nohighlight}[1]{\highlight[white!0]{#1}} \newcommand{\error}[1]{\highlight[red!75]{#1}} % Create an "invisible" cell in a table for consistent spacing purposes. % It does so by taking the width of the supplied text and generating an % empty box 1pt wider. \newcommand{\InvisibleCell}[2]{% \multicolumn{1}{#1}{\makebox[\widthof{#2} + 1pt]{}}% } % Draw a grid to aid PGF picture drawing/debugging. % DEPRECATED: Use \DrawGridTikZ instead. \newcommand{\DrawGrid}[2]{% \begin{pgfscope}% \color{lightgray}% \pgfsetlinewidth{0.5pt}% \pgfpathgrid[step={\pgfxy(0.2,0.2)}]{\pgfxy(0,0)}{\pgfxy(#1,#2)}% \pgfusepath{stroke}% \pgfsetlinewidth{1pt}% \pgfpathgrid[step={\pgfxy(1,1)}]{\pgfxy(-0.1,-0.1)}{\pgfxy(#1+0.1,#2+0.1)}% \pgfusepath{stroke}% \pgfputat{\pgfxy(0,-0.2)}{\pgfbox[center,top]{\tiny 0}}% \pgfputat{\pgfxy(-0.2,0)}{\pgfbox[right,center]{\tiny 0}}% \multido{\nx=1+1}{#1}{\pgfputat{\pgfxy(\nx,-0.2)}{\pgfbox[center,top]{\tiny\nx}}}% \multido{\ny=1+1}{#2}{\pgfputat{\pgfxy(-0.2,\ny)}{\pgfbox[right,center]{\tiny\ny}}}% \end{pgfscope}% } % Draw a grid to aid TikZ picture drawing/debugging. \newcommand{\DrawGridTikZ}[2]{% \begin{scope}[color=lightgray] \draw[thin,step=1mm] (0.0,0.0) grid (#1,#2);% \draw[thick,step=1cm] (-0.1,-0.1) grid (#1+0.1,#2+0.1);% \pgftext[top,at={\pgfxy(0.0,-0.2)}]{\tiny 0}% \pgftext[right,at={\pgfxy(-0.2,0.0)}]{\tiny 0}% \foreach \x in {1,...,#1} {\pgftext[top,at={\pgfxy(\x,-0.2)}]{\tiny\x}}% \foreach \y in {1,...,#2} {\pgftext[right,at={\pgfxy(-0.2,\y)}]{\tiny\y}}% \end{scope} } % For numbered notes, add note number references to the slides when generating notes. \ifbeamer@notes \newcounter{noteitem}[page] \newcommand<>{\noteitem}[1]{\only#2{\refstepcounter{noteitem}\unskip\ \fbox{\textbf{\scriptsize\thenoteitem}}\note[item]{#1}}} \else \newcommand<>{\noteitem}[1]{\only#2{\note[item]{#1}}} \fi % Sometimes we want to put a comment in tiny text on the next line, but the default line skip % will insert too much vertical space. Put a \tinyskip at the end of the line instead. \def\tinyskip{\\[-0.33\baselineskip]} % Increase item separation of level 1 list items. Can't use enumitem because it breaks beamer lists :(. % See: <https://tex.stackexchange.com/a/31524> \makeatletter \patchcmd{\@listI}{\itemsep3\p@}{\itemsep6\p@}{}{} \makeatother % Bibliography customisations for beamer. Uses FontAwesome icons. % Use: \setbeamertemplate{bibliography item}[faArticle] \setbeamercolor{bibliography item}{use=normal text,fg=normal text.fg} \setbeamercolor{bibliography entry author}{use=normal text,fg=normal text.fg} \setbeamercolor{bibliography entry location}{use=normal text,fg=normal text.fg} \setbeamercolor{bibliography entry note}{use=normal text,fg=normal text.fg} \setbeamertemplate{bibliography entry title}{} \setbeamertemplate{bibliography entry location}{} \setbeamertemplate{bibliography entry note}{} \defbeamertemplate{bibliography item}{faArticle}{\hfill\faNewspaper} \defbeamertemplate{bibliography item}{faBook}{\hfill\faBook} \defbeamertemplate{bibliography item}{faDocument}{\hfill\faFile*} \defbeamertemplate{bibliography item}{faImage}{\hfill\faImage} \defbeamertemplate{bibliography item}{faLink}{\hfill\faLink} \defbeamertemplate{bibliography item}{faMovie}{\hfill\faFilm} \defbeamertemplate{bibliography item}{faWeb}{\hfill\faCloud} \defbeamertemplate{bibliography item}{faWikipedia}{\hfill\faWikipediaW} \endinput
Show line notes below