GithubHelp home page GithubHelp logo

binb's Introduction

binb: Binb is not Beamer

CI Package-License CRAN Dependencies Downloads Last Commit

Motivation

The Beamer package is very popular for making pdf presentations from LaTeX, and also supported from Markdown and RMarkdown. This package (currently) provides functionality to use the following custom (LaTeX) themes for Beamer directly via RMarkdown:

The original LaTeX styles been converted to be directly useable from RMarkdown

Examples

Metropolis

Consider the following minimal example, adapted from the original minimal example at the bottom of the Metropolis page:

---
title: A minimal example
author: Matthias Vogelgesang
date: \today
institute: Centre for Modern Beamer Themes
output: binb::metropolis
---

# First Section

## First Frame

Hello, world!

It creates a three-page pdf file which we converted into this animated gif

IQSS

Similarly, for IQSS we use the following input adapting the example above but showing sections and subsections for the nice headings it generates:

---
title: A minimal example
author: Ista Zahn
date: \today
institute: IQSS
output: binb::iqss
---

# First Section

## First Sub-Section

### First Frame

Hello, world!

# Second Section

## Second Subsection

### Second Frame

Another planet!

This creates this pdf file which we converted into this animated gif:

Presento

The following small example adapted some of the slides from original minimal example from the Presento repo:

---
author: Ratul Saha
address: www.ratulsaha.com
title: PRESENTO
subtitle: clean, simple and extensible
date: \today
output: binb::presento
---

## Presento

- \begin{center}\largetext{The design is \underline{clean}}\end{center}    \bigskip
- \begin{center}\largetext{The rules are \underline{simple}}\end{center}   \bigskip
- \item \begin{center}\largetext{The code is \underline{extensible}}\end{center}


## Open Source Fonts

-  \montserratfont This is \textsc{Montserrat}	\bigskip
-  \notosansfont This is \textsc{Noto Sans}		\bigskip
-  \latolightfont This is Lato (light)          \bigskip
-  \inconsolatafont This is inconsolata         \bigskip
-  \textsc{This is Alegreya Sans small caps}    \bigskip


## Color Palette

\begin{center}
  \crule[colordgray] \crule[colorhgray] \crule[colorblue] \crule[colorgreen] \crule[colororange]
\end{center}

____

\begin{center}
 \hugetext{BIG BOLD TEXT}
 \medskip
 \small but background color does not work
\end{center}

____

\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}

From this, one can creats this pdf file which can be converted into this animated gif:

Monash

Below is an example of the Monash Business School theme by Rob Hyndman. There also two longer Monash demos included in the package: longer demo and options demo.

(The source is a little longer and included in the repo and package so not shown here.)

Status

The package is fairly new and susceptible to change, but on CRAN.

Usage

The package is on CRAN and can be installed via a standard

install.packages("binb")

and can then be used as a Markdown template via RStudio, or via code such as

library(rmarkdown)
draft("myslides.Rmd", template="metropolis", package="binb", edit=FALSE)
setwd("myslides")  ## template creates a new subdir
render("myslides.Rmd")

to create a first draft of a new myslides.Rmd.

Once installed, the above code examples should work as expected.

Requirements

Beyond the R package dependencies, a working pandoc binary is needed. RStudio installs its own copy, otherwise do what is needed on your OS (i.e., something like sudo apt-get install pandoc pandoc-citeproc).

The Metropolis LaTeX package is used, but we assume that is is installed via TeXLive, MikTeX or another LaTeX bundle. The LaTeX code for the IQSS Beamer Theme and the Presento Theme are included (and adapted for RMarkdown use).

These themes use additional (free) fonts you may need to install:

If you use Debian or Ubuntu, you can use the informal font packages I created for Fira and Fira Sans, Libertinus, Montserrat, Alegreya Sans, respectively.

Most modern desktop systems make it easy to install additional fonts as a user. However, instructions vary so please see for your particular system.

See Also

  • linl: Linl is not Letter: LaTeX letters from RMarkdown
  • pinp: Pinp is not PNAS: Snazzy one-or two column short papers or vignettes
  • tint: tint is not tufte: Beautiful pdf or html handout or writeups

and the minm package installing all of them.

Authors

Dirk Eddelbuettel, Ista Zahn and Rob Hyndman

