diff --git a/.gitignore b/.gitignore index 5b6a065..5b5bb30 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,8 @@ .Rhistory .RData .Ruserdata +vignettes/*_cache +vignettes/*_files +vignettes/auto +*auto/ +*.tar.gz diff --git a/ChangeLog b/ChangeLog index 6d82172..4f2a0fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,26 @@ +2018-09-16 Dirk Eddelbuettel + + * R/binb.R (iqss): Process IQSS theme (translated to Markdown) + + * inst/rmarkdown/templates/iqss/skeleton/: Style files adapted + from IQSS LaTeX example, along with png and pdf inputs used + * inst/rmarkdown/templates/iqss/resources/template.tex: Idem + + * inst/rmarkdown/templates/metropolis/resources/template.tex: Switch + to rounded parenthesis in natbib + + * vignettes/metropolisDemo.Rmd: Added extended RMarkdown demo + * vignettes/metropolis/demo.bib: Demo bibliography + * vignettes/metropolis/header.tex: Some extra definitions + 2018-09-15 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Initial pre-release version - * binb.R (metropolis): Process Metropolis theme + * binb.R (metropolis): Process Metropolis (translated to Markdown) + * man/metropolis.Rd: Documentation * inst/rmarkdown/templates/metropolis/skeleton/skeleton.Rmd: Example skeleton taken from my samples=rmarkdown-metropolis repo - * inst/rmarkdown/templates/metropolis/resources/template.tex): + * inst/rmarkdown/templates/metropolis/resources/template.tex: Generic template for beamer presentations diff --git a/DESCRIPTION b/DESCRIPTION index 3442538..5541ce3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,4 +16,4 @@ Imports: rmarkdown, knitr VignetteBuilder: knitr License: GPL (>= 2) Encoding: UTF-8 -RoxygenNote: 6.0.1 +RoxygenNote: 6.1.0 diff --git a/NAMESPACE b/NAMESPACE index 836e368..8bd337f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,3 +1,3 @@ -export("metropolis") +export("metropolis", "iqss") import("knitr") import("rmarkdown") diff --git a/R/binb.R b/R/binb.R index 5f7cee4..5b542c0 100644 --- a/R/binb.R +++ b/R/binb.R @@ -18,7 +18,7 @@ ##' @param keep_tex A logical variable defaulting to \code{FALSE}. ##' @param latex_engine A character variable defaulting to \dQuote{xelatex}. ##' @param citation_package An optional character variable with possible value -##' \dQuote{none} (the default), \dQuote{natbib} or \dQuote{biblatex}. +##' \dQuote{none}, \dQuote{natbib} (the default), or \dQuote{biblatex}. ##' @param includes An optional character variable defaulting to \code{NULL}. ##' @param md_extensions An optional character variable defaulting to \code{NULL}. ##' @param pandoc_args An optional character variable defaulting to \code{NULL}. @@ -42,7 +42,6 @@ metropolis <- function(toc = FALSE, md_extensions = NULL, pandoc_args = NULL) { - template <- system.file("rmarkdown", "templates", "metropolis", "resources", "template.tex", package="binb") @@ -69,6 +68,58 @@ metropolis <- function(toc = FALSE, } +##' @rdname metropolis +iqss <- function(toc = FALSE, + slide_level = 3, + incremental = FALSE, + fig_width = 10, + fig_height = 7, + fig_crop = TRUE, + fig_caption = TRUE, + dev = 'pdf', + df_print = "default", + fonttheme = "default", + highlight = "haddock", + keep_tex = FALSE, + latex_engine = "xelatex", + citation_package = c("none", "natbib", "biblatex"), + includes = NULL, + md_extensions = NULL, + pandoc_args = NULL) { + + for (f in c("beamercolorthemeiqss.sty", "beamerfontthemeiqss.sty", + "beamerthemeiqss.sty", "header.png", "figs/")) + if (!file.exists(f)) + file.copy(system.file("rmarkdown", "templates", "iqss", "skeleton", f, package="binb"), + ".", recursive=TRUE) + + template <- system.file("rmarkdown", "templates", "iqss", + "resources", "template.tex", + package="binb") + + rmarkdown::beamer_presentation(template = template, + toc = toc, + slide_level = slide_level, + incremental = incremental, + fig_width = fig_width, + fig_height = fig_height, + fig_crop = fig_crop, + fig_caption = fig_caption, + dev = dev, + df_print = df_print, + theme = "iqss", + fonttheme = fonttheme, + highlight = highlight, + keep_tex = keep_tex, + latex_engine = latex_engine, + citation_package = citation_package, + includes = includes, + md_extensions = md_extensions, + pandoc_args = pandoc_args) + +} + + # Call rmarkdown::pdf_documet and mark the return value as inheriting pdf_document inherit_pdf_document <- function(...) { fmt <- rmarkdown::pdf_document(...) diff --git a/inst/rmarkdown/templates/iqss/resources/template.tex b/inst/rmarkdown/templates/iqss/resources/template.tex new file mode 100644 index 0000000..a4e0ba7 --- /dev/null +++ b/inst/rmarkdown/templates/iqss/resources/template.tex @@ -0,0 +1,378 @@ +\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere +\PassOptionsToPackage{hyphens}{url} +\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$endif$$if(handout)$handout,$endif$$if(colorlinks)$dvipsnames,$endif$$if(beamer)$ignorenonframetext,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$} +\setbeamertemplate{caption}[numbered] +\setbeamertemplate{caption label separator}{: } +\setbeamercolor{caption name}{fg=normal text.fg} +\beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$ +$if(fontfamily)$ +\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$} +$else$ +\usepackage{lmodern} +$endif$ +\usepackage{amssymb} +\usepackage{amsmath} +\usepackage{ifxetex,ifluatex} +\usepackage{fixltx2e} % provides \textsubscript +\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex + \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc} + \usepackage[utf8]{inputenc} +$if(euro)$ + \usepackage{eurosym} +$endif$ +\else % if luatex or xelatex + \ifxetex + \usepackage{mathspec} + \else + \usepackage{fontspec} +\fi +\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase} + +$for(fontfamilies)$ + \newfontfamily{$fontfamilies.name$}[$fontfamilies.options$]{$fontfamilies.font$} +$endfor$ + +$if(euro)$ + \newcommand{\euro}{€} +$endif$ + +$if(mainfont)$ + \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} +$endif$ + +$if(sansfont)$ + \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$} +$endif$ + +$if(monofont)$ + \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$} +$endif$ + +%$if(mathfont)$ +% \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$} +%$endif$ + +$if(CJKmainfont)$ + \usepackage{xeCJK} + \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$} +$endif$ +\fi + +$if(theme)$ + \usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$} +$endif$ + +$if(colortheme)$ + \usecolortheme{$colortheme$} +$endif$ + +$if(fonttheme)$ + \usefonttheme{$fonttheme$} +$endif$ + +$if(mainfont)$ + \usefonttheme{serif} % use mainfont rather than sansfont for slide text +$endif$ + +$if(innertheme)$ + \useinnertheme{$innertheme$} +$endif$ + +$if(outertheme)$ + \useoutertheme{$outertheme$} +$endif$ + +% use upquote if available, for straight quotes in verbatim environments +\IfFileExists{upquote.sty}{\usepackage{upquote}}{} +% use microtype if available +\IfFileExists{microtype.sty}{% + \usepackage{microtype} + \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts +}{} + +$if(lang)$ +\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex + \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel} + $if(babel-newcommands)$ + $babel-newcommands$ + $endif$ +\else + \usepackage{polyglossia} + \setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$} + $for(polyglossia-otherlangs)$ + \setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$} + $endfor$ +\fi +$endif$ + +\newif\ifbibliography +$if(natbib)$ + \usepackage[round]{natbib} + \bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$} +$endif$ +$if(biblatex)$ + \usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex} + $for(bibliography)$ + \addbibresource{$bibliography$} + $endfor$ +$endif$ + +$if(verbatim-in-note)$ +\usepackage{fancyvrb} +$endif$ + +\hypersetup{ + $if(title-meta)$ + pdftitle={$title-meta$}, + $endif$ + $if(author-meta)$ + pdfauthor={$author-meta$}, + $endif$ + $if(keywords)$ + pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$}, + $endif$ + $if(colorlinks)$ + colorlinks=true, + linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$, + citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$, + urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$, + $else$ + pdfborder={0 0 0}, + $endif$ + breaklinks=true} +%\urlstyle{same} % Use monospace font for urls + +$if(verbatim-in-note)$ + \VerbatimFootnotes % allows verbatim text in footnotes +$endif$ + +$if(listings)$ + \usepackage{listings} +$endif$ + +$if(lhs)$ + \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{} +$endif$ + +$if(highlighting-macros)$ + $highlighting-macros$ +$endif$ + +$if(tables)$ + \usepackage{longtable,booktabs} + \usepackage{caption} + % These lines are needed to make table captions work with longtable: + \makeatletter + \def\fnum@table{\tablename~\thetable} + \makeatother +$endif$ + +$if(graphics)$ + \usepackage{graphicx,grffile} + \makeatletter + \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} + \def\maxheight{\ifdim\Gin@nat@height>\textheight0.8\textheight\else\Gin@nat@height\fi} + \makeatother + % Scale images if necessary, so that they will not overflow the page + % margins by default, and it is still possible to overwrite the defaults + % using explicit options in \includegraphics[width, height, ...]{} + \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} +$endif$ + +% Prevent slide breaks in the middle of a paragraph: +\widowpenalties 1 10000 +\raggedbottom + +$if(section-titles)$ + \AtBeginPart{ + \let\insertpartnumber\relax + \let\partname\relax + \frame{\partpage} + } + \AtBeginSection{ + \ifbibliography + \else + \let\insertsectionnumber\relax + \let\sectionname\relax + \frame{\sectionpage} + \fi + } + \AtBeginSubsection{ + \let\insertsubsectionnumber\relax + \let\subsectionname\relax + \frame{\subsectionpage} + } +$endif$ + +$if(links-as-notes)$ + % Make links footnotes instead of hotlinks: + \renewcommand{\href}[2]{#2\footnote{\url{#1}}} +$endif$ + +$if(strikeout)$ + \usepackage[normalem]{ulem} + % avoid problems with \sout in headers with hyperref: + \pdfstringdefDisableCommands{\renewcommand{\sout}{}} +$endif$ + +\setlength{\parindent}{0pt} +\setlength{\parskip}{6pt plus 2pt minus 1pt} +\setlength{\emergencystretch}{3em} % prevent overfull lines +\providecommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} + +$if(numbersections)$ + \setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$} +$else$ + \setcounter{secnumdepth}{0} +$endif$ + +$if(dir)$ + \ifxetex + % load bidi as late as possible as it modifies e.g. graphicx + $if(latex-dir-rtl)$ + \usepackage[RTLdocument]{bidi} + $else$ + \usepackage{bidi} + $endif$ + \fi + \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex + \TeXXeTstate=1 + \newcommand{\RL}[1]{\beginR #1\endR} + \newcommand{\LR}[1]{\beginL #1\endL} + \newenvironment{RTL}{\beginR}{\endR} + \newenvironment{LTR}{\beginL}{\endL} + \fi +$endif$ + +$for(header-includes)$ + $header-includes$ +$endfor$ + +%% IQSS overrides +\iqsssectiontitle{Outline} + +\AtBeginSection[]{ + \title{\insertsectionhead} + { + \definecolor{white}{rgb}{0.776,0.357,0.157} + \definecolor{iqss@orange}{rgb}{1,1,1} + \ifnum \insertmainframenumber > \insertframenumber + \frame{ + \frametitle{\iqsssectiontitleheader} + \tableofcontents[currentsection] + } + \else + \frame{ + \frametitle{Backup Slides} + \tableofcontents[sectionstyle=shaded/shaded,subsectionstyle=shaded/shaded/shaded] + } + \fi + } +} + +\AtBeginSubsection[]{} + +%% + + +$if(title)$ + \title[$shorttitle$]{$title$} +$endif$ + +$if(subtitle)$ + \subtitle{$subtitle$} +$endif$ + +$if(author)$ + \author[ + $if(short-author)$ + $for(short-author)$$short-author$$sep$ \and $endfor$ + $else$ + $for(author)$$author$$sep$ \and $endfor$ + $endif$ + ]{$for(author)$$author$$sep$ \and $endfor$} +$endif$ + +$if(institute)$ + \institute[ + $if(short-institute)$ + $for(short-institute)$$short-institute$$sep$ \and $endfor$ + $endif$ + ]{ + $if(department)$ + $for(department)$$department$$sep$ \and $endfor$ \\ + $endif$ + $for(institute)$$institute$$sep$ \and $endfor$ + $if(email)$ + \\ $for(email)$ \href{mailto:$email$}{\nolinkurl{$email$}}$sep$ \and $endfor$ + $endif$ + } +$endif$ + +\date[ + $if(short-date)$ + $short-date$ + $else$ + $date$ + $endif$]{ + $if(date)$ + $date$ + $if(license)$ + \\ \vspace{5mm} + $endif$ + $endif$ + $if(license)$ + {\scriptsize $license$} + $endif$ +} + +\begin{document} + +% Hide progress bar and footline on titlepage +$if(title)$ + \begin{frame}[plain] + \titlepage + \end{frame} +$endif$ + +$for(include-before)$ + $include-before$ +$endfor$ + +$if(toc)$ + \begin{frame} + \tableofcontents[hideallsubsections] + \end{frame} +$endif$ + +$body$ + +$if(natbib)$ + $if(bibliography)$ + $if(biblio-title)$ + $if(book-class)$ + \renewcommand\bibname{$biblio-title$} + $else$ + \renewcommand\refname{$biblio-title$} + $endif$ + $endif$ + \begin{frame}[allowframebreaks]{$biblio-title$} + \bibliographytrue + \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$} + \end{frame} + $endif$ +$endif$ + +$if(biblatex)$ + \begin{frame}[allowframebreaks]{$biblio-title$} + \bibliographytrue + \printbibliography[heading=none] + \end{frame} +$endif$ + +$for(include-after)$ + $include-after$ +$endfor$ + +\end{document} diff --git a/inst/rmarkdown/templates/iqss/skeleton/beamercolorthemeiqss.sty b/inst/rmarkdown/templates/iqss/skeleton/beamercolorthemeiqss.sty new file mode 100644 index 0000000..240cfab --- /dev/null +++ b/inst/rmarkdown/templates/iqss/skeleton/beamercolorthemeiqss.sty @@ -0,0 +1,236 @@ +% Modified from beamerclorthemedefault.sty. +% Original work Copyright 2007 by Till Tantau +% Copyright 2012,2015 by Vedran Mileti\'c, Joseph Wright +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% + +\RequirePackage{listings} + +\mode + +% - Main color BLUE (Title, bullets, arrows) +% - First accent ORANGE (math, or RED) +% - Second accent PURPLE +% - Third accent GREEN +% - Fourth accent RED +% - Fifth accent YELLOW + +% red green blue +%Orange 0.776 0.357 0.157 +%Blue 0.208 0.380 1.000 +%Purple 0.471 0.000 0.471 +%Yellow 0.808 0.616 0.133 +%Green 0.341 0.553 0.090 + +\definecolor{iqss@orange}{rgb}{0.776,0.357,0.157} +\definecolor{iqss@blue}{rgb}{0.19,0.55,0.91} +\definecolor{iqss@purple}{rgb}{0.471, 0.000 0.471} +\definecolor{iqss@yellow}{rgb}{0.808, 0.616 0.133} +\definecolor{iqss@green}{rgb}{0.341, 0.553 0.090} +\definecolor{iqss@red}{rgb}{0.65, 0.11 0.19} +\definecolor{iqss@gray}{rgb}{0.95,0.95,0.95} + +\lstset{ % + basicstyle=\ttfamily\footnotesize, + backgroundcolor=\color{iqss@gray}, + commentstyle=\color{iqss@green}, + keywordstyle=\color{iqss@blue}, + stringstyle=\color{iqss@purple}, + keepspaces=true, + showspaces=false, + showstringspaces=false, + showtabs=false +} + +\newcommand<>{\alertb}[1]{\setbeamercolor{alerted text}{fg=iqss@red}% + \begin{alertenv}#2\relax#1\end{alertenv}% + \setbeamercolor{alerted text}{fg=iqss@blue}% +} +\newcommand<>{\alertc}[1]{\setbeamercolor{alerted text}{fg=iqss@green}% + \begin{alertenv}#2\relax#1\end{alertenv}% + \setbeamercolor{alerted text}{fg=iqss@blue}% +} +\newcommand<>{\alertd}[1]{\setbeamercolor{alerted text}{fg=iqss@yellow}% + \begin{alertenv}#2\relax#1\end{alertenv}% + \setbeamercolor{alerted text}{fg=iqss@blue}% +} +\newcommand<>{\alerte}[1]{\setbeamercolor{alerted text}{fg=iqss@purple}% + \begin{alertenv}#2\relax#1\end{alertenv}% + \setbeamercolor{alerted text}{fg=iqss@blue}% +} + + +\setbeamercolor{normal text}{fg=black,bg=white} +\setbeamercolor{alerted text}{fg=iqss@blue} +\setbeamercolor{example text}{fg=iqss@green} + +\setbeamercolor{structure}{fg=iqss@orange} + +\setbeamercolor{background canvas}{parent=normal text} +\setbeamercolor{background}{parent=background canvas} + +\setbeamercolor{palette primary}{use=structure,fg=structure.fg} +\setbeamercolor{palette secondary}{use=structure,fg=structure.fg!75!black} +\setbeamercolor{palette tertiary}{use=structure,fg=structure.fg!50!black} +\setbeamercolor{palette quaternary}{fg=black} + +\setbeamercolor{palette sidebar primary}{use=normal text,fg=normal text.fg} +\setbeamercolor{palette sidebar secondary}{use=structure,fg=structure.fg} +\setbeamercolor{palette sidebar tertiary}{use=normal text,fg=normal text.fg} +\setbeamercolor{palette sidebar quaternary}{use=structure,fg=structure.fg} + +\setbeamercolor{math text}{} +\setbeamercolor{math text inlined}{parent=math text} +\setbeamercolor{math text displayed}{parent=math text} + +\setbeamercolor{normal text in math text}{} + +\setbeamercolor{local structure}{parent=structure} + +\setbeamercolor{titlelike}{parent=structure} + +%Edd \setbeamercolor{title}{parent=titlelike,fg=white,bg=iqss@orange} +\setbeamercolor{title}{parent=titlelike,fg=iqss@orange} +\setbeamercolor{title in head/foot}{parent=palette quaternary} +\setbeamercolor{title in sidebar}{parent=palette sidebar quaternary} + +\setbeamercolor{subtitle}{parent=title} + +\setbeamercolor{author}{} +\setbeamercolor{author in head/foot}{parent=palette primary} +\setbeamercolor{author in sidebar}{use=palette sidebar tertiary,fg=palette sidebar tertiary.fg} + +\setbeamercolor{institute}{} +\setbeamercolor{institute in head/foot}{parent=palette tertiary} +\setbeamercolor{institute in sidebar}{use=palette sidebar tertiary,fg=palette sidebar tertiary.fg} + +\setbeamercolor{date}{} +\setbeamercolor{date in head/foot}{parent=palette secondary} +\setbeamercolor{date in sidebar}{use=palette sidebar tertiary,fg=palette sidebar tertiary.fg} + +\setbeamercolor{titlegraphic}{} + +\setbeamercolor{part name}{} +\setbeamercolor{part title}{parent=title} + +\setbeamercolor{section name}{} +\setbeamercolor{section title}{parent=title} + +\setbeamercolor{section in toc}{parent=structure} +\setbeamercolor{section in toc shaded}{parent=section in toc} +\setbeamercolor{section in head/foot}{parent=palette tertiary} +\setbeamercolor{section in sidebar}{parent=palette sidebar secondary} +\setbeamercolor{section in sidebar shaded}{use=section in sidebar,fg=section in sidebar.fg!40!bg} +\setbeamercolor{section number projected}{parent=item projected} + +\setbeamercolor{subsection name}{} +\setbeamercolor{subsection title}{parent=titlelike} + +\setbeamercolor{subsection in toc}{} +\setbeamercolor{subsection in toc shaded}{parent=subsection in toc} +\setbeamercolor{subsection in head/foot}{parent=palette secondary} +\setbeamercolor{subsection in sidebar}{parent=palette sidebar primary} +\setbeamercolor{subsection in sidebar shaded}{use=subsection in sidebar,fg=subsection in sidebar.fg!40!bg} +\setbeamercolor{subsection number projected}{parent={subitem projected}} + +\setbeamercolor{subsubsection in toc}{parent=subsection in toc} +\setbeamercolor{subsubsection in toc shaded}{parent=subsubsection in toc} +\setbeamercolor{subsubsection in head/foot}{parent=subsection in head/foot} +\setbeamercolor{subsubsection in sidebar}{parent=subsection in sidebar} +\setbeamercolor{subsubsection in sidebar shaded}{parent=subsection in sidebar shaded} +\setbeamercolor{subsubsection number projected}{parent=subsubitem projected} + +\setbeamercolor{headline}{} +\setbeamercolor{footline}{} + +\setbeamercolor{sidebar}{} +\setbeamercolor{sidebar left}{parent=sidebar} +\setbeamercolor{sidebar right}{parent=sidebar} + +\setbeamercolor{logo}{parent=palette secondary} + +\setbeamercolor{frametitle}{parent=titlelike} +\setbeamercolor{framesubtitle}{parent=frametitle} + +\setbeamercolor{frametitle right}{parent=frametitle} + +\setbeamercolor{caption}{} +\setbeamercolor{caption name}{parent=structure} + +\setbeamercolor{button}{use=local structure,bg=local structure.fg!50!bg,fg=white} +\setbeamercolor{button border}{use=button,fg=button.bg} +\setbeamercolor{navigation symbols}{use=structure,fg=structure.fg!40!bg} +\setbeamercolor{navigation symbols dimmed}{use=structure,fg=structure.fg!20!bg} +\setbeamercolor{mini frame}{parent=section in head/foot} + +\setbeamercolor{block body}{} +\setbeamercolor{block body alerted}{} +\setbeamercolor{block body example}{} +\setbeamercolor{block title}{parent=structure,bg=iqss@gray} +\setbeamercolor{block title alerted}{parent=alerted text,bg=iqss@gray} +\setbeamercolor{block title example}{parent=example text,bg=iqss@gray} + +\setbeamercolor{item}{parent=local structure} +\setbeamercolor{subitem}{parent=item} +\setbeamercolor{subsubitem}{parent=subitem} + +\setbeamercolor{item projected}{parent=item,use=item,fg=white,bg=item.fg} +\setbeamercolor{subitem projected}{parent=item projected} +\setbeamercolor{subsubitem projected}{parent=subitem projected} + +\setbeamercolor{enumerate item}{parent=item} +\setbeamercolor{enumerate subitem}{parent=subitem} +\setbeamercolor{enumerate subsubitem}{parent=subsubitem} + +\setbeamercolor{itemize item}{parent=item} +\setbeamercolor{itemize subitem}{parent=subitem} +\setbeamercolor{itemize subsubitem}{parent=subsubitem} + +\setbeamercolor{itemize/enumerate body}{} +\setbeamercolor{itemize/enumerate subbody}{} +\setbeamercolor{itemize/enumerate subsubbody}{} + +\setbeamercolor{description item}{parent=item} + +\setbeamercolor{description body}{} + +\setbeamercolor{bibliography item}{parent=item} + +\setbeamercolor{bibliography entry author}{use=structure,fg=structure.fg} +\setbeamercolor{bibliography entry title}{use=normal text,fg=normal text.fg} +\setbeamercolor{bibliography entry location}{use=structure,fg=structure.fg!65!bg} +\setbeamercolor{bibliography entry note}{use=structure,fg=structure.fg!65!bg} + +\setbeamercolor{separation line}{} + +\setbeamercolor{upper separation line head}{parent=separation line} +\setbeamercolor{middle separation line head}{parent=separation line} +\setbeamercolor{lower separation line head}{parent=separation line} + +\setbeamercolor{upper separation line foot}{parent=separation line} +\setbeamercolor{middle separation line foot}{parent=separation line} +\setbeamercolor{lower separation line foot}{parent=separation line} + +\setbeamercolor{abstract}{} +\setbeamercolor{abstract title}{parent=structure} + +\setbeamercolor{verse}{} + +\setbeamercolor{quotation}{} +\setbeamercolor{quote}{parent=quotation} + +%\setbeamercolor{page number in head/foot}{fg=fg!50!bg} +\setbeamercolor{page number in head/foot}{fg=iqss@orange} + +\setbeamercolor{qed symbol}{parent=structure} + +\setbeamercolor{note page}{bg=white!90!black, fg=black} +\setbeamercolor{note title}{bg=white!80!black, fg=black} +\setbeamercolor{note date}{parent=note title} + +\mode + diff --git a/inst/rmarkdown/templates/iqss/skeleton/beamerfontthemeiqss.sty b/inst/rmarkdown/templates/iqss/skeleton/beamerfontthemeiqss.sty new file mode 100644 index 0000000..9c4cbab --- /dev/null +++ b/inst/rmarkdown/templates/iqss/skeleton/beamerfontthemeiqss.sty @@ -0,0 +1,7 @@ +\usefonttheme{professionalfonts} +\RequirePackage{fontspec} + +\setmainfont{Libertinus Serif} +\setsansfont{Libertinus Sans} +\setmathfont{Libertinus Math} +\setmonofont{Libertinus Mono} diff --git a/inst/rmarkdown/templates/iqss/skeleton/beamerthemeiqss.sty b/inst/rmarkdown/templates/iqss/skeleton/beamerthemeiqss.sty new file mode 100644 index 0000000..c33dda0 --- /dev/null +++ b/inst/rmarkdown/templates/iqss/skeleton/beamerthemeiqss.sty @@ -0,0 +1,123 @@ +% Modified from beamerthemedefault.sty. +% Original work Copyright 2007 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% + +% Requirement +\RequirePackage{tikz} +%\RequirePackage{amsmath} % DEdd: side-effects, and loaded later +%\RequirePackage{unicode-math} % DEdd: side-effects + +\mode + +\hypersetup{colorlinks=true,allcolors=iqss@orange} + +\def \iqsssectiontitleheader {} + +\newcommand{\iqsssectiontitle}[1]{ + \def \iqsssectiontitleheader{#1} +} + +\@ifundefined{insertmainframenumber} +{% + % \insertmainframenumber not defined + \newcommand{\insertmainframenumber}{\inserttotalframenumber} +} +{% + % \insertmainframenumber already defined +}% + + +%\setbeamertemplate{footline}[frame number] +\setbeamertemplate{footline} +{ \usebeamercolor[fg]{page number in head/foot}% + \usebeamerfont{page number in head/foot}% + \hspace{1em}\insertsectionhead% + \hfill% + \insertframenumber\,/\,\hyperlinkappendixstart{\insertmainframenumber} + \ifnum \thepage = \insertframeendpage{\small .}\else{\phantom{\small .}}\fi + \hspace{1em} + \vskip2pt% +} + +% Edd +\titlegraphic{\includegraphics[width=\paperwidth]{header.png}} +%This works: \titlegraphic{\includegraphics[width=0.4in]{illinois_logo_tm.eps}} + +\setbeamertemplate{title page} +{ + + % \node[anchor=north west,xshift=-1.2mm,yshift=1.2mm] at (current page.north west){% + \begin{tikzpicture}[remember picture,overlay] + %\node[anchor=north east] at (current page.north east){% + \node[anchor=north west,xshift=-1.2mm,yshift=1.2mm] at (current page.north west){% + \noindent\inserttitlegraphic\par + }; + \end{tikzpicture} + \vskip1em + \vbox{} + \begingroup + \centering + \usebeamercolor[fg]{titlegraphic} + \begin{beamercolorbox}[sep=8pt,center]{title} + \usebeamerfont{title}\inserttitle\par% + \ifx\insertsubtitle\@empty% + \else% + \vskip0.25em% + {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}% + \fi% + \end{beamercolorbox}% + \vskip1em\par + \begin{beamercolorbox}[sep=8pt,center]{author} + \usebeamerfont{author}\insertauthor + \end{beamercolorbox} + \begin{beamercolorbox}[sep=8pt,center]{institute} + \usebeamerfont{institute}\insertinstitute + \end{beamercolorbox} + \begin{beamercolorbox}[sep=8pt,center]{date} + \usebeamerfont{date}\insertdate + \end{beamercolorbox} + \endgroup + \vfill +} + +\setbeamertemplate{navigation symbols}{} +\setbeamertemplate{blocks}[rounded][shadow=true] + +\usefonttheme{iqss} +\usecolortheme{iqss} +\useinnertheme{default} +\useoutertheme{default} + +\setbeamertemplate{itemize items}[circle] + +\AtBeginSection[]{ + \title{\insertsectionhead} + { + \definecolor{white}{rgb}{0.776,0.357,0.157} + \definecolor{iqss@orange}{rgb}{1,1,1} + \ifnum \insertmainframenumber > \insertframenumber + \frame{ + \frametitle{\iqsssectiontitleheader} + \tableofcontents[currentsection] + } + \else + \frame{ + \frametitle{Backup Slides} + \tableofcontents[sectionstyle=shaded/shaded,subsectionstyle=shaded/shaded/shaded] + } + \fi + } +} + + +\mode + + +% Local Variables: +% TeX-engine: xetex +% End: diff --git a/inst/rmarkdown/templates/iqss/skeleton/figs/functionalForms.pdf b/inst/rmarkdown/templates/iqss/skeleton/figs/functionalForms.pdf new file mode 100644 index 0000000..6071894 Binary files /dev/null and b/inst/rmarkdown/templates/iqss/skeleton/figs/functionalForms.pdf differ diff --git a/inst/rmarkdown/templates/iqss/skeleton/figs/phbAr.png b/inst/rmarkdown/templates/iqss/skeleton/figs/phbAr.png new file mode 100644 index 0000000..69fb019 Binary files /dev/null and b/inst/rmarkdown/templates/iqss/skeleton/figs/phbAr.png differ diff --git a/inst/rmarkdown/templates/iqss/skeleton/header.png b/inst/rmarkdown/templates/iqss/skeleton/header.png new file mode 100644 index 0000000..217702f Binary files /dev/null and b/inst/rmarkdown/templates/iqss/skeleton/header.png differ diff --git a/inst/rmarkdown/templates/iqss/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/iqss/skeleton/skeleton.Rmd new file mode 100644 index 0000000..060683b --- /dev/null +++ b/inst/rmarkdown/templates/iqss/skeleton/skeleton.Rmd @@ -0,0 +1,243 @@ +--- +author: Gary King and Ista Zahn +classoption: compress +fontsize: 12pt +title: Beamer Class Demonstration +date: \today +institute: IQSS +output: binb::iqss +--- + + +# Beamer Features + +## Some of Gary's Examples + +### What's this course about? + + +::: incremental + +- \alert{Specific statistical methods for many research problems} + - How to learn (or create) new methods + - Inference: \underline{Using facts you know to learn about + facts you don't know} +- \alert{How to write a publishable scholarly paper} +- \alert{All the practical tools of research} --- theory, + applications, simulation, programming, word processing, plumbing, + whatever is useful +- $\leadsto$ \alert{Outline and class materials:} + - \mbox{{\huge\parbox[b][.5in][t]{1in}{\alert{j.mp/G2001}}} + $\qquad\qquad$\includegraphics[width=.95in]{figs/phbAr.png}} + - The syllabus gives topics, not a weekly plan. + - We will go as fast as possible subject to everyone following along + - We cover different amounts of material each week + +::: + +### How much math will you scare us with? + +- All math requires two parts: \alertb{proof} and \alertb{concepts \& intuition} +- Different classes emphasize: + - \alert{Baby Stats}: dumbed down proofs, vague intuition + - \alert{Math Stats}: rigorous mathematical proofs + - \alert{\underline{Practical Stats}}: deep concepts and intuition, proofs when needed + - Goal: how to do empirical research, in depth + - Use rigorous statistical theory --- when needed + - Insure we understand the intuition --- always + - Always traverse from theoretical foundations to practical applications + - Includes ``how to'' computation + - $\leadsto$ Fewer proofs, more concepts, better practical knowledge +- Do you have the background for this class? + +. . . + +\alert{A Test: What's this? + \begin{align*} + b=(X'X)^{-1}X'y + \end{align*} } + + +### Systematic Components: Examples + +\includegraphics[width=8cm]{figs/functionalForms} + +- \alertb{$E(Y_i) \equiv \mu_i = X_i\beta = \beta_0 + + \beta_1X_{1i} +\dots+\beta_kX_{ki}$} +- \alertc{$\Pr(Y_i=1) \equiv \pi_i = + \frac{1}{1+e^{-x_i\beta}}$} +- \alertd{$V(Y_i)\equiv \sigma_i^2 = e^{x_i\beta}$} +- Interpretation: + - Each is a \alert{class of functional forms} + - Set $\beta$ and it picks out one \alert{member of the class} + - \alert{$\beta$} in each is an ``effect parameter'' vector, + with different meaning + + +### Negative Binomial Derivation + +\uncover<+->{Recall:} + +\begin{equation*} + \uncover<+->{\Pr(A|B)=\frac{\Pr(AB)}{\Pr(B)} \implies + \alertb{\Pr(AB)}=\alerte{\Pr(A|B)}\alertd{\Pr(B)}} +\end{equation*} + +\alertb<1-1>{one} +\alertc<2-2>{two} +\alertd<3-3>{three} + +\begin{align*} + \uncover<+->{\text{NegBin}(y|\phi,\sigma^2) &= \int_0^\infty + \alerte{\text{Poisson}(y|\lambda)} + \times\alertd{\text{gamma}(\lambda|\phi,\sigma^2)}d\lambda\\} + \uncover<+->{&= \int_0^\infty + \alertb{\P(y,\lambda|\phi,\sigma^2) }d\lambda\\} + \uncover<+->{&= + \frac{\Gamma\left(\frac{\phi}{\sigma^2-1}+y_i\right)} + {y_i!\Gamma\left(\frac{\phi}{\sigma^2-1}\right)} + \left(\frac{\sigma^2-1}{\sigma^2}\right)^{y_i} + \left(\sigma^2\right)^{\frac{-\phi}{\sigma^2-1}}} +\end{align*} + + +# Other Features + +## Structural Features + +### Structural Features + +#### Levels of Structure + +- usual \LaTeX\ \textbackslash\ section, \textbackslash\ subsection commands +- `frame` environments provide slides +- `block` environments divide slides into logical sections +- `columns` environments divide slides vertically (example later) +- overlays (\`a la prosper) change content of slides dynamically + +#### \alertc{Overlay Alerts} + +On the first overlay, \alert<1>{this text} is highlighted (or \emph{alerted}). +On the second, \alert<2>{this text} is. + + +### Code blocks + +\footnotesize + +```r +# Say hello in R +hello <- function(name) paste("hello", name) +``` + +. . . + +```python +# Say hello in Python +def hello(name): +return("Hello" + " " + name) +``` + +. . . + +```haskell +-- Say hello in Haskell +hello name = "Hello" ++ " " ++ name +``` + +. . . + +```c +/* Say hello in C */ +#include +int main() +{ + char name[256]; + fgets(name, sizeof(name), stdin); + printf("Hello %s", name); + return(0); +} +``` + +\normalsize + + +### Alerts + +- First level \alert{alert} +- Second level \alertb{alert} +- Third level \alertc{alert} +- Fourth level \alertd{alert} +- Fifth level \alerte{alert} + +# More Features + +## Blocks + +### Other Features + +#### Levels of Structure + +- Clean, extensively customizable visual style +- Hyperlinks ([http://github.com/izahn/iqss-beamer-theme](click here_) +- No weird scaling prosper + - slides are 96~mm~$\times$~128~mm + - text is 10-12pt on slide + - slide itself magnified with Adobe Reader/xpdf/gv to fill screen +- pgf graphics framework easy to use +- include external JPEG/PNG/PDF figures +- output directly to pdf: no PostScript hurdles +- detailed User's Manual (with good presentation advice, too) + + +### Theorems and Proofs +\framesubtitle{The proof uses \textit{reductio ad absurdum}.} + +#### Theorem +There is no largest prime number. + +#### Proof +> - Suppose $p$ were the largest prime number. +> - Let $q$ be the product of the first $p$ numbers. +> - Then $q+1$ is not divisible by any of them. +> - But $q + 1$ is greater than $1$, thus divisible by some prime + number not in the first $p$ numbers. \qedhere + +### Blocks + +#### Normal block +A \alert{set} consists of elements. + + +#### \alert{Alert block} +$2=2$. + +#### \alertc{Example block} +The set $\{1,2,3,5\}$ has four elements. + + +# Appendix + +--- + +Backup Slides + + + +--- + +Details + +--- + +Text omitted in main talk. + + + +--- + +More details + +--- + +Even more details diff --git a/inst/rmarkdown/templates/iqss/template.yaml b/inst/rmarkdown/templates/iqss/template.yaml new file mode 100644 index 0000000..466d439 --- /dev/null +++ b/inst/rmarkdown/templates/iqss/template.yaml @@ -0,0 +1,3 @@ +name: Binb is not Beamer - IQSS (pdf) +description: A custom R Markdown Beamer presentation theme. +create_dir: true diff --git a/inst/rmarkdown/templates/metropolis/resources/template.tex b/inst/rmarkdown/templates/metropolis/resources/template.tex index d7ec420..a434ae4 100644 --- a/inst/rmarkdown/templates/metropolis/resources/template.tex +++ b/inst/rmarkdown/templates/metropolis/resources/template.tex @@ -106,7 +106,7 @@ $endif$ \newif\ifbibliography $if(natbib)$ - \usepackage{natbib} + \usepackage[round]{natbib} \bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$} $endif$ $if(biblatex)$ diff --git a/man/metropolis.Rd b/man/metropolis.Rd index 5e1a3e0..b94e6e2 100644 --- a/man/metropolis.Rd +++ b/man/metropolis.Rd @@ -2,14 +2,24 @@ % Please edit documentation in R/binb.R \name{metropolis} \alias{metropolis} +\alias{iqss} \title{Binb is not Beamer - Metropolis-themed PDF Presentation} \usage{ metropolis(toc = FALSE, slide_level = 2, incremental = FALSE, - fig_width = 10, fig_height = 7, fig_crop = TRUE, fig_caption = TRUE, - dev = "pdf", df_print = "default", fonttheme = "default", - highlight = "tango", keep_tex = FALSE, latex_engine = "xelatex", - citation_package = c("none", "natbib", "biblatex"), includes = NULL, - md_extensions = NULL, pandoc_args = NULL) + fig_width = 10, fig_height = 7, fig_crop = TRUE, + fig_caption = TRUE, dev = "pdf", df_print = "default", + fonttheme = "default", highlight = "tango", keep_tex = FALSE, + latex_engine = "xelatex", citation_package = c("none", "natbib", + "biblatex"), includes = NULL, md_extensions = NULL, + pandoc_args = NULL) + +iqss(toc = FALSE, slide_level = 3, incremental = FALSE, + fig_width = 10, fig_height = 7, fig_crop = TRUE, + fig_caption = TRUE, dev = "pdf", df_print = "default", + fonttheme = "default", highlight = "haddock", keep_tex = FALSE, + latex_engine = "xelatex", citation_package = c("none", "natbib", + "biblatex"), includes = NULL, md_extensions = NULL, + pandoc_args = NULL) } \arguments{ \item{toc}{A logical variable defaulting to \code{FALSE}.} @@ -39,7 +49,7 @@ metropolis(toc = FALSE, slide_level = 2, incremental = FALSE, \item{latex_engine}{A character variable defaulting to \dQuote{xelatex}.} \item{citation_package}{An optional character variable with possible value -\dQuote{none} (the default), \dQuote{natbib} or \dQuote{biblatex}.} +\dQuote{none}, \dQuote{natbib} (the default), or \dQuote{biblatex}.} \item{includes}{An optional character variable defaulting to \code{NULL}.} diff --git a/vignettes/metropolis/demo.bib b/vignettes/metropolis/demo.bib new file mode 100644 index 0000000..6cf6bad --- /dev/null +++ b/vignettes/metropolis/demo.bib @@ -0,0 +1,43 @@ +@article{Knuth92, + author = "D.E. Knuth", + title = "Two notes on notation", + journal = "Amer. Math. Monthly", + volume = "99", + year = "1992", + pages = "403--422", +} + +@book{ConcreteMath, + author = "R.L. Graham and D.E. Knuth and O. Patashnik", + title = "Concrete mathematics", + publisher = "Addison-Wesley", + address = "Reading, MA", + year = "1989" +} + +@unpublished{Simpson, + author = "H. Simpson", + title = "Proof of the {R}iemann {H}ypothesis", + note = "preprint (2003), available at + \texttt{http://www.math.drofnats.edu/riemann.ps}", + year = "2003" +} + +@incollection{Er01, + author = "P. Erd{\H o}s", + title = "A selection of problems and results in combinatorics", + booktitle = "Recent trends in combinatorics (Matrahaza, 1995)", + publisher = "Cambridge Univ. Press", + address = "Cambridge", + pages = "1--6", + year = "1995" +} +@article{greenwade93, + author = "George D. Greenwade", + title = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})", + year = "1993", + journal = "TUGBoat", + volume = "14", + number = "3", + pages = "342--351" +} diff --git a/vignettes/metropolis/header.tex b/vignettes/metropolis/header.tex new file mode 100644 index 0000000..77fbf0f --- /dev/null +++ b/vignettes/metropolis/header.tex @@ -0,0 +1,18 @@ +\usepackage{appendixnumberbeamer} + +\usepackage{booktabs} +\usepackage[scale=2]{ccicons} + +\usepackage{pgfplots} +\usepgfplotslibrary{dateplot} + +\usepackage{xspace} +\newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace} + +\metroset{titleformat frame=smallcaps} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: + diff --git a/vignettes/metropolisDemo.Rmd b/vignettes/metropolisDemo.Rmd new file mode 100644 index 0000000..2fd2d10 --- /dev/null +++ b/vignettes/metropolisDemo.Rmd @@ -0,0 +1,398 @@ +--- +author: Matthias Vogelgesang +title: Metropolis +subtitle: A modern beamer theme +institute: Center for modern beamer themes +date: \today +output: + binb::metropolis: + citation_package: natbib + includes: + in_header: metropolis/header.tex +bibliography: metropolis/demo.bib +biblio-style: abbrvnat +toc: true +vignette: > + %\VignetteIndexEntry{binb Metropolis Demo} + %\VignetteKeywords{binb,vignette} + %\VignettePackage{binb} + %\VignetteEngine{knitr::rmarkdown} +--- + +```{r,setup, include=FALSE} +knitr::opts_chunk$set(cache=TRUE) +``` + +# Introduction + +## Metropolis + +The \themename theme is a Beamer theme with minimal visual noise inspired +by the [hsrm](https://github.com/hsrmbeamertheme/hsrmbeamertheme) Beamer +Theme by Benjamin Weiss. + +Enable the theme (in \LaTeX) by loading + +```tex +\documentclass{beamer} +\usetheme{metropolis} +``` + +Note, that you have to have Mozilla's \emph{Fira Sans} font and XeTeX +installed to enjoy this wonderful typography. + +\scriptsize In R you can of course use this package directly, see its documentation. + +## Sections + +Sections group slides of the same topic + +``` +## Elements +``` + +for which \themename provides a nice progress indicator \ldots + + +# Title formats + +## Metropolis title formats + +\themename supports 4 different title formats: + +- Regular +- \textsc{Small caps} +- \textsc{all small caps} +- ALL CAPS + +They can either be set at once for every title type or individually. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# Elements + +## Typography + +``` +The theme provides sensible defaults to +\emph{emphasize} text, \alert{accent} parts +or show \textbf{bold} results. +``` + +\begin{center}becomes\end{center} + +The theme provides sensible defaults to \emph{emphasize} text, +\alert{accent} parts or show \textbf{bold} results. + + +## Font feature test + +- Regular +- \textit{Italic} (also _Italic_) +- \textsc{Small Caps} +- \textbf{Bold} (also **Bold**) +- \textbf{\textit{Bold Italic}} (also **_Italic_**) +- \textbf{\textsc{Bold Small Caps}} +- \texttt{Monospace} +- \texttt{\textit{Monospace Italic}} +- \texttt{\textbf{Monospace Bold}} +- \texttt{\textbf{\textit{Monospace Bold Italic}}} + + +## Lists +\begin{columns}[T,onlytextwidth] + \column{0.33\textwidth} + Items + \begin{itemize} + \item Milk \item Eggs \item Potatoes + \end{itemize} + + \column{0.33\textwidth} + Enumerations + \begin{enumerate} + \item First, \item Second and \item Last. + \end{enumerate} + + \column{0.33\textwidth} + Descriptions + \begin{description} + \item[PowerPoint] Meeh. \item[Beamer] Yeeeha. + \end{description} +\end{columns} + + +## Animation (using \LaTeX\ ) + +\begin{itemize}[<+- | alert@+>] + \item \alert<4>{This is\only<4>{ really} important} + \item Now this + \item And now this +\end{itemize} + +\bigskip +\scriptsize This uses \LaTeX\ for aninmation. The next slides uses RMarkdown + +## Animation (using RMarkdown, plus one \LaTeX\ trick) + +::: incremental + +- \alert<4>{This is\only<4>{ really} important} +- Now this +- And now this + +::: + + + +## Figures (using \LaTeX) + +\begin{figure} + \newcounter{density} + \setcounter{density}{20} + \begin{tikzpicture} + \def\couleur{alerted text.fg} + \path[coordinate] (0,0) coordinate(A) + ++( 90:5cm) coordinate(B) + ++(0:5cm) coordinate(C) + ++(-90:5cm) coordinate(D); + \draw[fill=\couleur!\thedensity] (A) -- (B) -- (C) --(D) -- cycle; + \foreach \x in {1,...,40}{% + \pgfmathsetcounter{density}{\thedensity+20} + \setcounter{density}{\thedensity} + \path[coordinate] coordinate(X) at (A){}; + \path[coordinate] (A) -- (B) coordinate[pos=.10](A) + -- (C) coordinate[pos=.10](B) + -- (D) coordinate[pos=.10](C) + -- (X) coordinate[pos=.10](D); + \draw[fill=\couleur!\thedensity] (A)--(B)--(C)-- (D) -- cycle; + } + \end{tikzpicture} + \caption{Rotated square from + \href{http://www.texample.net/tikz/examples/rotated-polygons/}{texample.net}.} +\end{figure} + +\scriptsize This used a \LaTeX\ feature. All RMarkdown features are also at our disposal. + + +## Tables (using \LaTeX}) + +\begin{table} + \caption{Largest cities in the world (source: Wikipedia)} + \begin{tabular}{@{} lr @{}} + \toprule + City & Population\\ + \midrule + Mexico City & 20,116,842\\ + Shanghai & 19,210,000\\ + Peking & 15,796,450\\ + Istanbul & 14,160,467\\ + \bottomrule + \end{tabular} +\end{table} + +\scriptsize This used a \LaTeX\ feature. All RMarkdown features are also at our disposal. + + +## Blocks + +Three different block environments are pre-defined and may be styled with an +optional background color. + +\begin{columns}[T,onlytextwidth] + \column{0.5\textwidth} + \begin{block}{Default} + Block content. + \end{block} + + \begin{alertblock}{Alert} + Block content. + \end{alertblock} + + \begin{exampleblock}{Example} + Block content. + \end{exampleblock} + + \column{0.5\textwidth} + + \metroset{block=fill} + + \begin{block}{Default} + Block content. + \end{block} + + \begin{alertblock}{Alert} + Block content. + \end{alertblock} + + \begin{exampleblock}{Example} + Block content. + \end{exampleblock} + +\end{columns} + +\bigskip + +\scriptsize The right side uses the `\metroset{block=fill}` option. Blocks +can also used in Markdown using `###` (if slide-level=2). + + +## Math + +\begin{equation*} + e = \lim_{n\to \infty} \left(1 + \frac{1}{n}\right)^n +\end{equation*} + +## Line plots + +\begin{figure} + \begin{tikzpicture} + \begin{axis}[ + mlineplot, + width=0.9\textwidth, + height=6cm, + ] + + \addplot {sin(deg(x))}; + \addplot+[samples=100] {sin(deg(2*x))}; + + \end{axis} + \end{tikzpicture} +\end{figure} + + +## Bar charts + +\begin{figure} + \begin{tikzpicture} + \begin{axis}[ + mbarplot, + xlabel={Foo}, + ylabel={Bar}, + width=0.9\textwidth, + height=6cm, + ] + + \addplot plot coordinates {(1, 20) (2, 25) (3, 22.4) (4, 12.4)}; + \addplot plot coordinates {(1, 18) (2, 24) (3, 23.5) (4, 13.2)}; + \addplot plot coordinates {(1, 10) (2, 19) (3, 25) (4, 15.2)}; + + \legend{lorem, ipsum, dolor} + + \end{axis} + \end{tikzpicture} +\end{figure} + + +## Quotes + +> Veni, Vidi, Vici + +## References + +Some references \citep{knuth92,ConcreteMath,Simpson,Er01,greenwade93} + +\bigskip + +\scriptsize `allowframebreaks` is not used or needed, also changed `\cite` to +`\citep`, and defaulted `natbib` to option `[round]`. + +# Conclusion + +## Summary + +Get the source of this theme and the demo presentation from + +\begin{center}\url{https://github.com/matze/mtheme}\end{center} + +The theme \emph{itself} is licensed under a [Creative Commons +Attribution-ShareAlike 4.0 International +License](http://creativecommons.org/licenses/by-sa/4.0/) + +\begin{center}\ccbysa\end{center} + +\scriptsize Source and documentation for the RMarkdown variant are at \url{https://github.com/eddelbuettel/binb}. + +_ _ _ + +Questions? + + + + +## Backup slides + +Sometimes, it is useful to add slides at the end of your presentation to +refer to during audience questions. + +The best way to do this is to include the `appendixnumberbeamer` +package in your preamble and call `\appendix` before your backup slides. + +\themename will automatically turn off slide numbering and progress bars for +slides in the appendix. + +\scriptsize Calling `\appendix` currently leads to an error in when using `binb`. + +## R Appendix: R Figure Example + +The following code generates the plot on the next slide (taken from +`help(bxp)` and modified slightly): + +```{r pressureCode, eval=FALSE} +library(stats) +set.seed(753) +bx.p <- boxplot(split(rt(100, 4), + gl(5, 20)), plot=FALSE) +bxp(bx.p, notch = FALSE, boxfill = "lightblue", + frame = FALSE, outl = TRUE, + main = "Example from help(bxp)") +``` + +## R Appendix: R Figure Example + +```{r pressureFig, echo=FALSE} +library(stats) +set.seed(753) +bx.p <- boxplot(split(rt(100, 4), + gl(5, 20)), plot=FALSE) +bxp(bx.p, notch = FALSE, boxfill = "lightblue", + frame = FALSE, outl = TRUE, + main = "Example from help(bxp)") +``` + +## R Appendix: R Table Example + +A simple `knitr::kable` example: + +```{r kableEx} +knitr::kable(mtcars[1:5, 1:8], + caption="(Parts of) the mtcars dataset") +``` diff --git a/vignettes/metropolisDemo.pdf b/vignettes/metropolisDemo.pdf new file mode 100644 index 0000000..1a26ccb Binary files /dev/null and b/vignettes/metropolisDemo.pdf differ