help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: My humble additions to AUCTeX


From: Marcin Borkowski
Subject: Re: My humble additions to AUCTeX
Date: Wed, 15 Jan 2014 18:58:21 +0100

Dnia 2014-01-14, o godz. 11:29:09
Nicolas Richard <theonewiththeevillook@yahoo.fr> napisaƂ(a):

> Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:
> > Do I guess correctly that you did some (or more) LaTeX typesetting,
> > but not too much low-level TeX programming, dear Watson? ;)
> 
> Indeed : I did some lower level (albeit trivial) TeX programming at
> some point, but not recently -- that might explain why I thought the
> problems had disappeared. Another reason is that I had changed the
> syntax class of backslash character in my .emacs (I made it ".", i.e.
> punctuation), which explains why I use C-M-f (but that doesn't
> address most of the points you raised).

Exactly.  So I guess that now you can see the problem I'm solving;).
(Though I didn't really know about C-M-f, so thanks for that tip, too.
I'm quite used to edit human-language documents in Emacs, but not as
good as editing programs, it seems.  I'll have to reread the relevant
portions of the manual.)

> > Imagine this: <!>\these\are\four\tokens, where <!> denotes the
> > point. Then, C-M-f moves too far; I want to move by one token (i.e.
> > to get \these<!>\are\four\tokens), not by a whole string of them at
> > the same level of curly braces.
> 
> In order to move by token, I made one further change this morning in
> my local setup:
> (modify-syntax-entry ?\\ ". p" LaTeX-mode-syntax-table)
> which lets C-M-b skip the backslash ("p" here means "prefix").

Interesting.  It solves *some* problems, but not all.  For instance,
it does not (obviously) see that the second backslash in "\\whatever"
is escaped and should not be treated as the first character of a
token.

> > Also, I want to level up the word commands to token-aware commands.
> > Imagine this: \these\are\four\tokens<!>.  Now, if you press M-DEL,
> > the backslash does not get deleted; if I made its syntax "word",
> > pressing M-DEL would kill *everything* shown here. And I want to be
> > able to kill just the string "\tokens" with one keystroke.
> 
> C-M-b C-M-k would work with the above modification. Not exactly "one
> keystroke", indeed, but close enough for me.

Right, though definitely not close enough for me.  Especially that
e.g. M-b doesn't do *anything* reasonable when used on a token
beginning with a backslash, and (at least for me) it begs for a
suitable modification.  As Stefan pointed out, this is a bad idea
outside my personal setup, so I'm going to examine superword-mode to
incorporate TeX's meaning of "symbol" into its "superword" notion.

> > Last but not least, I aim at commands to work on matching pairs of
> > \left...\right, \bigl...\bigr etc. delimiters.  Therefore, I want
> > to be able to walk through the text token by token.  (I did look
> > into smartparen, and it doesn't seem to be sophisticated enough to
> > do what I need.)
> 
> To work around that problem, I write this:
> \paren{foobar} or \paren*{foobar}
> which gives (foobar) (Starred version says to adapt height to the
> content) It's as simple as loading mathtools and having
> \DeclarePairedDelimiter{\paren}{(}{)}
> in the preamble.

Interesting, I completely forgot about this feature of mathtools.
Thanks!  This, however, still does not solve the problem.  It has an
advantage of replacing the (very plain-TeX-like) \left..\right,
\bigl..\bigr etc. syntax with something much more LaTeX-y, but is not
widespread enough.  Though I might change my TeX habits, people who
send their papers to the journal I'm working for probably won't.  And
making authors stick to *any* LaTeX conventions is, well, somewhere
between impossible and inconceivable;).  (I still quite often get
papers written using LaTeX 2.09 commands.  They should have been dead
for some fifteen years now...  I also get papers with hand-crafted
section titles, complete with all caps, \vskips and of course
hardcoded section numbers, footnotes numbered by hand and inserted
using the $^1$, $^2$ syntax and similar things.)

(Also, \DeclarePairedDelimiter does not help when the delimiters *do
not pair up*, like in the left-open interval $(0,1]$, though probably
defining macros like \lointerval for that purpose would be the right
way to deal with that kind of situation, especially that you could
easily change the appearance of the parens in the intervals globally.)

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University



reply via email to

[Prev in Thread] Current Thread [Next in Thread]