1

I'm trying to do simple beamer presentation. My code looks like this:

---
title: "Untitled"
author: "Name"
output:
  beamer_presentation:
    theme: "AnnArbor"
    colortheme: "dolphin"
    fonttheme: "structurebold"
fontsize: 24pt
---
## Slide 1

\begin{columns}

\column{0.75\textwidth}

```{r echo = FALSE, warning=FALSE, out.width="75%"}
plot(1:10)
```

\column{0.25\textwidth}
text

\end{columns}

## Slide 2

\begin{columns}

\column{0.25\textwidth}
text

\column{0.75\textwidth}

```{r echo = FALSE, warning=FALSE, out.width="75%"}
plot(1:10)
```

\end{columns}

On the first slide I got plot just on the left and nice looking text, but on the second one my plot is on the middle of the slide and the text is moved just to the left side of a slide. Do you know how to make it looks this aesthetically like on the first slide? I'll be great full for any help :)

jay.sf
  • 60,139
  • 8
  • 53
  • 110
Aleksandra
  • 151
  • 8
  • Does this answer your question? [Tables and Figures side-by-side in Knitr or RMarkdown Beamer](https://stackoverflow.com/questions/28000062/tables-and-figures-side-by-side-in-knitr-or-rmarkdown-beamer) – Carlos Luis Rivera Jun 20 '20 at 05:54

1 Answers1

1

What you observe is a combination of several different causes:

  • The theme you use has smaller than usual margins -- everything will look quite cramped

  • the combined width of your columns is too big and they will protrude into the margin. Use either \begin{columns}[onlytextwidth] or make them smaller

  • by using out.width="75%" your plot will only span there quarters of its columns, thus adding a lot of asymmetric empty space. If 100% is too large for you, make the column smaller

  • to avoid the left alignment of the text in the third frame, you could use \centering


---
title: "Untitled"
author: "Name"
output:
  beamer_presentation:
    theme: "AnnArbor"
    colortheme: "dolphin"
    fonttheme: "structurebold"
    keep_tex: true
fontsize: 24pt
---
## Slide 1

\begin{columns}[onlytextwidth]

\column{0.75\textwidth}

```{r echo = FALSE, warning=FALSE, out.width="100%"}
plot(1:10)
```


\column{0.25\textwidth}
\centering
text

\end{columns}

## Slide 2

\begin{columns}[onlytextwidth]

\column{0.25\textwidth}
\centering
text

\column{0.75\textwidth}

\hfill
```{r echo = FALSE, warning=FALSE, out.width="100%"}
plot(1:10)
```

\end{columns}

enter image description here