Skip to content

Instantly share code, notes, and snippets.

@TobiasBouma
Created Jul 10, 2015
Embed
What would you like to do?
classnofonts.cls
\NeedsTeXFormat{LaTeX2e}[2014/05/01]%
\ProvidesClass{classnofonts}[2015/05/27 - v0.1035 Class file intended for use for Condensed Matter II]%
% make sure pointsize is undefined, otherwise make sure it is undefined
\ifx\cm@ptsize\relax%
\else%
\let\cm@ptsize\relax%
\fi%
% LaTeX internals for two side option
\@twosidetrue%
\@mparswitchtrue%
% temporary fix for \tableofcontents
\newif\if@restonecol%
% PT SIZE OPTIONS (TODO)
\DeclareOption{8pt}{\def\cm@ptsize{8}}
\DeclareOption{9pt}{\def\cm@ptsize{9}}
\DeclareOption{10pt}{\def\cm@ptsize{10}}%
\DeclareOption{11pt}{\def\cm@ptsize{11}}%
\DeclareOption{12pt}{\def\cm@ptsize{12}}%
% EQUATION CUSTOMIZATION
\DeclareOption{leqno}{\input{leqno.clo}}%
\DeclareOption{fleqn}{\input{fleqn.clo}}%
% BIBLIOGRAPHY STUFF
\newif\ifcm@bibtex \cm@bibtexfalse%
\DeclareOption{bibtex}{\cm@bibtextrue}%
% TODO
\DeclareOption{openbib}{%
\AtEndOfPackage{%
\renewcommand\@openbib@code{%
\advance\leftmargin\bibindent%
\itemindent -\bibindent%
\listparindent \itemindent%
\parsep \z@%
}%
\renewcommand\newblock{\par}}%
}
\ExecuteOptions{9pt}%
\ProcessOptions%
% definitions for \normalsize, \small, \footnotesize, etc... INHERITED FROM DOCUMENTCLASS {book}
\ifnum\cm@ptsize<10
\input{size\cm@ptsize.clo}
\else
\input{bk\cm@ptsize.clo}%
\fi
% FONT RELATED SETTINGS
%\RequirePackage{ifxetex}%
%\ifxetex%
% \RequirePackage{fontspec}%
% \defaultfontfeatures{Ligatures=TeX}%
% \setmainfont%
% [BoldFont={LeMondeLivre-Bold},%
% ItalicFont={LeMondeLivre-Italic},%
% SmallCapsFont={LeMondeLivre-NormalSC}]%
% {LeMondeLivre-Normal}%
% \RequirePackage{microtype}%
% \input LeMondeLivre-fs.def%
%\else%
% \RequirePackage[T1]{fontenc}%
% \pdfmapfile{Typofonderie.map}%
% \pdfmapfile{Typekit.map}%
% %\pdfmapfile{proximanova.map}%
% \RequirePackage{microtype}%%
% \input{LeMondeLivre-map.def}%
% \renewcommand\rmdefault{fml}%
% \renewcommand\sfdefault{fml}%
%\fi%
% PAGE DIMENS
\RequirePackage[paperwidth=483pt, paperheight=682pt, left=40pt, top=40pt, textwidth=283pt, marginparsep=20pt, marginparwidth=100pt, textheight=\ifcase\cm@ptsize\or\or\or\or\or\or
\or\or59\or51\or47\or42\or39\fi\baselineskip, footskip=40pt]{geometry}%%8
\RequirePackage{xcolor}
\definecolor{cmdark}{RGB}{167,63,63}%
\definecolor{cmlight}{RGB}{244,218,151}%
% FULLWIDTH
\newlength{\cm@outerhang}%
\newenvironment{fullwidth}%
{%
\begin{adjustwidth*}{\z@}{-\cm@outerhang}%
}%
{%
\end{adjustwidth*}%
}%
% FIGURES AND TABLES
% (i) NUMBERING FORMATS
\def\preformatstyle{\thesection.\ignorespaces}%
\newcounter{figure}%
\newcounter{table}%
\renewcommand\theequation{\preformatstyle\@arabic\c@equation}%
\renewcommand\thefigure{\preformatstyle\@arabic\c@figure}%
\renewcommand\thetable{\preformatstyle\@arabic\c@table}%
% (ii) TODO - WHAT ARE THESE DEFINITIONS, ETC
\def\fps@figure{tbp}%
\def\ftype@figure{1}%
\def\ext@figure{lof}%
\def\fnum@figure{\figurename\nobreakspace\thefigure}%
\def\fps@table{tbp}%
\def\ftype@table{2}%
\def\ext@table{lot}%
\def\fnum@table{\tablename\nobreakspace\thetable}%
\newenvironment{oldfigure}{\@float{figure}}{\end@float}%
\newenvironment{oldfigure*}{\@dblfloat{figure}}{\end@dblfloat}%
\newenvironment{oldtable}{\@float{table}}{\end@float}%
\newenvironment{oldtable*}{\@dblfloat{table}}{\end@dblfloat}%
\newenvironment{figure}{}{}
\newenvironment{figure*}{}{}
\newenvironment{table}{}{}
\newenvironment{table*}{}{}
% make sure \@makecaption is defined before loading titlesec
% since titlesec loads the CAPTION package, which requires this to be defined
\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}%
% SIDENOTES
\RequirePackage{sidenotes}%
\def\sidenotenumstyle{\scriptsize}%
\def\sidenotetextstyle{\small\itshape\justifying}%
\ExplSyntaxOn%
\RenewDocumentCommand \sidenotetext { o o +m }%
{%
\IfNoValueOrEmptyTF{#1}%
{%
\@sidenotes@placemarginal{#2}{%
\setbox0=\hbox{\textsuperscript{\sidenotenumstyle\thesidenote}{}~}%
\leftskip=\wd0\hskip-\wd0\box0
\sidenotetextstyle#3}%
\refstepcounter{sidenote}%
}%
{\@sidenotes@placemarginal{#2}{%
\setbox0=\hbox{\textsuperscript{\sidenotenumstyle#1}~}%
\leftskip=\wd0\hskip-\wd0\box0
\sidenotetextstyle#3}}%
}%
\ExplSyntaxOff%
\newif\ifcm@floatstar%
% CUSTOM FLOATS (TODO)
\long\def\ifemptyarg#1{%
\if\relax\detokenize{#1}\relax%
\expandafter\@firstoftwo%
\else%
\expandafter\@secondoftwo%
\fi}%
\newcommand{\floatalignment}{x}% holds the current float alignment (t, b, h, p)
\newcommand{\setfloatalignment}[1]{\global\def\floatalignment{#1}}% manually sets the float alignment
\newsavebox{\cm@figure@box}%
\newsavebox{\cm@caption@box}%
\let\cm@orig@@float\@float%
\let\cm@orig@@endfloat\end@float%
\newlength{\cm@caption@vertical@offset}%
\setlength{\cm@caption@vertical@offset}{\floatsep}%
\newcommand{\cm@stored@shortcaption}{}%
\newcommand{\cm@stored@caption}{}%
\newcommand{\cm@stored@label}{}%
\long\def\cm@caption[#1][#2]#3{%
\ifemptyarg#1%
{\gdef\cm@stored@shortcaption{#3}}%
{\gdef\cm@stored@shortcaption{#1}}%
\global\setlength{\cm@caption@vertical@offset}{-#2}%
\gdef\cm@stored@caption{#3}%
}
\newif\ifcm@subcaptionloaded%
\AtBeginDocument{%
\@ifpackageloaded{subfigure}{\cm@subcaptionloadedtrue}{\cm@subcaptionloadedfalse}%
}%
\newlength{\cm@float@contents@width}%
\newlength{\cm@fullwidth}%
\newlength{\cm@caption@fill}%
\newcommand{\cm@recalculate}{%
\setlength{\cm@outerhang}{\marginparwidth}%
\addtolength{\cm@outerhang}{\marginparsep}%
\setlength{\cm@fullwidth}{\textwidth}%
\addtolength{\cm@fullwidth}{\marginparsep}%
\addtolength{\cm@fullwidth}{\marginparwidth}%
\setlength{\cm@caption@fill}{\textwidth}%
\addtolength{\cm@caption@fill}{\marginparsep}%
\cm@infobox@defaultwidth=\marginparwidth%
\advance\cm@infobox@defaultwidth by -2\fboxsep%
}
\AtBeginDocument{\cm@recalculate}
\newdimen\cm@tempdim
\RequirePackage{optparams}%
%% Define a float environment to place the captions in the margin space
\newenvironment{cm@float}[2][htbp]%
{%
\global\let\cm@orig@caption\caption%
\global\let\cm@orig@label\label%
\setfloatalignment{#1}%
\renewcommand\caption{\optparams{\cm@caption}{[][0pt]}}%
\renewcommand\label[1]{\gdef\cm@stored@label{##1}}%
\ifcm@subcaptionloaded%
\global\let\label\cm@orig@label%
\fi%
\cm@orig@@float{#2}[#1]%
\ifcm@floatstar%
\setlength{\cm@float@contents@width}{\cm@fullwidth}%
\else%
\setlength{\cm@float@contents@width}{\textwidth}%
\fi%
\begin{lrbox}{\cm@figure@box}%
\begin{minipage}[\floatalignment]{\cm@float@contents@width}\hbox{}%
}{%
\par\hbox{}\vskip-\baselineskip%
\ifdim\prevdepth>\z@%
\vskip-\prevdepth%
\fi%
\end{minipage}%
\end{lrbox}%
\begin{lrbox}{\cm@caption@box}%
\begin{minipage}[\floatalignment]{\marginparwidth}\hbox{}%
\if\cm@stored@caption\relax\else\cm@orig@caption[\cm@stored@shortcaption]{\cm@stored@caption}\fi%
\if\cm@stored@label\relax\else\cm@orig@label{\cm@stored@label}\fi%
\par%
\hbox{}%
\ifdim\prevdepth>\z@%
\vskip-\prevdepth%
\fi%
\end{minipage}%
\end{lrbox}%
\cm@tempdim=\ht\cm@caption@box%
\advance\cm@tempdim\dp\cm@caption@box%
\advance\cm@tempdim\ht\cm@figure@box%
\advance\cm@tempdim\dp\cm@figure@box%
\immediate\write\@auxout{\string\global\noexpand\@namedef{\floatalignment-float-page-\thepage}{\the\cm@tempdim}}%
\begin{fullwidth}%
\begin{minipage}[\floatalignment]{\linewidth}%
\ifcm@floatstar%
\cm@float@fullwidth[\cm@caption@vertical@offset]{\cm@figure@box}{\cm@caption@box}%
\else%
\cm@float@textwidth[\cm@caption@vertical@offset]{\cm@figure@box}{\cm@caption@box}%
\fi%
\end{minipage}%
\end{fullwidth}%
\cm@orig@@endfloat%
\let\caption\cm@orig@caption%
\let\label\cm@orig@label%
\begin{lrbox}{\cm@figure@box}\null\end{lrbox}%
\begin{lrbox}{\cm@caption@box}\null\end{lrbox}%
\gdef\cm@stored@shortcaption{}%
\gdef\cm@stored@caption{}%
\gdef\cm@stored@label{}%
\global\setlength{\cm@caption@vertical@offset}{\z@}%
}
\newcommand{\cm@float@textwidth}[3][0pt]{%
\strictpagecheck%
\checkoddpage%
\ifoddpage%
\hbox{%
\usebox{#2}%
\hspace{\marginparsep}%
\smash{\raisebox{#1}{\usebox{#3}}}}%
\else%
\hbox{%
\smash{\raisebox{#1}{\usebox{#3}}}%
\hspace{\marginparsep}%
\usebox{#2}%
}%
\fi%
}
%
\newcommand{\cm@float@fullwidth}[3][0pt]{%
\ifnum\pdf@strcmp{\floatalignment}{b}=0 %
\strictpagecheck%
\checkoddpage%
\ifoddpage%
\hfill\smash{\raisebox{#1}{\usebox{#3}}}%
\par%
\usebox{#2}%
\else%
\smash{\raisebox{#1}{\usebox{#3}}}\hfill%
\par%
\usebox{#2}%
\fi%
\else%
\strictpagecheck%
\checkoddpage%
\ifoddpage%
\usebox{#2}%
\par%
\hfill\smash{\raisebox{#1}{\usebox{#3}}}%
\else%
\usebox{#2}%
\par%
\smash{\raisebox{#1}{\usebox{#3}}}\hfill%
\fi%
\fi%
}
%
\renewenvironment{figure}[1][htbp]
{\cm@floatstarfalse%
\begin{cm@float}[#1]{figure}}%
{\end{cm@float}}%
\renewenvironment{table}[1][htbp]%
{\cm@floatstarfalse%
\begin{cm@float}[#1]{table}}%
{\end{cm@float}}
\renewenvironment{figure*}[1][htbp]%
{\cm@floatstartrue%
\begin{cm@float}[#1]{figure}}%
{\end{cm@float}}
\renewenvironment{table*}[1][htbp]%
{\cm@floatstartrue%
\begin{cm@float}[#1]{table}}%
{\end{cm@float}}
\RequirePackage{placeins}
%%
% Margin float environment
%\newsavebox{\cm@margin@floatbox}
%\newenvironment{cm@margin@float}[2][-1.2ex]%
% {\FloatBarrier% process all floats before this point so the figure/table numbers stay in order.
% \begin{lrbox}{\cm@margin@floatbox}%
% \begin{minipage}{\marginparwidth}%
% %\cm@caption@font%
% \def\@captype{#2}%
% \hbox{}\vspace*{#1}%
% \justifying%
% %\@tufte@margin@par%
% \noindent%
% }
% {\end{minipage}%
% \end{lrbox}%
% \marginpar{\usebox{\cm@margin@floatbox}}%
% %\@tufte@reset@par%
% }
% SECTIONS (initial commands)
\newcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries}}%
\newcommand\subsection{\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\large\bfseries}}%
\newcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}%
\newcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{3.25ex \@plus1ex \@minus.2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}}%
\newcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
{3.25ex \@plus1ex \@minus .2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}}%
% BIBTEX
\ifcm@bibtex%
\RequirePackage[backend = bibtex]{biblatex}%
\let\sidecite\fullfootcite%
\fi%
% STILL GOTTA FIX THIS (TODO)
%\long\def\@caption#1[#2]#3{%
% \par%
% \addcontentsline{\csname ext@#1\endcsname}{#1}%
% {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
% \begingroup%
% \@parboxrestore%
% \if@minipage%
% \@setminipage%
% \fi%
% %\cm@caption@font
% \justifying%
% \noindent\csname fnum@#1\endcsname: \ignorespaces#3\par%
% \endgroup
% }
% QUOTATION
\pdfmapfile{Impallari.map}
\def\quotationstyle{\itshape\fontsize{11pt}{13pt}\selectfont}
%\def\quotationfont{fcb}
\def\authorstyle{\scshape\footnotesize}
%\def\authorfont{fml}
\newsavebox{\cm@quotationbox}
\newsavebox{\cm@quotationauthorbox}
\newlength{\cm@widthofinitialminipage}
\newlength{\cm@heightofquotationbox}
\newlength{\cm@widthbetweenpicandquote}
\newlength{\cm@remainingwidth}
\newlength{\minipagealignment}
\newenvironment{quotation}[2][]
{%
\setlength{\minipagealignment}{.485\linewidth}
\def\quotationbox@figurename{#1}%
\def\quotationbox@authname{#2}%
\begin{lrbox}{\cm@quotationauthorbox}%
\begin{minipage}{\minipagealignment}
\hfill
\fontfamily{\authorfont}\selectfont\authorstyle\quotationbox@authname%
\end{minipage}
\end{lrbox}%
\begin{lrbox}{\cm@quotationbox}%
\begin{minipage}{\minipagealignment}%
\fontfamily{\quotationfont}\selectfont%
\quotationstyle``\ignorespaces%
}%
{%
''
\end{minipage}%
\end{lrbox}%
\setlength{\cm@heightofquotationbox}{\ht\cm@quotationbox}%
\addtolength{\cm@heightofquotationbox}{\dp\cm@quotationbox}%
%
\setlength{\cm@remainingwidth}{\linewidth}
\ifcm@cs@pic
\global\setlength{\cm@widthbetweenpicandquote}{0.03\linewidth}
\global\setlength{\cm@widthofinitialminipage}{\linewidth}
\global\addtolength{\cm@widthofinitialminipage}{-\minipagealignment}
\global\addtolength{\cm@widthofinitialminipage}{-\cm@widthbetweenpicandquote}
\global\addtolength{\cm@remainingwidth}{-\cm@widthofinitialminipage}
\global\addtolength{\cm@remainingwidth}{-\cm@widthbetweenpicandquote}
\begin{minipage}{\cm@widthofinitialminipage}
\hfill\raisebox{\fontchardp\font`y}{\includegraphics[height=\cm@heightofquotationbox]{\quotationbox@figurename}}%
\end{minipage}%
\hskip\cm@widthbetweenpicandquote
%%
\fi
\begin{minipage}[t]{\cm@remainingwidth}%
\ifcm@cs@pic
\else
\hfill
\fi
\usebox{\cm@quotationbox}%
\vskip.25\baselineskip%
\ifcm@cs@pic
\else
\hfill
\fi
\usebox{\cm@quotationauthorbox}%
\cm@cs@picfalse
\end{minipage}%
}
% PATCH WITH TITLESEC (temporary)
\colorlet{sectnumcolor}{cmdark}%
\RequirePackage[explicit]{titlesec}%
\newdimen\cm@cs@ts%
\newdimen\cm@cs@ms%
\newdimen\cm@cs@sbtar%
\newdimen\cm@cs@lheight
\newif\ifcm@cs@norule%
\newif\ifcm@cs@sectimage \cm@cs@sectimagefalse
\newif\ifcm@cs@keypoints \cm@cs@keypointsfalse
\newif\ifcm@cs@quotation \cm@cs@quotationfalse
\newif\ifcm@cs@pic \cm@cs@picfalse
\define@key{customsections}{title font}{\def\cm@ttf{#1}}%
\define@key{customsections}{title font size}{\def\cm@ttf@s{#1}}%
\define@key{customsections}{topskip}{\cm@cs@ts=#1}%
\define@key{customsections}{medskip}{\cm@cs@ms=#1}%
\define@key{customsections}{line distance sep}{\cm@cs@sbtar=#1}%
\define@key{customsections}{no rule}[true]{\csname cm@cs@norule#1\endcsname}%
\define@key{customsections}{sub}{\def\cm@cs@sub{#1}}%
\define@key{customsections}{substyle}{\def\cm@cs@ss{#1}}%
\define@key{customsections}{section image}{\cm@cs@sectimagetrue\def\cm@cs@ci@name{#1}}%
\define@key{customsections}{quotation}{\cm@cs@quotationtrue\long\def\cm@cs@quotationcontent{#1}}%
\define@key{customsections}{quotation image}{\cm@cs@pictrue\def\cm@cs@quotationimage{#1}}%
\define@key{customsections}{quotation name}{\def\cm@cs@quotationname{#1}}%
\define@key{customsections}{keypoints}{\cm@cs@keypointstrue\def\cm@cs@keypoints{#1}}%
\define@key{customsections}{keypoint headerstyle}{\def\cm@cs@keypointhstyle{#1}}%
\define@key{customsections}{keypoint style}{\def\cm@cs@keypointstyle{#1}}%
\setkeys{customsections}{%
title font=fml,%
title font size=40pt,%
topskip=.125\textheight,%
medskip=.1\textheight,%
line distance sep=5pt,%
no rule=false,%
substyle=\Large\itshape,%
keypoint style=\fontsize{9pt}{7pt}\selectfont,%
keypoint headerstyle=\fontsize{11pt}{13pt}\selectfont\scshape,%
}
\newcommand\cm@cs@parsekeypoints[1]{{%
{\cm@cs@keypointhstyle Keypoints:}%
\cm@cs@keypointstyle%
\begin{itemize}%
\@for\tmp:=#1\do{\item \tmp}%
\end{itemize}%
}}
\def\sectionset#1{%
\setkeys{customsections}{#1}%
}
\let\cm@orig@section\section%
\def\section{\@ifstar\cm@orig@section\cm@sect}%
\def\cm@sect{\@ifnextchar[\cm@sect@opt\cm@sect@}%
\long\def\cm@sect@opt[#1]#2{%
\bgroup%
\baselineskip=\z@%
\setkeys{customsections}{#1}%
\cm@orig@section{#2}%
\egroup%
}%
\def\cm@sect@#1{%
\cm@orig@section{#1}%
}%
\titleformat{name=\section}%
{}%
{}%
{\z@}%
{%
\clearpage%
\ifodd\c@page%
\else%
\null\newpage%
\fi%
\thispagestyle{empty}%
\begin{fullwidth}%
\null%
\vskip\cm@cs@ts%
\hbox{%
\hskip-3pt%
\fontfamily{\cm@ttf}\fontsize{\cm@ttf@s}{\z@}\selectfont%
#1%
\vphantom{A q}%
}%
\vskip\cm@cs@sbtar%
\ifcm@cs@norule%
\ifcsname cm@cs@sub\endcsname%
\phantom{\rule{\linewidth}{\p@}}%
\vskip\cm@cs@sbtar%
\cm@cs@ss\cm@cs@sub\phantom{A q}%
\else%
\phantom{\rule{\linewidth}{\p@}}%
\vskip\cm@cs@sbtar%
\cm@cs@ss\phantom{A q}%
\fi%
\else%
\ifcsname cm@cs@sub\endcsname%
\rule{\linewidth}{\p@}%
\vskip\cm@cs@sbtar%
\cm@cs@ss\cm@cs@sub\phantom{A q}%
\else%
\vskip-2.2pt%
\rule{\linewidth}{\p@}%
\vskip\cm@cs@sbtar%
\cm@cs@ss\phantom{A q}%
\fi%
\fi%
\vskip\cm@cs@ms%
\null%
%\rule{\linewidth}{\p@}%
\begin{minipage}[t]{.475\linewidth}%
\ifcm@cs@keypoints%
\setbox0=\vbox{%
\cm@cs@parsekeypoints{\cm@cs@keypoints}%
}%
\smash{\vbox to 0pt{\box0\vss}}%
\fi%
\end{minipage}\hfill%
\begin{minipage}[t]{.475\linewidth}%
\ifcm@cs@sectimage%
\setbox2=\vbox{\includegraphics[width=\linewidth]{\cm@cs@ci@name}}%
\smash{\vbox to 0pt{\box2\vss}}%
\fi%
\end{minipage}%
\ifcm@cs@quotation%
\vfill%
\ifcsname cm@cs@quotationimage\endcsname%
\ifemptyarg{\cm@cs@quotationimage}{%
\begin{quotation}{\cm@cs@quotationname}%
\cm@cs@quotationcontent%
\end{quotation}%
}{%
\begin{quotation}[\cm@cs@quotationimage]{\cm@cs@quotationname}%
\cm@cs@quotationcontent%
\end{quotation}%
}%
\else%
\begin{quotation}{\cm@cs@quotationname}%
\cm@cs@quotationcontent%
\end{quotation}%
\fi%
\fi%
\cm@cs@sectimagefalse%
\cm@cs@keypointsfalse%
\cm@cs@quotationfalse%
\cm@cs@picfalse%
\end{fullwidth}%
\clearpage}%
% PKGS
\RequirePackage{ragged2e}%
\RequirePackage{ifoddpage}%
\RequirePackage{bm}%
\RequirePackage[strict]{changepage}%
\RequirePackage{wrapfig}%
\RequirePackage{xifthen}%
\RequirePackage{amsmath}%
% DIMENSIONS
\setlength\lineskip{1\p@}%
\setlength\normallineskip{1\p@}%
\setlength\parskip{\z@\@plus\p@\@minus\p@}%
\setlength\columnsep{10\p@}%
\setlength\columnseprule{0\p@}%
\setlength\arraycolsep{5\p@}%
\setlength\tabcolsep{6\p@}%
\setlength\arrayrulewidth{.4\p@}%
\setlength\doublerulesep{2\p@}%
\setlength\tabbingsep{\labelsep}%
\setlength\fboxsep{6\p@}%
\setlength\fboxrule{.4\p@}%
% RAGGED BOTTOM HACK
\AtBeginDocument{%
\def\@textbottom{\vskip \z@ \@plus 7\p@}% SWEET SPOT
\let\@texttop\relax%
\vfuzz=\z@%
}
% DEFAULT PAGE NUMBERING (TODO)
\pagenumbering{arabic}%
% PENALTIES
\@lowpenalty 51%
\@medpenalty 151%
\@highpenalty 301%
% FLOATS
\setcounter{topnumber}{1}%
\setcounter{bottomnumber}{1}%
\setcounter{totalnumber}{1}%
\setcounter{dbltopnumber}{1}% TODO
% more LaTeX internals
\renewcommand\topfraction{.7}%
\renewcommand\bottomfraction{.7}%
\renewcommand\textfraction{.2}%
\renewcommand\floatpagefraction{.7}%
\renewcommand\dbltopfraction{.7}%
\renewcommand\dblfloatpagefraction{.5}%
% TODO
% \def\ps@headings{%
% \let\@oddfoot\@empty\let\@evenfoot\@empty
% \def\@evenhead{\thepage\hfil\slshape\leftmark}%
% \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
% \let\@mkboth\markboth
% \def\chaptermark##1{%
% \markboth {\MakeUppercase{%
% \ifnum \c@secnumdepth >\m@ne
% \if@mainmatter
% \@chapapp\ \thechapter. \ %
% \fi
% \fi
% ##1}}{}}%
% \def\sectionmark##1{%
% \markright {\MakeUppercase{%
% \ifnum \c@secnumdepth >\z@
% \thesection. \ %
% \fi
% ##1}}}}
%\def\ps@myheadings{%
% \let\@oddfoot\@empty\let\@evenfoot\@empty
% \def\@evenhead{\thepage\hfil\slshape\leftmark}%
% \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
% \let\@mkboth\@gobbletwo
% \let\chaptermark\@gobble
% \let\sectionmark\@gobble
% }
% SECTION NUMBERING
\setcounter{secnumdepth}{2}%
\newcounter {part}%
\newcounter {section}%
\newcounter {subsection}[section]%
\newcounter {subsubsection}[subsection]%
\newcounter {paragraph}[subsubsection]%
\newcounter {subparagraph}[paragraph]%
% FORMAT
\renewcommand \thepart {\@Roman\c@part}%
\renewcommand \thesection {\@arabic\c@section}%
\renewcommand \thesubsection {\thesection.\@arabic\c@subsection}%
\renewcommand \thesubsubsection {\thesubsection.\@arabic\c@subsubsection}%
\renewcommand \theparagraph {\thesubsubsection.\@arabic\c@paragraph}%
\renewcommand \thesubparagraph {\theparagraph.\@arabic\c@subparagraph}%
% ITEMIZE (TODO)
\setlength\leftmargini {1.75em}%
\leftmargin \leftmargini%
\setlength\leftmarginii {1.65em}%
\setlength\leftmarginiii {1.1em}%
\setlength\leftmarginiv {1.5em}%
\setlength\leftmarginv {1em}%
\setlength\leftmarginvi {1em}%
\setlength\labelsep {.5em}%
\setlength\labelwidth{\leftmargini}%
\addtolength\labelwidth{-\labelsep}%
\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{\textbullet}%
\newcommand\labelitemii{\normalfont\bfseries \textendash}%
\newcommand\labelitemiii{\textasteriskcentered}%
\newcommand\labelitemiv{\textperiodcentered}%
% LaTeX INTERNALS, PENALTIES
\@beginparpenalty -\@lowpenalty%
\@endparpenalty -\@lowpenalty%
\@itempenalty -\@lowpenalty%
% TABLE OF CONTENTS FORMATTING (TODO)
\newcommand\@pnumwidth{1.55em}%
\newcommand\@tocrmarg{2.55em}%
\newcommand\@dotsep{4.5}%
\setcounter{tocdepth}{2}%
\newcommand\tableofcontents{%
\@restonecolfalse%
\chapter*{\contentsname%
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\@starttoc{toc}%
\if@restonecol\twocolumn\fi%
}%
\newcommand*\l@part[2]{%
\ifnum \c@tocdepth >-2\relax%
\addpenalty{-\@highpenalty}%
\addvspace{2.25em \@plus\p@}%
\setlength\@tempdima{3em}%
\begingroup%
\parindent \z@ \rightskip \@pnumwidth%
\parfillskip -\@pnumwidth%
{\leavevmode%
\large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par%
\nobreak%
\global\@nobreaktrue%
\everypar{\global\@nobreakfalse\everypar{}}%
\endgroup%
\fi}%
% DIMENSIONS (TODO)
\newcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}%
\newcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}%
\newcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}%
\newcommand*\l@paragraph{\@dottedtocline{4}{10em}{5em}}%
\newcommand*\l@subparagraph{\@dottedtocline{5}{12em}{6em}}%
\newcommand*\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}%
\let\l@table\l@figure%
% RESETS
\@addtoreset{equation}{section}%
% BIBLIOGRAPHY (TODO)
\newdimen\bibindent%
\setlength\bibindent{1.5em}%
\newenvironment{thebibliography}[1]%
{\chapter*{\bibname}%
\@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth%
\advance\leftmargin\labelsep%
\@openbib@code%
\usecounter{enumiv}%
\let\p@enumiv\@empty%
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy%
\clubpenalty4000%
\@clubpenalty \clubpenalty%
\widowpenalty4000%
\sfcode`\.\@m}%
{\def\@noitemerr%
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}%
% INDEX
% UNCLEAR WHAT THIS IS
\newcommand\newblock{\hskip .11em\@plus.33em\@minus.07em}%
\let\@openbib@code\@empty%
\newenvironment{theindex}%
{%
\@restonecoltrue%
\twocolumn[\@makeschapterhead{\indexname}]%
\@mkboth{\MakeUppercase\indexname}%
{\MakeUppercase\indexname}%
\thispagestyle{plain}\parindent\z@%
\parskip\z@ \@plus .3\p@\relax%
\columnseprule \z@%
\columnsep 35\p@%
\let\item\@idxitem}%
{\if@restonecol\onecolumn\else\clearpage\fi}%
\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}%
% REDIRECT FOOTNOTES TO SIDENOTE
% PERHAPS REDIRECT THIS TO MARGINPAR? (TODO)
%\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}
\let\footnote\sidenote%
% NAMING SCHEME
\newcommand\contentsname{Contents}%
\newcommand\listfigurename{List of Figures}%
\newcommand\listtablename{List of Tables}%
\newcommand\bibname{Bibliography}%
\newcommand\indexname{Index}%
\newcommand\figurename{Figure}%
\newcommand\tablename{Table}%
\newcommand\partname{Part}%
\newcommand\appendixname{Appendix}%
% IDK IF THIS IS USEFUL....
\def\monthname{\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}%
\def\today{\dateformat}%
\def\dateformat{\number\day\space\monthname, \number\year}%
% MARGINPARS (FIX)
\def\@oddfoot{\hss\rlap{\hbox to \cm@outerhang{\hfill\thepage}}}
\def\@evenfoot{\llap{\hbox to \cm@outerhang{\thepage\hfill}}\hss}
\@ifpackageloaded{fancyhdr}{%
\def\ps@@fancy{%
\ps@@empty %
\def\@mkboth{\protect\markboth}%
\def\@oddhead{\@fancyhead\fancy@Oolh\f@ncyolh\f@ncyoch\f@ncyorh\fancy@Oorh}%
\def\@oddfoot{\@fancyfoot\fancy@Oolf\f@ncyolf\f@ncyocf\f@ncyorf\fancy@Oorf\rlap{\hskip\marginparsep\mcolumn}}%
\def\@evenhead{\@fancyhead\fancy@Oelh\f@ncyelh\f@ncyech\f@ncyerh\fancy@Oerh}%
\def\@evenfoot{\llap{\mcolumn\hskip\marginparsep}\@fancyfoot\fancy@Oelf\f@ncyelf\f@ncyecf\f@ncyerf\fancy@Oerf}%
}%
}{%
\expandafter\def\expandafter\@oddfoot\expandafter{%
\@oddfoot\rlap{\hskip\marginparsep\mcolumn}%
}%
\expandafter\def\expandafter\@evenfoot\expandafter{%
\expandafter\llap\expandafter{\expandafter\mcolumn\expandafter\hskip\expandafter\marginparsep\expandafter}\@evenfoot%
}%
}
\newdimen\mathindent \mathindent\parindent
\def\flequations{%
\renewcommand\[{\relax
\ifmmode\@badmath
\else
\begin{trivlist}%
\@beginparpenalty\predisplaypenalty
\@endparpenalty\postdisplaypenalty
\item[]\leavevmode
\hb@xt@\linewidth\bgroup $\m@th\displaystyle %$
\hskip\mathindent\bgroup
\fi}
\renewcommand\]{\relax
\ifmmode
\egroup $\hfil% $
\egroup
\end{trivlist}%
\else \@badmath
\fi}
}
\newbox\mp@topfigbox \setbox\mp@topfigbox\box\voidb@x%
\newdimen\mp@tempdim@tfb
\newif\ifnextfloattop
\renewenvironment{marginfigure}
{%
\global\let\cm@orig@caption\caption%
\global\let\cm@orig@label\label%
\def\@captype{figure}
\def\floatalignment{t}
\renewcommand\caption{\optparams{\cm@caption}{[][0pt]}}%
\renewcommand\label[1]{\gdef\cm@stored@label{##1}}%
\ifcm@subcaptionloaded%
\global\let\label\cm@orig@label%
\fi%
\begin{lrbox}{\cm@figure@box}
\begin{minipage}[t]{\marginparwidth}
}%
{%
\par
\null
\vskip-\baselineskip%
\ifdim\prevdepth>\z@%
\vskip-\prevdepth%
\fi%
\end{minipage}
\end{lrbox}
\begin{lrbox}{\cm@caption@box}
\begin{minipage}[t]{\marginparwidth}\null
\if\cm@stored@caption\relax\else\cm@orig@caption[\cm@stored@shortcaption]{\cm@stored@caption}\fi
\if\cm@stored@label\relax\else\cm@orig@label{\cm@stored@label}\fi
\par\null
\ifdim\prevdepth>\z@%
\vskip-\prevdepth
\fi
\end{minipage}%
\end{lrbox}%
\global\setbox\mp@topfigbox\vbox{\unvbox\mp@topfigbox\hbox{%
%
\hbox{\parbox[t]{\marginparwidth}{
\@marginparreset
\mathindent.5\mathindent
\flequations
\unhbox\cm@figure@box
\par
\ifdim\prevdepth>\z@
\vskip-\prevdepth
\fi
\unhbox\cm@caption@box
}}%
%
\hbox{\parbox[t]{\marginparwidth}{%
% \@marginparreset
% \mathindent.5\mathindent
% \flequations
% \unhbox\cm@figure@box
% \par
% \ifdim\prevdepth>\z@
% \vskip-\prevdepth
% \fi
% \unhbox\cm@caption@box
}}%
}\break}%
%
\let\caption\cm@orig@caption%
\let\label\cm@orig@label%
\begin{lrbox}{\cm@figure@box}\null\end{lrbox}%
\begin{lrbox}{\cm@caption@box}\null\end{lrbox}%
\gdef\cm@stored@shortcaption{}%
\gdef\cm@stored@caption{}%
\gdef\cm@stored@label{}%
\global\setlength{\cm@caption@vertical@offset}{\z@}%
\def\@captype{}
}
\newbox\mp@box
\newdimen\marginparmindistance \marginparmindistance=17\p@
\newdimen\mp@min@ht@required
\newdimen\mp@tempdim
\newdimen\mp@ht@botrule
\countdef\mp@count=6 \mp@count\z@
\newcount\mp@count@ \mp@count@\z@%
\global\setbox\mp@box\vbox{}%
\newlength{\mp@maxht}
\long\def\marginpar#1{%
\saveposition{mpar}%
\global\setbox\mp@box\vbox{\unvbox\mp@box\hbox{%
\hbox{\parbox[t]{\marginparwidth}{\@marginparreset\mathindent.5\mathindent\flequations#1\@minipagefalse}}%
\hbox{\parbox[t]{\marginparwidth}{\@marginparreset\mathindent.5\mathindent\flequations#1\@minipagefalse}}%
}\break}}
\def\saveposition#1{%
\pdfsavepos\write\@auxout{%
\noexpand\savedpos%
{#1}{\the\c@page}{\the\pdflastxpos}{\the\pdflastypos}}}
\def\savedpos#1#2#3#4{%
\begingroup
\let\@positions\relax
\expandafter\xdef\csname sp@#1-#2\endcsname{%
\expandafter\ifx\csname sp@#1-#2\endcsname\relax
\else
\csname sp@#1-#2\endcsname
\fi
\@positions{#3}{#4}}%
\endgroup}%
\expandafter\def\expandafter\@comflelt\expandafter#\expandafter1\expandafter{%
\@comflelt{#1}
\ifnextfloattop
\@tempdima\ht\@tempboxa
\advance\@tempdima\dp\@tempboxa
\immediate\write\@auxout{\string\global\noexpand\@namedef{topfloats-page-\the\c@page}{\the\@tempdima}}%
\fi
}
\def\@xfloat #1[#2]{%
\@nodocument
\def \@captype {#1}%
\def \@fps {#2}%
\ifnum\pdf@strcmp{\@fps}{t}=0 %
\global\nextfloattoptrue%
\else%
\global\nextfloattopfalse%
\fi%
\@onelevel@sanitize \@fps
\def \reserved@b {!}%
\ifx \reserved@b \@fps
\@fpsadddefault
\else
\ifx \@fps \@empty
\@fpsadddefault
\fi
\fi
\ifhmode
\@bsphack
\@floatpenalty -\@Mii
\else
\@floatpenalty-\@Miii
\fi
\ifinner
\@parmoderr\@floatpenalty\z@
\else
\@next\@currbox\@freelist
{%
\@tempcnta \sixt@@n
\expandafter \@tfor \expandafter \reserved@a
\expandafter :\expandafter =\@fps
\do
{%
\if \reserved@a h%
\ifodd \@tempcnta
\else
\advance \@tempcnta \@ne
\fi
\fi
\if \reserved@a t%
\@setfpsbit \tw@
\fi
\if \reserved@a b%
\@setfpsbit 4%
\fi
\if \reserved@a p%
\@setfpsbit 8%
\fi
\if \reserved@a !%
\ifnum \@tempcnta>15
\advance\@tempcnta -\sixt@@n\relax
\fi
\fi
}%
\@tempcntb \csname ftype@\@captype \endcsname
\multiply \@tempcntb \@xxxii
\advance \@tempcnta \@tempcntb
\global \count\@currbox \@tempcnta
}%
\@fltovf
\fi
\global \setbox\@currbox
\color@vbox
\normalcolor
\vbox \bgroup
\hsize\columnwidth
\@parboxrestore
\@floatboxreset
}
\newbox\mp@evaluatedtfb
\def\evaluatetopfigbox{%
\@tempdimb\z@
\advance\vbadness\@M
\setbox0=\vsplit\mp@topfigbox to \maxdimen
\advance\vbadness-\@M
\setbox0\vbox{%
\unvbox0%
\setbox0\lastbox
\setbox0\hbox{%
\unhbox0
\global\setbox\mp@evaluatedtfb\lastbox%
\global\setbox\mp@evaluatedtfb\lastbox%
}}%
\expandafter\ifx\csname topfloats-page-\the\c@page\endcsname\relax
\else
\@tempdimb\csname topfloats-page-\the\c@page\endcsname
\fi
\vskip\@tempdimb
\global\advance\dimen@-\@tempdimb %
\global\advance\dimen@-\ht\mp@evaluatedtfb %
\global\advance\dimen@-\dp\mp@evaluatedtfb %
\hrule\@height\z@
\copy\mp@evaluatedtfb %
\hrule\@height\z@
}
\def\mcolumn{%
\saveposition{foot}%
\expandafter\ifx\csname sp@foot-\the\c@page\endcsname\relax%
\else%
\let\@positions\origin@positions%
\csname sp@foot-\the\c@page\endcsname%
\vfuzz=\marginparmindistance
\advance\vfuzz-\ht\@ne
\smash{\raise\footskip\vbox to \textheight{\hsize\marginparwidth%
\hrule\@height\z@%
\ifvoid\mp@topfigbox
\else
\evaluatetopfigbox
\fi
\let\@positions\mp@positions%
\expandafter\ifx\csname mpars-page-\the\c@page\endcsname\relax
\else
\begingroup
\loop
\ifnum\mp@count@<\csname mpars-page-\the\c@page\endcsname%
\setboxes
\advance\mp@count@\@ne %
\repeat
\endgroup
\fi
\csname sp@mpar-\the\c@page\endcsname
\vskip\z@\@plus\textheight%
\hrule\@height\z@
\immediate\write\@auxout{\string\global\noexpand\@namedef{mpars-page-\the\c@page}{\the\mp@count}}}}%
\global\setbox\mp@evaluatedtfb\box\voidb@x
\fi}
\AtBeginDocument{%
\setbox0=\vtop{\textsuperscript{1}g}% temporary
\setlength{\mp@maxht}{\the\ht0}%
}
\def\origin@positions#1#2{%
\dimen@#2sp
\advance\dimen@\footskip
\mp@ht@botrule\dimen@
\expandafter\ifx\csname b-float-page-\the\c@page\endcsname\relax
\else
\advance\mp@ht@botrule\csname b-float-page-\the\c@page\endcsname
\advance\mp@ht@botrule\marginparmindistance
\advance\mp@ht@botrule\cm@caption@vertical@offset
\fi
\advance\dimen@\textheight
}
\def\setboxes{%
\advance\mp@count\@ne%
\advance\vbadness\@M
\setbox0=\vsplit\mp@box to \maxdimen
\advance\vbadness-\@M
\setbox0\vbox{%
\unvbox0%
\setbox0\lastbox
\setbox0\hbox{%
\unhbox0
\ifodd\c@page
\global\setbox\mp@count\lastbox%
\fi%
\global\setbox\mp@count\lastbox%
}}%
}
\def\mp@positions#1#2{%
\advance\mp@count\@ne%
\mp@tempdim-#2sp
\@tempdimb\dimen@%
\advance\@tempdimb-#2sp%
\advance\@tempdimb-\mp@maxht
\begingroup%
\expandafter\ifx\csname mpars-page-\the\c@page\endcsname\relax%
\else%
\global\mp@min@ht@required\z@%
\advance\mp@count\m@ne
\loop%
\ifnum\mp@count<\csname mpars-page-\the\c@page\endcsname%
\advance\mp@count\@ne%
\global\advance\mp@min@ht@required\ht\mp@count %
\global\advance\mp@min@ht@required\dp\mp@count %
\ifnum\mp@count=\csname mpars-page-\the\c@page\endcsname
\else
\global\advance\mp@min@ht@required\marginparmindistance%
\fi
\repeat
\global\advance\mp@min@ht@required\@tempdimb
\fi
\endgroup
\mp@tempdim\dimen@
\advance\mp@tempdim-\mp@ht@botrule
\ifdim\mp@tempdim<\mp@min@ht@required
\advance\@tempdimb\mp@tempdim
\advance\@tempdimb-\mp@min@ht@required
\fi
\ifnum\mp@count=\@ne
\ifvoid\mp@evaluatedtfb
\else
\ifdim\@tempdimb<\marginparmindistance
\@tempdimb\marginparmindistance
\fi
\fi
\else
\ifdim\@tempdimb<\marginparmindistance
\@tempdimb\marginparmindistance
\fi
\fi
\vskip\@tempdimb
\advance\dimen@-\@tempdimb
\advance\dimen@-\ht\mp@count %
\advance\dimen@-\dp\mp@count %
\hrule\@height\z@
\box\mp@count %
\hrule\@height\z@
}
% UNIT VECTORS
\newif\ifijknotation \ijknotationfalse%
\ifijknotation%
\newcommand{\uveci}{{\bm{\hat{\textnormal{\bfseries\i}}}}}%
\newcommand{\uvecj}{{\bm{\hat{\textnormal{\bfseries\j}}}}}%
\fi%
\DeclareRobustCommand{\uvec}[1]{{%
\ifcsname uvec#1\endcsname%
\csname uvec#1\endcsname%
\else%
\bm{\hat{\mathbf{#1}}}%
\fi%
}}
% EQUATION HOOK (no longer necessary)
%\newcount\cm@infoboxdepth \cm@infoboxdepth=0
%\newcount\cm@infoboxid
%\newcount\cm@infobox@eqn@quantity \cm@infobox@eqn@quantity=0
%\def\[{%
% %\ifnum\cm@infoboxdepth=1
% %\global\advance\cm@infobox@eqn@quantity1
% %\fi
% \begin{equation*}%
%}
%\def\]{%
% \end{equation*}%
%}
% INFOBOXES
\newdimen\infoboxsep \infoboxsep=12\p@%
\newsavebox{\cm@reservedbox}%
\def\cm@infoboxcolor{cmlight!30}%
%\def\cm@reseteqnno{\global\cm@infobox@eqn@quantity=0}
\def\cm@infotextcolor{cmdark}%
\def\cm@infoboxfont{fbg}%
\newenvironment{infobox}[1][Extra information]%
{%
%\global\advance\cm@infoboxid1
%\advance\cm@infoboxdepth1 %
\begin{figure*}[t]%
%\begin{fullwidth}%
\fboxsep=\infoboxsep% only redefine this locally
\begin{lrbox}{\cm@reservedbox}%
\begin{minipage}{\linewidth-2\fboxsep}%
\fontfamily{\cm@infoboxfont}\selectfont%
\textcolor{\cm@infotextcolor}{\Large \textbf{#1} \hfill}\vskip\infoboxsep%
\flequations
}%
{%
\end{minipage}%
\end{lrbox}%
\colorbox{\cm@infoboxcolor}{%
\usebox{\cm@reservedbox}%
}%
%\end{fullwidth}%
\end{figure*}%
%\advance\cm@infoboxdepth-1 %
%\immediate\write\@auxout{\string\cm@eqnsininfobox{\the\cm@infoboxid}{\the\cm@infobox@eqn@quantity}}%
%\cm@reseteqnno
}%
%
%\def\cm@eqnsininfobox#1#2{%
%\global\@namedef{infobox-#1}{#2}%
%}%
\newdimen\cm@infobox@defaultwidth%
\newif\ifcm@wrapfigadjust%
% AUTOWRAPFIG
\define@key{autowrapfig}{height}{\def\cm@wfht{#1}}%
\define@key{autowrapfig}{width}{\def\cm@wfwd{#1}}%
\define@key{autowrapfig}{adjust lines}[true]{\csname cm@wrapfigadjust#1\endcsname}%
\define@key{autowrapfig}{lines}{\count4=#1}%
\setkeys{autowrapfig}{width=\cm@infobox@defaultwidth,adjust lines=false}%
\def\awffactor{1.25}% fine tuned
\newcommand\autowrapfig[2][]{%
\count4=\z@%
\setkeys{autowrapfig}{#1}%
\ifcsname cm@wfht\endcsname% check whether height key was used
\setbox0=\hbox{\includegraphics[height=\cm@wfht]{#2}}%
\count2=\ht0 %
\divide\count2 by \baselineskip%
\ifcm@wrapfigadjust%
\ifnum\count4=0 %
\else%
\advance\count2 by \count4 %
\fi%
\fi%
\else% height key not used, proceed to calculate height based on width
\setbox0=\hbox{\includegraphics[width=\cm@wfwd]{#2}}%
\count2=\ht0 %
\divide\count2 by \baselineskip%
\ifcm@wrapfigadjust%
\ifnum\count4=0 %
\else%
\advance\count2 by \count4 %
\fi%
\fi%
\fi%
\checkoddpage%
\edef\cm@tmp{\ifoddpage r\else l\fi}%
\columnsep=\marginparsep%
\begin{wrapfigure}[\count2]{\cm@tmp}{\wd0}%
\vskip-\awffactor\baselineskip\box0 %
\end{wrapfigure}%
\ignorespaces
}
\def\ratio#1#2#3{%
\dimen99=#2%
\count99=65536 %
\loop%
\ifdim\dimen99<8192\p@%
\dimen99=2\dimen99%
\divide\count99 by 2 %
\repeat%
\divide#3\count99 %
\divide\dimen99#3%
\edef#1{\strip@pt\dimen99}}%
\def\invert#1#2{%
\dimen98=#1\p@%
\ratio#2 {\p@}{\dimen98}%
}
% LETTRINES
\newdimen\lettrinesep \lettrinesep=3.6pt
\def\lettrine{\@ifnextchar[{\lettrine@}{\lettrine@[3]}}
\def\lettrine@[#1]#2#3 {%
\dimen0=\fontcharht\font`A%
\ratio\x {\f@size\p@}{\dimen0}%
\invert\x\z%
\dimen1=\fontcharht\font`A%
\advance\dimen1 by #1\baselineskip% crucial step
\advance\dimen1 by -\baselineskip%
\ratio\tmp {\z\p@}{\dimen1}%
\invert\tmp\requiredpointsize%
\setbox0=\hbox{\fontsize{\requiredpointsize\p@}{\z@}\selectfont #2}
\dimen2=\wd0%
\advance\dimen2 by \lettrinesep%
\smash{%
\raise-#1\baselineskip\hbox{%
\copy0%
}%
}%
\hangindent\dimen2%
\hangafter-#1%
\noindent%
\ifnum#1>1 %
\textsc{#3 }%
\else%
\hskip-\lettrinesep%
\textsc{#3 }%
\fi%
}%
% style of captions
\captionsetup{font={footnotesize}}
% math related commands
{\catcode`\.=13 \gdef.{{\cdot}}}%
\newcommand*\unit[1]{%
\begingroup%
\mathcode`.="8000%
\ensuremath{\mathrm{#1}}%
\endgroup}%
\newcommand*\SI[2]{\ensuremath{#1\,\unit{#2}}}%
\def\bra#1{\langle#1\rvert}
\def\ket#1{\lvert#1\rangle}
\def\braket#1#2{\langle#1\mvert#2\rangle}
\def\physicaloperator{\hat}
\def\abs#1{\lvert#1\rvert}
\def\pd{%
\@ifnextchar[%
{\@pd}%
{\@pd[x]}%
}
\def\@pd[#1]{%
\@ifnextchar\bgroup%
{\@@pd[#1]}%
{\@@pd[#1]{}}%
}
\def\@@pd[#1]#2{%
\frac{\partial #2}{\partial #1}%
}
% some style commands
\def\keyword{\textbf}
\endinput
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment