summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/rbt-mathnotes/rbt-mathnotes-formula-sheet.cls
blob: 85e789b34a1c6c1a07873e56cdc4a9dff417c2bb (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
%% rbt-mathnotes-formula-sheet.cls
%% Copyright 2021 Rebecca B. Turner.
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Rebecca B. Turner.
%
% This work consists of the files:
%     README.md
%     rbt-mathnotes.tex
%     rbt-mathnotes.sty
%     rbt-mathnotes.cls
%     rbt-mathnotes-util.sty
%     rbt-mathnotes-messages.sty
%     rbt-mathnotes-hw.cls
%     rbt-mathnotes-formula-sheet.cls
%     examples/cheat-sheet.tex
%     examples/multivar.tex
%     examples/topology-hw-1.tex
% and the derived files:
%     rbt-mathnotes.pdf
%     examples/cheat-sheet.pdf
%     examples/multivar.pdf
%     examples/topology-hw-1.pdf

\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplClass{rbt-mathnotes-formula-sheet}{2021/11/29}{1.0.2}{Styles
  for mathematical exam formula sheets.}

\LoadClass{article}

\RequirePackage{rbt-mathnotes}

\cs_set:Npn \@maketitle
  {
    \textbf{\@title}~
    (\@author,~\@date)
  }

\cs_set:Npn \mn__tiny_thm:nn #1#2
  {
    \RenewDocumentEnvironment { #1 } { o }
      {
        \textbf
          {
            #2
            \IfValueT { ##1 }
              {
                :~##1
              }
            .
          }
      }
      {
      }
  }

\mn__tiny_thm:nn { thm } { Thm }
\mn__tiny_thm:nn { lem } { Lem }
\mn__tiny_thm:nn { cor } { Cor }
\mn__tiny_thm:nn { prop } { Prop }
\mn__tiny_thm:nn { defn } { Defn }
\mn__tiny_thm:nn { ex } { Ex }
\mn__tiny_thm:nn { note } { Note }
\mn__tiny_thm:nn { remark } { Rmrk }

\prg_new_conditional:Npnn \mn__if_should_use_multicols:
  { T, }
  {
    \int_compare:nNnTF
      { \g__mn_fs_columns_int } = { \c_one_int }
      { \prg_return_false: }
      { \prg_return_true: }
  }

\RequirePackage{multicol}
\AtBeginDocument
  {
    \scriptsize
    \mn__if_should_use_multicols:T
      {
        \begin
          {
            multicols
            \bool_if:NF \g__mn_should_balance_multicols_bool
              { * }
          }
          {
            \int_use:N \g__mn_fs_columns_int
          }
      }
    \skip_set:Nn \abovedisplayskip { 0pt }
    \skip_set:Nn \belowdisplayskip { 0pt }
  }

\AtEndDocument
  {
    \mn__if_should_use_multicols:T
      {
        \end
          {
            multicols
            \bool_if:NF \g__mn_should_balance_multicols_bool
              { * }
          }
      }
  }

\bool_new:N \g__mn_should_balance_multicols_bool

\keys_define:nn { mn__main }
  {
    columns .int_set:N = \g__mn_fs_columns_int ,
    columns .initial:x = 3 ,

    balance~columns .default:n = true ,
    balance~columns .bool_set:N = \g__mn_should_balance_multicols_bool ,

    width .value_required:n = true ,
    width .code:n = \geometry{ paperwidth = #1 } ,

    height .value_required:n = true ,
    height .code:n = \geometry{ paperheight = #1 } ,
  }

\RequirePackage
  [
    letterpaper ,
    margin = 0.1in ,
  ]
  { geometry }

\skip_set:Nn \parskip { 0.25em }

\RequirePackage { enumitem }
\setlist
  {
    nosep
  }

\def\section#1{\hrulefill\\\textbf{#1}\\}