% alounsburymacros.sty 1.03 2024/2/27
% Andrew Lounsbury
% This file was not generated from source code.
% This software is contributed to the public domain.
% Marking this file as a package
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mymacros}[2024/2/27 1.0.3 miscellaneous commands]
% This allows commands that use things from these packages to work even if we
% haven't put them in \usepackage{} in the preamble.
\RequirePackage{forloop, mathrsfs, mathtools, nicefrac, xcolor}
% Otherwise, we could list packages we often use to avoid having to include them
% in the preamble of our tex files.
% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
% In other words, the use of \usepackage{} for packages other than mymacros at the *
% beginning of LaTeX_for_Undergraduates.tex is merely there for the sake of example.*
% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
\RequirePackage{amsmath, amsfonts, amssymb, amsthm, cancel, calligra, enumitem, fancyvrb, fontenc, graphicx, istgame, multicol, pagecolor, pifont, soul, totcount, upgreek, ulem, verbatim, verse}
\PassOptionsToPackage{T1}{fontenc}
\PassOptionsToPackage{normalem}{ulem}
% GENERAL COMMANDS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% From enumitem package
% Fixing indentation in enumerate and itemize environments
\setlist{
listparindent=\parindent,
parsep=0pt,
}
% For <...> options in LaTeX_for_Undergraduates.tex
\newcommand*{\opt}[1]{$\langle$\textit{#1}$\rangle$}
\newcommand*{\mopt}[1]{\text{$\langle$\textit{#1}$\rangle$}}
% LaTeX Workshop autocompletes \par to \paragraph{}, which gets annoying.
\newcommand{\p}{\par}
% \renewcommand overrides a command that has already been defined.
% In the proof environment, \qedsymbol defaults to a white square.
% I prefer a black square, so I change it here.
\renewcommand{\qedsymbol}{$\blacksquare$}
% but these allow me to easily change it to other things
\newcommand{\whiteqed}{\renewcommand{\qedsymbol}{$\square$}}
\newcommand{\noqed}{\renewcommand{\qedsymbol}{}}
% Environments -----------------------------------------------------------------
% Creating \begin{...} \end{...} environments with a few defaults provided by
% \newtheorem
% * removes numbering
% The first {} contains the name of the environment.
% The second {} contains what will be displayed.
\newtheorem{claim}{Claim} % numbered
\newtheorem*{claim*}{Claim} % not numbered
\newtheorem{conjecture}{Conjecture}
\newtheorem*{conjecture*}{Conjecture}
\newtheorem{corollary}{Corollary}
\newtheorem*{corollary*}{Corollary}
\newtheorem{lemma}{Lemma}
\newtheorem*{lemma*}{Lemma}
\newtheorem{note}{Note}
\newtheorem{problem}{Problem}
\newtheorem{proposition}{Proposition}
\newtheorem*{proposition*}{Proposition}
\newtheorem{theorem}{Theorem}
\newtheorem*{theorem*}{Theorem}
\theoremstyle{definition} % removes italics from the following
\newtheorem{axiom}{Axiom}
\newtheorem*{axiom*}{Axiom}
\newtheorem{case}{Case}
\newtheorem{counterexample}{Counterexample}
\newtheorem*{counterexample*}{Counterexample}
\newtheorem{definition}{Definition}
\newtheorem*{definition*}{Definition}
\newtheorem{definitions}{Definitions}
\newtheorem*{definitions*}{Definitions}
\newtheorem{example}{Example}
\newtheorem*{example*}{Example}
\newtheorem{examples}{Examples}
\newtheorem*{examples*}{Examples}
\newtheorem{nonexample}{Non-Example}
\newtheorem*{nonexample*}{Non-Example}
\newtheorem{fact}{Fact}
\newtheorem*{fact*}{Fact}
\newtheorem{notation}{Notation}
\newtheorem*{notation*}{Notation}
\theoremstyle{remark} % italicized title, upright text
\newtheorem{remark}{Remark}
\newtheorem*{remark*}{Remark}
% Don't use these \newtheorem environments.
% Use the \newenvironment's below.
\newtheorem*{pfcases}{Proof by Cases}
\newtheorem*{pfcontradiction}{Proof by Contradiction}
\newtheorem*{pfcombinatorial}{Proof (Combinatorial)}
\newtheorem*{pfcontrapositive}{Proof by Contrapositive}
\newtheorem*{pfdirect}{Proof (Direct)}
\newtheorem*{pfinduction}{Proof by Induction}
% Proof environments with the technique specified
\newenvironment*{pfca}
{\pushQED{\qed}\pfcases}
{\popQED\endpfcases}
\newenvironment*{pfcd}
{\pushQED{\qed}\pfcontradiction}
{\popQED\endpfcontradiction}
\newenvironment*{pfco}
{\pushQED{\qed}\pfcombinatorial}
{\popQED\endpfcombinatorial}
\newenvironment*{pfcp}
{\pushQED{\qed}\pfcontrapositive}
{\popQED\endpfcontrapositive}
\newenvironment*{pfd}
{\pushQED{\qed}\proof}
{\popQED\endpfdirect}
\newenvironment*{pfi}
{\pushQED{\qed}\pfinduction}
{\popQED\endpfinduction}
\theoremstyle{plain} % adds italics to the following
\newtheorem*{cconjecture*}{\colorbox{orange}{Conjecture}}
\newtheorem{ccorollary}{\colorbox{orange}{Corollary}}
\newtheorem*{ccorollary*}{\colorbox{orange}{Corollary}}
\newtheorem{clemma}{\colorbox{orange}{Lemma}}
\newtheorem*{clemma*}{\colorbox{orange}{Lemma}}
\newtheorem{cnote}{\colorbox{blue}{Note}}
\newtheorem{cproposition}{\colorbox{pink}{Proposition}}
\newtheorem*{cproposition*}{\colorbox{pink}{Proposition}}
\newtheorem{ctheorem}{\colorbox{pink}{Theorem}}
\newtheorem*{ctheorem*}{\colorbox{pink}{Theorem}}
\theoremstyle{definition} % removes italics from the following
\newtheorem{ccase}{Case}
\newtheorem*{cfact*}{\colorbox{cyan}{Fact}}
\newtheorem{cexample}{\colorbox{darkpastelgreen}{Example}}
\newtheorem*{cexample*}{\colorbox{darkpastelgreen}{Example}}
\newtheorem{cnonexample}{\colorbox{darkpastelgreen}{Non-Example}}
\newtheorem*{cnonexample*}{\colorbox{red}{Non-Example}}
\newtheorem*{cremark*}{\colorbox{cyan}{Remark}}
%-----------------------------------------------------------------
% For double row separators in arrays
\newcommand{\hhline}{\hline\hline}
% For inductive proofs and recursive definitions
\newcommand{\bc}{\textbf{\underline{Base case}: }}
\newcommand{\ind}{\textbf{\underline{Induction step}: }}
\newcommand{\basis}{\textbf{\underline{Basis}: }}
\newcommand{\rec}{\textbf{\underline{Recursive step}: }}
% Ways to avoid \text{} in display-math
\newcommand{\as}{\text{ as}\ }
\newcommand{\bec}{\text{ because}\ }
\newcommand{\but}{\text{ but}\ }
\newcommand{\const}{\text{ const}\ }
\newcommand{\countable}{\text{ countable}\ }
\newcommand{\each}{\text{ each}\ }
\newcommand{\et}{\text{ and}\ }
\newcommand{\for}{\text{ for}\ }
\newcommand{\some}{\text{ some}\ }
\newcommand{\fs}{\text{ for some}\ }
\newcommand{\on}{\text{ on}\ }
\newcommand{\ona}{\text{ on a}\ }
\newcommand{\ow}{\text{o/w}\ } % otherwise
\newcommand{\suchthat}{\text{s.t.}\ } % such that
\newcommand{\mst}{\text{ s.t.}\ } % math such that
\newcommand{\ou}{\text{ or}\ }
\renewcommand{\over}{\text{ over}\ }
\newcommand{\alors}{\text{ so}\ }
\newcommand{\tms}{\text{ times}\ } % for \underbrace{...}_{n times}
\newcommand{\undef}{\text{undef.}\ }
\newcommand{\with}{\text{ with}\ }
\newcommand{\where}{\text{ where}\ }
\newcommand{\wrt}{\text{ with respect to}\ }
% Things to stack on =, <, \le, etc.
\newcommand{\lh}{\stackrel{\text{\tiny L'H}}} % L'Hôpital's Rule
\newcommand{\pf}{\stackrel{\text{\tiny PF}}} % Pascal's Formula
\newcommand{\ti}{\stackrel{\text{\tiny TI}}} % Triangle Inequality
\newcommand{\one}{\stackrel{\text{\tiny \ensuremath{(1)}}}}
\newcommand{\two}{\stackrel{\text{\tiny \ensuremath{(2)}}}}
\newcommand{\three}{\stackrel{\text{\tiny \ensuremath{(3)}}}}
% Miscellaneous
\newcommand{\bs}{\boldsymbol}
\newcommand{\f}{\frac} % \f{numerator}{denominator}
\newcommand{\inv}{^{-1}}
\newcommand*{\lcm}[1]{\mathrm{lcm}\left\{#1\right\}} % least common multiple
\newcommand{\mbf}{\mathbf} % math bold face
\newcommand*{\ol}[1]{\overline{#1}}
\newcommand*{\ttt}[1]{\texttt{#1}}
\newcommand*{\unl}[1]{\underline{#1}}
\newcommand{\vn}{\varnothing}
\newcommand{\wt}{\widetilde}
% My notations
\newcommand*{\ine}[1]{{\in_{#1}}}
\newcommand*{\msum}[3]{\sum\limits_{#1=#2}^{#3}} % my sum
\newcommand*{\mprod}[3]{\prod\limits_{#1=#2}^{#3}} % my prod
\newcommand*{\mcap}[3]{\cap_{#1=#2}^{#3}} % etc.
\newcommand*{\mcup}[3]{\cup_{#1=#2}^{#3}}
\newcommand*{\mbcap}[3]{\bigcap\limits_{#1=#2}^{#3}}
\newcommand*{\mbcup}[3]{\bigcup\limits_{#1=#2}^{#3}}
\newcommand*{\mset}[4]{\left\{#1\right\}_{#2=#3}^{#4}}
% Default infinity for the upper bounds
\newcommand*{\msumi}[2]{\msum{#1}{#2}{\infty}}
\newcommand*{\mprodi}[2]{\mprod{#1}{#2}{\infty}}
\newcommand*{\mcapi}[2]{\mcap{#1}{#2}{\infty}}
\newcommand*{\mcupi}[2]{\mcup{#1}{#2}{\infty}}
\newcommand*{\mbcapi}[2]{\mbcap{#1}{#2}{\infty}}
\newcommand*{\mbcupi}[2]{\mbcup{#1}{#2}{\infty}}
\newcommand*{\mseti}[3]{\mset{#1}{#2}{#3}{\infty}}
% \Mid is a very useful extensible \mid from the mathtools documentation
% (originally \given)
% just to make sure it exists
\providecommand\Mid{}
% can be useful to refer to this outside \set
\newcommand\SetSymbol[1][]{%
\nonscript\:#1\vert%
\allowbreak%
\nonscript\:%
\mathopen{}%
}
\DeclarePairedDelimiterX{\set}[1]\{\}{%
\renewcommand\Mid{\SetSymbol[\delimsize]}%
#1%
}
%-------------------------------------------------------------------------
% Polynomial rings over projective space
\newcommand*{\pring}[2]{\bP^{#1}(#2)}
\newcommand{\ptwok}{\bP^2(k)}
\newcommand{\pnk}{\bP^n(k)}
\newcommand{\por}{\bP^1(\R)}
\newcommand{\ptwor}{\bP^2(\R)}
\newcommand{\pthr}{\bP^3(\R)}
\newcommand{\pnr}{\bP^n(\R)}
\newcommand{\gln}{\mathrm{GL}(n,k)}
\DeclareMathOperator{\lm}{LM} % leading monomial
\DeclareMathOperator{\lt}{LT} % leading term
\DeclareMathOperator{\lc}{LC} % leading coefficient
\DeclareMathOperator{\md}{multideg} % degree for multivariate polynomial
\newcommand*{\mto}[2]{#1\to#2} % my to
\newcommand*{\mtoi}[1]{\mto{#1}{\infty}}
\newcommand{\nti}{\mtoi{n}}
\newcommand{\ttx}{\mto{t}{x}}
\newcommand{\xti}{\mtoi{x}}
% Default upper bound of infinity
\newcommand*{\dinti}[1]{\dint{#1}{\infty}} % display integral (no \limits)
\newcommand*{\minti}[1]{\mint{#1}{\infty}}
\newcommand{\pint}{\mint{0}{1}} % probability integral
\newcommand{\piint}{\mint{0}{1}\mint{0}{1}}
\newcommand{\piiint}{\mint{0}{1}\mint{0}{1}\mint{0}{1}}
\newcommand{\dpint}{\dint{0}{1}}
\newcommand{\dpiint}{\dint{0}{1}\dint{0}{1}}
\newcommand{\dpiiint}{\dint{0}{1}\dint{0}{1}\dint{0}{1}}
% For loops
\newcounter{i}
\newcommand*{\mdit}[1][1]{% my ditto; invoked as \mdit[n] for n ditto marks
\forloop{i}{0}{\value{i} < #1}%
{%
\dit%
}%
}
% my sparse ditto
\newcommand*{\msdit}[1][1]{\forloop{i}{0}{\value{i}<#1}{\sdit}}
% my dense ditto
\newcommand*{\mddit}[1][1]{\forloop{i}{0}{\value{i}<#1}{\ddit}}