two-column layouts in RStudio presentations/slidify/pandoc

前端 未结 7 2004
有刺的猬
有刺的猬 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:34

    There is a workaround for beamer error.

    In short: Error is related to pandoc conversion engine, which treats everything between \begin{...} and \end{...} as TeX. It can be avoided by giving new definition for begin{column} and end{column} in yaml header.

    Create mystyle.tex and write there:

    \def\begincols{\begin{columns}}
    \def\begincol{\begin{column}}
    \def\endcol{\end{column}}
    \def\endcols{\end{columns}}
    

    In the Rmd file use these new definitions

    ---
    output:
      beamer_presentation:
        includes:
          in_header: mystyle.tex
    ---
    
    
    Two Column Layout 
    -------
    
    \begincols
      \begincol{.48\textwidth}
    
    This slide has two columns.
    
      \endcol
    \begincol{.48\textwidth}
    
    ```{r}
    #No error here i can run any r code
    plot(cars)
    ```
    
      \endcol
    \endcols
    

    And you get:

    0 讨论(0)
提交回复
热议问题