diff --git a/lectures/preamble.tex b/lectures/preamble.tex index bcab9eb..dd1c028 100644 --- a/lectures/preamble.tex +++ b/lectures/preamble.tex @@ -10,8 +10,9 @@ \usepackage{hhline} \usepackage{texpower} % options added via \PassOptionsToPackage in driver files \usepackage[T1]{fontenc} % needed for getting rid of smart quotes in code -\usepackage{courier} % redefines \ttfamily to courier for code +\usepackage[scaled]{beramono} % code font \usepackage{textcomp} % needed for getting rid of smart quotes in code +\usepackage[protrusion=true,expansion=true]{microtype} \usepackage{listings} @@ -27,11 +28,11 @@ \renewcommand{\sliderightmargin}{5mm} -%%% source code highlighting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% source code highlighting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % first param is font size, second is baselineskip -\newcommand\codesize{\fontsize{10}{15}\selectfont} -\newcommand\smallcodesize{\fontsize{9}{11}\selectfont} +\newcommand\codesize{\fontsize{9}{1.15\parskip}\selectfont} +\newcommand\smallcodesize{\fontsize{8}{1.1\parskip}\selectfont} % define the colors for code highlighting (based on Eclipse colors) @@ -41,20 +42,25 @@ % define the colors for code highlighting (based on NetBeans colors) \definecolor{KeywordColor}{rgb}{0.0,0,0.9} -\definecolor{CommentColor}{rgb}{0.59,0.59,0.59} +\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} +\newcommand{\commentfont}{\rmfamily\itshape} + % create a new environment for source code blocks \lstnewenvironment{codeblock}[1][] { \lstset{ language=Java, upquote=true, - basicstyle=\color{black}\ttfamily\codesize, - keywordstyle=\color{KeywordColor}\ttfamily\bfseries\codesize, - commentstyle=\color{CommentColor}\rmfamily\itshape\codesize, - stringstyle=\color{StringColor}\rmfamily\codesize, - lineskip=-7pt, + 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, @@ -71,11 +77,12 @@ \lstset{ language=Java, upquote=true, - basicstyle=\color{black}\ttfamily\smallcodesize, - keywordstyle=\color{KeywordColor}\ttfamily\bfseries\smallcodesize, - commentstyle=\color{CommentColor}\rmfamily\itshape\smallcodesize, - stringstyle=\color{StringColor}\rmfamily\smallcodesize, - lineskip=-7pt, + basicstyle=\color{black}\codefont\smallcodesize, + keywordstyle=\color{KeywordColor}\codefont\smallcodesize, + commentstyle=\color{CommentColor}\commentfont\codesize, + stringstyle=\color{StringColor}\codefont\smallcodesize, + aboveskip=5pt, + belowskip=-5pt, showstringspaces=false, tabsize=2, showtabs=false, @@ -100,15 +107,17 @@ \lstset{% language=Java, upquote=true, - basicstyle=\color{black}\ttfamily\codesize, - keywordstyle=\color{KeywordColor}\ttfamily\bfseries\codesize, - commentstyle=\color{CommentColor}\rmfamily\itshape\codesize, - stringstyle=\color{StringColor}\rmfamily\codesize, + 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]