yihui / xaringan

Presentation Ninja 幻灯忍者 · 写轮眼
https://slides.yihui.org/xaringan/
Other
1.49k stars 281 forks source link

Vertical bar in an equation inside a table and Slidy format #365

Open jjescario opened 1 year ago

jjescario commented 1 year ago

Although Xaringan is great, I think these suggestions will improve it for some users: 1) If you want to include in a column of a table a vertical bar in order to express, for example, a conditional mean like $E(y|x)$. The vertical bar is interpreted as a column separator. Would it be possible that Xaringan interpret it inside a formula as a vertical bar instead of as a column separator? I solved the problem using an inclined bar, but it would be nice to use a vertical bar. 2) When reporting estimates in a long table, the table is cut after some rows. Would it be possible to present the table as in the slidy presentation format? Thank vou very much. José Julián Escario


By filing an issue to this repo, I promise that

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

yihui commented 1 year ago
  1. Please follow the issue guide and provide a reproducible example. I can't reproduce your problem:
---
title: "test"
output:
  xaringan::moon_reader: null
---

$E(y|x)$

image

  1. Yes, but again, it's hard to help you without an example.
jjescario commented 1 year ago

In this table, for example, the vertical bars inside the formulas are interpreted as a column separator

---
title: "test"
output:
  xaringan::moon_reader: null
---

## Regression models: Linear Regression Model

Assumptions                       |  Linear Regression Model (LRM)                                 
-------------------------       | ------------                            
1. About the distribution    | $$Y_i|x_i \sim N(\mu_i, \sigma^2)$$                      
2. About the mean              | $E(Y_i|x_i) = \mu_i  =x'_i\beta= \eta_i$

Rendering the file Rmd separates "$$Y_i" in one column and the rest "|x_i \sim N(\mu_i, \sigma^2)$$" in another colmun. The same happens with the next line. "$E(Y_i" appears in one colmun and "x_i) = \mu_i =x'_i\beta= \eta_i$" in the next column. Consequently, they yields 3 columns when only two columns should appear. See attached document.

José Julián

Renddering the Rmd file.pdf

yihui commented 1 year ago

You can use \vert for |: https://tex.stackexchange.com/q/498/9128

jjescario commented 1 year ago

Thank you so much. What about the second theme? Do you plan in the future to add the option to enable long table scrolling like the Slidy format in RMarkdown?

yihui commented 1 year ago

I don't have a plan, but recently I've been working on a totally different slides format, which is based on the markdown package (https://github.com/rstudio/markdown) and makes it possible to scroll over one slide if it's too long: https://cran.r-project.org/web/packages/markdown/vignettes/slides.html#lengthy-slides