[Tex/LaTex] Undefined control sequence in R markdown

markdownr

I have got stuck on this code which I could not be
able to find that in my content anymore after checking for
more than two times.

Is there any packages I should have updated?
As I am using TexShop and Text Live Utility.
Thank you very much!
I need to compile it and submit the assignment on time. 🙁
Any help would be appreciated!!

    /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS STAT_731_Exam_3_JenLi_Chen.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output STAT_731_Exam_3_JenLi_Chen.tex --template /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable 'geometry:margin=1in' --variable 'compact-title:yes' 
! Undefined control sequence.
l.138 ...a)e^{-x/\theta},\) \(x\ge0,\) \(\theta\gt
                                                  0\) 

Best Answer

Macros like \ge is defined by default to be equivalent to \geq or . However, \gt is not. Assuming it should be equivalent to >, you can just add

---
# ...
header-includes:
  - \newcommand{\gt}{>}
  - \newcommand{\lt}{<}
# ...
---

nath defines them as well

\edef\lt{\mathchar\the\mathcode`<\relax}
\edef\gt{\mathchar\the\mathcode`>\relax}

so you can

---
# ...
header-includes:
  -\usepackage{nath}
# ...
---

as part of your YAML header.

Related Question