Moved tex packages into this repo

This commit is contained in:
Mark 2023-01-12 10:30:53 -08:00
parent 3ff9ea3c50
commit 5ef1d0f461
20 changed files with 1022 additions and 57 deletions

View File

@ -1,11 +1,9 @@
% https://git.betalupi.com/Mark/latex
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[
solutions,
singlenumbering
]{ormc_handout}
]{../../resources/ormc_handout}
\usepackage{amsmath}
\usepackage{amssymb}

View File

@ -1,10 +1,8 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[
solutions
]{ormc_handout}
]{../../resources/ormc_handout}
\usepackage{tikz}

View File

@ -1,11 +1,9 @@
% https://git.betalupi.com/Mark/latex
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[
singlenumbering,
nosolutions
]{ormc_handout}
]{../../resources/ormc_handout}
\usepackage{amsmath}
\usepackage{amssymb}

View File

@ -1,10 +1,8 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[
solutions
]{ormc_handout}
]{../../resources/ormc_handout}
\input{tikxset}

View File

@ -1,12 +1,9 @@
% https://git.betalupi.com/Mark/latex
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[
solutions,
singlenumbering
]{ormc_handout}
]{../../resources/ormc_handout}
\usepackage{url}
\usepackage{mathtools} % for \coloneqq

View File

@ -1,10 +1,8 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[
solutions
]{ormc_handout}
]{../../resources/ormc_handout}
\usepackage{amsmath}
\usepackage{amssymb}

View File

@ -1,11 +1,8 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.0.6
\documentclass[
solutions,
simplefooter
]{ormc_handout}
solutions
]{../../resources/ormc_handout}
\usepackage{tkz-graph}

View File

@ -1,8 +1,6 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[solutions]{ormc_handout}
\documentclass[solutions]{../../resources/ormc_handout}
\newcommand{\nck}[2] {
\ensuremath{

View File

@ -1,10 +1,8 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[
solutions
]{ormc_handout}
]{../../resources/ormc_handout}
\usepackage{tkz-graph}

View File

@ -1,8 +1,8 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.0.6
\documentclass[solutions, simplefooter]{ormc_handout}
\documentclass[
solutions
]{../../resources/ormc_handout}
\begin{document}

View File

@ -1,8 +1,6 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[solutions]{ormc_handout}
\documentclass[solutions]{../../resources/ormc_handout}
% Quick P() macro.

View File

@ -1,10 +1,8 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[
solutions
]{ormc_handout}
]{../../resources/ormc_handout}
\usepackage{pdfpages}
\usepackage{sliderule}

View File

