% Macros for typesetting math (assignments) % Written by Marcel Goh, except for the parts that are not. % ================== KNUTH ================== % \def\xskip{\hskip 7pt plus 3pt minus 4pt} \def\boldbegin#1{\medbreak\noindent {\bf#1}\xskip\ignorespaces} \def\proof{\medbreak\noindent{\it Proof.}\xskip\ignorespaces} \def\solution{\medbreak\noindent{\it Solution.}\xskip\ignorespaces} \def\slug{\quad\hbox{\kern1.5pt\vrule width2.5pt height6pt depth1.5pt\kern1.5pt}\medskip} \def\noskipslug{\quad\hbox{\kern1.5pt\vrule width2.5pt height6pt depth1.5pt\kern1.5pt}} % Algorithms \newdimen\algindent \newif\ifitempar \itempartrue % normally true unless briefly set false \def\algindentset#1{\setbox0\hbox{{\bf #1.\kern.25em}}\algindent=\wd0\relax} \def\algbegin #1 #2{\algindentset{#21}\alg #1 #2} % when steps all have 1 digit \def\aalgbegin #1 #2{\algindentset{#211}\alg #1 #2} % when 10 or more steps \def\alg#1(#2). {\medbreak % Usage: \algbegin Algorithm A (algname). This... \noindent{\bf#1}({\it#2\/}).\xskip\ignorespaces} \def\algstep#1.{\ifitempar\smallskip\noindent\else\itempartrue \hskip-\parindent\fi \hbox to\algindent{\bf\hfil #1.\kern.25em}% \hangindent=\algindent\hangafter=1\ignorespaces} % ================ END KNUTH ================ % % Sets of numbers (not compatible with CWEB) \def\NN{{\bf N}} \def\ZZ{{\bf Z}} \def\QQ{{\bf Q}} \def\RR{{\bf R}} \def\CC{{\bf C}} \def\N{{\bf N}} % Deprecated \def\Z{{\bf Z}} \def\Q{{\bf Q}} \def\R{{\bf R}} \def\C{{\bf C}} \def\op#1{\mathop{\hbox{#1}}\nolimits} \def\limitop#1{\mathop{\hbox{#1}}} % Probability \def\pr{\hbox{\bf P}} \def\ex{\hbox{\bf E}} \def\var{\hbox{\bf V}} \def\one{\hbox{\bf 1}} \def\indic#1{\one_{\sevenrm[#1]}} % Graphs \def\edge{\mathrel-\!\!\mathrel-} % Analysis \def\d{\,d} \def\eps{\epsilon} % Counters \newcount\thmcount % Counts theorems/lemmas/corollaries \thmcount=1 \newcount\sectcount % Counts sections \sectcount=1 \newcount\figcount % Counts figures \figcount=1 \newcount\eqcount % Counts equations \eqcount=1 % Number an equation oldstyle \def\oldno#1{\eqno({\oldstyle#1})} \def\refeq#1{({\oldstyle#1})} \def\adveq{\oldno{\the\eqcount}\global\advance\eqcount by 1} % Print and advance equation counter \def\advthm{\the\thmcount\global\advance \thmcount by 1} % Numbered section (advances equation counter) \def\advsect{\section\the\sectcount\global\advance\sectcount by 1. } \def\caption#1{\centerline{\ninepoint{\bf Fig.~\the\figcount\global\advance\figcount by 1.\enspace}#1}} % Proclaim with parentheses in italics \outer\def\parenproclaim #1 (#2).#3\par{\medbreak \noindent{\bf #1}\enspace\rm({\it #2\/}).\nobreak\ignorespaces{\sl #3\par} \ifdim\lastskip<\medskipamount \removelastskip\penalty55\medskip\fi} % Exactly what it sounds like \def\twodots{\mathinner{\ldotp\ldotp}} % Axioms \newdimen\axiomindent \def\axiomindentset#1{\setbox0\hbox{{\bf #1.\kern.25em}}\axiomindent=\wd0\relax} \def\axiombegin#1{\axiomindentset{#11}} % when all have 1 digit \def\axiom#1. [#2.]{\ifitempar\par\noindent\else\itempartrue \hskip-\parindent\fi% \hbox to\axiomindent{\bf\hfil #1.\kern.25em}% \hangindent=\axiomindent\hangafter=1[{\it #2.}]}