Xaringan: Suggestion: make pull-left and pull-right available in all themes on xaringan

Created on 18 Sep 2019  路  4Comments  路  Source: yihui/xaringan

Hello!
The default theme has the following CSS code that allows to use 2 columns on the slide:

.pull-left {
  float: left;
  width: 47%;
}
.pull-right {
  float: right;
  width: 47%;
}

And we can easily use 2 columns using this code (and the remedy package creates a shortcut called xaringan for it):

.pull-left[

]

.pull-right[

]

But this is not available in all the themes that comes with xaringan.

Themes that don't have this CSS code (and don't work when try to use 2 columns using pull-left and pull-right :

  • chocolate (tested
  • duke-blue
  • hygge
  • lucy
  • metropolis
  • ninjutsu + kunoichi
  • rladies
  • shinobi
  • tamu
  • uo

A suggestion is to make this available in all themes. So if someone is using a theme, and wants to use another one, it will still work properly.

Reproducible example of how using pull-left and pull-right with the rladies theme won麓t work:

title: "Presentation Ninja"
output:
  xaringan::moon_reader:
    css: ["rladies", "rladies-fonts"]
    lib_dir: libs
    nature:
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false
---

.pull-left[
test
]

.pull-right[
example
]

My session info:

> xfun::session_info('xaringan')
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763), RStudio 1.2.1335

Locale:
  LC_COLLATE=Portuguese_Brazil.1252  LC_CTYPE=Portuguese_Brazil.1252   
  LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C                      
  LC_TIME=Portuguese_Brazil.1252    

Package version:
  base64enc_0.1.3  BH_1.69.0.1      digest_0.6.20    evaluate_0.14   
  glue_1.3.1       graphics_3.6.1   grDevices_3.6.1  highr_0.8       
  htmltools_0.3.6  httpuv_1.5.2     jsonlite_1.6     knitr_1.25      
  later_0.8.0      magrittr_1.5     markdown_1.1     methods_3.6.1   
  mime_0.7         promises_1.0.1   R6_2.4.0         Rcpp_1.0.2      
  rlang_0.4.0      rmarkdown_1.15.1 servr_0.15       stats_3.6.1     
  stringi_1.4.3    stringr_1.4.0    tinytex_0.16     tools_3.6.1     
  utils_3.6.1      xaringan_0.12.1  xfun_0.9         yaml_2.2.0      

By filing an issue to this repo, I promise that

  • [x] I have fully read the issue guide at https://yihui.name/issue/.
  • [x] I have provided the necessary information about my issue.

    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.

    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('xaringan'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/xaringan').

    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.

  • [x] I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

Most helpful comment

In order to have the styles from the base default theme, you can include default in your CSS list. The CSS files are loaded in the order listed, so themes (CSS files) that appear later in the list override those that are earlier. This is shown in the example on the wiki page but could probably be more prominently discussed.

For example, to use .pull-left[] and .pull-right[] from the default theme with the rladies theme, your xaringan slides would look like this:

````markdown

output:
xaringan::moon_reader:
css: [default, rladies-fonts, rladies]

seal: false

Override default theme with other themes

output:
  xaringan::moon_reader:
    css: [default, rladies-fonts, rladies]

.pull-left[
Left-column content

  • Lorem
  • Ipsum
  • Bacon
    ]

.pull-right[
Right-column content

  • Lorem
  • Ipsum
  • Bacon
    ]
    ````

image

All 4 comments

In order to have the styles from the base default theme, you can include default in your CSS list. The CSS files are loaded in the order listed, so themes (CSS files) that appear later in the list override those that are earlier. This is shown in the example on the wiki page but could probably be more prominently discussed.

For example, to use .pull-left[] and .pull-right[] from the default theme with the rladies theme, your xaringan slides would look like this:

````markdown

output:
xaringan::moon_reader:
css: [default, rladies-fonts, rladies]

seal: false

Override default theme with other themes

output:
  xaringan::moon_reader:
    css: [default, rladies-fonts, rladies]

.pull-left[
Left-column content

  • Lorem
  • Ipsum
  • Bacon
    ]

.pull-right[
Right-column content

  • Lorem
  • Ipsum
  • Bacon
    ]
    ````

image

Hi @gadenbuie ! I didn't thought about this. I'm so sorry that I asked a question of something that is already implemented!

Thank you for such a complete answer! Next time I'll use the default theme with the other themes.

Considering that is a suggestion of something that already works, It is ok to close this issue?

No worries! I'm sure you're not the only one who has run into this and wondered why it wasn't working. I updated the wiki page; hopefully my edits help clarify this situation. If that looks good to you, then feel free to close the issue.

I saw that now in the wiki page there is: "Include the default theme as the first css option to retain all of the CSS styles in the default xaringan presentation theme."
It's very clear to me! I'm closing the issue now.
Thank you so much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

royfrancis picture royfrancis  路  4Comments

tcgriffith picture tcgriffith  路  4Comments

slowkow picture slowkow  路  3Comments

kevinykuo picture kevinykuo  路  3Comments

burgerga picture burgerga  路  3Comments