@ -0,0 +1,534 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sliderule}[2022/08/22 Slide rule tools]
\RequirePackage{tikz}
\RequirePackage{ifthen}
% Scale functions:
% See https://sliderulemuseum.com/SR_Scales.htm
%
% l: length of the rule
% n: the number on the rule
%
% A/B: (l/2) * log(n)
% C/D: l / log(n)
% CI: abs(l * log(10 / n) - l)
% K: (l/3) * log(n)
%
% L: n * l
% T: l * log(10 * tan(n))
% S: l * log(10 * sin(n))
\def\sliderulewidth{10}
\def\abscalefn(#1){(\sliderulewidth/2) * log10(#1)}
\def\cdscalefn(#1){(\sliderulewidth * log10(#1))}
\def\ciscalefn(#1){(\sliderulewidth - \cdscalefn(#1))}
\def\kscalefn(#1){(\sliderulewidth/3) * log10(#1)}
\def\lscalefn(#1){(\sliderulewidth * #1)}
\def\tscalefn(#1){(\sliderulewidth * log10(10 * tan(#1)))}
\def\sscalefn(#1){(\sliderulewidth * log10(10 * sin(#1)))}
% Arguments:
% Label
% x of start
% y of start
\newcommand{\linearscale}[3]{
\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);
\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};
% Numbers and marks
\foreach \i in {0,..., 10}{
\draw[black]
({#1 + (\sliderulewidth / 10) * \i}, #2) --
({#1 + (\sliderulewidth / 10) * \i}, #2 + 0.3)
node[above] {\i};
}
% Submarks
\foreach \n in {0, ..., 9} {
\foreach \i in {1,..., 9} {
\ifthenelse{\i=5}{
\draw[black]
({#1 + (\sliderulewidth / 10) * (\n + \i / 10)}, #2) --
({#1 + (\sliderulewidth / 10) * (\n + \i / 10)}, #2 + 0.2);
} {
\draw[black]
({#1 + (\sliderulewidth / 10) * (\n + \i / 10)}, #2) --
({#1 + (\sliderulewidth / 10) * (\n + \i / 10)}, #2 + 0.1);
}
}
}
}
% Arguments:
% Label
% x of start
% y of start
\newcommand{\abscale}[3]{
\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);
\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};
% Numbers and marks 1 - 9
\foreach \i in {1,..., 9}{
\draw[black]
({#1 + \abscalefn(\i)}, #2) --
({#1 + \abscalefn(\i)}, #2 + 0.3)
node[above] {\i};
}
% Numbers and marks 10 - 100
\foreach \i in {1,..., 10}{
\draw[black]
({#1 + \abscalefn(10 * \i)}, #2) --
({#1 + \abscalefn(10 * \i)}, #2 + 0.3)
node[above] {\ifthenelse{\i=10}{1}{\i}};
}
% Submarks 1 - 9
\foreach \n in {1, ..., 9} {
\ifthenelse{\n<5}{
\foreach \i in {1,..., 9}
} {
\foreach \i in {2,4,6,8}
}
{
\ifthenelse{\i=5}{
\draw[black]
({#1 + \abscalefn(\n + \i / 10)}, #2) --
({#1 + \abscalefn(\n + \i / 10)}, #2 + 0.2);
} {
\draw[black]
({#1 + \abscalefn(\n + \i / 10)}, #2) --
({#1 + \abscalefn(\n + \i / 10)}, #2 + 0.1);
}
}
}
% Submarks 10 - 100
\foreach \n in {10,20,...,90} {
\ifthenelse{\n<50}{
\foreach \i in {1,..., 9}
} {
\foreach \i in {2,4,6,8}
}
{
\ifthenelse{\i=5}{
\draw[black]
({#1 + \abscalefn(\n + \i)}, #2) --
({#1 + \abscalefn(\n + \i)}, #2 + 0.2);
} {
\draw[black]
({#1 + \abscalefn(\n + \i)}, #2) --
({#1 + \abscalefn(\n + \i)}, #2 + 0.1);
}
}
}
}
\newcommand{\cdscale}[3]{
\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);
\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};
% Numbers and marks 1 - 10
\foreach \i in {1,..., 10}{
\draw[black]
({#1 + \cdscalefn(\i)}, #2) --
({#1 + \cdscalefn(\i)}, #2 + 0.3)
node[above] {\ifthenelse{\i=10}{1}{\i}};
}
% Submarks 1 - 9
\foreach \n in {1, ..., 9} {
\ifthenelse{\n<3}{
\foreach \i in {5,10,...,95}
} {
\foreach \i in {10,20,...,90}
}
{
\ifthenelse{\i=50}{
\draw[black]
({#1 + \cdscalefn(\n + \i / 100)}, #2) --
({#1 + \cdscalefn(\n + \i / 100)}, #2 + 0.2);
\ifthenelse{\n=1}{
\draw
({#1 + \cdscalefn(\n + \i / 100)}, #2 + 0.2)
node [above] {1.5};
}{}
} {
\ifthenelse{
\i=10 \OR \i=20 \OR \i=30 \OR \i=40 \OR
\i=60 \OR \i=70 \OR \i=80 \OR \i=90
}{
\draw[black]
({#1 + \cdscalefn(\n + \i / 100)}, #2) --
({#1 + \cdscalefn(\n + \i / 100)}, #2 + 0.15);
} {
\draw[black]
({#1 + \cdscalefn(\n + \i / 100)}, #2) --
({#1 + \cdscalefn(\n + \i / 100)}, #2 + 0.1);
}
}
}
}
}
\newcommand{\ciscale}[3]{
\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);
\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};
% Numbers and marks
\foreach \i in {1,...,10}{
\draw[black]
({#1 + \ciscalefn(\i)}, #2) --
({#1 + \ciscalefn(\i)}, #2 + 0.3)
node[above] {\ifthenelse{\i=10}{1}{\ifthenelse{\i=0}{0}{.\i}}};
}
% Submarks 1 - 9
\foreach \n in {1, ..., 9} {
\ifthenelse{\n<3}{
\foreach \i in {5,10,...,95}
} {
\foreach \i in {10,20,...,90}
}
{
\ifthenelse{\i=50}{
\draw[black]
({#1 + \ciscalefn(\n + \i / 100)}, #2) --
({#1 + \ciscalefn(\n + \i / 100)}, #2 + 0.2);
\ifthenelse{\n=1}{
\draw
({#1 + \ciscalefn(\n + \i / 100)}, #2 + 0.2)
node [above] {1.5};
}{}
} {
\ifthenelse{
\i=10 \OR \i=20 \OR \i=30 \OR \i=40 \OR
\i=60 \OR \i=70 \OR \i=80 \OR \i=90
}{
\draw[black]
({#1 + \ciscalefn(\n + \i / 100)}, #2) --
({#1 + \ciscalefn(\n + \i / 100)}, #2 + 0.15);
} {
\draw[black]
({#1 + \ciscalefn(\n + \i / 100)}, #2) --
({#1 + \ciscalefn(\n + \i / 100)}, #2 + 0.1);
}
}
}
}
}
\newcommand{\kscale}[3]{
\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);
\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};
% Numbers and marks 1 - 9
\foreach \i in {1,...,9}{
\draw[black]
({#1 + \kscalefn(\i)}, #2) --
({#1 + \kscalefn(\i)}, #2 + 0.3)
node[above] {\i};
}
% Numbers and marks 10 - 90
\foreach \i in {1,..., 9}{
\draw[black]
({#1 + \kscalefn(10 * \i)}, #2) --
({#1 + \kscalefn(10 * \i)}, #2 + 0.3)
node[above] {\ifthenelse{\i=10}{1}{\i}};
}
% Numbers and marks 100 - 1000
\foreach \i in {1,..., 10}{
\draw[black]
({#1 + \kscalefn(100 * \i)}, #2) --
({#1 + \kscalefn(100 * \i)}, #2 + 0.3)
node[above] {\ifthenelse{\i=10}{1}{\i}};
}
% Submarks 1 - 9
\foreach \n in {1, ..., 9} {
\ifthenelse{\n<4}{
\foreach \i in {1,..., 9}
} {
\foreach \i in {2,4,6,8}
}
{
\ifthenelse{\i=5}{
\draw[black]
({#1 + \kscalefn(\n + \i / 10)}, #2) --
({#1 + \kscalefn(\n + \i / 10)}, #2 + 0.2);
} {
\draw[black]
({#1 + \kscalefn(\n + \i / 10)}, #2) --
({#1 + \kscalefn(\n + \i / 10)}, #2 + 0.1);
}
}
}
% Submarks 10 - 90
\foreach \n in {10,20,...,90} {
\ifthenelse{\n<40}{
\foreach \i in {1,..., 9}
} {
\foreach \i in {2,4,6,8}
}
{
\ifthenelse{\i=5}{
\draw[black]
({#1 + \kscalefn(\n + \i)}, #2) --
({#1 + \kscalefn(\n + \i)}, #2 + 0.2);
} {
\draw[black]
({#1 + \kscalefn(\n + \i)}, #2) --
({#1 + \kscalefn(\n + \i)}, #2 + 0.1);
}
}
}
% Submarks 100 - 1000
\foreach \n in {100,200,...,900} {
\ifthenelse{\n<400}{
\foreach \i in {10,20,...,90}
} {
\foreach \i in {20,40,60,80}
}
{
\ifthenelse{\i=50}{
\draw[black]
({#1 + \kscalefn(\n + \i)}, #2) --
({#1 + \kscalefn(\n + \i)}, #2 + 0.2);
} {
\draw[black]
({#1 + \kscalefn(\n + \i)}, #2) --
({#1 + \kscalefn(\n + \i)}, #2 + 0.1);
}
}
}
}
\newcommand{\lscale}[3]{
\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);
\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};
% Numbers and marks
\foreach \i in {0,..., 10}{
\draw[black]
({#1 + \lscalefn(\i / 10)}, #2) --
({#1 + \lscalefn(\i / 10)}, #2 + 0.3)
node[above] {\ifthenelse{\i=10}{1}{\ifthenelse{\i=0}{0}{.\i}}};
}
% Submarks
\foreach \n in {0, ..., 9} {
\foreach \i in {1,...,19} {
\ifthenelse{\i=10}{
\draw[black]
({#1 + \lscalefn((\n + (\i / 20))/10)}, #2) --
({#1 + \lscalefn((\n + (\i / 20))/10)}, #2 + 0.2);
} {
\ifthenelse{
\i=1 \OR \i=3 \OR \i=5 \OR \i=7 \OR
\i=9 \OR \i=11 \OR \i=13 \OR \i=15 \OR
\i=17 \OR \i=19
}{
\draw[black]
({#1 + \lscalefn((\n + (\i / 20))/10)}, #2) --
({#1 + \lscalefn((\n + (\i / 20))/10)}, #2 + 0.1);
} {
\draw[black]
({#1 + \lscalefn((\n + (\i / 20))/10)}, #2) --
({#1 + \lscalefn((\n + (\i / 20))/10)}, #2 + 0.15);
}
}
}
}
}
\newcommand{\tscale}[3]{
\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);
% First line
\draw[black] ({#1}, #2) -- ({#1}, #2 + 0.2);
\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};
% Numbers and marks 6 - 10
\foreach \i in {6,...,9,10,15,...,45}{
\draw[black]
({#1 + \tscalefn(\i)}, #2) --
({#1 + \tscalefn(\i)}, #2 + 0.3)
node[above] {\i};
}
% Submarks 6 - 10
\foreach \n in {6, ..., 9} {
\foreach \i in {1,...,9}{
\ifthenelse{\i=5}{
\draw[black]
({#1 + \tscalefn(\n + \i / 10)}, #2) --
({#1 + \tscalefn(\n + \i / 10)}, #2 + 0.2);
} {
\draw[black]
({#1 + \tscalefn(\n + \i / 10)}, #2) --
({#1 + \tscalefn(\n + \i / 10)}, #2 + 0.1);
}
}
}
% Submarks 15 - 45
\foreach \n in {10, 15, ..., 40} {
\foreach \i in {1,...,24}{
\ifthenelse{
\i=5 \OR \i=10 \OR \i=15 \OR \i=20
} {
\draw[black]
({#1 + \tscalefn(\n + \i / 5)}, #2) --
({#1 + \tscalefn(\n + \i / 5)}, #2 + 0.2);
} {
\draw[black]
({#1 + \tscalefn(\n + \i / 5)}, #2) --
({#1 + \tscalefn(\n + \i / 5)}, #2 + 0.1);
}
}
}
}
\newcommand{\sscale}[3]{
\draw[black] ({#1}, #2) -- ({#1 + \sliderulewidth}, #2);
\draw[black] ({#1}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.9);
\draw[black] ({#1}, #2 + 0.9) -- ({#1}, #2 + 0.7);
\draw[black] ({#1 + \sliderulewidth}, #2 + 0.9) -- ({#1 + \sliderulewidth}, #2 + 0.7);
% First line
\draw[black] ({#1}, #2) -- ({#1}, #2 + 0.2);
\draw ({#1 - 0.1}, #2 + 0.5) node[left] {#3};
% Numbers and marks
\foreach \i in {6,...,9,10,15,...,30,40,50,...,60,90}{
\draw[black]
({#1 + \sscalefn(\i)}, #2) --
({#1 + \sscalefn(\i)}, #2 + 0.3)
node[above] {\i};
}
% Submarks 6 - 10
\foreach \n in {6, ..., 9} {
\foreach \i in {1,...,9}{
\ifthenelse{\i=5}{
\draw[black]
({#1 + \sscalefn(\n + \i / 10)}, #2) --
({#1 + \sscalefn(\n + \i / 10)}, #2 + 0.2);
} {
\draw[black]
({#1 + \sscalefn(\n + \i / 10)}, #2) --
({#1 + \sscalefn(\n + \i / 10)}, #2 + 0.1);
}
}
}
% Submarks 15 - 30
\foreach \n in {10, 15, ..., 25} {
\foreach \i in {1,...,24}{
\ifthenelse{
\i=5 \OR \i=10 \OR \i=15 \OR \i=20
} {
\draw[black]
({#1 + \sscalefn(\n + \i / 5)}, #2) --
({#1 + \sscalefn(\n + \i / 5)}, #2 + 0.2);
} {
\draw[black]
({#1 + \sscalefn(\n + \i / 5)}, #2) --
({#1 + \sscalefn(\n + \i / 5)}, #2 + 0.1);
}
}
}
% Submarks 30
\foreach \n in {30} {
\foreach \i in {1,...,19}{
\ifthenelse{
\i=2 \OR \i=4 \OR \i=6 \OR \i=8 \OR
\i=10 \OR \i=12 \OR \i=14 \OR \i=16 \OR
\i=18
} {
\draw[black]
({#1 + \sscalefn(\n + \i / 2)}, #2) --
({#1 + \sscalefn(\n + \i / 2)}, #2 + 0.2);
} {
\draw[black]
({#1 + \sscalefn(\n + \i / 2)}, #2) --
({#1 + \sscalefn(\n + \i / 2)}, #2 + 0.1);
}
}
}
% Submarks 40 - 50
\foreach \n in {40, 50} {
\foreach \i in {1,...,9}{
\ifthenelse{
\i=5 \OR \i=10 \OR \i=15 \OR \i=20
} {
\draw[black]
({#1 + \sscalefn(\n + \i)}, #2) --
({#1 + \sscalefn(\n + \i)}, #2 + 0.2);
} {
\draw[black]
({#1 + \sscalefn(\n + \i)}, #2) --
({#1 + \sscalefn(\n + \i)}, #2 + 0.1);
}
}
}
% Submarks 60
\foreach \i in {1,...,10}{
\ifthenelse{
\i=5 \OR \i=10
} {
\draw[black]
({#1 + \sscalefn(60 + \i * 2)}, #2) --
({#1 + \sscalefn(60 + \i * 2)}, #2 + 0.2);
} {
\draw[black]
({#1 + \sscalefn(60 + \i * 2)}, #2) --
({#1 + \sscalefn(60 + \i * 2)}, #2 + 0.1);
}
}
}

View File

@ -1,8 +1,6 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.0.4
\documentclass[solutions]{ormc_handout}
\documentclass[solutions]{../../resources/ormc_handout}
\usepackage{adjustbox}
\begin{document}

View File

@ -1,8 +1,6 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.0.6
\documentclass[solutions]{ormc_handout}
\documentclass[solutions]{../../resources/ormc_handout}
\begin{document}

View File

@ -1,10 +1,8 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[
solutions
]{ormc_handout}
]{../../resources/ormc_handout}
\usepackage{subfiles}
\usepackage{graphicx}

View File

@ -1,12 +1,10 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[
nosolutions,
singlenumbering,
nopagenumber
]{ormc_handout}
]{../../resources/ormc_handout}
% We put nodes in a separate layer, so we can
% slightly overlap with paths for a perfect fit

View File

@ -1,12 +1,10 @@
% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[
nosolutions,
singlenumbering,
nopagenumber
]{ormc_handout}
]{../../resources/ormc_handout}
\usepackage{tikz}

View File

@ -1,7 +1,6 @@
# ORMC Handouts
This repository contains all the handouts I've written for the [ORMC](https://circles.math.ucla.edu/circles/). Most of them are built using [these](https://git.betalupi.com/Mark/latex) packages.
This repository contains all the handouts I've written for the [ORMC](https://circles.math.ucla.edu/circles/).
If you are not affiliated with the ORMC, ask for permission before using these.
@ -11,4 +10,29 @@ Handouts are sorted by the class they're for:
- [`./Intermediate`](./Intermediate/): Grades 5 - 9
- [`./Advanced`](./Advanced): Grades 9 - 12
These grade levels are estimates.
Grade levels are estimates.
## Usage
Most handouts use a custom document class. If you move any files out of this repository, you'll need to change a few things for the handout to compile:
1. Download [`./resources/ormc_handout.cls`](./resources/ormc_handout.cls).
2. Put it in the same directory as the handout.
3. Fix the include path at the top of the handout.
Usually, you'll need to replace
```latex
\documentclass[
solutions
]{../../resources/ormc_handout}
```
with
```latex
\documentclass[
solutions
]{ormc_handout}
```
**Warning:** As of now, `ormc_handout.cls` does not work with hyperref.

441
resources/ormc_handout.cls Normal file
View File

@ -0,0 +1,441 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ormc_handout}[2022/05/07 1.1.0 ORMC Handout]
% Boolean that determines solution behavior.
% If false, solutions and instructor notes are hidden.
\newif{\ifsolutions}
\solutionstrue
% Boolean that determines object numbering
% If true, the same counter is used for all objects.
\newif{\ifsinglenumbering}
\singlenumberingfalse
% Boolean. If true, don't number pages.
\newif{\ifnopagenumber}
\nopagenumberfalse
% Declare and parse arguments
\DeclareOption{solutions}{\solutionstrue}
\DeclareOption{nosolutions}{\solutionsfalse}
\DeclareOption{singlenumbering}{\singlenumberingtrue}
\DeclareOption{nopagenumber}{\nopagenumbertrue}
\DeclareOption*{\ClassWarning{ormc_handout}{\CurrentOption ignored}}
\ProcessOptions\relax
% Based on article class
\LoadClass{article}
\makeatletter % Allow commands with @ (\makeatother is at end of this file)
\newcommand\sbullet[1][.5]{\mathbin{\vcenter{\hbox{\scalebox{#1}{$\bullet$}}}}}
\renewcommand{\labelitemi}{$\sbullet$}
\renewcommand{\labelitemii}{$\cdot$}
% Hack for command-line arguments.
% To force a build with solutions, run
% latexmk
% -synctex=1
% -interaction=nonstopmode
% -file-line-error
% -outdir=%OUTDIR%
% -xelatex
% -jobname=%DOCFILE%.sol
% -pdfxelatex="xelatex %O \"\\def\\argYesSolutions{1}\\input{%S}\""
% %DOC%
%
% Or, make a new file with the contents
% \def\argYesSolutions{1}\input{<target file>}
% and build that with latex.
\ifdefined\argYesSolutions
\solutionstrue
\else
\ifdefined\argNoSolutions
\solutionsfalse
\fi
\fi
%%% PACKAGES %%%
% 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,
}
\RequirePackage{enumitem} % list customization
\RequirePackage{xparse} % Provides powerful macros via \NewDocumentCommand
\RequirePackage{xcolor} % For colored text
\RequirePackage{tcolorbox} % For solution boxes
\RequirePackage{tikz} % Used by \boxlinehack
\RequirePackage{comment} % Used to hide solutions
\RequirePackage{fancyhdr} % Header/Footer customization
\RequirePackage{adjustbox} % Used for title
\RequirePackage[
left = ``,
right = '',
leftsub = `,
rightsub = '
]{dirtytalk}
% Not used by this class, but likely to be used in documents
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{multicol}
\RequirePackage{subfiles}
%%% CONFIG %%%
% No paragraph indentation, no list item spacing,
% raggedright layout (hyphenation is excessive).
\setlength{\parindent}{0mm}
\setlist{noitemsep, topsep=0mm}
\raggedright
% Use symbols instead of numbers for footnotes
\renewcommand*{\thefootnote}{\arabic{footnote}}
% One space after a period.
\frenchspacing
% Fancyhdr setup
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0mm}
\ifnopagenumber
\else
\fancyfoot[C]{\thepage}
\fi
%%% COMMANDS %%%
% Make a heading.
% Arguments:
%
% First: Top-left text
% Second: Top-right text
% Both are optional, but should only be provided TOGETHER.
%
% Third: Title
% Forth: author
\RenewDocumentCommand{\maketitle}{ d<> d<> m m } {
\begin{adjustbox}{minipage=0.7\textwidth, margin=0pt \smallskipamount,center}
\begin{center}
\IfNoValueF{#1}{\textsc{#1}} \hfill \IfNoValueF{#2}{\textsc{#2}} \\
\rule{\linewidth}{0.2mm}\\
\huge
#3 \\
\normalsize
\vspace{1ex}
#4
\rule{\linewidth}{0.2mm} \\
% Instructor's handout warning
\ifsolutions
\begin{tcolorbox}[
colback=white,
colframe=red
]
\begin{center}
\large
\textcolor{red}{
\textbf{Instructor's Handout}
} \\
\normalsize
\end{center}
\vspace{1ex}
\textcolor{red}{This file contains solutions and notes.}
\textcolor{red}{Compile with the ``nosolutions'' flag before distributing.}
\end{tcolorbox}
\fi
\end{center}
\end{adjustbox}
}
% Helper command that creates a label with custom text.
% First arg: label name
% Second arg: custom text
\newcommand{\customlabel}[2]{%
\protected@write \@auxout {}{
\string \newlabel {#1}{{#2}{}}
}
}
% Commands for problems, theorems, and definitions
%
% Each of these take two arguments. For example:
%
% \problem{} makes an unnamed problem
% \problem{Division} makes a named problem
% \problem{}<gcd>
% makes a problem and a label "problem:gcd"
% that gives text "Problem X" when referenced.
\newcounter{section_counter}
\newcounter{problempartcounter}
\ifsinglenumbering
\newcounter{object_counter}
\def\problemcounter{object_counter}
\def\theoremcounter{object_counter}
\def\definitioncounter{object_counter}
\def\examplecounter{object_counter}
\def\propositioncounter{object_counter}
\else
\newcounter{problem_counter}
\newcounter{theorem_counter}
\newcounter{definition_counter}
\newcounter{example_counter}
\newcounter{proposition_counter}
\def\problemcounter{problem_counter}
\def\theoremcounter{theorem_counter}
\def\definitioncounter{definition_counter}
\def\examplecounter{example_counter}
\def\propositioncounter{proposition_counter}
\fi
% Generic object command.
% First arg: counter name (mandatory)
% Second arg: object type (optional)
% Third arg: object title (mandatory, can be empty)
%
% If the second argument is ommited, the counter is hidden
% and only the object title is shown. For example:
% \@object{counter}[Problem]{Example Problem} -> Problem 1: Example Problem
% \@object{counter}{Example Problem} -> Example Problem
%
% Only used internally (See following definitions)
\NewDocumentCommand{\@object}{ m d[] m}{
\stepcounter{#1}
\vspace{3mm}
\IfNoValueTF{#2} {
{\bf\normalsize #3}
} {
{\bf\normalsize #2 \arabic{#1}:\IfNoValueF{#3}{ #3}}
}
}
% Generic object.
% Does the same thing as \problem, \theorem, etc, but with no counter.
\NewDocumentCommand{\generic}{ m d<> }{
\vspace{3mm}
{\bf\normalsize #1} \\*
\IfNoValueF{#2}{
\customlabel{#2}{#1}
}
}
% If not starred, text is "Part X: <title>"
% If starred, text is "<title>"
\RenewDocumentCommand{\section}{ s m d<> }{
\stepcounter{section_counter}
\vspace{8mm}
\IfBooleanTF{#1}{
{\bf\Large \hfill #2 \hfill}
\IfNoValueF{#3}{\customlabel{#3}#2} \\*
} {
{\bf\Large \hfill Part \arabic{section_counter}\IfNoValueF{#2}{: #2} \hfill}
\IfNoValueF{#3}{\customlabel{#3}Part \arabic{section_counter}} \\*
}
\vspace{2mm}
}
\RenewDocumentCommand{\paragraph}{}{
\hspace{1cm}
}
\NewDocumentCommand{\problem}{ m d<> }{
\setcounter{problempartcounter}{0}
\@object{\problemcounter}[Problem]{#1}
\IfNoValueF{#2}{
\customlabel{#2}{Problem \arabic{\problemcounter}}
\customlabel{NUM:#2}{\arabic{\problemcounter}}
} \\*
}
\NewDocumentCommand{\problempart}{ m d<> }{
\@object{problempartcounter}[Part]{#1}
\IfNoValueF{#2}{
\customlabel
{#2}
{Problem \arabic{\problemcounter}\alph{problempartcounter}}
\customlabel{NUM:#2}{\arabic{\problemcounter}\alph{problempartcounter}}
} \\*
}
\NewDocumentCommand{\definition}{ m d<> }{
\@object{\definitioncounter}[Definition]{#1}
\IfNoValueF{#2}{
\customlabel{#2}{Definition \arabic{\definitioncounter}}
\customlabel{NUM:#2}{\arabic{\definitioncounter}}
} \\*
}
\NewDocumentCommand{\theorem}{ m d<> }{
\@object{\theoremcounter}[Theorem]{#1}
\IfNoValueF{#2}{
\customlabel{#2}{Theorem \arabic{\theoremcounter}}
\customlabel{NUM:#2}{\arabic{\theoremcounter}}
} \\*
}
\NewDocumentCommand{\proposition}{ m d<> }{
\@object{\propositioncounter}[Proposition]{#1}
\IfNoValueF{#2}{
\customlabel{#2}{Proposition \arabic{\propositioncounter}}
\customlabel{NUM:#2}{\arabic{\propositioncounter}}
} \\*
}
\NewDocumentCommand{\example}{ m d<> }{
\@object{\examplecounter}[Example]{#1}
\IfNoValueF{#2}{
\customlabel{#2}{Example \arabic{\examplecounter}}
\customlabel{NUM:#2}{\arabic{\examplecounter}}
} \\*
}
% Solution environment.
% examplesolution environment is always shown (useful for example problems)
% solution environments do the same thing, but are hidden when the [nosolutions] flag is passed.
\newenvironment{examplesolution} {
\begin{tcolorbox}[
colback=white,
colframe=gray!75!black,
title={\textbf{Example Solution}}
]
}{
\end{tcolorbox}
}
\def\ORMCbgcolor{white}
% \if isn't parsed inside of LaTeX environents,
% so we have to use the comment package.
\newenvironment{@shown_solution} {
\def\ORMCbgcolor{red!5!white}
\begin{tcolorbox}[
colback=red!5!white,
colframe=red!75!black,
title={\textbf{Solution}}
]
\raggedright
}{
\end{tcolorbox}
}
\newenvironment{@shown_note} {
\def\ORMCbgcolor{cyan!5!white}
\begin{tcolorbox}[
colback=cyan!5!white,
colframe=cyan!75!black,
title={\textbf{Note for Instructors}}
]
\raggedright
}{
\end{tcolorbox}
}
% tcolorbox only give us two sections.
% This macro makes a macro \linehack that draws
% lines across a tcolorbox.
%
% Inside every environment that needs a
% \linehack macro, put \@makelinehack{color}.
\newcommand{\@makelinehack}[1]{
\newcommand{\linehack}{
\begin{tikzpicture}
\path[use as bounding box]
(0, 0)
--
(\linewidth, 0);
\draw[
color=#1,
dashed,
dash phase=1mm
]
(
0 - \kvtcb@leftlower-\kvtcb@boxsep,
0
) -- (
\linewidth + \kvtcb@rightlower + \kvtcb@boxsep,
0
);
\end{tikzpicture} \\
}
}
\ifsolutions
\newenvironment{solution}{
\@makelinehack{red!75!black}
\begin{@shown_solution}
} {
\end{@shown_solution}
}
\newenvironment{instructornote}{
\@makelinehack{cyan!75!black}
\begin{@shown_note}
} {
\end{@shown_note}
}
\else
\excludecomment{solution}
\excludecomment{instructornote}
\fi
\NewDocumentCommand{\note}{ d<> m }{
\IfNoValueTF{#1} {
\textcolor{gray}{#2} \\
} {
\textcolor{gray}{\textit{#1:} #2} \\
}
}
\NewDocumentCommand{\hint}{ m }{
\note<Hint>{#1}
}
\makeatother