3

I would like to use Yasnippet to insert the template for a latex inline equation: \( \)

The snippet is defined:

    # -*- Mode: snippet -*-
# name: inline equation
# key: ineq
# --
\(  \)

But Yasnippet inserts only the parentheses ( ) without the backslashes. Any suggestions?

Drew
  • 75,699
  • 9
  • 109
  • 225
Snelephant
  • 814
  • 1
  • 7
  • 17

1 Answers1

4

The backslash is used in regular expressions to escape individual characters:

For the most part, \ followed by any character matches only that character.

So \( gives you ( in your output. To get the backslash in the output, escape it:

\\( \\)
Dan
  • 32,584
  • 6
  • 98
  • 168
  • 1
    http://joaotavora.github.io/yasnippet/snippet-development.html#sec-3 would be a better link, this isn't about regular expressions. – npostavs Apr 15 '17 at 13:27