Newer
Older
templates / lectures / preamble.tex
Mark on 26 Jul 2014 7 KB Minor changes.
  1. \usepackage[pdftex]{hyperref} % options added via hypersetup below
  2. \usepackage{fixseminar}
  3. \usepackage{soul}
  4. \usepackage{graphicx}
  5. \usepackage{pslatex}
  6. \usepackage{paralist}
  7. \usepackage{tplists}
  8. \usepackage{multicol}
  9. \usepackage{tabularx}
  10. \usepackage{hhline}
  11. \usepackage{texpower} % options added via \PassOptionsToPackage in driver files
  12. \usepackage[T1]{fontenc} % needed for getting rid of smart quotes in code
  13. \usepackage[scaled]{beramono} % code font
  14. \usepackage{textcomp} % needed for getting rid of smart quotes in code
  15. \usepackage[protrusion=true,expansion=true]{microtype}
  16. \usepackage{listings}
  17. \usepackage[default]{gillius}
  18.  
  19. \definecolor{SectionColor}{rgb}{0.32,0.32,0.32}
  20.  
  21. %
  22. % PDF tex graphics extensions {graphicx}
  23. \DeclareGraphicsExtensions{.jpg,.jpeg,.pdf,.png,.mps}
  24.  
  25.  
  26. % slidemargins {seminar,powersem}
  27. \renewcommand{\slidetopmargin}{11mm}
  28. \renewcommand{\slidebottommargin}{7mm}
  29. \renewcommand{\slideleftmargin}{5mm}
  30. \renewcommand{\sliderightmargin}{5mm}
  31.  
  32.  
  33. %%% source code highlighting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  34.  
  35. % first param is font size, second is baselineskip
  36. \newcommand\codesize{\fontsize{9}{1.3\parskip}\selectfont}
  37. \newcommand\smallcodesize{\fontsize{8}{1.2\parskip}\selectfont}
  38.  
  39.  
  40. % define the colors for code highlighting (based on Eclipse colors)
  41. \definecolor{KeywordColor}{rgb}{0.5,0,0.33} % violet
  42. \definecolor{CommentColor}{rgb}{0.25,0.5,0.37} % green
  43. \definecolor{StringColor}{rgb}{0.16,0,1} % blue
  44.  
  45. % define the colors for code highlighting (based on NetBeans colors)
  46. %\definecolor{KeywordColor}{rgb}{0.0,0,0.9}
  47. %\definecolor{CommentColor}{rgb}{0.45,0.45,0.45} % a bit darker than NetBeans
  48. %\definecolor{StringColor}{rgb}{0.81,0.48,0.0}
  49.  
  50. % create the fonts for code highlighting
  51. \newcommand{\codefont}{\fontfamily{fvm}\selectfont} % beramono
  52. \newcommand{\commentfont}{\rmfamily\itshape}
  53.  
  54. % create a new environment for source code blocks
  55. \lstnewenvironment{codeblock}[1][]
  56. {
  57. \lstset{
  58. language=Java,
  59. upquote=true,
  60. basicstyle=\color{black}\codefont\codesize,
  61. keywordstyle=\color{KeywordColor}\codefont\codesize,
  62. commentstyle=\color{CommentColor}\commentfont\normalsize,
  63. stringstyle=\color{StringColor}\codefont\codesize,
  64. gobble=2,
  65. aboveskip=10pt,
  66. belowskip=0pt,
  67. showstringspaces=false,
  68. tabsize=3,
  69. showtabs=false,
  70. columns=fullflexible,
  71. flexiblecolumns=true,
  72. xleftmargin=\slideleftmargin,
  73. breaklines=true
  74. }\lstset{#1}}
  75. {}
  76.  
  77. % create a new environment for source code blocks
  78. \lstnewenvironment{smallcodeblock}[1][]
  79. {% set up source code highlighting environment {listings}
  80. \lstset{
  81. language=Java,
  82. upquote=true,
  83. basicstyle=\color{black}\codefont\smallcodesize,
  84. keywordstyle=\color{KeywordColor}\codefont\smallcodesize,
  85. commentstyle=\color{CommentColor}\commentfont\codesize,
  86. stringstyle=\color{StringColor}\codefont\smallcodesize,
  87. gobble=2,
  88. aboveskip=5pt,
  89. belowskip=-5pt,
  90. showstringspaces=false,
  91. tabsize=2,
  92. showtabs=false,
  93. columns=fullflexible,
  94. flexiblecolumns=true,
  95. xleftmargin=\slideleftmargin,
  96. breaklines=true
  97. }\lstset{#1}}
  98. {}
  99.  
  100. \lstdefinelanguage{JavaScript}{
  101. keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break, this},
  102. sensitive=false,
  103. comment=[l]{//},
  104. morecomment=[s]{/*}{*/},
  105. morestring=[b]',
  106. morestring=[b]"
  107. }
  108.  
  109. % command for typesetting inline code
  110. \renewcommand{\code}[2][language=java]{%
  111. \lstset{%
  112. language=Java,
  113. upquote=true,
  114. basicstyle=\color{black}\codefont\normalsize,
  115. keywordstyle=\color{KeywordColor}\codefont\normalsize,
  116. commentstyle=\color{CommentColor}\commentfont\normalsize,
  117. stringstyle=\color{StringColor}\codefont\normalsize,
  118. showstringspaces=false,
  119. showtabs=false
  120. }%
  121. \mbox{\lstinline[#1]!#2!}}
  122.  
  123. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  124.  
  125. % command for figures - first param is scale, second is file
  126. \newcommand{\fig}[2] {
  127. \begin{figure}[H]
  128. \begin{center}
  129. \includegraphics[scale=#1,draft=false]{#2}
  130. \end{center}
  131. \end{figure}
  132. \vspace{-0.75\baselineskip}
  133. }
  134.  
  135. % command for figures rotated 90 degrees left - first param is scale.
  136. \newcommand{\rotatedfig}[2] {
  137. \begin{figure}[H]
  138. \begin{center}
  139. \includegraphics[scale=#1,draft=false, angle=90]{#2}
  140. \end{center}
  141. \end{figure}
  142. }
  143.  
  144. % command for figures - first param is scale, second is file
  145. \newcommand{\capfig}[3] {
  146. \begin{figure}[H]%
  147. \begin{center}%
  148. \includegraphics[scale=#1,draft=false]{#2}%
  149. \\ %
  150. {\footnotesize #3} %
  151. \end{center} %
  152. \end{figure} %
  153. \vspace{-0.75\baselineskip}
  154. }
  155.  
  156. % suppress section numbers
  157. \setcounter{secnumdepth}{-2}
  158.  
  159. % scale factors used by seminar/powersem package to make over/under full slides fit a bit better
  160. \renewcommand{\slideshrink}{1.0}
  161. \renewcommand{\slideskip}{0.25}
  162. \renewcommand{\slidestretch}{1.05}
  163.  
  164. % increase paragraph spacing a little bit so slides don't look so crowded
  165. \renewcommand{\slideparskip}{1.1ex}
  166.  
  167. % tweak section spacing and fonts
  168. \makeatletter
  169. \renewcommand\section{\@startsection{section}{1} %
  170. {0ex} % indent
  171. {-0.1ex} % above
  172. {0.1ex} % below
  173. {\huge\color{SectionColor}}}
  174.  
  175. \renewcommand\subsection{\@startsection{subsection}{2} %
  176. {0ex} % indent
  177. {-0.1ex} % above
  178. {0.1ex} % below
  179. {\Large\color{SectionColor}}}
  180.  
  181. \renewcommand\subsubsection{\@startsection{subsubsection}{3} %
  182. {0ex} % indent
  183. {-0.1ex} % above
  184. {0.1ex} % below
  185. {\large\color{SectionColor}}}
  186. \makeatother
  187.  
  188. % suppress slide centering (which buggers up incremental uncovering, and makes
  189. % things jump around a lot)
  190. \centerslidesfalse
  191.  
  192. % options for hyperef
  193. \hypersetup{
  194. final={true},
  195. colorlinks={true},
  196. urlcolor={blue},
  197. filecolor={blue},
  198. linkcolor={blue},
  199. bookmarks={true},
  200. bookmarksopen={true},
  201. pdfpagemode={None}
  202. } % title/subject/author attributes are set in lecturedetails.tex
  203.  
  204. % command for continuing slides - moves the content down a bit
  205. \newcommand{\continued}{\null\smallskip}
  206.  
  207. \newcommand{\ra}[0]{$\rightarrow$~}
  208.  
  209. %\definecolor{oublue}{cmyk}{1,0.85,0.1,0} % RGB 0, 15, 90
  210. %\definecolor{oured}{cmyk}{0,0.9,0.85,0} % RGB 100, 10, 15
  211. %\definecolor{ougold}{cmyk}{0,0.25,1,0} % RGB 100, 75, 0
  212. %\definecolor{darkred}{cmyk}{0,1,1,0.1}
  213.  
  214. %\newpagestyle{oupagestyle}%
  215. %{\color{ougold}\hspace{-\slideleftmargin}\rule[2mm]{0.1\textwidth}{\baselineskip}\color{oublue}\rule[2mm]{0.87\textwidth}{\baselineskip}\color{oured}\rule[2mm]{0.1\textwidth}{\baselineskip}}%
  216. %{\color{ougold}\hspace{-\slideleftmargin}\rule{0.97\textwidth}{\baselineskip}\color{oured}\rule{0.1\textwidth}{\baselineskip}% bottom band
  217. %\tiny\hspace{-\textwidth}\hspace{-\slideleftmargin}\color{black}% reset to start of band
  218. %\hspace{5pt}\raisebox{3.5pt}\PaperCode\hfill\raisebox{3.5pt}{\textsc{\LectureTitle}} % footer content
  219. %\hfill\raisebox{3.5pt}{\thepage}\hspace{3pt}% page number
  220. %}
  221. %
  222. %\slidepagestyle{oupagestyle}
  223.  
  224.  
  225. \slidepagestyle{empty}
  226.  
  227. \slideframe[\setlength{}{}]{none}
  228.  
  229. % environment for generating first page content
  230. \newenvironment{lecturecontent}%
  231. {%
  232. \null\vfill\maketitle\vfill%
  233. \section{Topics covered in this lecture}%
  234. \begin{compactitem}
  235. }%
  236. {%
  237. \end{compactitem}\vfill\null%
  238. }
  239.  
  240. \newcommand{\point}[2]{\textbf{#1}\\#2}
  241.  
  242. \renewcommand{\emph}[1]{\color{emcolor}\textbf{#1}}