Problem with backslashes

25 views
Skip to first unread message

Jim Burton

unread,
Nov 15, 2012, 6:24:08 AM11/15/12
to smart-...@googlegroups.com

Hi, I have installed yasnippet 0.8 from elpa on emacs 24 and I want to write a snippet that inserts this text into a LaTeX document (using AUCTeX):

\\

\vspace{10pt}

So I have this snippet:

# -*- mode: snippet -*-
# name: para
# key: para
# binding: direct-keybinding
# expand-env: ((some-var some-value))
# type: command
# --
\\\\

\\vspace{10pt}

but when I type para<TAB> all that happens is that the text para is removed. What am I doing wrong?

Thanks!

Jim Burton

unread,
Nov 15, 2012, 9:30:12 AM11/15/12
to smart-...@googlegroups.com
Please ignore, my copy-and-paste shame was sorted out by Magnar on SE: http://stackoverflow.com/questions/13395476/yasnippet-and-backslashes/13398973#13398973.

tamouse mailing lists

unread,
Nov 16, 2012, 3:37:30 AM11/16/12
to smart-...@googlegroups.com
On Thu, Nov 15, 2012 at 5:24 AM, Jim Burton <jimbu...@gmail.com> wrote:
> So I have this snippet:
>
> # -*- mode: snippet -*-
> # name: para
> # key: para
> # binding: direct-keybinding
> # expand-env: ((some-var some-value))
> # type: command
> # --
> \\\\
>
> \\vspace{10pt}
>


Actually, I'm surprised this would work at all.

* the snippet is set to fire if you type "direct-binding" based on the
way binding is set -- which means all those self-inserting symbols
would be masked where the snippet is active.

* expand-env should fail when the snippet is fired as the sexp will
fail in emacs.

* type is probably wrong there as well, but it's a new feature and I
haven't played with it.
Reply all
Reply to author
Forward
0 new messages