%% Common macros for the course CSC236H1, on the St. George Campus at %% the University of Toronto. %% %% Copyright (c) 2009-2012 Francois Pitt %% last updated at 12:38 (EST) on Wed 8 Feb 2012 %% %% This work may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.3 of this license %% or (at your option) any later version. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.3 or later is part of all distributions of LaTeX %% version 2003/12/01 or later. %% %% This work has the LPPL maintenance status "author-maintained". %% %% The Current Maintainer of this work is %% Francois Pitt . %% %% This work consists of the file macros-236.tex. % Trick so that math symbols are bold when text is. \let\seiresfb\bfseries\def\bfseries{\boldmath\seiresfb} \let\seiresdm\mdseries\def\mdseries{\unboldmath\seiresdm} % Centered version of \llap and \rlap. \newcommand*{\clap}[1]{\hbox to 0pt{\hss#1\hss}} % Spacing macros with default argument. \newcommand*{\vstretch}[1][1]{\vspace*{\stretch{#1}}} \newcommand*{\hstretch}[1][1]{\hspace*{\stretch{#1}}} % General fonts and characters. \let\altemph\textsl % alternate way to emphasize \let\strong\textbf % strong emphasis \let\code\texttt % code fragments \let\const\textsf % constants \let\var\textsl % multi-letter variables (or constants) \newcommand*{\txtbksl} {\symbol{"5C}}% \ \newcommand*{\txtcaret}{\symbol{"5E}}% ^ \newcommand*{\txtunder}{\symbol{"5F}}% _ \newcommand*{\txtlcurl}{\symbol{"7B}}% { \newcommand*{\txtrcurl}{\symbol{"7D}}% } \newcommand*{\txttilde}{\symbol{"7E}}% ~ \newcommand*{\N}{\ensuremath{\mathbb{N}}} % requires amssymb \newcommand*{\Z}{\ensuremath{\mathbb{Z}}} % requires amssymb \newcommand*{\Q}{\ensuremath{\mathbb{Q}}} % requires amssymb \newcommand*{\R}{\ensuremath{\mathbb{R}}} % requires amssymb \newcommand*{\bigOh}{\mathcal{O}} \newcommand*{\onehalf}{\ensuremath{{}^1\!\!/\!_2}} % Abbreviations of latin phrases. \let\latinabb\emph % abbreviations of latin phrases \newcommand*{\ie}{\latinabb{i.e.}} \newcommand*{\eg}{\latinabb{e.g.}} \newcommand*{\etc}{\latinabb{etc}} \newcommand*{\vs}{\latinabb{vs}} % General math macros. \newcommand*{\comp}[1]{\overline{#1}} % set complement \newcommand*{\emptystr}{\varepsilon} % empty string \newcommand*{\lequiv}{\mathrel{\ \Longleftrightarrow\ }} % equivalence \newcommand*{\lxor}{\mathbin\oplus} % exclusive or \newcommand*{\cat}{\cdot} % string concatenation \newcommand*{\invisible}[1]{\mathrel{\hphantom{#1}}} % Floors and ceilings, with optional size-changing command, e.g., % \floor[\Big]{x/2} generates '\Big\lfloor{x/2}\Big\rfloor'. \newcommand*{\floor}[2][]{{#1\lfloor}{#2}{#1\rfloor}} \newcommand*{\ceil}[2][]{{#1\lceil}{#2}{#1\rceil}} \newcommand*{\lcm}{\operatorname{lcm}} % requires amsmath \newcommand*{\len}{\operatorname{len}} % requires amsmath \newcommand*{\size}{\operatorname{size}} % requires amsmath % Redefined symbols from amssymb. \renewcommand*{\emptyset}{\varnothing} % rounder than default \let\bigiff\iff \renewcommand*{\iff}{\mathrel{\Leftrightarrow}} % smaller than default \let\bigimplies\implies \renewcommand*{\implies}{\mathrel{\Rightarrow}} % smaller than default \renewcommand*{\ge}{\geqslant} % with slanted line under the > sign \renewcommand*{\le}{\leqslant} % with slanted line under the < sign % For algorithms, in pseudo-code. \let\kw\textbf % keywords \let\proc\textsc % function names \newcommand*{\True}{\const{True}} \newcommand*{\False}{\const{False}} \newcommand*{\None}{\const{None}} \newcommand*{\cmod}{\mathbin{\%}} % Like {itemize} but using less vertical space. \newenvironment*{points} {\ifvmode\else\unskip\par\fi\begin{list}{$\bullet$} {\setlength{\topsep}{.25ex plus .125ex minus .1825ex} \setlength{\itemsep}{\topsep}\setlength{\parsep}{0ex} \setlength{\leftmargin}{1.75em}\setlength{\labelsep}{.5em} \setlength{\labelwidth}{1.75em}}\ignorespaces} {\ifvmode\else\unskip\fi\end{list}\ignorespaces} % Checkboxes and checklists. \newcommand*{\cbox}[1]{{\fboxrule.125ex\fboxsep0ex \framebox[2.75ex]{\rule[-.75ex]{0ex}{2.75ex}\smash{#1}}}} \newcommand*{\cmark}{\raisebox{.0625ex}{$\surd$\kern.125ex}} \newcommand*{\xmark}{\raisebox{-.1875ex}{\kern.0625ex{X}}} \newcommand*{\checkbox}{{\sf\cbox{}}} \newcommand*{\checkedbox}{{\sf\cbox{\cmark}}} \newcommand*{\markedbox}{{\sf\cbox{\xmark}}} \newenvironment{checklist}{\begin{list}{\checkbox}{}}{\end{list}} \newcommand*{\checkeditem}{\item[\checkedbox]} \newcommand*{\markeditem}{\item[\markedbox]} % Proof-related environments and macros. \newcommand*{\just}{{\quad\#\ }} % justification for a proof step \newenvironment*{pindent} {\begin{list}{} {\topsep 0pt \partopsep 0pt \itemsep 0pt \parsep 0pt \parskip 0pt}\item\relax} {\unskip\end{list}\ignorespaces} % CFGs. \newcommand*{\yields}{\mathrel{\,::=\,}} \newcommand*{\phantyields}{\mathrel{\hphantom{\yields}}} \newcommand*{\baror}{\mathbin{\,|\,}} \newcommand*{\gvar}[1]{\ensuremath{\langle\mathrm{#1}\rangle}} \newcommand*{\term}[1]{\ensuremath{\mathbin{\mathsf{#1}}}} % 236-specific. \newcommand*{\LI}{\textsl{LI}} % for loop invariants