Xaringan: Scrolling Area for Wide or Long Content

Created on 18 Jun 2018  路  4Comments  路  Source: yihui/xaringan

It would be convenient to be able to use a macro to display R output that's long or wide with scroll bars. For example, the head of a data frame with more columns than horizontally fits onto the slide.

question

Most helpful comment

The sydney-xaringan theme defines several classes to support vertical scrolling of code output: https://github.com/garthtarr/sydney_xaringan

I have this working in a custom .css theme, but I also just tested it using the xaringan default with a minimal my-theme.css that just includes the scrolling classes from https://github.com/garthtarr/sydney_xaringan/blob/master/assets/sydney.css. The vertical and horizontal scrolling slide is then (from the sydney example presentation):


.scroll-output[
I tend to think it's best to format the slide such that everything you want to show is visible, however there can be times when the R output is extensive, and it's not important that the whole lot is printable (i.e. won't appear on the pdf version of the slides), but you might want to be able to scroll down interactively during the presentation. This can be done using the .scroll-output[] class.

{r} step(lm(Fertility~.,data = swiss))
]

There are classes to scroll a smaller number of lines as well (e.g., .scroll-box-8).

All 4 comments

To me this sounds like it would be better suited as a feature request to remark which would make it available in xaringan, too, eventually.

It is easy for the content to scroll horizontally, e.g., you can set the max width of pre to 100%, and use the overflow-x property: https://www.w3schools.com/CSSref/css3_pr_overflow-x.asp

Vertical scroll will be tricky, because the available height is usually unknown and you cannot set a fixed height.

Anyway, I think this is more like a question, so please try to ask on StackOverflow instead (with at least tags remarkjs, xaringan and css).

The sydney-xaringan theme defines several classes to support vertical scrolling of code output: https://github.com/garthtarr/sydney_xaringan

I have this working in a custom .css theme, but I also just tested it using the xaringan default with a minimal my-theme.css that just includes the scrolling classes from https://github.com/garthtarr/sydney_xaringan/blob/master/assets/sydney.css. The vertical and horizontal scrolling slide is then (from the sydney example presentation):


.scroll-output[
I tend to think it's best to format the slide such that everything you want to show is visible, however there can be times when the R output is extensive, and it's not important that the whole lot is printable (i.e. won't appear on the pdf version of the slides), but you might want to be able to scroll down interactively during the presentation. This can be done using the .scroll-output[] class.

{r} step(lm(Fertility~.,data = swiss))
]

There are classes to scroll a smaller number of lines as well (e.g., .scroll-box-8).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DavisVaughan picture DavisVaughan  路  3Comments

rsangole picture rsangole  路  3Comments

richardohrvall picture richardohrvall  路  3Comments

ramongallego picture ramongallego  路  3Comments

tcgriffith picture tcgriffith  路  4Comments