question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LaTeX syntax highlighting in Rmd

See original GitHub issue
  • VSCode Version: 1.28.0
  • VSCode-R Version: v0.6.2
  • OS Version: x86_64-apple-darwin15.6.0 (64-bit)

Steps to Reproduce:

  1. Use two reserved markdown characters in LaTeX math blocks in the same line
  2. Syntax highlighting does not consider the LaTeX math notation and applies styling

Example of issue (with totally made up math)

image

Expected something more like this

image

TBH, simply catching the use of LaTeX and removing the syntax highlighting between paired $..$ or $$..$$ would be a great improvement.

Example text
For each $x_i$, consider all $x_i < k$.
Is $x*2$ greater than $y*2$?

$$
y_i = m * x_i + b
$$

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:7
  • Comments:35 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
eitsupicommented, Jan 21, 2022

We use embedded languages to provide syntax highlighting for code blocks of Python, C etc. in Rmd files. It should be possible to do this for LaTeX too. The difference is that grammars for Python, C etc. are built in to VS Code itself, but LaTeX isn’t built in. (The built-in languages are here: microsoft/vscode@master/extensions)

FYI, LaTeX is now built in code-insiders.

image

2reactions
andycraigcommented, Feb 16, 2020

Once PR #228 is merged, I’ll fix this so that text in $..$ and $$..$$ is highlighted as LaTeX (if the user has installed an extension that provides LaTeX highlighting), or has no highlighting (if they haven’t installed such an extension).

Read more comments on GitHub >

github_iconTop Results From Across the Web

LaTeX syntax highlighting in Rmd · Issue #93 - GitHub
Steps to Reproduce: Use two reserved markdown characters in LaTeX math blocks in the same line; Syntax highlighting does not consider the LaTeX...
Read more >
Changing the syntax highlighting color in a Rmarkdown ...
Which tex package does Rmarkdown use by default to implement syntax highlighting and how to change the highlighting colors?
Read more >
8.2 Appearance and style | R Markdown: The Definitive Guide
highlight specifies the syntax highlighting style. Supported styles include "default" , "tango" , "pygments" , "kate" , "monochrome" , "espresso" ...
Read more >
Syntax highlighting themes - R
The syntax highlighting here only applies to '.Rnw' (LaTeX) and '.Rhtml' (HTML) documents, and it does not work for other types of documents,...
Read more >
Markdown and Latex syntax highlighting - CodeMirror
Yes, write an extension for the markdown parser that recognizes dollar sign markup, and either directly integrate the math parsing in there, or ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found