GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
1
mark.george
/
templates
Browse code
Massive cleanup. Changed fonts to libertine, and added todonotes.
master
1 parent
a5af07b
commit
a8a61508455547056a2457b6128c1f517e3fe682
Mark
authored
on 26 Jul 2014
Patch
Showing
1 changed file
labs/preamble.tex
Ignore Space
Show notes
View
labs/preamble.tex
\documentclass[a4paper, 12pt]{article} \usepackage[a4paper, portrait, hmargin=20mm, vmargin=25mm]{geometry} \usepackage[bookmarks, colorlinks]{hyperref} \usepackage{paralist, float, tabularx, hhline, graphicx, xcolor, todonotes, hyperref} \hypersetup{ bookmarks, colorlinks, citecolor=black, linkcolor=black, % don't need colored links urlcolor=blue!55!black % blue enough to see, but dark enough to print } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% fonts %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{cmap} % fix PDF searching (ligatures cause problems) \usepackage{libertine} % default font set (looks good on both screen and paper) \usepackage[scaled]{beramono} % code font \usepackage[T1]{fontenc} % force type 1 fonts \usepackage{microtype} % general improvements to typography \usepackage{textcomp} % additional symbols (like the degrees symbol} \usepackage{listings} % syntax highlighting % 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\PaperCode~--~\PaperTitle} \fancyhead[C]{} \fancyhead[R]{\footnotesize\LabNum\LabTitle} \fancyfoot[L]{} \fancyfoot[C]{\thepage} \fancyfoot[R]{} \setlength{\headheight}{14pt} \renewcommand{\footrulewidth}{0pt} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% general layout %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % relax the justification/hyphenation wrapping settings \tolerance=800 \emergencystretch=5mm % try to avoid widows and orphans \clubpenalty = 10000 \widowpenalty = 10000 % kill the paragraph indenting \setlength{\parindent}{0 mm} \setlength{\parskip}{0.7\baselineskip} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% syntax highlighting %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % create the fonts for code highlighting \newcommand\codesize{\fontsize{11}{8}\selectfont} \newcommand{\codefont}{\fontfamily{fvm}\selectfont} % beramono \newcommand{\commentfont}{\rmfamily\itshape} % standard roman % 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) \definecolor{KeywordColor}{rgb}{0.0,0,0.7} \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]" } % create a new environment for source code blocks \lstnewenvironment{codeblock}[1][] { \lstset{ language=Java, upquote=true, basicstyle=\color{black}\codefont\codesize, keywordstyle=\color{KeywordColor}\codefont\codesize, commentstyle=\color{CommentColor}\commentfont\normalsize, 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}[2][language=java]{% \lstset{% language=Java, upquote=true, basicstyle=\color{black}\codefont\codesize, keywordstyle=\color{black}\codefont\codesize, commentstyle=\color{black}\commentfont\normalsize, stringstyle=\color{black}\codefont\codesize, showstringspaces=false, showtabs=false }% \mbox{\lstinline[#1]!#2!}} % 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] \begin{center} \includegraphics[scale=#1,draft=false]{#2} \vspace{-25pt} \end{center} \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} } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 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}{\todo[color=red!60,inline,size=\large]{Incomplete}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% misc %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % a simpler way of getting a right arrow \newcommand{\ra}[0]{$\rightarrow$~}
\documentclass[a4paper, 12pt, pdftex]{article} \usepackage{cmap} % attempt to fix search with ligatures problem. \usepackage[pdftex]{graphicx} \usepackage[pdftex, a4paper, portrait, left=20mm, right=20mm, top=30mm, bottom=25mm]{geometry} \usepackage[pdftex, bookmarks, colorlinks=false]{hyperref} \usepackage{paralist} \usepackage{pslatex} \usepackage{float} \usepackage{tabularx} \usepackage{hhline} \usepackage[usenames]{xcolor} \usepackage{pdfpages} % font stuff \usepackage[scaled]{beramono} % code font \usepackage[T1]{fontenc} % might fix copy-pasting issues \usepackage[protrusion=true,expansion=true]{microtype} \usepackage{textcomp} \usepackage{listings} \usepackage{sectsty} % easily change section style \allsectionsfont{\raggedright\sffamily\bfseries} \usepackage{titlesec} % allows adjustment of section spacing \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 is 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}} \usepackage{fancyhdr} \pagestyle{fancyplain} \fancyhead[L]{\footnotesize\PaperCode~--~\PaperTitle} \fancyhead[C]{} \fancyhead[R]{\footnotesize\LabNum\LabTitle} \fancyfoot[L]{} \fancyfoot[C]{\thepage} \fancyfoot[R]{} \setlength{\headheight}{14pt} \renewcommand{\footrulewidth}{0pt} % PDF tex graphics extensions \DeclareGraphicsExtensions{.jpg,.jpeg,.pdf,.png,.mps} % font size for code \def\thesize{11truept} % relax the justification/hyphenation wrapping settings \tolerance=800 \emergencystretch=15mm % kill the paragraph indenting \setlength{\parindent}{0 mm} \setlength{\parskip}{0.7\baselineskip} % create the fonts for code highlighting \newcommand\codesize{\fontsize{11}{8}\selectfont} \newcommand{\codefont}{\fontfamily{fvm}\selectfont} \newcommand{\commentfont}{\rmfamily\itshape} % 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) \definecolor{KeywordColor}{rgb}{0.0,0,0.9} \definecolor{CommentColor}{rgb}{0.39,0.39,0.39} \definecolor{StringColor}{rgb}{0.41,0.24.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]" } % create a new environment for source code blocks \lstnewenvironment{codeblock}[1][] { \lstset{ language=Java, upquote=true, basicstyle=\color{black}\codefont\codesize, keywordstyle=\color{KeywordColor}\codefont\codesize, commentstyle=\color{CommentColor}\commentfont\normalsize, 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}[2][language=java]{% \lstset{% language=Java, upquote=true, basicstyle=\color{black}\codefont\normalsize, keywordstyle=\color{KeywordColor}\codefont\normalsize, commentstyle=\color{CommentColor}\commentfont\normalsize, stringstyle=\color{StringColor}\codefont\normalsize, showstringspaces=false, showtabs=false }% \mbox{\lstinline[#1]!#2!}} % centre command that won't add any vertical space before or after \newcommand{\centre}[1]{\hfill#1\hfill} % 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] \begin{center} \includegraphics[scale=#1,draft=false]{#2} \vspace{-25pt} \end{center} \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} } % new indent command that doesn't rely on \parindent \renewcommand{\indent}{\hspace*{5 mm}} % make \emph do italics (just in case other environments make it do something else) \renewcommand{\emph}[1]{\textit{#1}} % a simpler way of getting a right arrow \newcommand{\ra}[0]{$\rightarrow$~} % a command for padding out a page \newcommand{\pad}[0]{\vspace{\stretch{1}}} % command for adding a placeholder for information to be entered at a later date \newcommand{\fixme}[1]{\textcolor{red}{\textbf{TO DO:~ }#1}} \newcommand{\todo}[1]{\fixme{#1}} % fix the extra spacing that itemize/enumerate has when you put have an blank % line prior to the environment. \setlength{\pltopsep}{0.2\baselineskip} \setlength{\plpartopsep}{-0.2\baselineskip} \setlength{\plitemsep}{0.2\baselineskip} \setlength{\plparsep}{0.4\baselineskip} \renewenvironment{itemize}% {\begin{compactitem}}% {\end{compactitem}} \renewenvironment{enumerate}% {\begin{compactenum}}% {\end{compactenum}}
Show line notes below