License

GPL (>= 2) for this package.

binb's People

Contributors

eddelbuettel avatar izahn avatar jolars avatar jsta avatar mvkorpel avatar robjhyndman avatar selbosh avatar svraka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

binb's Issues

Example binb fails on Windows

Using example code provided in package

library(rmarkdown)
draft("myslides.Rmd", template="metropolis", package="binb", edit=FALSE)
setwd("myslides")       ## template creates a new subdir
render("myslides.Rmd")

produces this message to console

output file: myslides.knit.md

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS myslides.utf8.md --to beamer --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output myslides.tex --template "C:\Users\eric\Documents\R\win-library\3.5\binb\rmarkdown\templates\metropolis\resources\template.tex" --slide-level 2 --variable theme=metropolis --highlight-style tango --pdf-engine xelatex --self-contained 

Output created: myslides.pdf
Error in tools::file_path_as_absolute(output_file) : 
  file 'myslides.pdf' does not exist

Same result when performing demo of tint

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rmarkdown_1.10

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18     codetools_0.2-15 digest_0.6.17    rprojroot_1.3-2  backports_1.1.2 
 [6] magrittr_1.5     evaluate_0.11    highr_0.7        stringi_1.1.7    tint_0.1.0      
[11] binb_0.0.1       tools_3.5.1      stringr_1.3.1    tinytex_0.8      xfun_0.3        
[16] yaml_2.2.0       compiler_3.5.1   htmltools_0.3.6  knitr_1.20    

Sorry if I'm missing something obvious

Possible Monash theme improvements

In no particular order:

  • add a vignette / demo i.e. something longer than the skeleton
  • document the options
  • make monashwhite the default?
  • make the defaults more sensible, i.e. currently several of the options in the yaml header in skeleton.Rmd (e.g. fontsize, titlefontsize, compress) are more or less mandatory
  • add skeleton.Rmd based demo to README.md, expand README.md
  • possible make titlepage.png the value of variable set in YAML to override default
  • more flexible font setup, maybe bera as fallback for carlito ?

Add more items as needed.

Possible Presento theme improvements

