How to use comma as decimal separator in R Markdown Latex equations

I use R Markdown documents in RStudio to write LaTeX equations. In my native language, decimal separator in numbers is a comma (European style numbers). I.e., 0,49 means "0 point forty-nine". If I write numbers like this as LaTeX equations in R Markdown, a small space is added after the comma and the number looks like two separate numbers (in this case, 0 and 49):

Equation in RMarkdown

If I knit to HTLM, the same problem persists:

Equation in HTML

I heard that LaTeX packages siunitx and icomma may be helpful in this situation. Unfortunately, I do not imagine how to use them with RStudio.

Question: How to make LaTeX equations in R Markdown documents, knitted HTLM documents, and bookdown (GitBook) projects accept comma as a decimal separator (remove small space after the commas)?

As I understood, the best solution, if additional packages cannot be activated, is to use {,} notation, i.e., $0{,}49$.

But is it possible to activate icomma LaTeX package?

It should be possible via the header-includes section in the front matter of your Rmd file:

header-includes:
  - \usepackage{icomma}

I haven't used this feature for commas (although as a Czech I feel your pain) but it helps with the Environment tabu undefined issue I was having with {kableExtra} package.

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