summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lectureslides/lectureslides.sty
blob: 3bfff0dedb9fdccdec3ccbb219c30eae6a544220 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
%
% lectureslides 
% version 1.0
% 2022/03/01
%
% Taihao Zhang (taihao.de)
% 1 March, 2022
%
% This work is licensed under the Creative Commons Attribution 4.0 International License. 
% To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ 
% or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
%
% For contribution or suggestions, please contact me at t@taihao.de
%

\newcommand{\thispackage}{lectureslides}

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{\thispackage}[2022/03/01 \thispackage]

\RequirePackage{xparse}
\RequirePackage{pdfpages
    , tocloft
    , hyperref
    , babel
}
\renewcommand{\cftdot}{}
\renewcommand{\cftsecfont}{\mdseries}
\renewcommand{\cftsecafterpnum}{\vspace{-3.25mm}}

% Not really a variable meant to be changed, leaving it in for now
\newcommand*{\toclevel}{section}

\newcommand{\orientation}{, landscape}
\DeclareOption{portrait}{\renewcommand{\orientation}{}}
\DeclareOption{landscape}{\renewcommand{\orientation}{, landscape}}
\DeclareOption*{\PackageWarning{\thispackage}{Unknown option ‘\CurrentOption’}}
\ProcessOptions\relax

\newcommand{\createdAt}[1]{Compiled \today.}

\NewDocumentCommand{\course}{o m}{%
  {%
      \noindent\LARGE\bfseries\sffamily #2%
      \footnote{
          \IfNoValueTF{#1}%
            {
                % No optional argument passed
                \iflanguage{ngerman}{
                    Zusammengestellt am \today.
                }{
                    Compiled \today.
                }
            }%
            {#1}%
        }%
      \par%
  }%
}

\newcommand{\tocline}[1]{\arabic{\toclevel}.~#1}

\newcommand*{\lecturetitle}[1]{%
    \addtocounter{\toclevel}{1}%
    \newpage\phantomsection%
    \addcontentsline{toc}{\toclevel}{\tocline{#1}}%
}

\NewDocumentCommand{\lectureslides}{o o m}{%
    \includepdf[pages=#1-#2 \orientation]{#3}
    % \IfNoValueTF{#1}%
    % {\includepdf[pages=- \orientation]{#2}}%
    % {\includepdf[pages=-#1 \orientation]{#2}}%
}

\NewDocumentCommand{\lecture}{m o o m}{%
    \lecturetitle{#1}\lectureslides[#2][#3]{#4}%
}