In no particular order, and in comparison to the upstream repo:

  • Full color pages :-( (as also noted in #1); this may need some pandoc and or beamer changes
  • Examples are pretty heavy on LaTeX; Markdown has e.g. no centering feature
  • Maybe offer default fonts? OTOH Presento is pretty tied to its set

metropolis(citation_package) argument appears to have no default

Receiving an error on previously working code when calling binb::metropolis in RMarkdown or directly in R:

metropolis()
Error in match.arg(citation_package) : 'arg' must be of length 1

I'm unable to figure out how to pass an argument for citation_package="none" in the RMarkdown YAML header. Suspect it may be the default value for citation_package

The MWE in the readme for binb::metropolis does not work for me (R 4.02; binb_0.0.6)

Presento ignores date set in YAML

I am not entirely sure where the bug is, but it seems like no matter what we set as the date in the YAML header, Presento always prints the date as if it were \today. Even if we set it to NULL or an empty string "".

I had a quick look at the pandoc template but didn't spot anything obvious.

presento theme failing with knitr::kable

Hi.

I noticed a problem with presento theme when printing a data.frame with knitr::kable.

I have just added this code to the presento theme template:

# Print data frame

```{r}
data(mtcars, "ggplot2")
knitr::kable(mtcars)
```

Error message:

! File ended while scanning use of \@tempa.
<inserted text> 
                \par 
l.75 ...e{footnote}\makesavenoteenv{long table}}{}

Possible Metropolis theme improvements

In no particular order, and in comparison to the demo.tex-based demo.pdf of the LaTeX variant:

  • No standout pages :-( which is a bummer and possibly hard to adjust due to how we get from new Markdown slide entry to \begin{frame} ... \end{frame}
  • Table of contents page has no header
  • References page has no header (but we changed things anyway with natbib use)
  • Metropolis has a bazillion (nice) options which we should support from YAML metadata where useful and sensible

Possible IQSS theme improvements

In no particular order, and in comparison to the demo.tex-based demo.pdf of the LaTeX variant:

  • Libertinus font requirement currently a hard constraint, might be nicer to make it soft ie warn but proceed rather than fail
  • Title changed to not be on dark background, could make that a toggle in YAML header
  • Table of content line and paragraph breaks look different
  • Need to find a trick to do the \item[] placement in one of the examples
  • Make the header.png file an option for the YAML header

Get rid of one nagging NOTE

Possibly brandnew and/or temporary, but all of a sudden one of the CRAN check machines now whines about missing cross refrences:

Version: 0.0.5
Check: Rd cross-references
Result: NOTE
Undeclared packages ‘tint’, ‘pinp’, ‘linl’ in Rd xrefs
Flavor: r-devel-linux-x86_64-fedora-clang

As a result the 0.0.6 currently being processed enters a 'is pending a manual inspection'. We should free ourselves and CRAN from this. It is simply due a block in the Rd file from

##'
##' @seealso Three other packages also offer RMarkdown interfaces to LaTeX
##' (or HTML) content: \code{\link[tint]{tint}} for Tufte-style pdf and html,
##' \code{\link[pinp]{pinp}} for two-column pdf vignettes, and
##' \code{\link[linl]{linl}} for LaTeX letters.
##'

and I suggest we just nix it and remove it. Screw See also. Or maybe change \code{\link[xxx]{xxx}} to just \code{xxx} for the three packages?

Thoughts? Preferences?

presento output rendering error: Cannot find NotoSans-Regular.mf

I find your package very useful. Thank you very much.

However, it seems like there is an issue with presento output.

Please address it. I am sharing reproducible code below:

library(rmarkdown)
test <- draft("myslides.Rmd", template="presento", package="binb", edit=FALSE)

render(test)
#> processing file: myslides.Rmd
#> output file: myslides.knit.md
#> "C:/PROGRA~3/CHOCOL~1/bin/pandoc" +RTS -K512m -RTS myslides.utf8.md --to beamer --from markdown+autolink_bare_uris+tex_math_single_backslash --output myslides.tex --template "C:\PROGRA~1\R\R-36~1.1\library\binb\RMARKD~1\TEMPLA~1\presento\RESOUR~1\template.tex" --slide-level 2 --variable theme=iqss --highlight-style haddock --pdf-engine xelatex --self-contained
#> tlmgr search --file --global "/NotoSans-Regular[.](tfm|afm|mf|otf)"
#> Warning in parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)): Failed to
#> find a package that contains NotoSans-Regular[.](tfm|afm|mf|otf)
#> tlmgr search --file --global "/tikzlibrarytopaths.code.tex"
#> Trying to automatically install missing LaTeX packages...
#> tlmgr install pgf
#> tlmgr search --file --global "/NotoSans-Regular[.](tfm|afm|mf|otf)"
#> Warning in parse_packages(logfile, quiet = c(TRUE, FALSE, FALSE)): Failed to
#> find a package that contains NotoSans-Regular[.](tfm|afm|mf|otf)
#> tlmgr search --file --global "/tikzlibrarytopaths.code.tex"
#> ! Package fontspec Error: The font "NotoSans-Regular" cannot be found.
#> 
#> ! name = NotoSans-Regular, rootname = NotoSans-Regular, pointsize = 
#> ! mktexmf: empty or non-existent rootfile!
#> 
#> ! mktexmf: empty or non-existent rootfile!
#> 
#> ! kpathsea: Running mktexmf NotoSans-Regular.mf
#> 
#> ! The command name is C:\Users\JooYoung\AppData\Roaming\TinyTeX\bin\win32\mktexmf
#> ! Cannot find NotoSans-Regular.mf.
#> 
#> ! Cannot find NotoSans-Regular.mf.
#> 
#> ! kpathsea: Running mktextfm NotoSans-Regular
#> 
#> ! The command name is C:\Users\JooYoung\AppData\Roaming\TinyTeX\bin\win32\mktextfm
#> 
#> ! kpathsea: Appending font creation commands to missfont.log.
#> Error: Failed to compile myslides.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See myslides.log for more info.

Created on 2019-12-18 by the reprex package (v0.3.0.9001)

Session info
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.6.1 (2019-07-05)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  English_United States.1252  
#>  ctype    English_United States.1252  
#>  tz       America/New_York            
#>  date     2019-12-18                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version    date       lib source                            
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.1)                    
#>  backports     1.1.5      2019-10-02 [1] CRAN (R 3.6.1)                    
#>  binb          0.0.5      2019-12-18 [1] Github (eddelbuettel/binb@74ff84e)
#>  cli           2.0.0      2019-12-09 [1] CRAN (R 3.6.1)                    
#>  crayon        1.3.4      2017-09-16 [1] CRAN (R 3.6.1)                    
#>  digest        0.6.23     2019-11-23 [1] CRAN (R 3.6.1)                    
#>  evaluate      0.14       2019-05-28 [1] CRAN (R 3.6.1)                    
#>  fansi         0.4.0      2018-10-05 [1] CRAN (R 3.6.1)                    
#>  fs            1.3.1      2019-05-06 [1] CRAN (R 3.6.1)                    
#>  glue          1.3.1.9000 2019-11-14 [1] Github (tidyverse/glue@c02d7d4)   
#>  highr         0.8        2019-03-20 [1] CRAN (R 3.6.1)                    
#>  htmltools     0.4.0      2019-10-04 [1] CRAN (R 3.6.1)                    
#>  knitr         1.26.1     2019-12-05 [1] Github (yihui/knitr@33d69c3)      
#>  magrittr      1.5        2014-11-22 [1] CRAN (R 3.6.1)                    
#>  pillar        1.4.2      2019-06-29 [1] CRAN (R 3.6.1)                    
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 3.6.1)                    
#>  purrr         0.3.3      2019-10-18 [1] CRAN (R 3.6.1)                    
#>  Rcpp          1.0.3      2019-11-08 [1] CRAN (R 3.6.1)                    
#>  reprex        0.3.0.9001 2019-11-13 [1] Github (tidyverse/reprex@27aa69a) 
#>  rlang         0.4.2.9000 2019-12-12 [1] Github (r-lib/rlang@ec7c1ed)      
#>  rmarkdown   * 2.0.3      2019-12-17 [1] Github (rstudio/rmarkdown@26cc3b1)
#>  sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.1)                    
#>  stringi       1.4.3      2019-03-12 [1] CRAN (R 3.6.0)                    
#>  stringr       1.4.0.9000 2019-11-11 [1] Github (hadley/stringr@80aaaac)   
#>  styler        1.2.0.9000 2019-11-13 [1] Github (r-lib/styler@a8acde5)     
#>  tibble        2.1.3      2019-06-06 [1] CRAN (R 3.6.1)                    
#>  tinytex       0.18.1     2019-12-18 [1] Github (yihui/tinytex@f9130fb)    
#>  withr         2.1.2      2018-03-15 [1] CRAN (R 3.6.1)                    
#>  xfun          0.11.3     2019-11-22 [1] Github (yihui/xfun@4fcd6ff)       
#>  yaml          2.2.0      2018-07-25 [1] CRAN (R 3.6.0)                    
#> 
#> [1] C:/Program Files/R/R-3.6.1/library

