"Nicolas Richard" <[email protected]> writes:
> as a side note on the same subject, I use the following modified
> version of TeX-parse-macro. The change is so that, when the region is
> active and TeX-insert-macro is called, a pair of braces is inserted
> around the region, even in math mode : it's a slight abuse of the
> brace insertion mechanism (which, I assume, existed to avoid space
> gobbling by TeX in non-math mode), but that abuse already existed in
> non-math mode too.
Also as a side node: AUCTeX does a bit of regex parsing to find out
about macro arguments in the LaTeX style files. For example, it
successfully finds out that \frac has two mandatory arguments, and thus
`C-c RET frac RET' inserts \frac{}{} and places point in the first pair
of {}.
But the definition of \text isn't really accessible for this regex-based
approach, thus giving AUCTeX that information manually is required.
--8<---------------cut here---------------start------------->8---
\DeclareRobustCommand{\text}{%
\ifmmode\expandafter\text@\else\expandafter\mbox\fi}
\let\nfss@text\text
\def\text@#1{{\mathchoice
{\textdef@\displaystyle\f@size{#1}}%
{\textdef@\textstyle\f@size{\firstchoice@false #1}}%
{\textdef@\textstyle\sf@size{\firstchoice@false #1}}%
{\textdef@\textstyle \ssf@size{\firstchoice@false #1}}%
\check@mathfonts
}%
}
--8<---------------cut here---------------end--------------->8---
Maybe it would be a good idea to have some alist
(("amstext" ("text" t))
("foobar" ("foo" t nil nil) ("bar" t)))
which would add \text with one mandatory arg to the symbol list if
amstext is used, \foo with 3 mandatory args if the foobar package is
used, etc.
But currently, I don't see exactly how to implement that. Is there
already a check for package "usiness"? And a function that's run
periodically/when the used packages have been altered? (I'm pretty much
lost with the auto-parsing stuff to be honest.)
Bye,
Tassilo
_______________________________________________
auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex