Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print an asterisk ('*') in R Markdown

Tags:

r

r-markdown

I am trying to write in my R Markdown "3 times 6:10 and (3 times 6):10" all in complete letters (I am using times instead of *. My purpose is to put * instead of word times without any problem). However, it keeps giving me italic syntax for the part "6:10 and (3". How can I write my *s in R Markdown straight into the document without evoking * syntax which is make letters italic in the middle?

like image 308
autopilot38 Avatar asked Dec 23 '22 16:12

autopilot38


2 Answers

Escape '*' by using '\*' instead

Alternatively, you could use $\times$ to get the '×' symbol

like image 173
Captain Hat Avatar answered Jan 22 '23 20:01

Captain Hat


Markdown is quite sensitive to whitespace. If you don't put spaces around the * (line 3 below) you get the problem you're describing (markdown assumes the *s are italic-delimiters).

Some possible solutions

  • line 5: add spaces, no problem (except you might not want that spacing)
  • line 7 (@CaptainHat): set times as a LaTeX times symbol
  • line 9: set in code format
  • line 11 (@CaptainHat): protect *s with backslashes

Also tried @CaptainHat's suggestions as well as type-setting in code format ...) enter image description here

like image 32
Ben Bolker Avatar answered Jan 22 '23 20:01

Ben Bolker