I want to write following in MathJax:


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?


4 Answers 4


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) $$

  • 1
    $\begingroup$ 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!) $\endgroup$
    – user1729
    Commented Nov 24, 2019 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)$
  • 11
    $\begingroup$ 6 and 7 are "wrong", in the sense that you shouldn't exit mathmode like that...! $\endgroup$
    – user1729
    Commented Nov 24, 2019 at 17:17
  • 4
    $\begingroup$ Point 4 can also be made less obscure using \unicode{x29f5}: $L(A)\unicode{x29f5}L(B)$. Same for points 9, 11 and 12. $\endgroup$
    – celtschk
    Commented Nov 25, 2019 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



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

\!\!\! L(B)


$$\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

  • $\begingroup$ or rotate / through 90 $\endgroup$
    – user645636
    Commented Nov 24, 2019 at 16:32
  • 7
    $\begingroup$ (+1) Aah yes, a simple answer from TheSimpliFire $\endgroup$
    – clathratus
    Commented Nov 25, 2019 at 16:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .