[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Including tex commands in a list
From: |
tomas |
Subject: |
Re: Including tex commands in a list |
Date: |
Fri, 29 Jan 2021 23:24:02 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Jan 29, 2021 at 10:52:39PM +0100, steve-humphreys@gmx.com wrote:
> I wantt to make the equivalent to the following, but still find
> difficulty doing it.
>
> (,(concat "\\\\\\<\\(alpha\\|beta\\|gamma\\)\\>")
There's something missing up there. I'll try with just
"\\\\\\<\\(alpha\\|beta\\|gamma\\)\\>"
The first four backslashes translate to one escaped backslash:
(rx "\\" ...)
(two backslashes, because of Lisp string literal syntax)
Now comes a word start ("word-start" or "bow"; I'll go with the
more readable "word-start"):
(rx "\\" word-start ...)
Next is a group, followed by a word-end:
(rx "\\" word-start (group ...) word-end)
Within the group, there is an alternative:
(rx "\\"
word-start
(group
(or ...))
word-end)
Now the alternative's content:
(rx "\\"
word-start
(group
(or "alpha" "beta" "gamma"))
word-end)
You can check that by evaluating it in a Emacs Lisp buffer (e.g.
this *scratch* buffer Emacs comes up at start): put point after
the whole expression and hit C-x e. You get:
"\\\\\\<\\(\\(?:\\(?:alph\\|bet\\|gamm\\)a\\)\\)\\>"
There are some spurious non-capturing groups (?: ...), and it
even factored out the trailing -a from "alpha"... etc., but
should be equivalent.
Does it help?
Cheers
- t
signature.asc
Description: Digital signature
- Re: Including tex commands in a list, (continued)
- Re: Including tex commands in a list, steve-humphreys, 2021/01/28
- Re: Including tex commands in a list, Michael Heerdegen, 2021/01/29
- Re: Including tex commands in a list, steve-humphreys, 2021/01/29
- Re: Including tex commands in a list, Michael Heerdegen, 2021/01/29
- Re: Including tex commands in a list, steve-humphreys, 2021/01/29
- Re: Including tex commands in a list, Michael Heerdegen, 2021/01/29
- Re: Including tex commands in a list, steve-humphreys, 2021/01/29
- Re: Including tex commands in a list, steve-humphreys, 2021/01/29
- Re: Including tex commands in a list, tomas, 2021/01/29
- Re: Including tex commands in a list, steve-humphreys, 2021/01/29
- Re: Including tex commands in a list,
tomas <=