How Can I Write a Dollar Sign in blogdown

I want to write a dollar symbol in a blogdown post. If I write multiple of them though, math mode becomes activated. Even if the dollar symbols are on separate lines. And even if I escape them with \$.

Hello,

Normally with proper escaping this should not happen I think, could you provide an example where this happens. So provide us with a piece of Rmarkdown that when rendered produces the error.

Grtz,
PJ

I will provide a reproducible example. First, create a new blogdown website with blogdown::new_site(). Then set options(blogdown.ext = ".Rmd", blogdown.methood = "markdown") in .Rprofile. Create a new blog post by running blogdown::new_post("Dollar Signs"). In the index.Rmd file, add this:

Five hundred dollars: \$500
One thousand dollars: \$1000
Two thousand dollars: \$2000

Return to the root directory. Compile the post by running blogdown::build_site(build_rmd = "newfile". Preview the website by running blogdown::serve_site() and type the address it tells you to type in your browser (usually localhost:4321). Click on the new blog post and see if the dollar signs are rendered correctly.

Hi,

First of all, that was a very nice reprex!! I just had a mini tutorial in Bookdown :slight_smile: Thanks. So when I follow the steps this is what is rendered for me:

This all looks correct to me, and the escape did work as I expected it to... Is your result different?

PJ

You're right. It works by default. The reason it didn't work for me is that I had math enabled in the configuration file using KaTeX. It uses dollar symbols to enable math. Once I disabled it, I didn't have this issue anymore. So the issue is basically solved now.

2 Likes

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.