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

Escape math environments #136

Closed
tristone13th opened this issue Apr 9, 2021 · 5 comments
Closed

Escape math environments #136

tristone13th opened this issue Apr 9, 2021 · 5 comments

Comments

@tristone13th
Copy link

tristone13th commented Apr 9, 2021

It will parse the backslash '\' in $...$ or $$...$$ thus make the math parsing failed, is there any method to escape the parsing actions inside the math environments?

@gjtorikian
Copy link
Owner

What pipeline are you using to convert math environments? What does the text look like? Escaping the backslash with a backslash (eg. \\text{}) should work, but I would need more details.

@tristone13th
Copy link
Author

tristone13th commented Apr 10, 2021

What pipeline are you using to convert math environments? What does the text look like? Escaping the backslash with a backslash (eg. \\text{}) should work, but I would need more details.

I'm using jekyll-commonmark-ghpages to parse my markdown files in my blog. It seems to have some small pitfalls when it encounters backslash in the markdown file. Specifically, it always eliminates the backslash in the file and doesn't care about the position and the context such as math block. For example, when I write this math block segment:

$$
\left\{
\begin{aligned}
\frac{w^\intercal x+b}{\|w^\intercal\|} & > d^{w,b} &, y=1 \\
\frac{w^\intercal x+b}{\|w^\intercal\|} & < -d^{w,b} &,  y=-1 \\
\end{aligned}
\right .
$$

it will automatically replace the \{ with { and make the math interpretation failed, how to avoid this?

@gjtorikian
Copy link
Owner

Try entering \\{ and see if that retains the text. I think you'll need to escape the backslash.

@tristone13th
Copy link
Author

Try entering \\{ and see if that retains the text. I think you'll need to escape the backslash.

Thanks, I think it would be ok but will break the math interpretation on other markdown editors, I will try to find another way to avoid this.

@gjtorikian
Copy link
Owner

Sorry I cannot be of more help.

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

2 participants