Author: Yihui Xie
Date: 2025-04-03

# Scrollama Document with the Sidebar Layout

### Yihui Xie

### 2025-04-03

# 1 Get started

You can create a new Scrollama document with the sidebar layout from the RStudio IDE: `File -> New File -> R Markdown -> From Template`, and use the template “Scrollama Document (Sidebar Layout)”.

# 2 The layout

The main body of the document is displayed in the sidebar on the left. Figures, tables, and videos will be displayed in their full sizes in the main area on the right.

For example, here is a simple table:

Table 2.1: A boring table.
| mpg | cyl | disp | hp | drat | wt | qsec | vs | am | gear | carb
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
Mazda RX4 | 21.0 | 6 | 160 | 110 | 3.90 | 2.620 | 16.46 | 0 | 1 | 4 | 4
Mazda RX4 Wag | 21.0 | 6 | 160 | 110 | 3.90 | 2.875 | 17.02 | 0 | 1 | 4 | 4
Datsun 710 | 22.8 | 4 | 108 | 93 | 3.85 | 2.320 | 18.61 | 1 | 1 | 4 | 1
Hornet 4 Drive | 21.4 | 6 | 258 | 110 | 3.08 | 3.215 | 19.44 | 1 | 0 | 3 | 1
Hornet Sportabout | 18.7 | 8 | 360 | 175 | 3.15 | 3.440 | 17.02 | 0 | 0 | 3 | 2
Valiant | 18.1 | 6 | 225 | 105 | 2.76 | 3.460 | 20.22 | 1 | 0 | 3 | 1

As you scroll over the document, the first-level section that comes to the view will be highlighted, and the figure or table or video in the view in that section will be displayed on the right (if exists).

# 3 Plots

You may include any number of plots in a section.

    par(mar = c(4, 4, .5, .1))
    plot(cars, pch = 19)

Figure 3.1: A boring scatterplot.

    for (z in 4:1) curve(z/x, 0, 10, add = z < 4, col = z)

Figure 3.2: A series of curves.

# 4 Conclusion

That’s it.