use bookdown rmarkdown rather than just rmarkdown

Hi!
I'm right now creating my slides with

output: 
  bookdown::beamer_presentation2:
    keep_tex: yes
    theme: metropolis
    latex_engine: xelatex
    slide_level: 2
    incremental: no
    includes: 
      in_header: top-matter.tex
classoption: aspectratio=169
fontsize: 12pt

in my YAML, it would be nice to automatize this, but I binb doesn't use bookdown, right?
There are many advantages in the bookdown flavor of rmarkdown including numbering and cross-referencing figures/tables/sections/equations

I'm also including some hacks in the tex files that could be included in binb, see https://bookdown.org/yihui/rmarkdown-cookbook/multi-column.html

What do you think? Should I do pull request with all these changes?

New theme Monash (or MonashEBS) ?

@robjhyndman has some snazzy Beamer theming here: https://github.com/robjhyndman/MonashEBSTemplates

Recent example: https://github.com/robjhyndman/Writing-seminar/blob/master/Writing.pdf

When I glanced at the source it revealed itself as another Metropolis variant so it would fit here. Style file looks small and clean. Have not checked if it needs additional fonts, but that would be a bridge we have crossed before :)

@izahn Thoughts?

@robjhyndman Any thoughts or concerns from your end? Here in binb we mostly care about the Beamer side of things.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.