Discussion:
[AUCTeX] `\pause' instead of `\pause{}'
Denis Bitouzé
2017-06-13 12:27:45 UTC
Permalink
Hi,

as stated in Beamer's documentation, the syntax of the \pause command
is:

┌────
│ \pause[⟨number⟩]
└────

Hence, after

┌────
│ C-c C-c pau TAB ENT
└────

shouldn't AUCTeX insert `\pause' instead of `\pause{}'?

All the best.
--
Denis
Arash Esbati
2017-06-13 20:51:34 UTC
Permalink
Post by Denis Bitouzé
as stated in Beamer's documentation, the syntax of the \pause command
┌────
│ \pause[⟨number⟩]
└────
Hi Denis,

my apologies if you receive this message comes twice. Thanks for the
report. I've just fixed this bug in style/beamer.el[1].
Post by Denis Bitouzé
Hence, after
┌────
│ C-c C-c pau TAB ENT
└────
shouldn't AUCTeX insert `\pause' instead of `\pause{}'?
Have you set `TeX-insert-braces' to t? In this case, AUCTeX will insert
a pair of empty braces. They don't harm, just look odd, probably. If
you don't like this, customize `TeX-insert-braces-alist' or add
something like this to your init file:

(eval-after-load "beamer"
'(add-to-list 'TeX-insert-braces-alist '("pause" . nil)))

Best, Arash

Footnotes:
[1] http://git.savannah.gnu.org/cgit/auctex.git/commit/?id=4ddee01e68d34a91e75f92af58157d5985c5e6e2
Denis Bitouzé
2017-06-14 07:42:01 UTC
Permalink
Post by Arash Esbati
Post by Denis Bitouzé
as stated in Beamer's documentation, the syntax of the \pause command
┌────
│ \pause[⟨number⟩]
└────
Hi Denis,
Hi Arash,
Post by Arash Esbati
my apologies if you receive this message comes twice.
No problem.
Post by Arash Esbati
Thanks for the report. I've just fixed this bug in
style/beamer.el[1].
Nice!

BTW, what will be the effect of replacing:

┌────
│ '("pause")
└────

by:

┌────
│ '("pause" ["Slide number"])
└────
Post by Arash Esbati
Post by Denis Bitouzé
Hence, after
┌────
│ C-c C-c pau TAB ENT
└────
shouldn't AUCTeX insert `\pause' instead of `\pause{}'?
Have you set `TeX-insert-braces' to t?
Well, I don't think so: I couldn't find `TeX-insert-braces' neither in
`emacs-leuven':

┌────
│ http://emacs-leuven.readthedocs.io/en/latest/
└────

nor in my `.emacs'.
Post by Arash Esbati
In this case, AUCTeX will insert a pair of empty braces.
Is `TeX-insert-braces' the only one which inserts a pair of empty
braces? Because, with my current configuration, even with a dummy
command:

┌────
│ C-c RET foo RET
└────

inserts \foo{}.
Post by Arash Esbati
They don't harm, just look odd, probably.
Indeed.
Post by Arash Esbati
If you don't like this, customize `TeX-insert-braces-alist' or add
(eval-after-load "beamer"
'(add-to-list 'TeX-insert-braces-alist '("pause" . nil)))
Works like a charm, thanks!

All the best.
--
Denis
Ikumi Keita
2017-06-14 13:52:38 UTC
Permalink
Hi Denis,
Post by Denis Bitouzé
Post by Arash Esbati
Have you set `TeX-insert-braces' to t?
Well, I don't think so: I couldn't find `TeX-insert-braces' neither in
┌────
│ http://emacs-leuven.readthedocs.io/en/latest/
└────
nor in my `.emacs'.
The default value of `TeX-insert-braces' is t, so I suppose that the
option has a value of t on your machine.
Post by Denis Bitouzé
Post by Arash Esbati
In this case, AUCTeX will insert a pair of empty braces.
Is `TeX-insert-braces' the only one which inserts a pair of empty
braces? Because, with my current configuration, even with a dummy
┌────
│ C-c RET foo RET
└────
inserts \foo{}.
That's the effect of `TeX-insert-braces' being t. If you customize it
to nil, the empty braces don't appear.

Regards,
Ikumi Keita
Denis Bitouzé
2017-06-14 16:36:10 UTC
Permalink
Post by Arash Esbati
Hi Denis,
Hi Ikumi,
Post by Arash Esbati
Post by Denis Bitouzé
Post by Arash Esbati
Have you set `TeX-insert-braces' to t?
Well, I don't think so: I couldn't find `TeX-insert-braces' neither in
┌────
│ http://emacs-leuven.readthedocs.io/en/latest/
└────
nor in my `.emacs'.
The default value of `TeX-insert-braces' is t, so I suppose that the
option has a value of t on your machine.
I see :)
Post by Arash Esbati
Post by Denis Bitouzé
Post by Arash Esbati
In this case, AUCTeX will insert a pair of empty braces.
Is `TeX-insert-braces' the only one which inserts a pair of empty
braces? Because, with my current configuration, even with a dummy
┌────
│ C-c RET foo RET
└────
inserts \foo{}.
That's the effect of `TeX-insert-braces' being t. If you customize it
to nil, the empty braces don't appear.
OK, thanks.

In fact, there are some LaTeX \⟨command⟩s which are known to be
argumentless and for which, IMHO, after:

┌────
│ C-c RET ⟨command⟩ RET
└────

AUCTeX should insert:

┌────
│ \⟨command⟩
└────

and not:

┌────
│ \⟨command⟩{}
└────

Examples of such commands are \pause (now fixed), \frontmatter,
\mainmatter, \backmatter, \bfseries, \itshape, \ttfamily, etc.

As examples of such commands for which AUCTeX behaves well (doesn't
insert empty braces) are the font sizes switches (\tiny, \large, etc.).

All the best.
--
Denis
Arash Esbati
2017-06-14 21:13:08 UTC
Permalink
Post by Denis Bitouzé
Post by Arash Esbati
Thanks for the report. I've just fixed this bug in
style/beamer.el[1].
┌────
│ '("pause")
└────
┌────
│ '("pause" ["Slide number"])
└────
The effect is that when you invoke `C-c C-m pause RET', AUCTeX will ask
for an optional argument and it will be only inserted in square brackets
if you enter something instead of just hitting RET.
Post by Denis Bitouzé
Post by Arash Esbati
Have you set `TeX-insert-braces' to t?
Well, I don't think so
Sorry, my bad. As Keita already pointed out (thanks Keita!), the
default value of this variable is t and inserting a pair of braces is
the default behavior. I have (setq TeX-insert-braces nil) for such a
long time in my .emacs, it felt like it is the default ;-)
Post by Denis Bitouzé
┌────
│ http://emacs-leuven.readthedocs.io/en/latest/
└────
I don't use the config above, but I think it should drop this line:

