\documentclass[a4paper, 11pt]{article} \RequirePackage[l2tabu, orthodox]{nag} \usepackage[a4paper, portrait, hmargin=20mm, vmargin=25mm]{geometry} \usepackage[bookmarks, colorlinks]{hyperref} \usepackage{paralist, float, tabularx, hhline, graphicx, xcolor, todonotes, bbding, hyperref, needspace, booktabs, changepage} \hypersetup{ citecolor=black, linkcolor=black, % don't need colored links urlcolor=blue!55!black % blue enough to see, but dark enough to print } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% fonts %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{fontspec} \setmainfont{Lora} \setsansfont[Ligatures=NoCommon]{Roboto Condensed} \setmonofont[Scale=MatchLowercase]{Inconsolata} \usepackage{microtype} % general improvements to typography % make \emph do italics (just in case other environments change it) \renewcommand{\emph}[1]{\textit{#1}} % add a \strong command \newcommand{\strong}[1]{\textbf{#1}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% sections %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage[sf,bf]{titlesec} \titlespacing{\section}{0pt}{0.75\parskip}{-0.25\parskip} \titlespacing{\subsection}{0pt}{0.75\parskip}{-0.25\parskip} \titlespacing{\subsubsection}{0pt}{0.75\parskip}{-0.25\parskip} \titlespacing{\paragraph}{0pt}{0.75\parskip}{-0.25\parskip} % repurpose \paragraph as \subsubsubsection (which it sort of is already) \titleformat{\paragraph}{\normalfont\normalsize\sffamily\bfseries}{\theparagraph}{1em}{} \titlespacing{\paragraph}{0pt}{0.75\parskip}{-0.25\parskip} \newcommand{\subsubsubsection}[1]{\paragraph{#1}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% headers/footers %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{fancyhdr} \pagestyle{fancyplain} \fancyhead[L]{\footnotesize\textsf{\PaperCode~--~\PaperTitle}} \fancyhead[C]{} \fancyhead[R]{\footnotesize\textsf{\LabNum\LabTitle}} \fancyfoot[L]{} \fancyfoot[C]{\footnotesize\textsf{\thepage}} \fancyfoot[R]{} \setlength{\headheight}{14pt} \renewcommand{\footrulewidth}{0pt} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% general layout %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % relax the justification/hyphenation wrapping settings \pretolerance=200 \tolerance=500 \setlength{\emergencystretch}{1.5em} % try harder to avoid widows and orphans \clubpenalty=300 \widowpenalty=300 % kill the paragraph indenting \setlength{\parindent}{0 mm} \setlength{\parskip}{0.7\baselineskip} % create an indent command that does not rely on \parindent \renewcommand{\indent}{\hspace*{1em}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% syntax highlighting %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{listings} % syntax highlighting \usepackage{lstautogobble} % add-on for listings that auto-gobbles leading spaces in code % create the fonts for code highlighting \newcommand\codesize{\fontsize{11}{10}\selectfont} \newcommand{\codefont}{\ttfamily} % define the colors for code highlighting (based on Eclipse colors) %\definecolor{KeywordColor}{rgb}{0.5,0,0.33} %\definecolor{CommentColor}{rgb}{0.25,0.5,0.37} %\definecolor{StringColor}{rgb}{0.16,0,1} % define the colors for code highlighting (based on NetBeans colors, although darker so that they are readable when printed on a black and white printer) \definecolor{KeywordColor}{rgb}{0.0,0,0.6} \definecolor{CommentColor}{rgb}{0.3,0.3,0.3} \definecolor{StringColor}{rgb}{0.4,0.22.0} \lstdefinelanguage{JavaScript}{ keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break, this}, sensitive=false, comment=[l]{//}, morecomment=[s]{/*}{*/}, morestring=[b]', morestring=[b]" } \lstdefinelanguage{xml} { morestring=[b][\color{black}]", moredelim=[s][\color{KeywordColor}]{<}{>}, morecomment=[s]{<?}{?>}, morecomment=[s]{<!--}{-->}, commentstyle=\color{CommentColor}, stringstyle=\color{StringColor}, identifierstyle=\color{black}, alsoletter=-: } % create a new environment for source code blocks \lstnewenvironment{codeblock}[1][] { \lstset{ language=Java, upquote=true, autogobble=true, xleftmargin=1em, basicstyle=\color{black}\codefont\codesize, keywordstyle=\color{KeywordColor}\codefont\codesize, commentstyle=\color{CommentColor}\codefont\codesize, stringstyle=\color{StringColor}\codefont\codesize, aboveskip=10pt, belowskip=0pt, showstringspaces=false, tabsize=3, showtabs=false, columns=fullflexible, flexiblecolumns=true, breaklines=true }\lstset{#1}} {} % command for typesetting inline code \newcommand{\code}[1]{% \lstset{% language={}, upquote=true, basicstyle=\color{black}\codefont\bfseries\codesize, keywordstyle=\color{black}\codefont\bfseries\codesize, stringstyle=\color{black}\codefont\bfseries\codesize, showstringspaces=false, showtabs=false }% \mbox{\lstinline!#1!}} % centre command that won't add any vertical space before or after \newcommand{\centre}[1]{\hfill#1\hfill} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% figures %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % PDF tex graphics extensions \DeclareGraphicsExtensions{.jpg,.jpeg,.pdf,.png} % command for figures with captions - first param is scale. \newcommand{\captionedfig}[3] { \begin{figure}[H] \begin{center} \includegraphics[scale=#1,draft=false]{#2} \\ #3 \vspace{-25pt} \end{center} \end{figure} } % command for figures - first param is scale. \newcommand{\fig}[2] { \begin{figure}[H] \makebox[\textwidth][c]{\includegraphics[scale=#1,draft=false]{#2}}% \vspace{-5pt} \end{figure} } % command for figures rotated 90 degrees right - first param is scale. \newcommand{\rotatedfig}[2] { \begin{figure}[H] \begin{center} \includegraphics[scale=#1,draft=false, angle=270]{#2} \end{center} \end{figure} } % command for figures that fit the page width \newcommand{\fittedfig}[1] { \begin{figure}[H] \begin{center} \resizebox{\textwidth}{!}{\includegraphics[draft=false]{#1}} \vspace{-25pt} \end{center} \end{figure} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% lists %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % fix the extra spacing that itemize/enumerate has when you put have an blank % line prior to the environment (paralist). \setlength{\pltopsep}{0.2\baselineskip} \setlength{\plpartopsep}{-0.2\baselineskip} \setlength{\plitemsep}{0.2\baselineskip} \setlength{\plparsep}{0.4\baselineskip} % use paralist compact versions by default so that above tweaks are used \renewenvironment{itemize}% {\begin{compactitem}}% {\end{compactitem}} \renewenvironment{enumerate}% {\begin{compactenum}}% {\end{compactenum}} % rationalise the bullet points \def\labelitemi{\footnotesize$\bullet$} \def\labelitemii{\footnotesize$\circ$} \def\labelitemiii{\footnotesize$\diamond$} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% to-do notes %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % fix todonotes 'wrong margin' issue \reversemarginpar \newcommand{\fix}{\todo[color=red!60,noline,size=\large]{Fix}} \newcommand{\comment}[1]{\todo[color=yellow!60,inline,size=\large]{#1}} %\newcommand{\incomplete}[1]{\todo[color=red!60,inline,size=\large]{Incomplete: #1}} %\newcommand{\complete}{\todo[color=green!60,inline,size=\large]{Complete}} \newcommand{\complete}{{\color{green}\Checkmark}~} \newcommand{\incomplete}{{\color{red}\XSolidBrush}~} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% misc %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % a simpler way of getting a right arrow \newcommand{\ra}[0]{$\rightarrow$~} % a section header and counter for exercises \newcounter{ExerciseCounter} \newcommand{\exercise}[1]{% \stepcounter{ExerciseCounter}% \section{Exercise \arabic{ExerciseCounter}~--~#1} } % menus, key strokes, paths \usepackage[os=win]{menukeys} \renewmenumacro{\menu}[>]{roundedmenus} \renewmenumacro{\keys}[>]{roundedkeys} \renewmenumacro{\path}[>]{pathswithfolder} \changemenucolortheme{roundedmenus}{blacknwhite} \changemenucolortheme{pathswithfolder}{blacknwhite} \changemenucolortheme{roundedkeys}{blacknwhite}