2

I was trying to post a comment on escaping backslashes, and ran into some formatting issues.

Namely, how to not escape backtick characters, because by default, they are always escaped following a backslash, regardless of the number of backslashes.

(repro'd in comment below)

This is despite the fact that backticks are not escaped in this way in posts: `\` generates \ as expected.

Backticks are tricky, so a workaround may be more useful than a fix. Unless, there are hideously more use cases than just regular expressions and questions about escaping strings?

6
  • `` no code formatting, or backslash!
    – Hannele
    Jul 25, 2013 at 15:31
  • \` broken code formatting <html>`
    – Hannele
    Jul 25, 2013 at 15:31
  • \\\` the last backtick always escapes $oddities`
    – Hannele
    Jul 25, 2013 at 15:36
  • @SomeHelpfulCommenter Thanks - I had tried searching, but didn't come across anything. If anything, useful to know it's [status-bydesign]
    – Hannele
    Jul 25, 2013 at 15:39
  • Although, the answers to that question don't really show how to work around the issue.
    – Hannele
    Jul 25, 2013 at 15:44
  • actually one of them links to the meta.tex question with this answer but its fine that it's here too Jul 25, 2013 at 16:06

2 Answers 2

4

Use double backticks.

``\``

Problem solved (try it in the comments below).

2
  • ``\`` gives \
    – Antony
    Jul 25, 2013 at 15:42
  • This doesn't give you extra whitespace, so I'll mark this is as the best answer.
    – Hannele
    Jul 25, 2013 at 15:46
1

To work around this issue in comments, put a space (or other character) between the backslash and the backtick, like so: ```\ ` ``

(to be repro'd in comment below).

2
  • \ visible, code-formatted backslash
    – Hannele
    Jul 25, 2013 at 15:32
  • \ working code formatting <html>
    – Hannele
    Jul 25, 2013 at 15:33

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