Newer
Older
templates / lectures / preamble.tex
\usepackage[pdftex]{hyperref} % options added via hypersetup below
\usepackage{fixseminar}
\usepackage{soul}
\usepackage{graphicx}
\usepackage{paralist}
\usepackage{multicol}
\usepackage{tabularx}
\usepackage{hhline}
\usepackage{texpower} % options added via \PassOptionsToPackage in driver files
\usepackage[T1]{fontenc} % needed for getting rid of smart quotes in code
\usepackage[scaled]{beramono} % code font
\usepackage{textcomp} % needed for getting rid of smart quotes in code
\usepackage{microtype}
\usepackage{listings}
\usepackage{todonotes}
\usepackage[default]{gillius}

\definecolor{SectionColor}{rgb}{0.32,0.32,0.32}

%
% PDF tex graphics extensions {graphicx}
\DeclareGraphicsExtensions{.jpg,.jpeg,.pdf,.png,.mps}

% slidemargins {seminar,powersem}
\renewcommand{\slidetopmargin}{15mm}
\renewcommand{\slidebottommargin}{15mm}
\renewcommand{\slideleftmargin}{15mm}
\renewcommand{\sliderightmargin}{15mm}


%%% source code highlighting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% first param is font size, second is baselineskip
\newcommand\codesize{\fontsize{9}{1.1em}\selectfont}
\newcommand\smallcodesize{\fontsize{8}{1.1em}\selectfont}


% define the colors for code highlighting (based on Eclipse colors)
\definecolor{KeywordColor}{rgb}{0.5,0,0.33}    % violet
\definecolor{CommentColor}{rgb}{0.25,0.5,0.37} % green
\definecolor{StringColor}{rgb}{0.16,0,1}       % blue

% define the colors for code highlighting (based on NetBeans colors)
%\definecolor{KeywordColor}{rgb}{0.0,0,0.9}
%\definecolor{CommentColor}{rgb}{0.45,0.45,0.45} % a bit darker than NetBeans
%\definecolor{StringColor}{rgb}{0.81,0.48,0.0}

% create the fonts for code highlighting
\newcommand{\codefont}{\fontfamily{fvm}\selectfont} % beramono
\newcommand{\commentfont}{\sffamily\itshape}

% 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\codesize,
	stringstyle=\color{StringColor}\codefont\codesize,
	aboveskip=5pt,
	belowskip=0pt,
	lineskip=-5pt,
	showstringspaces=false,
	tabsize=3,
	showtabs=false,
	columns=fullflexible,
	flexiblecolumns=true,
	xleftmargin=0pt,
	breaklines=true
}\lstset{#1}}
{}

% create a new environment for source code blocks
\lstnewenvironment{smallcodeblock}[1][]
{% set up source code highlighting environment {listings}
\lstset{
	language=Java,
	upquote=true,
	basicstyle=\color{black}\codefont\smallcodesize,
	keywordstyle=\color{KeywordColor}\codefont\smallcodesize,
	commentstyle=\color{CommentColor}\commentfont\codesize,
	stringstyle=\color{StringColor}\codefont\smallcodesize,
	aboveskip=3pt,
	belowskip=-5pt,
	lineskip=-9pt,
	showstringspaces=false,
	tabsize=2,
	showtabs=false,
	columns=fullflexible,
	flexiblecolumns=true,
	xleftmargin=0pt,
	breaklines=true
}\lstset{#1}}
{}

\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]"
}

% command for typesetting inline code
\renewcommand{\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!}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% command for figures - first param is scale, second is file
\newcommand{\fig}[2] {
  \begin{figure}[H]
    \begin{center}
      \includegraphics[scale=#1,draft=false]{#2}
    \end{center}
  \end{figure}
  \vspace{-0.75\baselineskip}
}

% command for figures rotated 90 degrees left - first param is scale.
\newcommand{\rotatedfig}[2] {
  \begin{figure}[H]
    \begin{center}
      \includegraphics[scale=#1,draft=false, angle=90]{#2}
    \end{center}
  \end{figure}
}

% command for figures - first param is scale, second is file
\newcommand{\capfig}[3] {
  \begin{figure}[H]%
    \begin{center}%
      \includegraphics[scale=#1,draft=false]{#2}%
		\\ %
		{\footnotesize #3} %
    \end{center} %
  \end{figure} %
  \vspace{-0.75\baselineskip}
}

% suppress section numbers
\setcounter{secnumdepth}{-2}

% scale factors used by seminar/powersem package to make over/under full slides fit a bit better
\renewcommand{\slideshrink}{1.0}
\renewcommand{\slideskip}{0.25}
\renewcommand{\slidestretch}{1.05}

% increase paragraph spacing a little bit so slides don't look so crowded
\renewcommand{\slideparskip}{1.5ex}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% sections                                                                  %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage[sf,bf]{titlesec}

\titlespacing{\section}{0pt}{0pt}{0pt}
\titlespacing{\subsection}{0pt}{0pt}{0pt}
\titlespacing{\subsubsection}{0pt}{0pt}{0pt}
\titlespacing{\paragraph}{0pt}{0pt}{-0.5\parskip}

\titleformat{\section}{\normalfont\Huge\sffamily\bfseries\filcenter}{\theparagraph}{1em}{}
\titleformat{\subsection}{\normalfont\Large\sffamily\bfseries\filcenter}{\theparagraph}{1em}{}
\titleformat{\subsubsection}{\normalfont\large\sffamily\bfseries\filcenter}{\theparagraph}{1em}{}
\titleformat{\paragraph}{\normalfont\normalsize\sffamily\bfseries\filcenter}{\theparagraph}{1em}{}

% 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}}


% suppress slide centering (which buggers up incremental uncovering, and makes
% things jump around a lot)
\centerslidesfalse

% options for hyperef
\hypersetup{
  final={true},
  colorlinks={true},
  urlcolor={blue},
  filecolor={blue},
  linkcolor={blue},
  bookmarks={true},
  bookmarksopen={true},
  pdfpagemode={None}
} % title/subject/author attributes are set in lecturedetails.tex

% command for continuing slides - moves the content down a bit
\newcommand{\continued}{\null\smallskip}

\newcommand{\ra}[0]{$\rightarrow$~}


\slidepagestyle{empty}

\slideframe[\setlength{}{}]{none}

% environment for generating first page content
\newenvironment{lecturecontent}%
{%
	\null\vfill\maketitle\vfill\vfill\null%
	\newslide
	\section{Topics covered}%
	\begin{itemize}
}%
{%
	\end{itemize}%
}

\newcommand{\point}[2]{\textbf{#1}\\#2}

\renewcommand{\emph}[1]{\color{emcolor}\textit{#1}}
\newcommand{\strong}[1]{\color{emcolor}\textbf{#1}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 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.2\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$}
\def\labelitemiv{\footnotesize$\triangleright$}