2 column Section in R Markdown

后端 未结 5 1919
情书的邮戳
情书的邮戳 2020-11-28 01:51

I\'m very new at R Markdown and I\'m putting together an R Markdown HTML page for some new R users at my work to give them an intro and walk them through some simple demos.

5条回答
  •  春和景丽
    2020-11-28 02:27

    If you are exporting to pdf you can do this in the header with includes.

    Without using css files I have created a two-column environment using the following.

    1st: I created the file header.tex. header.tex includes the following statements:

    \usepackage{multicol}
    \newcommand{\btwocol}{\begin{multicols}{2}}
    \newcommand{\etwocol}{\end{multicols}}
    

    2nd: I put the following command into my document header

    ---
    title: "My title"
    author: "My name"
    date: "Today"
    output:
        beamer_presentation:
            highlight: haddock
        includes:
            in_header: header.tex
            keep_tex: yes
    ---
    

    Here is an example of the body and a picture of the output with two columns.

    ***********
    \btwocol
    ```{r, results="asis"}
    print("test")
    ```
    
    Here is some text that also is in two column environment.
    \etwocol
    
    Now only one column
    

    And here is what the slide looks like:

提交回复
热议问题