Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xaringan: Math renders as inline code in footnote class

Tags:

r

xaringan

Using the default Xaringan CSS, if $math$ is placed in a footnote, it appears to be rendered as inline code, rather than rendering as math. I was not able to find information about this - is this just a natural limitation in Xaringan or remark.js? Or perhaps I am doing something wrong?

See basic example below:

# A Test

- This is a test<sup>1</sup>

.footnote[<sup>1</sup> This includes $\delta+\frac{2}{3}$ math.]

This will render the math between the $$ as if it were between backticks.

like image 452
ryansafner Avatar asked Jun 18 '19 13:06

ryansafner


1 Answers

[UPDATE 17/12/2019] Another way to circumvent this is to replace the maths expression $\delta+\frac{2}{3}$ with \(\delta+\frac{2}{3}\) which bypasses any need for remark.js to convert $ and thus avoiding the bug there.


Yes I noticed this too. I think somehow remark.js is interfering with mathjax but I don't really know. To get around this I use the html code directly instead. So below should work:

# A Test

- This is a test<sup>1</sup>

<span class="footnote"><sup>1</sup> This includes $\delta+\frac{2}{3}$ math.</span>

[UPDATE] The explanation of why this happens can be found here. TL;DR: remark.js removes the brackets necessary for mathjax to detect the maths.

Yihui also provided an alternate hack if the use of .footnote[] is desirable which involves adding the brackets to the inline math code:

.footnote[<sup>1</sup> This includes `\\(\delta+\frac{2}{3}\\)` math.]

like image 199
Emi Avatar answered Sep 23 '22 14:09

Emi