2023-05-14 19:50:30 -07:00
|
|
|
|
% Mark's math circle handout style.
|
2023-03-01 09:04:12 -08:00
|
|
|
|
% Source is at https://git.betalupi.com/Mark/ormc-handouts
|
2023-01-12 10:30:53 -08:00
|
|
|
|
\NeedsTeXFormat{LaTeX2e}
|
2023-05-25 21:43:21 -07:00
|
|
|
|
\ProvidesClass{ormc_handout}[2023/05/25 2.0.0 ORMC Handout]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% ------------------ %
|
|
|
|
|
% Option Definitions %
|
|
|
|
|
% ------------------ %
|
|
|
|
|
|
|
|
|
|
\newif{\if@solutions} % If false, solutions and instructor notes are hidden.
|
|
|
|
|
\newif{\if@singlenumbering} % If true, the same counter is used for all objects.
|
|
|
|
|
\newif{\if@nopagenumber} % If true, don't number pages.
|
|
|
|
|
\newif{\if@shortwarning} % If true, show a smaller solutions warning
|
|
|
|
|
\newif{\if@nowarning} % If true, do not show solution warning
|
|
|
|
|
|
|
|
|
|
\DeclareOption{solutions}{\@solutionstrue}
|
|
|
|
|
\DeclareOption{nosolutions}{\@solutionsfalse}
|
|
|
|
|
\DeclareOption{multinumbering}{\@singlenumberingfalse}
|
|
|
|
|
\DeclareOption{singlenumbering}{\@singlenumberingtrue}
|
|
|
|
|
\DeclareOption{pagenumber}{\@nopagenumberfalse}
|
|
|
|
|
\DeclareOption{nopagenumber}{\@nopagenumbertrue}
|
|
|
|
|
\DeclareOption{longwarning}{\@shortwarningfalse}
|
|
|
|
|
\DeclareOption{shortwarning}{\@shortwarningtrue}
|
|
|
|
|
\DeclareOption{showwarning}{\@nowarningfalse}
|
|
|
|
|
\DeclareOption{hidewarning}{\@nowarningtrue}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
\DeclareOption*{\ClassWarning{ormc_handout}{\CurrentOption ignored}}
|
2023-05-25 21:43:21 -07:00
|
|
|
|
|
|
|
|
|
\ExecuteOptions{
|
|
|
|
|
solutions,
|
|
|
|
|
multinumbering,
|
|
|
|
|
pagenumber,
|
|
|
|
|
longwarning,
|
|
|
|
|
yeswarning
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
\ProcessOptions
|
|
|
|
|
|
|
|
|
|
% Hack to allow script option override.
|
|
|
|
|
% To force a build with solutions, compile a file containing the following:
|
|
|
|
|
% `\def\argYesSolutions{1}\input{<target file>}`
|
2023-05-25 22:58:47 -07:00
|
|
|
|
\ifdefined\argYesSolutions\@solutionstrue\fi
|
|
|
|
|
\ifdefined\argNoSolutions\@solutionsfalse\fi
|
2023-05-25 21:43:21 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\RequirePackage{etoolbox}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
|
|
|
|
|
% Based on article class
|
|
|
|
|
\LoadClass{article}
|
2023-05-25 21:43:21 -07:00
|
|
|
|
\undef\maketitle
|
|
|
|
|
\undef\section
|
2023-01-12 10:30:53 -08:00
|
|
|
|
|
|
|
|
|
\newcommand\sbullet[1][.5]{\mathbin{\vcenter{\hbox{\scalebox{#1}{$\bullet$}}}}}
|
|
|
|
|
|
|
|
|
|
\renewcommand{\labelitemi}{$\sbullet$}
|
|
|
|
|
\renewcommand{\labelitemii}{$\cdot$}
|
2023-05-19 17:03:40 -07:00
|
|
|
|
\renewcommand{\labelenumi}{\textbf{\Alph{enumi}:}}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% ------------- %
|
|
|
|
|
% Package Setup %
|
|
|
|
|
% ------------- %
|
2023-01-12 10:30:53 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% Set up page geometry.
|
|
|
|
|
% MUST BE DONE FIRST!
|
|
|
|
|
\RequirePackage{geometry}
|
|
|
|
|
\geometry{
|
|
|
|
|
paper = letterpaper,
|
|
|
|
|
top = 25mm,
|
|
|
|
|
bottom = 30mm,
|
|
|
|
|
left = 30mm,
|
|
|
|
|
right = 30mm,
|
|
|
|
|
headheight = 75mm,
|
|
|
|
|
footskip = 15mm,
|
|
|
|
|
headsep = 75mm,
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
\RequirePackage{enumitem} % List customization
|
2023-01-12 10:30:53 -08:00
|
|
|
|
\RequirePackage{xcolor} % For colored text
|
|
|
|
|
\RequirePackage{tikz} % Used by \boxlinehack
|
|
|
|
|
\RequirePackage{comment} % Used to hide solutions
|
2023-05-25 21:43:21 -07:00
|
|
|
|
\RequirePackage{tcolorbox} % For solution boxes
|
2023-05-14 19:50:30 -07:00
|
|
|
|
\tcbuselibrary{breakable} % Allows tcolorboxes to break across pages
|
2023-05-13 17:11:33 -07:00
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
\RequirePackage[ % Provides \say{} for quoted text.
|
2023-01-12 10:30:53 -08:00
|
|
|
|
left = ``,
|
|
|
|
|
right = '',
|
|
|
|
|
leftsub = `,
|
|
|
|
|
rightsub = '
|
|
|
|
|
]{dirtytalk}
|
|
|
|
|
|
|
|
|
|
% Not used by this class, but likely to be used in documents
|
|
|
|
|
\RequirePackage{amsmath}
|
|
|
|
|
\RequirePackage{amssymb}
|
2023-05-14 19:50:30 -07:00
|
|
|
|
\RequirePackage{tabto}
|
|
|
|
|
\TabPositions{1cm, 2cm, 3cm, 4cm, 5cm, 6cm, 7cm, 8cm}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% ----------- %
|
|
|
|
|
% Style Setup %
|
|
|
|
|
% ----------- %
|
|
|
|
|
|
|
|
|
|
\if@nopagenumber
|
|
|
|
|
\pagestyle{empty}
|
|
|
|
|
\else
|
|
|
|
|
\pagestyle{plain}
|
|
|
|
|
\fi
|
|
|
|
|
|
|
|
|
|
\renewcommand*{\thefootnote}{\arabic{footnote}}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
\setlength{\parindent}{0mm}
|
|
|
|
|
\setlist{noitemsep, topsep=0mm}
|
|
|
|
|
\raggedright
|
2023-05-25 21:43:21 -07:00
|
|
|
|
\frenchspacing
|
|
|
|
|
|
2023-01-12 10:30:53 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% ------------- %
|
|
|
|
|
% Handout Title %
|
|
|
|
|
% ------------- %
|
|
|
|
|
|
|
|
|
|
% These are in LaTeX by default, but we don't use them here.
|
|
|
|
|
% Undef them to avoid confusion.
|
|
|
|
|
\undef\thanks
|
|
|
|
|
\undef\author
|
|
|
|
|
\undef\date
|
|
|
|
|
|
|
|
|
|
% Additional title parameters
|
|
|
|
|
\def\@subtitle{\relax}
|
|
|
|
|
\def\@uptitlel{\relax}
|
|
|
|
|
\def\@uptitler{\relax}
|
|
|
|
|
\newcommand{\subtitle}[1]{\gdef\@subtitle{#1}}
|
|
|
|
|
\newcommand{\uptitlel}[1]{\gdef\@uptitlel{#1}}
|
|
|
|
|
\newcommand{\uptitler}[1]{\gdef\@uptitler{#1}}
|
|
|
|
|
|
|
|
|
|
\newcommand{\@shortwarning}{
|
|
|
|
|
\begin{tcolorbox}[colback=white, colframe=red]
|
|
|
|
|
\large\centering\color{red}
|
|
|
|
|
\textbf{Instructor's Handout} \par
|
|
|
|
|
\end{tcolorbox}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
\newcommand{\@longwarning}{
|
|
|
|
|
\begin{tcolorbox}[colback=white, colframe=red]
|
|
|
|
|
\color{red}
|
|
|
|
|
\begingroup
|
|
|
|
|
\large\centering
|
|
|
|
|
\textbf{Instructor's Handout} \par
|
|
|
|
|
\endgroup
|
|
|
|
|
\vspace{1ex}
|
|
|
|
|
This file contains solutions and notes. \par
|
|
|
|
|
Compile with the ``nosolutions'' flag before distributing. \par
|
|
|
|
|
\end{tcolorbox}
|
|
|
|
|
}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
\newcommand{\maketitle}{
|
|
|
|
|
\begingroup
|
|
|
|
|
\centering
|
|
|
|
|
\begin{minipage}{0.7\textwidth}
|
|
|
|
|
\centering
|
|
|
|
|
|
|
|
|
|
% Left and right headers (uptitle)
|
|
|
|
|
\def\uptitle{%
|
|
|
|
|
\if\@uptitlel\relax\else\textsc{\@uptitlel}\fi \hfill~%
|
|
|
|
|
\if\@uptitler\relax\else\textsc{\@uptitler}\fi \par
|
|
|
|
|
}
|
|
|
|
|
\if\@uptitlel\relax % If neither header is defined,
|
|
|
|
|
\if\@uptitlel\relax % don't insert an upper title.
|
|
|
|
|
\def\@uptitle{\relax}
|
|
|
|
|
\fi\fi\uptitle{}
|
|
|
|
|
|
|
|
|
|
% Main title
|
|
|
|
|
\rule{\linewidth}{0.2mm} \par
|
|
|
|
|
\huge \@title \par \normalsize
|
|
|
|
|
\vspace{1ex} \@subtitle \par
|
|
|
|
|
\rule{\linewidth}{0.2mm} \par
|
|
|
|
|
|
|
|
|
|
% Solution warning
|
|
|
|
|
\if@nowarning\else\if@solutions%
|
|
|
|
|
\if@shortwarning \@shortwarning%
|
|
|
|
|
\else \@longwarning%
|
|
|
|
|
\fi\fi\fi
|
|
|
|
|
\end{minipage} \par
|
|
|
|
|
\vspace{2ex}
|
|
|
|
|
\endgroup
|
2023-01-12 10:30:53 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
% ---------------- %
|
|
|
|
|
% Handout Sections %
|
|
|
|
|
% ---------------- %
|
|
|
|
|
|
|
|
|
|
% Helper command that creates a label with custom text.
|
|
|
|
|
% Аrgs: label name, custom text
|
|
|
|
|
\newcommand{\@customlabel}[2]{%
|
|
|
|
|
\protected@write\@auxout{}{\string\newlabel{#1}{{#2}{}}}%
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
\newcounter{section_counter}
|
|
|
|
|
\NewDocumentCommand{\section}{ m d<> }{
|
|
|
|
|
\stepcounter{section_counter}
|
|
|
|
|
\vspace{8mm}
|
|
|
|
|
{\bf\Large \hfill Part \arabic{section_counter}\IfNoValueF{#1}{: #1} \hfill}
|
|
|
|
|
\IfNoValueF{#2}{\@customlabel{#2}Part \arabic{section_counter}} \\*
|
|
|
|
|
\vspace{2mm}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
% Generic object.
|
2023-05-25 21:43:21 -07:00
|
|
|
|
% Same format as \problem, \theorem, etc, but has no counter.
|
2023-01-12 10:30:53 -08:00
|
|
|
|
\NewDocumentCommand{\generic}{ m d<> }{
|
|
|
|
|
\vspace{3mm}
|
2023-05-25 21:43:21 -07:00
|
|
|
|
{\bf\normalsize #1} \\*
|
|
|
|
|
\IfNoValueF{#2}{\@customlabel{#2}{#1}}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
% Make a new secion type.
|
|
|
|
|
% Args: command, counter, title.
|
|
|
|
|
\newcommand\@newobj[3]{
|
|
|
|
|
\NewDocumentCommand{#1}{ m d<> }{
|
|
|
|
|
\stepcounter{#2}
|
|
|
|
|
\generic{#3 \arabic{#2}:\IfNoValueF{##1}{ ##1}}
|
|
|
|
|
\IfNoValueF{##2}{\@customlabel{##2}{#3 \arabic{#2}}}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
\if@singlenumbering
|
|
|
|
|
\newcounter{object_counter}
|
|
|
|
|
\def\@problemcounter{object_counter}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
\@newobj{\definition}{object_counter}{Definition}
|
|
|
|
|
\@newobj{\theorem}{object_counter}{Theorem}
|
|
|
|
|
\@newobj{\proposition}{object_counter}{Proposition}
|
|
|
|
|
\@newobj{\example}{object_counter}{Example}
|
|
|
|
|
\else
|
|
|
|
|
\newcounter{problem_counter}
|
|
|
|
|
\newcounter{theorem_counter}
|
|
|
|
|
\newcounter{definition_counter}
|
|
|
|
|
\newcounter{example_counter}
|
|
|
|
|
\newcounter{proposition_counter}
|
|
|
|
|
\def\@problemcounter{problem_counter}
|
|
|
|
|
|
|
|
|
|
\@newobj{\definition}{definition_counter}{Definition}
|
|
|
|
|
\@newobj{\theorem}{theorem_counter}{Theorem}
|
|
|
|
|
\@newobj{\proposition}{proposition_counter}{Proposition}
|
|
|
|
|
\@newobj{\example}{example_counter}{Example}
|
|
|
|
|
\fi
|
2023-01-12 10:30:53 -08:00
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
% These must be defined manually, since
|
|
|
|
|
% problems and problemparts use two counters.
|
|
|
|
|
\newcounter{problempartcounter}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
\NewDocumentCommand{\problem}{ m d<> }{
|
|
|
|
|
\setcounter{problempartcounter}{0}
|
2023-05-25 21:43:21 -07:00
|
|
|
|
\stepcounter{\@problemcounter}
|
|
|
|
|
\generic{Problem \arabic{\@problemcounter}:\IfNoValueF{#1}{ #1}}
|
|
|
|
|
\IfNoValueF{#2}{\@customlabel{#2}{Problem \arabic{\@problemcounter}}}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
}
|
|
|
|
|
\NewDocumentCommand{\problempart}{ m d<> }{
|
2023-05-25 21:43:21 -07:00
|
|
|
|
\stepcounter{problempartcounter}
|
|
|
|
|
\generic{Part \arabic{problempartcounter}:\IfNoValueF{#1}{ #1}}
|
|
|
|
|
\IfNoValueF{#2}{\@customlabel{#2}{Problem \arabic{\@problemcounter}.\arabic{problempartcounter}}}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
% ---------------- %
|
|
|
|
|
% Box environments %
|
|
|
|
|
% ---------------- %
|
2023-01-12 10:30:53 -08:00
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
% Keep track of the current background color.
|
|
|
|
|
% Useful for transparent tikz drawings.
|
|
|
|
|
\def\ORMCbgcolor{white}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
% Make a box environment.
|
|
|
|
|
% These can safely be nested.
|
|
|
|
|
% Args: name, title, back color, frame color.
|
|
|
|
|
\newcommand{\@makeORMCbox}[4]{
|
|
|
|
|
\newenvironment{#1}{
|
|
|
|
|
% \linehack draws a line across a tcolorbox.
|
|
|
|
|
% tcolorbox only supports two sections, but
|
|
|
|
|
% this hack allows us to have more.
|
|
|
|
|
\def\linehack{
|
|
|
|
|
\begin{tikzpicture}
|
|
|
|
|
\path[use as bounding box]
|
|
|
|
|
(0, 0) --
|
|
|
|
|
(\linewidth, 0);
|
|
|
|
|
|
|
|
|
|
\draw[color=#4, dashed, dash phase=1mm]
|
|
|
|
|
(0 - \kvtcb@leftlower-\kvtcb@boxsep, 0) --
|
|
|
|
|
(\linewidth + \kvtcb@rightlower + \kvtcb@boxsep, 0);
|
|
|
|
|
\end{tikzpicture} \par
|
|
|
|
|
\vspace{2mm}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
% Keep track of the current background color.
|
|
|
|
|
% Useful for transparent tikz drawings.
|
|
|
|
|
\def\ORMCbgcolor{#3}
|
|
|
|
|
|
|
|
|
|
\begin{tcolorbox}[
|
|
|
|
|
breakable,
|
|
|
|
|
colback=#3,
|
|
|
|
|
colframe=#4,
|
|
|
|
|
title={\textbf{#2}}
|
|
|
|
|
]
|
|
|
|
|
\raggedright
|
|
|
|
|
} {
|
|
|
|
|
\end{tcolorbox}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
\@makeORMCbox{examplesolution}{Example Solution}{white}{grey!75!black}
|
|
|
|
|
|
|
|
|
|
\if@solutions
|
|
|
|
|
\@makeORMCbox{solution}{Solution}{red!5!white}{red!75!black}
|
|
|
|
|
\@makeORMCbox{instructornote}{Note for Instructors}{cyan!5!white}{cyan!75!black}
|
2023-01-12 10:30:53 -08:00
|
|
|
|
\else
|
|
|
|
|
\excludecomment{solution}
|
|
|
|
|
\excludecomment{instructornote}
|
|
|
|
|
\fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-25 21:43:21 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% -------------------- %
|
|
|
|
|
% Misc helper commands %
|
|
|
|
|
% -------------------- %
|
|
|
|
|
|
|
|
|
|
\NewDocumentCommand{\note}{ d[] m }{
|
|
|
|
|
\IfNoValueTF{#1}
|
|
|
|
|
{\textcolor{gray}{#2}}
|
|
|
|
|
{\textcolor{gray}{\textit{#1:} #2}}
|
|
|
|
|
\par
|
|
|
|
|
}
|
|
|
|
|
\newcommand{\hint}[1]{\note[Hint]{#1}}
|