(add-to-list 'LaTeX-verbatim-environments "comment")

The style had a fontification bug which is now fixed[1].
Post by Denis Bitouzé
Post by Arash Esbati
If you don't like this, customize `TeX-insert-braces-alist' or add
(eval-after-load "beamer"
'(add-to-list 'TeX-insert-braces-alist '("pause" . nil)))
Works like a charm, thanks!
You're welcome. OTOH, you could consider dropping this solution and
setting `TeX-insert-braces' to nil. Depends on your taste, of course.

Best, Arash

Footnotes:
[1] http://git.savannah.gnu.org/cgit/auctex.git/commit/style/comment.el?id=a90cab531b6365edf6a6ba66ad4c624b3c11d2cc
Mosè Giordano
2017-06-14 17:22:33 UTC
Permalink
Hi Arash,
Post by Arash Esbati
Have you set `TeX-insert-braces' to t? In this case, AUCTeX will insert
a pair of empty braces. They don't harm
This isn't always true, there are cases where an empty group does
actually harm, see for example this thread that led to introduction of
`TeX-insert-braces-alist':
https://lists.gnu.org/archive/html/auctex-devel/2013-09/msg00012.html
I'm not sure if this is the case for \pause. If so, it should
definitely be added by default to `TeX-insert-braces-alist' like in
booktabs.el, otherwise users that just don't like braces after \pause
can customize that variable.

Bye,
Mosè
Arash Esbati
2017-06-14 20:49:19 UTC
Permalink
Post by Arash Esbati
Have you set `TeX-insert-braces' to t? In this case, AUCTeX will insert
a pair of empty braces. They don't harm
This isn't always true [...]
I'm not sure if this is the case for \pause.
Hi Mosè,

thanks for pushing me to check this ;-) In case of \pause, empty braces
are not significant (at least acc. to my test).

Best, Arash
Loading...