While we're talking about the bundle... my number one activity in writing LaTeX is going in and out of math mode as in
( blah ) and [ foo ].
What is the officially encouraged LaTeX bundle way of shortening that task?
- Eric
On Nov 6, 2005, at 11:21 PM, Eric Hsu wrote:
While we're talking about the bundle... my number one activity in writing LaTeX is going in and out of math mode as in
( blah ) and [ foo ].
What is the officially encouraged LaTeX bundle way of shortening that task?
Ah yes, excellent question. I'd like to know the answer to that myself. I guess the desired behavior (at least for me) would be: 1) Type (, and magically a ) appears, and your cursor stands between them. 2) Type in the stuff, and then press tab to move outside the ). I would expect this would be the ideal situation for an input pattern? What is the status with those, are they on the todo? At the very least it would be ideal that when ( is typed, () appears, instead of (). I actually encounter this problem when I want to describe sets in math mode, where I need to introduce {}, and instead I get {}. I remember discussing this a long time ago, and it wasn't possible to implement as smart pairs the way things were back then. Not sure if they have changed now.
Another possibility I guess would be to first type the math inside, and then have a macro similar to the Ctrl-shft-< one take care of the rest. In that case, maybe we could decide on some appropriate shortcuts for it, e.g. ctrl-shift-( for ( and ctrl-shift-[ for [ ? Same goes for the $$ pair by the way. I'd love to have a similar macro for that one. I can put one dollar sign around selected text easily enough, but for two dollar signs I'd need to select it again.
- Eric
-- Eric Hsu, Assistant Professor of Mathematics San Francisco State University erichsu@math.sfsu.edu http://math.sfsu.edu/hsu
Haris
On 07/11/2005, at 6.36, Charilaos Skiadas wrote:
[...]
- Type (, and magically a ) appears, and your cursor stands
between them. 2) Type in the stuff, and then press tab to move outside the ). I would expect this would be the ideal situation for an input pattern? What is the status with those, are they on the todo?
They are on the to-do, but it's probably not going to happen before 1.3 (I'll remove the GUI for these meanwhile).
What can be done is to let the LaTeX syntax assign a scope to \ (which is already the case in some situations), then make a snippet which is: “( $1 )” and assign that the key equivalent of ( and the scope corresponding to the scope when standing to the right of an escape character.
This should give the desired behavior.
It may be a little cumbersome for LaTeX because of the escape character being used so much, but if the constant.character.escape.latex rule was changed like this (just adding a named capture for the escape):
{ name = 'constant.character.escape.latex'; comment = <snip>; match = '(\)[^A-Za-z\n]'; captures = { 1 = { name = 'meta.escape-character.latex'; }; }; },
And a new rule was added for the case when the escape is at the end of line:
{ name = 'meta.escape-character.latex'; match = '\$'; },
Then I think the cases that arise in practice are covered.