1
0
mirror of https://github.com/eddelbuettel/binb synced 2024-12-22 12:39:58 +01:00

presento theme

from github.com/RatulSaha/presento
see github.com/RatulSaha/presento/blob/master/presento.pdf

some font-size still off
This commit is contained in:
Dirk Eddelbuettel 2018-09-22 10:28:26 -05:00
parent 5b138a1c47
commit cf48a9b719
9 changed files with 567 additions and 4 deletions

View File

@ -1,8 +1,8 @@
Package: binb
Type: Package
Title: 'binb' is not 'Beamer'
Version: 0.0.1
Date: 2018-09-19
Version: 0.0.1.1
Date: 2018-09-22
Author: Dirk Eddelbuettel and Ista Zahn
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Description: A collection of 'LaTeX' styles using 'Beamer' customization for

View File

@ -1,3 +1,3 @@
export("metropolis", "iqss")
export("metropolis", "iqss", "presento")
import("knitr")
import("rmarkdown")

View File

@ -118,7 +118,8 @@ iqss <- function(toc = FALSE,
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"),
file.copy(system.file("rmarkdown", "templates", "iqss", "skeleton",
f, package="binb"),
".", recursive=TRUE)
template <- system.file("rmarkdown", "templates", "iqss",
@ -148,6 +149,58 @@ iqss <- function(toc = FALSE,
}
##' @rdname metropolis
presento <- function(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 = "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("presento.sty", "images/"))
if (!file.exists(f))
file.copy(system.file("rmarkdown", "templates",
"presento", "skeleton", f, package="binb"),
".", recursive=TRUE)
template <- system.file("rmarkdown", "templates", "presento",
"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(...)

View File

@ -0,0 +1,335 @@
\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
\PassOptionsToPackage{hyphens}{url}
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$endif$$if(papersize)$$papersize$paper,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
$if(beamerarticle)$
\usepackage{beamerarticle} % needs to be loaded first
$endif$
$if(fontfamily)$
\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
$else$
\usepackage{lmodern}
$endif$
$if(linestretch)$
\usepackage{setspace}
\setstretch{$linestretch$}
$endif$
\usepackage{amssymb,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
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
%\PassOptionsToPackage{hyphens}{url} % url is loaded by hyperref
$if(verbatim-in-note)$
\usepackage{fancyvrb}
$endif$
\usepackage[unicode=true]{hyperref}
$if(colorlinks)$
\PassOptionsToPackage{usenames,dvipsnames}{color} % color is loaded by hyperref
$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} % don't use monospace font for urls
$if(verbatim-in-note)$
\VerbatimFootnotes % allows verbatim text in footnotes
$endif$
$if(geometry)$
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
$endif$
$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$
$if(natbib)$
\usepackage{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(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}
% Fix footnotes in tables (requires footnote package)
\IfFileExists{footnote.sty}{\usepackage{footnote}\makesavenoteenv{long table}}{}
$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>\textheight\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$
$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$
$if(indent)$
$else$
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
$endif$
\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(subparagraph)$
$else$
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
$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$
% set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
$for(header-includes)$
$header-includes$
$endfor$
\usepackage{presento}
$if(title)$
\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
$endif$
$if(subtitle)$
\providecommand{\subtitle}[1]{}
\subtitle{$subtitle$}
$endif$
$if(author)$
\author{$for(author)$$author$$sep$ \and $endfor$}
$endif$
$if(institute)$
\providecommand{\institute}[1]{}
\institute{$for(institute)$$institute$$sep$ \and $endfor$}
$endif$
\date{$date$}
%% presento start
% presento-config
% Sets the background color to be light gray and the default text color to be heavy dark gray.
% Recommended for presenting with high quality projectors, since the high contrast of black-white is not advisable
\setbeamercolor{background canvas}{bg=colorlgray}
\setbeamercolor{normal text}{fg=colorhgray}
% personal data
%\newcommand{\myTitle}{\color{colorblue}\hugetext{PRESENTO\\}{\montserratfont\largetext{clean, simple and extensible}}}
%\newcommand{\myName}{\largetext{\color{orange}{Ratul Saha}}\\\setnote{www.ratulsaha.com}}
%\newcommand{\myDetails}{\setnote{\today}}
% personal data
$if(title)$
\newcommand{\myTitle}{\color{colorblue}\hugetext{$title$}
$if(subtitle)$ {\montserratfont\largetext{$subtitle$}} $endif$
}
$endif$
$if(author)$
\newcommand{\myName}{\largetext{\color{orange}{$for(author)$$author$$sep$ \and $endfor$}
$if(address)$ \\\setnote{$address$} $endif$
}}
$endif$
\newcommand{\myDetails}{\setnote{\today}}
%sty file
%\usepackage{config/presento}
%\usepackage{presento}
% custom command and packages
%\input{config/custom-command}
% custom packages
\usepackage{textpos}
\setlength{\TPHorizModule}{1cm}
\setlength{\TPVertModule}{1cm}
\newcommand\crule[1][black]{\textcolor{#1}{\rule{2cm}{2cm}}}
%% presento end
\begin{document}
%% DEdd Commented-out for presento
%$if(title)$
%\maketitle
%$endif$
% DEdd added for presento
\begin{frame}[plain]
\vfill
\myTitle
\vfill
\myName
\vfill
\myDetails
\vfill
\end{frame}
$if(abstract)$
\begin{abstract}
$abstract$
\end{abstract}
$endif$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
{
$if(colorlinks)$
\hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$black$endif$}
$endif$
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
}
$endif$
$if(lot)$
\listoftables
$endif$
$if(lof)$
\listoffigures
$endif$
$body$
$if(natbib)$
$if(bibliography)$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$biblio-title$}
$endif$
$endif$
\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
$endif$
$endif$
$if(biblatex)$
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
$endif$
$for(include-after)$
$include-after$
$endfor$
\end{document}

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 KiB

View File

@ -0,0 +1,118 @@
\ProvidesPackage{config/presento}
\mode<presentation>
% removing navigation symbols
\setbeamertemplate{navigation symbols}{}
% packages
\usepackage{xcolor}
\usepackage{fontspec}
\usepackage{setspace}
\usepackage{tikz}
\usepackage{enumitem}
% colors
\definecolor{colororange}{HTML}{E65100} % orange
\definecolor{colordgray}{HTML}{795548} % dark gray for note
\definecolor{colorhgray}{HTML}{212121} % heavy dark gray for normal text
\definecolor{colorgreen}{HTML}{009688} % green
\definecolor{colorlgray}{HTML}{FAFAFA} % background light gray
\definecolor{colorblue}{HTML}{0277BB} % blue
% font sizes
\newcommand{\fontsizeone}{2.292em}
\newcommand{\fontsizetwo}{1.217em}
\newcommand{\fontsizethree}{0.875em}
% line spaces
\newcommand{\linespaceone}{2}
% font families
% DEdd: removed path, set Lato to 'Lato-Light', set Montserrat to Bold
\newfontfamily{\montserratfont}[BoldFont=Montserrat-Bold]{Montserrat-Bold}
\newfontfamily{\notosansfont}[BoldFont=NotoSans-Bold,ItalicFont=NotoSans-Italic,BoldItalicFont=NotoSans-BoldItalic,SmallCapsFont=AlegreyaSansSC-Regular]{NotoSans-Regular}
\newfontfamily{\latolightfont}{Lato-Light}
\newfontfamily{\inconsolatafont}{Inconsolata}
% beamer template changes
\setbeamertemplate{frametitle}{
\vspace{0.40em}
\noindent
\hspace{-1.22em}
\tikz[overlay,remember picture,baseline=0.3em]{\fill[fill=colorblue] (-0.3,0.05) rectangle (0,0.9); }\latolightfont\color{colorblue}~~\insertframetitle%
}
\setmainfont[Ligatures=TeX,BoldFont=NotoSans-Bold,ItalicFont=NotoSans-Italic,BoldItalicFont=NotoSans-BoldItalic,SmallCapsFont=AlegreyaSansSC-Regular]{NotoSans-Regular}
\setsansfont[Ligatures=TeX,BoldFont=NotoSans-Bold,ItalicFont=NotoSans-Italic,BoldItalicFont=NotoSans-BoldItalic,SmallCapsFont=AlegreyaSansSC-Regular]{NotoSans-Regular}
\setmonofont[Ligatures=TeX,SmallCapsFont=AlegreyaSansSC-Regular]{Inconsolata}
% frame counter
\newcounter{totalfr}
\setbeamertemplate{footline}{
\ifnum\inserttotalframenumber=1
\setcounter{totalfr}{2}
\else
\setcounter{totalfr}{\inserttotalframenumber}
\fi
\hfill{
\tikz{
\filldraw[fill=colorblue!40, draw=colorblue!50] (0,0) -- (0.2,0) arc (0:{\value{framenumber}*(360/(\value{totalfr}-1))}:0.2) -- (0,0);
\node at (0,0) {\normalsize \color{colororange}\tiny{\insertframenumber}};
}
}
\hspace{2em}
\vspace*{1em}
}
% custom commands
\newcommand{\hugetext}[1]{
{
\begin{spacing}{\linespaceone}
\fontsize{\fontsizeone}{\fontsizeone}{\montserratfont #1}
\end{spacing}
}
}
\newcommand{\largetext}[1]{
{\fontsize{\fontsizetwo}{\fontsizeone}\selectfont{#1}}
}
\newcommand{\setnote}[1]{
{\fontsize{\fontsizethree}{\fontsizeone}\selectfont\color{colordgray}{#1}}
}
\newcommand{\rtarrow}{$\color{colorblue}{\rightarrow}$}
\newcommand{\itemR}{
\item[\rtarrow]
}
\newcommand{\framecard}[2][colorgreen]{
{\setbeamercolor{background canvas}{bg=#1}
\begin{frame}[plain]
\vfill
\begin{center}
{#2}
\end{center}
\vfill
\end{frame}
}
}
\newcommand{\framepic}[3][1]{
{
\usebackgroundtemplate{%
\tikz[overlay,remember picture] \node[opacity=#1, at=(current page.center)] {
\includegraphics[width=\paperwidth]{#2}};
}
\begin{frame}
#3
\end{frame}
}
}
\newenvironment{baseitemize}
{\itemize[leftmargin=*]}
{\enditemize}
\newenvironment{fullpageitemize}
{\itemize[nolistsep,itemsep=\fill,leftmargin=*]}
{\vfill\enditemize}

View File

@ -0,0 +1,45 @@
---
author: Ratul Saha
address: www.ratulsaha.com
title: Presento
subtitle: clean, simple and extensible
date: \today
fontsize: 17pt
output: binb::presento
---
## Presento
- \begin{center}\largetext{The design is \underline{clean}}\end{center}
- \item \begin{center}\largetext{The rules are \underline{simple}}\end{center}
- \item \begin{center}\largetext{The code is \underline{extensible}}\end{center}
## Open Source Fonts
- \montserratfont This is Montserrat
- \notosansfont This is Noto Sans
- \latolightfont This is Lato (light)
- \inconsolatafont This is inconsolata
- \textsc{This is Alegreya Sans small caps}
## Color Palette
\begin{center}
\crule[colordgray] \crule[colorhgray] \crule[colorblue] \crule[colorgreen] \crule[colororange]
\end{center}
____
\setbeamercolor{background canvas}{bg=\colorgreen}
\centering{\hugetext{BIG BOLD TEXT} \bigskip \tiny but background color does not work}
----
<!-- maybe this could be wrapped into one latex command -->
\tikz[overlay,remember picture] \node[opacity=0.8, at=(current page.center)]{%
\includegraphics[width=\paperwidth]{images/skeleton}};
\begin{textblock}{7}(7,2.5)
{\color{colorblue}\hugetext{\textbf{RUN!}}}
\end{textblock}

View File

@ -0,0 +1,3 @@
name: Binb is not Beamer - Presento (pdf)
description: A custom R Markdown Beamer presentation theme.
create_dir: true

View File

@ -3,6 +3,7 @@
\name{metropolis}
\alias{metropolis}
\alias{iqss}
\alias{presento}
\title{Binb is not Beamer - PDF Presentation Themes}
\usage{
metropolis(toc = FALSE, slide_level = 2, incremental = FALSE,
@ -20,6 +21,14 @@ iqss(toc = FALSE, slide_level = 3, incremental = FALSE,
latex_engine = "xelatex", citation_package = c("none", "natbib",
"biblatex"), includes = NULL, md_extensions = NULL,
pandoc_args = NULL)
presento(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 = "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}.}