summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/rbt-mathnotes/rbt-mathnotes.tex
blob: 59550cc1056058c113af3549ccb774e9fbff41af (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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
%% rbt-mathnotes.tex
%% 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

\documentclass{ltxguidex}

\errorcontextlines=10
\usepackage{longtable}
\usepackage{changepage}
\usepackage{metalogo}
\usepackage{changelog}
\newcommand{\mn}{\ctan{rbt-mathnotes}}

\makeatletter
\renewcommand{\SX@explpreset}{
  language=[LaTeX]TeX,
  numbers=none,
}
\makeatother

%\setmainfont{Charter}
\lstset{basewidth=0.6em}

\usepackage[
  nomaketitle,
  notitles,
  noxcolor,
  noenumitem,
  notheorems,
]{rbt-mathnotes}

\usepackage{FiraSans}
\usepackage{FiraMono}

\NewDocumentEnvironment{ctandescription}{}
  {\NewDocumentCommand{\pkg}{m}{\item[\ctan{##1}]}
  \begin{description}}
  {\end{description}}

\author{Rebecca Turner\thanks{\email{rbt@sent.as}, \https{becca.ooo}}}
\title{The \mn\ Package}
\date{1.0.2 2021/11/29}
\begin{document}
\maketitle

\begin{abstract}
  Rebecca Turner's personal macros and styles for typesetting mathematics
  notes.
\end{abstract}

\begin{note}
  Browse the sources, contribute, or complain at \\
  \https{github.com/9999years/latex-mathnotes}
\end{note}

\tableofcontents
\vfill
\pagebreak

\begin{note}
  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
    \https{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:
    \begin{itemize}
      \item \texttt{README.md}
      \item \texttt{rbt-mathnotes.tex}
      \item \texttt{rbt-mathnotes.sty}
      \item \texttt{rbt-mathnotes.cls}
      \item \texttt{rbt-mathnotes-util.sty}
      \item \texttt{rbt-mathnotes-messages.sty}
      \item \texttt{rbt-mathnotes-hw.cls}
      \item \texttt{rbt-mathnotes-formula-sheet.cls}
      \item \texttt{examples/cheat-sheet.tex}
      \item \texttt{examples/multivar.tex}
      \item \texttt{examples/topology-hw-1.tex}
    \end{itemize}
  and the derived files:
    \begin{itemize}
      \item \texttt{rbt-mathnotes.pdf}
      \item \texttt{examples/cheat-sheet.pdf}
      \item \texttt{examples/multivar.pdf}
      \item \texttt{examples/topology-hw-1.pdf}
    \end{itemize}
\end{note}

\vfill
\pagebreak

\section{Package options}

Some options are enabled by default, and can be disabled by passing
|no<option>|. The enabled-by-default options are:
\begin{keys}
  \key{fonts}[\bool][true]
  \key{stix}[\bool][true]
    \begin{itemize}
      \item In \XeTeX\ or \LuaTeX, loads the \ctan{unicode-math} package, and
        then, if the \option{stix} option is also given, loads the
        \texttt{STIX2Text} and \texttt{STIX2Math} \textsc{otf} fonts (available
        in the \ctan{stix2-otf} package).

        The \texttt{STIX2Math} font is loaded with stylistic sets 1 (roundhand
        script forms instead of chancery script for |\mathcal| Script
        Alphanumeric Symbols) and 8 (upright, rather than slanted, forms for
        integrals); see ``Stylistic Sets'' in
        \href{http://mirrors.ctan.org/fonts/stix2-otf/STIXTwoMath-Regular.pdf}{the
        \texttt{stix2-otf} documentation} (pp.~51--53) for more information.

      \item In other engines, if the \option{stix} option is also given, loads
        the \package{stix2} package from \ctan{stix2-type1}.
    \end{itemize}

  \key{symbols}[\bool][true]

    Defines a collection of ``natural language'' math-mode symbol commands.
    Most commands are declared with |\ProvideDocumentCommand| so that they
    won't overwrite custom commands you've already defined.

    Note that symbols may look different depending on the \option{fonts} and
    \option{stix} options.

    \begin{longtable}{rl}
      |\lnot| & $\lnot$ \\
      |\Rational|, |\Rat|, |\Q| & $\Rational$ \\
      |\Natural|, |\Nat|, |\N| & $\Natural$ \\
      |\Integer|, |\Int|, |\Z| & $\Integer$ \\
      |\Complex|, |\Comp|, |\C| & $\Complex$ \\
      |\Real|, |\R| & $\R$ \\
      |\powerset| & $\powerset$ \\
      |\vec{A}| & $\vec{A}$ \\
      |\intersection|, |\inter| & $\intersection$ \\
      |\bigintersection|, |\biginter| & $\bigintersection$ \\
      |\union| & $\union$ \\
      |\bigunion| & $\bigunion$ \\
      |\divisible|, |\div| & $a \divisible b$ \\
      |\notdivisible|, |\ndivisible|, |\notdiv|, |\ndiv| & $a \notdivisible b$ \\
      |\floor{A}| & $\floor{A}$ \\
      |\ceil{A}| & $\ceil{A}$ \\
      |\emptyset|, |\es| & $\emptyset$ \\
      |\after| & $g \after f$ \\
      |\cross| & $a \cross b$ \\
      |\img| & $\img f$ \\
      |\pre| & $\pre f$ \\
      |\Stab| & $\Stab f$ \\
      |\FixPt| & $\FixPt f$ \\
      |\id| & $\id$ \\
      |\injection|, |\inj| & $\injection$ \\
      |\surjection|, |\surj| & $\surjection$ \\
      |\bijection|, |\bij| & $\bijection$ \\
      |\restriction|, |\restr| & $f \restr_{\N}$ \\
      |\dd[y]{x}| & $\dd[y]{x}$ \\
      |\pd[y]{x}| & $\pd[y]{x}$ \\
      |\curl| & $\curl$ \\
      |\dive| & $\dive$ \\
    \end{longtable}

  \key{maketitle}[\bool][true]
    Redefines |\maketitle| and related commands. The provided |\maketitle|
    command will automatically insert a |\thanks| if any email, course,
    instructor, institution, or semester is supplied with the |\mathnotes|
    command.

  \key{titles}[\bool][true]
    No-op; may set the format of sectioning commands in the future.

  \key{xcolor}[\bool][true]
    Load the \ctan{xcolor} package and defines several colors with the |MN|
    prefix.

  \key{theorems}[\bool][true]
    Set up various theorem environments with the \ctan{ntheorem} and
    \ctan{mdframed} packages.

    Provides |thm| (Theorem), |lem| (Lemma), |cor| (Corollary), |prop|
    (Proposition), |defn| (Definition), |notation|, |ex|
    (Example), |note|, |remark|, |hint|, and |abuse-of-notation| (Abuse of
    notation) theorem-like environments.

  \key{enumitem}[\bool][true]
    Loads the \ctan{enumitem} package.

\end{keys}

The other options are not enabled by default, and can be enabled by passing
|<option>| --- the option name --- as a package option:
\begin{keys}
  \key{listings}[\bool]
    Loads the \ctan{listings} and \ctan{xcolor} packages.
    Sets default styles for listings, including setting the default language to
    |Mathematica|.

  \key{knowledge}\bool]
    Loads the \ctan{knowledge} package and sets up default styles.
    Patches lists so that manually placing |\AP| and |\itemAP| commands is
    unecessary.

  \key{index}[\bool]
    Sets the |knowledge| key and starts indexing with |\makeindex|.

  \key{footnotes}[\bool]
    Loads the \ctan{footmisc} package and sets up footnotes.

  \key{figures}[\bool]
    Loads the \ctan{graphicx} and \ctan{caption} packages and sets up figure
    captions.

  \key{tabu}[\bool]
    Loads the \ctan{multirow}, \ctan{booktabs}, \ctan{longtable}, and
    \ctan{tabu} packages.

    Defines the |\Th| command.

  \key{kindle}[\bool]
    Sets a small page size and tweaks the layout for Kindle devices; designed in
    particular for whatever generation of Kindle Paperwhite I have.
    Only compatible with the \ctan{memoir} document class.

\end{keys}

\section{Commands}

\begin{desc}
|\numberthis|
\end{desc}

At the end of a line (before the |\\|) in an \ctan{amsmath} starred
environment, gives an equation a number.

\begin{LTXexample}
\begin{alignat*}{2}
  x &= y \\
  y &= 2z \numberthis \\
  z &= 1/w
\end{alignat*}
\end{LTXexample}

\begin{desc}
|\labelthis{<label>}|
\end{desc}

At the end of a line (before the |\\|) in an \ctan{amsmath} starred
environment, gives an equation a number and label for referencing.

\begin{LTXexample}
\begin{alignat*}{2}
  x &= y \\
  y &= 2z \labelthis{eq:cool} \\
  z &= 1/w.
\end{alignat*}
As we saw in
Equation~\ref{eq:cool}, \dots
\end{LTXexample}

\begin{desc}
|\newacronym[<command>]{<text>}|
\end{desc}

Defines |\<command>| to be |\textsc{<text>}|; |<command>| defaults to |<text>|
if ommitted.

\begin{LTXexample}
\newacronym{nist}
\newacronym[\seetan]{ctan}

\nist\ is not associated
with \seetan.
\end{LTXexample}

\begin{desc}
|\newacronyms{<acronyms>}|
\end{desc}

Defines a collection of acronym commands together using |\newacronym|;
|<acronyms>| is a comma-separated list of acronyms.

\begin{LTXexample}
\newacronyms{apa, mla}

\apa\ and \mla\ are common
citation styles.
\end{LTXexample}

\begin{desc}
|\mathnotes{<key-value pairs>}|
\end{desc}

\begin{keys}
  \key{date}[\m{date}]
  \key{author}[\m{author}]
  \key{title}[\m{title}]
    Sets the date, author, or title; setting these keys are equivalent to using the
    |\date|, |\author|, and |\title| commands, respectively.

  \key{institution}[\m{institution}]
    Sets the institution (e.g., Brandeis University) associated with the
    document.
  \key{course}[\m{course}]
    Sets the course (e.g., \textsc{math}~23a) associated with the
    document.
  \key{semester}[\m{semester}]
    Sets the semester (e.g., Fall 2018) associated with the document.
  \key{instructor}[\m{instructor}]
    Sets the instructor (e.g., Prof.~Ruth~Charney) associated with the document.
  \key{email}[\m{email}]
    Sets the email (e.g., \email{rbt@sent.as}) associated with the author.
\end{keys}

\begin{desc}
|\TODO[<item>]|
\end{desc}

Typesets a to-do marker.

\begin{LTXexample}
\TODO

\TODO[explain in detail]
\end{LTXexample}

\begin{desc}
|\email{<email>}|
\end{desc}
Typesets an email address, with a link if the \ctan{hyperref} package is loaded.

\begin{LTXexample}
\email{rbt@sent.as}
\end{LTXexample}

\begin{desc}
|\Th[<column spec>]{<header>}|
\end{desc}
Typesets a table column header in bold using |\multicolumn|. Especially useful
if the column in question is a math or numeric column.

\m{column spec} defaults to |l| (left-aligned).

\section{The \texttt{rbt-mathnotes} document class}

The \mn\ document class is a \ctan{memoir}-based class that automatically loads
the \mn\ package.

\section{The \texttt{rbt-mathnotes-hw} document class}

The |rbt-mathnotes-hw| document class is based on the |rbt-mathnotes| document
class, providing additional commands and styles for typesetting homework
assignments.  Theorems are given subtler styling that takes up less space on
the page.  The author name and title are added to the top-left heading.

\begin{desc}
|problem| \\
|\begin{problem}[<number or options>]| \\
|\prob[<number or options>]{<text>}|
\end{desc}

The |problem| environment (and its matching shorthand |\prob|) typesets a
homework problem typesets a homework problem. Problems are added to the table of
contents at the chapter-level, which is the top level if I remember correctly.

\m{number or options} is a list of key-value pairs:

\begin{keys}
  \key{number}[\m{number}]
    Sets the problem's number. For brevity, an unrecognized key with no value
    is also used as the problem number; this allows concise expressions like
    |\begin{problem}[4.3a] ...| to specify problem numbers (to match textbook
    problem numbers, for example). Otherwise, problem numbers
    start at 1 and count up.

  \key{title}[\m{title}]
    Sets the problem's ``title''.

  \key{label}[\m{label}]
    Sets the problem's label (e.g., |prob:n-sheeted-covering|), which can be
    referred to later with |\ref|.
\end{keys}

If your professor calls them ``exercises'' or something, you can change the
string used to refer to them with the |\mathnotes| command, which supports an
additional key in |rbt-mathnotes-hw|:
\begin{keys}
  \key{problem string}[\m{problem string}][Problem]
    The string used to represent a problem in titles and contents entries.
\end{keys}

\pagebreak
\section{The \texttt{rbt-mathnotes-formula-sheet} document class}

Sometimes, exams will let you take any formula sheet of a given size as
reference material. The |rbt-mathnotes-formula-sheet| document class (based on the
\ctan{article} class) is optimized for getting as much material as possible in
that area. A tiny |\maketitle| is provided, as well as a tiny |\section|.
Theorem titles are highly abbreviated (``Thm'' instead of ``Theorem''). Lists
are rendered without linebreaks between items. Paragraphs are compressed and the
page margins are set to a tenth of an inch. The entire document is set in
|\scriptsize|.

Some additional keys are added to the |\mathnotes| command to customize the
output:

\begin{keys}
  \key{columns}[\m{column count}][3]
    The number of text columns to set the formula sheet in; use 1 to turn off
    columns.

  \key{balance columns}
    If set, the unstarred |multicols| environment is used instead of |multicols*|,
    which attempts to spread material between each of the columns evenly, to
    make their vertical sizes as even as possible.

    It doesn't look great --- you want to know when you've filled up one column
    --- so it's off by default.

  \key{width}[\m{width}][8.5in]
  \key{height}[\m{height}][11in]
    Set the paper width and height. The 0.1 inch margins are not customizable.
\end{keys}

\begin{changelog}[author=Rebecca Turner]
  \begin{version}[v=1.0.2, date=2021-11-27, short]
    Added license notice to all files.
  \end{version}

  \begin{version}[v=1.0.1, date=2021-11-24, short]
    Renamed package from \texttt{mathnotes} to \texttt{rbt-mathnotes} to avoid
    a file name conflict with
    \href{http://mirrors.ctan.org/fonts/newtx/doc/mathnotes.pdf}{\texttt{CTAN:/fonts/newtx/doc/mathnotes.pdf}}.
  \end{version}

  \begin{version}[v=1.0.0, date=2021-11-04, short]
    Initial release as \texttt{mathnotes}, documented package.
  \end{version}
\end{changelog}

\end{document}