escape-latex | Escape LaTeX special characters with Javascript | Parser library
kandi X-RAY | escape-latex Summary
kandi X-RAY | escape-latex Summary
Escape LaTeX special characters with Javascript
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of escape-latex
escape-latex Key Features
escape-latex Examples and Code Snippets
Community Discussions
Trending Discussions on escape-latex
QUESTION
I can create a new blogdown site utilizing the default hugo-lithium theme and the text statement below will not render as a LaTeX equation, which is the behavior I expect.
An amount between $5 and $10.
Pandoc's manual explains the reason why, which I'll paste below with a bold emphasis:
Anything between two
$
characters will be treated as TeX math. The opening$
must have a non-space character immediately to its right, while the closing$
must have a non-space character immediately to its left, and must not be followed immediately by a digit. Thus,$20,000 and $30,000
won’t parse as math. If for some reason you need to enclose text in literal$
characters, backslash-escape them and they won’t be treated as math delimiters.
HOWEVER, I can change to other Hugo themes (e.g. hugo-theme-codex) and this exact same text block renders improperly whenever I include math: true
in my YAML.
An amount between $5 and $10.
ends up displaying as:
Why is LaTeX invoked, when Pandoc is supposed to follow the rule I quoted above? How can I use "other" hugo themes, still use LaTeX math equations, and have Pandoc follow it's own rules? Escaping the $
unfortunately doesn't do anything, and displays the same result as the un-escaped version.
ANSWER
Answered 2020-Jul-20 at 19:45First create the following file:
QUESTION
---
title: "esc"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
A. An amount between $5 and $10.
B. An amount between \$5 and \$10.
C. An amount between \\$5 and \\$10.
X. An equation $1 and 1 = 2$.
Y. An equation \$1 and 1 = 2\$.
Z. An equation \\$1 and 1 = 2\\$.
...ANSWER
Answered 2020-Jul-15 at 15:14Pandoc's manual, under the Pandoc's Markdown > Math section, probably explains it best:
Anything between two
$
characters will be treated as TeX math. The opening$
must have a non-space character immediately to its right, while the closing$
must have a non-space character immediately to its left, and must not be followed immediately by a digit. Thus,$20,000 and $30,000
won’t parse as math. If for some reason you need to enclose text in literal$
characters, backslash-escape them and they won’t be treated as math delimiters.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install escape-latex
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page