# Jekyll eats backslashes in \`\\{\` and \`\\}\`

**URL:** <https://talk.jekyllrb.com/t/jekyll-eats-backslashes-in-and/7668>\
**Category:** Help\
**Created:** [September 18, 2022, 3:45am UTC](https://talk.jekyllrb.com/t/jekyll-eats-backslashes-in-and/7668 "2022-09-18T03:45:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![j-james](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/j-james/32/4886_2.png) [@j-james](https://talk.jekyllrb.com/u/j-james)\
**Post date:** [September 18, 2022, 3:45am UTC](https://talk.jekyllrb.com/t/jekyll-eats-backslashes-in-and/7668/1 "2022-09-18T03:45:53Z")

</div>

Hi all, I’ve been getting Github Pages set up to build and generate html for my class notes, which are written in a combination of Markdown and inline LaTeX (via the `$$` style).

I’ve run into a really weird issue where the Jekyll build script seems to remove backslashes in front of the `{` and `}` characters. Since LaTeX uses `{}` extensively, representing sets (and literal braces) is done like so: `\{ x \in \mathbb{Z} \}`. As Jekyll is removing those preceding backslashes, KaTeX (the LaTeX rendering engine I’m using) doesn’t render them properly.

You can see an example of this behavior here: [Automata Theory](https://j-james.me/notes/cpsc421/automata)

KaTeX will render everything (sans braces) upon loading the page in a browser, but if you curl it, you’ll notice that the backslashes before the braces are gone (compared to the [raw markdown](https://github.com/j-james/notes/blob/main/cpsc421/automata.md?plain=1)). Interestingly - the same thing appears to happen on Github’s native Markdown renderer.

---

<div class="post-metadata">

**Author:** ![chuckhoupt](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/chuckhoupt/32/523_2.png) [@chuckhoupt](https://talk.jekyllrb.com/u/chuckhoupt)\
**Post date:** [September 18, 2022, 1:14pm UTC](https://talk.jekyllrb.com/t/jekyll-eats-backslashes-in-and/7668/2 "2022-09-18T13:14:04Z")

</div>

Markdown has backslash escape codes, which include curly brace escapes (`\{`, `\}`), so if you want a literal backslash, you often have to escape it. I.e. write `\\{` to get `\{`. See: [Daring Fireball: Markdown Syntax Documentation](https://daringfireball.net/projects/markdown/syntax#backslash)

Backslash escapes aren’t applied within code spans/blocks, as well as HTML block elements (`div`, etc). I gather there may be ways to configure MathJax/KaTeX to process those blocks so Markdown escaping can be avoided. May not be worth implementing if you only have a few problematic LaTeX expressions.
