Newer
Older
LaTeX / lectures / deprecated / lecturecombined.cls
  1. \def\filedate{21 July 2020}
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. %
  4. % Document class for lecture combined document.
  5. %
  6. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  7. %
  8. % Version History
  9. % v1.0 Initial version
  10. % v1.0.1 Changed package loading order to ensure that hyperref is last.
  11. % v1.1 Added nochapters option.
  12. % v1.2 Added support for configurable class types.
  13. % v1.3 Replaced deprecated fancyhdr macros.
  14. %
  15. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  16.  
  17. \NeedsTeXFormat{LaTeX2e}[2001/06/01]
  18. \ProvidesClass{lecturecombined}%
  19. [2020/07/21 INFO lecture combined document style, v.1.3]
  20.  
  21.  
  22. % "Stream of conciousness" chapters vs. explicit individual classes. NOTE:
  23. % you can't have both chapters and classes! This is because we use the same
  24. % chapter macros for both cases, but they're applied differently (e.g., if
  25. % nochapters is set, then \insertchapternumber represent the class number).
  26. \newif\if@chapters \@chapterstrue
  27. \DeclareOption{nochapters}{\@chaptersfalse}
  28.  
  29.  
  30. \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
  31. \ProcessOptions
  32. \LoadClass{article}
  33.  
  34.  
  35. % The article class doesn't have a chapter counter.
  36. \newcounter{chapter}
  37.  
  38.  
  39. % Load required packages.
  40. \RequirePackage{pdfpages}
  41. \RequirePackage[a4paper,landscape,pdftex]{geometry}
  42. \RequirePackage{fancyhdr}
  43. % DO NOT REMOVE THE NEXT LINE! The lecturesetup package loads a bunch
  44. % of other packages, some of which are referenced below.
  45. \RequirePackage{lecturecommon}
  46.  
  47.  
  48. % Fix margins.
  49. \geometry{vmargin=0.9in,hmargin=0.5in}
  50.  
  51. \raggedright
  52.  
  53.  
  54. \if@chapters
  55. \SetClassType{Chapter}
  56. \fi
  57.  
  58.  
  59. % hyperref setup. We have to use a slightly convoluted method, because the
  60. % macros referenced here haven't been set yet. Define the hyperref setup
  61. % as a new macro, and call this AFTER initialising the paper and chapter
  62. % variables.
  63. \newcommand{\inithyperref}{%
  64. \hypersetup{%
  65. pdftitle={\PaperCode\ \ClassType\ \thechapter\ Lecture Material},%
  66. pdfsubject={\ShortClassTitle},%
  67. colorlinks=false%
  68. }%
  69. }
  70.  
  71.  
  72. % Set up fancy headings.
  73. \fancyhf{}
  74. \fancyhead[C]{\Huge\sffamily\bfseries \PaperCode, \PaperTitle, \TeachingPeriod\ \YearOffered}
  75.  
  76. \fancyfoot[L]{\large\sffamily\bfseries \ClassType\ \thechapter: \ShortClassTitle}
  77. \fancyfoot[R]{\large\sffamily\bfseries\thepage}
  78.  
  79. \renewcommand{\footrulewidth}{0mm}
  80. \renewcommand{\headrulewidth}{0mm}
  81.  
  82. % Ensure first page footer is correctly positioned.
  83. % (see https://tex.stackexchange.com/a/442558)
  84. \setlength{\headheight}{30pt}
  85.  
  86. \pagestyle{fancy}
  87.  
  88.  
  89. \endinput