Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting in Rmd: LaTeX equations with \(\) and \[\] #47

Open
rcragun opened this issue May 28, 2021 · 0 comments
Open

Syntax highlighting in Rmd: LaTeX equations with \(\) and \[\] #47

rcragun opened this issue May 28, 2021 · 0 comments

Comments

@rcragun
Copy link

rcragun commented May 28, 2021

The RMarkdown syntax highlighting does not seem to recognize \( \) and \[ \] as math delimiters.

Here is an example Rmd file to illustrate, and I have attached a screenshot of how the syntax highlighting looks.

---
title: "Sublime Text 4 R-IDE Rmd syntax highlighting problem"
author: "Randy Cragun"
output: html_document
---

Correct syntax highlighting:

  * Inline equation: $\overline{Y}_{g,t}$
  * Display equations:
      $$\overline{Y}_{g,t}$$
      \begin{equation}\overline{Y}_{g,t}\end{equation}

Possibly incorrect highlighting: inline equation: \(Y_{g,t}\)

Incorrect highlighting:

  * Inline equation: \(\overline{Y}_{g,t}\) (everything after _ is treated as italic, which is possibly a second issue)
  * Display equation:
      \[\overline{Y}_{g,t}\]


I left two line breaks at the end of the file to illustrate that the highlighting suggests that there is an un-closed delimiter at the end.
SublimeRmdMathDelim

\( \) should be treated as math delimiters. RMarkdown supports it. Pandoc supports it. Furthermore, $ $ is supposedly deprecated (see this answer, for example). I think the problem of underscore being treated as starting a section of italics will be solved if \( \) and \[ \] are recognized as math delimiters.

My system:

  • Sublime Text: build 4107
  • R-IDE: v0.2.7
  • LSP: v1.3.1 (rlang server enabled globally)
  • Package Control: v3.4.1
  • Windows 10 Home: version 20H2
  • I made no modifications to R-IDE or LSP settings after installing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant