# How can I write backslash in MathJax?

I want to write following in MathJax:

L(A)\L(B)


When I type following:

$$L(A)\ L(B)$$


It prints: $$L(A)\ L(B)$$

When I type following:

$$L(A)\\ L(B)$$


It prints: $$L(A)\\ L(B)$$

How can I make \ appear in MathJax?

If you want a real backslash, and not something spaced like a binary operation, use L(A)\backslash L(B) to get $$L(A) \backslash L(B)$$

• You can also surround \backslash with \mathbin or \mathrel to change the spacing, giving something similar (the same?) as \setminus. So L(A)\mathbin{\backslash} L(B) gives $L(A)\mathbin{\backslash} L(B)$ while L(A)\mathrel{\backslash} L(B) gives $L(A)\mathrel{\backslash} L(B)$. (The spacing is different, honest!) – user1729 Nov 24 '19 at 17:20

Use \setminus for the result $$𝐿(𝐴)\setminus𝐿(𝐵)$$.

Here's a list of possible solutions that I could come up with (includes a curated Detexify output), the first two are the other two current answers:

1. $$L(A)\backslash L(B)$$ $L(A)\backslash L(B)$
2. $$L(A)\setminus L(B)$$$L(A)\setminus L(B)$ (looks the same as the next too)
3. $$L(A)\mathbin{\setminus}L(B)$$ $L(A)\mathbin{\backslash}L(B)$
4. $$L(A)⧵L(B)$$ $L(A)⧵L(B)$using U+29F5 "Reverse Solidus Operator"
5. $$L(A)\text{\ }\!L(B)$$ $L(A)\text{\ }\!L(B)$ PS / also works in \text
6. $$L(A)$$\ $$\!L(A)$$ $L(A)$\ $\!L(A)$ (broken into two MathJax pieces) and similarly
7. $$L(A)$$ \ $$L(A)$$ $L(A)$ \ $L(A)$
8. $$L(A) \diagdown L(B)$$ $A \diagdown B$
9. $$L(A)╲L(B)$$ $L(A)╲L(B)$ using U+2572 "Box Drawings Light Diagonal Upper Left to Lower Right"
10. $$L(A) \smallsetminus L(B)$$ $A \smallsetminus B$
11. $$L(A)﹨L(B)$$ $L(A)﹨L(B)$ using U+FE68 "Small Reverse Solidus"
12. $$L(A)＼L(B)$$ $L(A)＼L(B)$ using U+FF3C "Fullwidth Reverse Solidus"
13. $$L(A)\backprime L(B)$$ $L(A)\backprime L(B)$
14. $$L(A)\searrow L(B)$$ $L(A)\searrow L(B)$
• 6 and 7 are "wrong", in the sense that you shouldn't exit mathmode like that...! – user1729 Nov 24 '19 at 17:17
• Point 4 can also be made less obscure using \unicode{x29f5}: $L(A)\unicode{x29f5}L(B)$. Same for points 9, 11 and 12. – celtschk Nov 25 '19 at 17:02

For fun:

How can I make \ appear in MathJax?

The command \cancel produces a forward slash: $$\require{cancel}\cancel{\phantom{k}}$$. A simple rotation flips it around to produce a backslash. So

\require{cancel}

L(A)\!\!\!

\style{display: inline-block; transform: rotate(90deg)}{\cancel{\phantom{mm}}}

\!\!\! L(B)


gives

$$\require{cancel}L(A)\!\!\! \style{display: inline-block; transform: rotate(90deg)}{\cancel{\phantom{mm}}}\!\!\! L(B).$$

This is clearly easier better than \setminus or \backslash :P

• or rotate / through 90 – user645636 Nov 24 '19 at 16:32
• (+1) Aah yes, a simple answer from TheSimpliFire – clathratus Nov 25 '19 at 16:10