Improve configuration modularity, use minted for inline code

This commit is contained in:
Julian Ospald
2015-04-20 20:55:41 +02:00
parent 9d9ddfaf2d
commit 22f0fd9447
29 changed files with 86 additions and 98 deletions

View File

@@ -14,15 +14,10 @@
\usepackage[T1]{fontenc}
\usepackage[Q=yes]{examplep}
\input{../common/common_configuration.tex}
% package configuration
\DeclareGraphicsExtensions{.pdf,.png,.jpg}
\usemintedstyle{friendly}
\newminted{haskell}{frame=single,numbers=left,samepage=true}
\newminted{cpp}{frame=single,numbers=left}
\newminted{c}{frame=single,numbers=left}
\renewcommand{\theFancyVerbLine}{\ttfamily
\textcolor[rgb]{0.0,0.0,0.0}{\footnotesize
\oldstylenums{\arabic{FancyVerbLine}}}}
% macros and environments
\NewDocumentCommand {\slide} { m O{} O{} }
@@ -33,8 +28,4 @@
\newcommand{\slidep}{}
\newenvironment{itemizep}
{\begin{itemize}}
{\end{itemize}}
% color definition
\definecolor{solarized}{HTML}{002B36}
\definecolor{mygreen}{rgb}{0,0.6,0}
{\end{itemize}}

View File

@@ -6,55 +6,26 @@
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{minted}
\usepackage[newfloat=true]{minted}
\usepackage{xparse}
% for \verb inside \item
\usepackage[T1]{fontenc}
\usepackage[Q=yes]{examplep}
% color definition
\definecolor{solarized}{HTML}{002B36}
\definecolor{mygreen}{HTML}{009900}
\definecolor{mygrey}{rgb}{0.95,0.95,0.95}
\input{../common/common_configuration.tex}
% package configuration
\DeclareGraphicsExtensions{.pdf,.png,.jpg}
\beamertemplatenavigationsymbolsempty
\setbeamertemplate{footline}[frame number]
% minted
%% fix the minted@colorbg environment
\makeatletter
\renewenvironment{minted@colorbg}[1]
{\def\minted@bgcol{#1}%
\noindent
\begin{lrbox}{\minted@bgbox}
\begin{minipage}{\linewidth-2\fboxsep}}
{\end{minipage}%
\end{lrbox}%
\setlength{\topsep}{\smallskipamount}% set the vertical space
\trivlist\item\relax % ensure going to a new line
\colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}%
\endtrivlist % close the trivlist
}
\makeatother
\usemintedstyle{friendly}
\newminted{haskell}{bgcolor=mygrey,frame=single,numbers=left}
\newminted{cpp}{bgcolor=mygrey,frame=single,numbers=left}
\newminted{c}{bgcolor=mygrey,frame=single,numbers=left}
\renewcommand{\theFancyVerbLine}{\ttfamily
\textcolor[rgb]{0.0,0.0,0.0}{\footnotesize
\oldstylenums{\arabic{FancyVerbLine}}}}
% macros and environments
\newcommand{\code}[1]{\texttt{#1}}
\newcommand{\slidep}{\onslide<+->}
\newenvironment{itemizep}
{\begin{itemize}[<+->]}
{\end{itemize}}
\NewDocumentCommand {\slide} { m O{} O{} }
{\begin{frame}{#3}
\frametitle{\thesection.\ifnum\thesubsection=0\else\thesubsection.\fi\ \currentname {#2}}
@@ -67,8 +38,7 @@
\tableofcontents[currentsection,hideothersubsections]
\end{frame}}
% sections numbered
% sections numbered
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[subsections numbered]
\defbeamertemplate{subsubsection in toc}{subsubsections numbered}
@@ -81,4 +51,4 @@
\usepackage{nameref}
\makeatletter
\newcommand*{\currentname}{\@currentlabelname}
\makeatother
\makeatother

View File

@@ -0,0 +1,32 @@
% color definition
\definecolor{solarized}{HTML}{002B36}
\definecolor{mygreen}{HTML}{009900}
\definecolor{myblue}{HTML}{0000FF}
\definecolor{mygrey}{rgb}{0.95,0.95,0.95}
% minted
%% fix the minted@colorbg environment
\makeatletter
\renewenvironment{minted@colorbg}[1]
{\def\minted@bgcol{#1}%
\noindent
\begin{lrbox}{\minted@bgbox}
\begin{minipage}{\linewidth-2\fboxsep}}
{\end{minipage}%
\end{lrbox}%
\setlength{\topsep}{\smallskipamount}% set the vertical space
\trivlist\item\relax % ensure going to a new line
\colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}%
\endtrivlist % close the trivlist
}
\makeatother
\usemintedstyle{friendly}
\newminted{haskell}{bgcolor=mygrey,frame=single,numbers=left}
\newminted{cpp}{bgcolor=mygrey,frame=single,numbers=left}
\newminted{c}{bgcolor=mygrey,frame=single,numbers=left}
\newcommand{\hinline}[1]{\mintinline{haskell}{#1}}
\newcommand{\cinline}[1]{\mintinline{c}{#1}}
\newcommand{\cppinline}[1]{\mintinline{cpp}{#1}}
\renewcommand{\theFancyVerbLine}{\ttfamily
\textcolor[rgb]{0.0,0.0,0.0}{\footnotesize
\oldstylenums{\arabic{FancyVerbLine}}}}