# R Markdown incorrectly creates new line when using math mode in lists

#1

R Markdown is showing some unexpected behavior when math mode is part of a list:

---
title: "Reproducible list/math error"
output:
html_document:
df_print: paged
---

The simple markup below seems correct but produces

* $\beta$ in the beggining is fine
* $\beta$ in the second line strangely forces a new line, and again if $\phi$ appears later
+ While a line with only text is fine,
+ $\beta$ in the beggining of a line does nothing, and
+ $\beta$ sublist is fine even when $\omega$ drops in for a visit
* Can someone tell me what's going on?



Which produces this output when I preview or knit to HTML (knitting to PDF using LaTeX produces correct output, but that's not the final format needed):

Any ideas what I've done wrong, or why math mode is triggering new lines?

0 Likes

#2

I can't reproduce this issue. The same code generated the expected output on my device, without the additional blank line before the 2nd line.

Rmd code
---
title: "Reproducible list/math error"
output:
html_document:
df_print: paged
---

The simple markup below seems correct but produces

* $\beta$ in the beggining is fine
* $\beta$ in the second line strangely forces a new line, and again if $\phi$ appears later
+ While a line with only text is fine,
+ $\beta$ in the beggining of a line does nothing, and
+ $\beta$ sublist is fine even when $\omega$ drops in for a visit
* Can someone tell me what's going on?

Here's my session info:

{r}
sessionInfo()



This generates the following:

0 Likes

#3

Can you both share version of Rmarkdown and knitr to compare ? Thanks!

0 Likes

#4

I've already shared mine in the screenshot.

packageVersion(pkg = "knitr")
#> [1] '1.22'
packageVersion(pkg = "rmarkdown")
#> [1] '1.12'

1 Like

#6

I am using the same packageVersions.

I can reproduce the problem on Mojave but not on Ubuntu.

Both boxes are fully updated.

BTW, I get the same results with or without backlashes, with or without paged output, pdf, as you noted, is fine.

0 Likes

#7

Thank you all for your replies. The request for package version prompted me to run updates to see if that would fix things. Package updates didn't fix the matter, but an update to R version 3.5.3 did fix it.

I'm still not sure what caused the original error but I guess the lesson for me is to keep running updates.

Just for thoroughness, I'm showing the correct output (from the exact same script) and have added the sessionInfo as well. Thank you all again.

0 Likes

#8

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

0 Likes

#9

Thanks, and sorry about that. I didn't even realize this could be done! (I'm more used to Stack Overflow, where the answering and feedback mechanisms are more prominent.)

1 Like

closed #10

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

0 Likes