slides/slides05.tex
changeset 153 70ab41cb610e
parent 151 df229ec49b22
child 157 b6eee9571a63
equal deleted inserted replaced
152:90e27fafc5c7 153:70ab41cb610e
    18 \usetikzlibrary{shadows}
    18 \usetikzlibrary{shadows}
    19 \usetikzlibrary{positioning}
    19 \usetikzlibrary{positioning}
    20 \usetikzlibrary{calc}
    20 \usetikzlibrary{calc}
    21 \usepackage{graphicx} 
    21 \usepackage{graphicx} 
    22 \usepackage{pgfplots}
    22 \usepackage{pgfplots}
       
    23 \usepackage{fontspec}
       
    24 \setmonofont{Consolas}
    23 
    25 
    24 \definecolor{javared}{rgb}{0.6,0,0} % for strings
    26 \definecolor{javared}{rgb}{0.6,0,0} % for strings
    25 \definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
    27 \definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
    26 \definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
    28 \definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
    27 \definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
    29 \definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
    29 \makeatletter
    31 \makeatletter
    30 \lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}}
    32 \lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}}
    31 \@empty\z@\@empty
    33 \@empty\z@\@empty
    32 \makeatother
    34 \makeatother
    33 
    35 
    34 \lstset{language=Java,
       
    35 	basicstyle=\consolas,
       
    36 	keywordstyle=\color{javapurple}\bfseries,
       
    37 	stringstyle=\color{javagreen},
       
    38 	commentstyle=\color{javagreen},
       
    39 	morecomment=[s][\color{javadocblue}]{/**}{*/},
       
    40 	numbers=left,
       
    41 	numberstyle=\tiny\color{black},
       
    42 	stepnumber=1,
       
    43 	numbersep=10pt,
       
    44 	tabsize=2,
       
    45 	showspaces=false,
       
    46 	showstringspaces=false}
       
    47 
    36 
    48 \lstdefinelanguage{scala}{
    37 \lstdefinelanguage{scala}{
    49   morekeywords={abstract,case,catch,class,def,%
    38   morekeywords={abstract,case,catch,class,def,%
    50     do,else,extends,false,final,finally,%
    39     do,else,extends,false,final,finally,%
    51     for,if,implicit,import,match,mixin,%
    40     for,if,implicit,import,match,mixin,%
    52     new,null,object,override,package,%
    41     new,null,object,override,package,%
    53     private,protected,requires,return,sealed,%
    42     private,protected,requires,return,sealed,%
    54     super,this,throw,trait,true,try,%
    43     super,this,throw,trait,true,try,%
    55     type,val,var,while,with,yield, then},
    44     type,val,var,while,with,yield},
    56   otherkeywords={=>,<-,<\%,<:,>:,\#,@,->},
    45   otherkeywords={=>,<-,<\%,<:,>:,\#,@},
    57   sensitive=true,
    46   sensitive=true,
    58   morecomment=[l]{//},
    47   morecomment=[l]{//},
    59   morecomment=[n]{/*}{*/},
    48   morecomment=[n]{/*}{*/},
    60   morestring=[b]",
    49   morestring=[b]",
    61   morestring=[b]',
    50   morestring=[b]',
    62   morestring=[b]"""
    51   morestring=[b]"""
    63 }
    52 }
    64 
    53 
       
    54 \lstdefinelanguage{while}{
       
    55   morekeywords={while, if, then. else, read, write},
       
    56   otherkeywords={=>,<-,<\%,<:,>:,\#,@},
       
    57   sensitive=true,
       
    58   morecomment=[l]{//},
       
    59   morecomment=[n]{/*}{*/},
       
    60   morestring=[b]",
       
    61   morestring=[b]',
       
    62   morestring=[b]"""
       
    63 }
       
    64 
       
    65 
    65 \lstset{language=Scala,
    66 \lstset{language=Scala,
    66 	basicstyle=\consolas,
    67 	basicstyle=\ttfamily,
    67 	keywordstyle=\color{javapurple}\bfseries,
    68 	keywordstyle=\color{javapurple}\bfseries,
    68 	stringstyle=\color{javagreen},
    69 	stringstyle=\color{javagreen},
    69 	commentstyle=\color{javagreen},
    70 	commentstyle=\color{javagreen},
    70 	morecomment=[s][\color{javadocblue}]{/**}{*/},
    71 	morecomment=[s][\color{javadocblue}]{/**}{*/},
    71 	numbers=left,
    72 	numbers=left,
   340 
   341 
   341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   342 \mode<presentation>{
   343 \mode<presentation>{
   343 \begin{frame}[c]
   344 \begin{frame}[c]
   344 
   345 
   345 \texttt{\consolas\lstinputlisting{../progs/fib.while}}
   346 \mbox{\lstinputlisting[language=while]{../progs/fib.while}}
   346 
   347 
   347 \end{frame}}
   348 \end{frame}}
   348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   349 
   350 
   350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   351 \mode<presentation>{
   352 \mode<presentation>{
   352 \begin{frame}[c]
   353 \begin{frame}[c]
   353 
   354 
   354 \texttt{\consolas\lstinputlisting{../progs/collatz.while}}
   355 \mbox{\lstinputlisting[language=while]{../progs/collatz.while}}
   355 
   356 
   356 \end{frame}}
   357 \end{frame}}
   357 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   358 
   359 
   359 
   360 
   360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   361 \mode<presentation>{
   362 \mode<presentation>{
   362 \begin{frame}[c]
   363 \begin{frame}[c]
   363 
   364 
   364 \texttt{\consolas\lstinputlisting{../progs/loops.while}}
   365 \mbox{\lstinputlisting[language=while]{../progs/loops.while}}
   365 
   366 
   366 \begin{textblock}{6}(10,2)
   367 \begin{textblock}{6}(10,2)
   367 \begin{tikzpicture}[scale=0.46]
   368 \begin{tikzpicture}[scale=0.46]
   368 \begin{axis}[axis x line=bottom, axis y line=left, ylabel=secs,
   369 \begin{axis}[axis x line=bottom, axis y line=left, ylabel=secs,
   369     xlabel=n,
   370     xlabel=n,