Class no longer depends on article.cls

This commit is contained in:
Mark 2023-05-25 23:00:15 -07:00
parent 34cda713a0
commit 6c0508f286

View File

@ -10,12 +10,31 @@
% Option Definitions % % Option Definitions %
% ------------------ % % ------------------ %
% Standard LaTeX
\newcommand\@ptsize{}
\@twocolumnfalse
\@twosidefalse
\@mparswitchfalse
% ORMC-specific
\newif{\if@solutions} % If false, solutions and instructor notes are hidden. \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@singlenumbering} % If true, the same counter is used for all objects.
\newif{\if@nopagenumber} % If true, don't number pages. \newif{\if@nopagenumber} % If true, don't number pages.
\newif{\if@shortwarning} % If true, show a smaller solutions warning \newif{\if@shortwarning} % If true, show a smaller solutions warning
\newif{\if@nowarning} % If true, do not show solution warning \newif{\if@nowarning} % If true, do not show solution warning
% Standard LaTeX options
\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
\DeclareOption{a4paper}{%
\setlength\paperheight{297mm}%
\setlength\paperwidth{210mm}%
}
\DeclareOption{letterpaper}{%
\setlength\paperheight{11in}%
\setlength\paperwidth{8.5in}%
}
% ORMC-specific options
\DeclareOption{solutions}{\@solutionstrue} \DeclareOption{solutions}{\@solutionstrue}
\DeclareOption{nosolutions}{\@solutionsfalse} \DeclareOption{nosolutions}{\@solutionsfalse}
\DeclareOption{multinumbering}{\@singlenumberingfalse} \DeclareOption{multinumbering}{\@singlenumberingfalse}
@ -29,6 +48,7 @@
\DeclareOption*{\ClassWarning{ormc_handout}{\CurrentOption ignored}} \DeclareOption*{\ClassWarning{ormc_handout}{\CurrentOption ignored}}
\ExecuteOptions{ \ExecuteOptions{
letterpaper,10pt,
solutions, solutions,
multinumbering, multinumbering,
pagenumber, pagenumber,
@ -37,6 +57,7 @@
} }
\ProcessOptions \ProcessOptions
\input{size1\@ptsize.clo}
% Hack to allow script option override. % Hack to allow script option override.
% To force a build with solutions, compile a file containing the following: % To force a build with solutions, compile a file containing the following:
@ -51,12 +72,198 @@
\RequirePackage{etoolbox} % ------------------------------- %
% Minimal LaTeX class %
% Based on a stripped article.cls %
% Version 2022/07/02 v1.4n %
% ------------------------------- %
% Based on article class % Lengths
\LoadClass{article} \setlength\lineskip{1\p@}
\undef\maketitle \setlength\normallineskip{1\p@}
\undef\section \renewcommand\baselinestretch{}
\setlength\parskip{0\p@ \@plus \p@}
\@lowpenalty 51
\@medpenalty 151
\@highpenalty 301
\setlength\leftmargini{2.5em}
\leftmargin\leftmargini
\setlength\leftmarginii{2.2em}
\setlength\leftmarginiii{1.87em}
\setlength\leftmarginiv{1.7em}
\setlength\leftmarginv{1em}
\setlength\leftmarginvi{1em}
\setlength\labelsep{.5em}
\setlength\labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}
\@beginparpenalty -\@lowpenalty
\@endparpenalty -\@lowpenalty
\@itempenalty -\@lowpenalty
\setlength\arraycolsep{5\p@}
\setlength\tabcolsep{6\p@}
\setlength\arrayrulewidth{.4\p@}
\setlength\doublerulesep{2\p@}
\setlength\tabbingsep{\labelsep}
\skip\@mpfootins = \skip\footins
\setlength\fboxsep{3\p@}
\setlength\fboxrule{.4\p@}
\newcommand\@pnumwidth{1.55em}
\newcommand\@tocrmarg{2.55em}
\newcommand\@dotsep{4.5}
\setlength\columnsep{10\p@}
\setlength\columnseprule{0\p@}
% Counters
\setcounter{topnumber}{2}
\renewcommand\topfraction{.7}
\setcounter{bottomnumber}{1}
\renewcommand\bottomfraction{.3}
\setcounter{totalnumber}{3}
\renewcommand\textfraction{.2}
\renewcommand\floatpagefraction{.5}
\setcounter{dbltopnumber}{2}
\renewcommand\dbltopfraction{.7}
\renewcommand\dblfloatpagefraction{.5}
%\setcounter{secnumdepth}{3}
% Enum labels
\renewcommand\theenumi{\@arabic\c@enumi}
\renewcommand\theenumii{\@alph\c@enumii}
\renewcommand\theenumiii{\@roman\c@enumiii}
\renewcommand\theenumiv{\@Alph\c@enumiv}
\newcommand\labelenumi{\theenumi.}
\newcommand\labelenumii{(\theenumii)}
\newcommand\labelenumiii{\theenumiii.}
\newcommand\labelenumiv{\theenumiv.}
\renewcommand\p@enumii{\theenumi}
\renewcommand\p@enumiii{\theenumi(\theenumii)}
\renewcommand\p@enumiv{\p@enumiii\theenumiii}
\newcommand\labelitemi{\labelitemfont \textbullet}
\newcommand\labelitemii{\labelitemfont \bfseries \textendash}
\newcommand\labelitemiii{\labelitemfont \textasteriskcentered}
\newcommand\labelitemiv{\labelitemfont \textperiodcentered}
\newcommand\labelitemfont{\normalfont}
% Required by enumitem, not sure why.
\newenvironment{description}{%
\list{}{\labelwidth\z@ \itemindent-\leftmargin\let\makelabel\descriptionlabel}%
}{\endlist}
\newcommand*\descriptionlabel[1]{\hspace\labelsep\normalfont\bfseries #1}
% Font switching
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
\DeclareRobustCommand*\cal{\@fontswitch\relax\mathcal}
\DeclareRobustCommand*\mit{\@fontswitch\relax\mathnormal}
% Figures and tables
\newcommand\figurename{Figure}
\newcommand\tablename{Table}
\newcounter{figure}
\renewcommand \thefigure {\@arabic\c@figure}
\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{\figurename\nobreakspace\thefigure}
\newenvironment{figure}{\@float{figure}}{\end@float}
\newenvironment{figure*}{\@dblfloat{figure}}{\end@dblfloat}
\newcounter{table}
\renewcommand\thetable{\@arabic\c@table}
\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{\tablename\nobreakspace\thetable}
\newenvironment{table}{\@float{table}}{\end@float}
\newenvironment{table*}{\@dblfloat{table}}{\end@dblfloat}
\newlength\abovecaptionskip
\newlength\belowcaptionskip
\setlength\abovecaptionskip{10\p@}
\setlength\belowcaptionskip{0\p@}
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{#1: #2}%
\ifdim \wd\@tempboxa >\hsize
#1: #2\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip%
}
\newcommand*\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
\let\l@table\l@figure
% Miscellaneous
\newcommand\newblock{\hskip .11em\@plus.33em\@minus.07em}
\let\@openbib@code\@empty
\newcommand\@idxitem{\par\hangindent 40\p@}
\newcommand\subitem{\@idxitem \hspace*{20\p@}}
\newcommand\subsubitem{\@idxitem \hspace*{30\p@}}
\newcommand\indexspace{\par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax}
\renewcommand\footnoterule{%
\kern-3\p@
\hrule\@width.4\columnwidth
\kern2.6\p@%
}
\newcommand\@makefntext[1]{%
\parindent 1em%
\noindent
\hb@xt@1.8em{\hss\@makefnmark}#1%
}
\def\today{%
\ifcase\month\or
January\or
February\or
March\or
April\or
May\or
June\or
July\or
August\or
September\or
October\or
November\or
December
\fi%
\space\number\day, \number\year
}
\pagenumbering{arabic}
\raggedbottom
\onecolumn
% ------------ %
% Minor Tweaks %
% ------------ %
% We probably don't need enumitem for this.
% TODO: apply these edits above, in plain LaTeX.
\newcommand\sbullet[1][.5]{\mathbin{\vcenter{\hbox{\scalebox{#1}{$\bullet$}}}}} \newcommand\sbullet[1][.5]{\mathbin{\vcenter{\hbox{\scalebox{#1}{$\bullet$}}}}}