From 7943f21a2c682ed32d1e9b6f91c09e0e2afc45c4 Mon Sep 17 00:00:00 2001 From: "Jeroen F.J. Laros" <J.F.J.Laros@lumc.nl> Date: Tue, 15 Mar 2011 08:41:19 +0000 Subject: [PATCH] Added support for displaying code with the lstlisting package. Added support for a multi line title. Makefile: - Expanded the clean command. presentation.tex: - Added an example code frame. beamerthemelumc.sty: - Enabled numbering of figures and tables. - Added settings for displaying code, fixed references in captions of code and fixed increasing of the listing counter in an overlay. - Made the title multi line with the use of a minipage. --- Makefile | 2 +- beamerthemelumc.sty | 64 +++++++++++++++++++++++++++++++++------------ presentation.tex | 14 ++++++++-- 3 files changed, 60 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 25ae58f..e803070 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ release: $(SRC) clean clean: rm -f *.aux $(SRC).blg $(SRC).dvi $(SRC).log $(SRC).nav $(SRC).out \ - $(SRC).toc $(SRC).snm + $(SRC).toc $(SRC).snm $(SRC).vrb distclean: clean rm -f $(SRC).ps $(SRC).pdf diff --git a/beamerthemelumc.sty b/beamerthemelumc.sty index 939c892..ed7c000 100644 --- a/beamerthemelumc.sty +++ b/beamerthemelumc.sty @@ -36,6 +36,34 @@ % Macro for bold text. \newcommand{\bt}[1]{\texttt{\textbf{#1}}} +% Enable numbering of figures and tables. +\setbeamertemplate{caption}[numbered] + +% +% Settings for displaying code. +% + +% This is for code listing in a presentation and to use references in captions. +\usepackage{listings} +\usepackage{cleveref} + +% Prevent an overlay to increase the listing counter. +\resetcounteronoverlays{lstlisting} + +% Make a nice layout for code. +\lstset{ + language = Python, + basicstyle = \footnotesize, + lineskip = -0.40ex, + frame = shadowbox, + rulesepcolor = \color{black}, + showstringspaces = false, + captionpos = b, + numbers = left, + numbersep = -1em, + numberstyle = \tiny +} + % % Settings for the title page. % @@ -90,28 +118,30 @@ { \titletemplate \begin{frame} - \vspace{1.5cm} - - \begin{center} - \color{black} {\Large {\bf \inserttitle}} + \begin{minipage}[b][6cm][c]{0.98\textwidth} + \begin{center} + \vspace{1.5cm} + + \color{black} {\Large {\bf \inserttitle}} - \vspace{2.3cm} - {\bf - {\scriptsize - \color{LUMCBlue} - \insertauthor - \smallskip + \vfill + {\bf + {\scriptsize + \color{LUMCBlue} + \insertauthor + \smallskip - \myGroup - \smallskip + \myGroup + \smallskip - \myDepartment + \myDepartment - \vspace{-0.1cm} - \myCenter + \vspace{-0.1cm} + \myCenter + } } - } - \end{center} + \end{center} + \end{minipage} \end{frame} } diff --git a/presentation.tex b/presentation.tex index 63ba3a8..4a6fade 100644 --- a/presentation.tex +++ b/presentation.tex @@ -34,7 +34,6 @@ \pause Second line. - \hfill \end{frame} \section{Topic2} @@ -55,11 +54,22 @@ The second slide in the same section. \end{frame} +\begin{frame}[fragile] + And an example of displaying code, mind the [fragile] option. + + \begin{lstlisting}[caption = {Example input}] + print "Hello" + \end{lstlisting} +\end{frame} + \section{Questions?} \lastpagetemplate \begin{frame} \begin{center} - Acknowledgements.. + Acknowledgements: + \bigskip + \bigskip + \end{center} \end{frame} -- GitLab