two-column layouts in RStudio presentations/slidify/pandoc

前端 未结 7 2032
有刺的猬
有刺的猬 2020-11-30 19:00

I\'m trying to come up with a good system for generating slides and accompanying handouts. The ideal system would have the following properties:

  • beautiful in b
7条回答
  •  孤城傲影
    2020-11-30 19:26

    You can use fenced_divs notation or ::: to create columns or `Two Content layout'. See also this page to know more about the notation.

    ## Slide With Image Left
    
    ::: columns
    
    :::: column
    left
    ::::
    
    :::: column
    right
    
    ```{r your-chunk-name, echo=FALSE, fig.cap="your-caption-name"}
    knitr::include_graphics("your/figure/path/to/the-image.pdf")
    
    #The figure will appear on the right side of the slide...
    ```
    ::::
    
    :::
    

    Since pandoc 2+, which supports the notation, was implemented in RStudio v1.2+, you may need to install RStudio v1.2+ first. The installation is easy enough (at least in my case); just download and install RStudio v1.2+. In the way of installation, the former version of RStudio on your computer will be replaced with the new one without uninstalling it manually.

    The ::: notation can be used even when you knit .Rmd files with beamer_presentation option, as well as when you create HTML slides. So we don't have to neither mix markdown and LaTeX notation in one file, nor add additional codes any longer: just knit the file as you knit other .Rmd with other options.

提交回复
热议问题