rstudio / rmarkdown

Dynamic Documents for R
https://rmarkdown.rstudio.com
GNU General Public License v3.0
2.87k stars 975 forks source link

Cannot use $$\gt$$ in expressions, but > works OK; Undefined control sequence #2185

Closed nweerasu closed 3 years ago

nweerasu commented 3 years ago

Hi all, this could be a wildly basic issue but I wasn't able to find this posted about already. I am new to RMarkdown.

$$H_{1}: \mu master \gt 70$$

The above code didn't want to compile, using xelatex, Windows 10, MikTEX (fully updated).

! Undefined control sequence.
l.763 \[H_{1}: \mu master \gt
                              70\] 

Error: LaTeX failed to compile Day-3.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Day-3.log for more info.
Execution halted

However, using the > symbol didn't give an error compiling:

e.g.: $$H_{1}: \mu master > 70$$

Compiling in HTML and Word were fine.

R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043), RStudio 1.4.1717

Locale:
  LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
  LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
  LC_TIME=English_United States.1252    

Package version:
  base64enc_0.1.3   digest_0.6.27     evaluate_0.14     glue_1.4.2        graphics_4.1.0   
  grDevices_4.1.0   highr_0.9         htmltools_0.5.1.1 jsonlite_1.7.2    knitr_1.33       
  magrittr_2.0.1    markdown_1.1      methods_4.1.0     mime_0.11         rlang_0.4.11     
  rmarkdown_2.9     stats_4.1.0       stringi_1.6.2     stringr_1.4.0     tinytex_0.32     
  tools_4.1.0       utils_4.1.0       xfun_0.24         yaml_2.2.1       

Pandoc version: 2.14.0.3

My header:

title: 'XX'
author: "YY"
date: "`r format(Sys.time(), '%d %B %Y')`"
output:
  pdf_document:
    keep_tex: yes
    latex_engine: xelatex
    toc: yes
    toc_depth: 3
    highlight: default
    fig_width: 6
    fig_height: 4
    number_sections: yes
  word_document:
    toc: yes
    toc_depth: '3'
  html_document:
    toc: yes
    toc_depth: '3'
    df_print: paged
subtitle: 'xxx '
---

Checklist

When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:

cderv commented 3 years ago

Hi,

I am not a LaTeX expert but are you sure \gt is valid operator in LaTeX math ?

The error says it is not, and I get the same error with default pdflatex too (not xelatex)

---
title: "Minimal Example"
output: pdf_document
--- 

$$H_{1}: \mu master \gt 70$$

Also, I can't find this operator for is greater than and only find > for this:

Do you have a reference for this \gt syntax working with LaTeX outside of using rmarkdown ?

Thank you.

nweerasu commented 3 years ago

Ah, that would explain it! Haha I assumed \gt was a thing since \ge was but ... obviously the keystroke exists for it. I thought I saw it ages ago on a Stack Overflow post but truly cannot find it now.

github-actions[bot] commented 2 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.