[SVN] r2362 (Latex)

Charilaos Skiadas cskiadas at uchicago.edu
Sat Dec 3 15:39:04 UTC 2005


On Dec 3, 2005, at 3:38 AM, Jeroen van der Ham wrote:

> Maybe we shouldn't make the universal command not too universal,  
> because for the user it is hard to see what it really does.
> Right now it has mixed behavior:
> - Without a word: begin/end environment
> - With a word:
>   - If that word is in the magic list:
>      - If that word is in the \text* range, it creates a \text*  
> command
>      - If that word is one of the itemize, enumerate, etc, it  
> creates an environment.
>   - Else, create a command from that word.
>
No, that's not exactly what it does.
- without a word, inserts begin/end environment (sidenote: Maybe add  
label support? )
- With a word, it first expands the word according to the shortcuts.  
Then:
     - If the new word is in the list of commands, it creates a command.
     - Otherwise, it creates an environment. For that environment:
         - If the TM_LATEX_LABEL variable is set to 1, it adds labels  
to all environments. (btw, not sure if that is ever a desirable  
behavior, I'm more in favor of dumping it for the custom list of  
extra first lines, and have that already preset for standard stuff.)
         - If not (actually, it does this even in the TM_LATEX_LABEL  
case), then it inserts anything stored in the firstLine hash value  
corresponding to the word in the line below \begin ( to support \ 
\item and similar stuff).
> I am sure that the universal command can be written so that it does  
> the above, even in a smart way with labels and items, etc.
> But would the user really remember what it's for?
>
It's a good question, and maybe we should ask the list if they like  
it this way, and what shortcut they would want. I think they would,  
and after a while it would become an automatic reflex, just like Tab  
is an automatic reflex for snippets. All this is provided we find a  
good shortcut for it. For me they functionally do the same thing,  
they expand the current selection in an intelligent and predefined  
way, to the functional unit it stands for. If it's a command that I  
have not customized, I would be more inclined to just type out  
\theCommand{} rather than type theCommand and press a key combo, it  
does not save me enough time to make it worth it. But for the  
environments, then it's great. That's why i think defaulting to  
environment makes a lot of sense, and having a separate command for  
commands would personally confuse me. It would be like having a  
different key than tab for the tab triggers for half the commands,  
and tab for the other half, based on, say, whether the command calls  
a command-line tool or just inserts a snippet. I would just never use  
the command for commands.
> It was initially created based on the html command, where almost  
> everything is begin/end, with one or two exceptions, that are  
> widely known.
Agreed things are more clear in the html case. Though even there I  
would like to see it allowing me to customize for standard tags, and  
more generally, what attributes I want to appear in the opening tag.
> With Latex, you have about as much commands as environments and  
> when the word is unknown, it is also unknown what is meant.

True, but if the word is unknown, it is highly unlikely that the user  
would want to expand is as \command{}, it only saves 2 keystrokes at  
most. I thing expanding as command only makes sense if you have  
established shortcuts, so the user would have to customize it anyway,  
for commands they use often. For instance I use \displaystyle all the  
time, so right now I have a \renewcommand at the top to have it use  
\ds instead. I could associate a shortcut to it, and have  
\displaystyle appear everywhere in the text instead. (though  
admittedly the command would add the braces at the end, which in this  
case is not desirable, so it wasn't a very good example)

> So maybe we should create two commands, one for completing commands  
> and another for completing environments. And find some better keys  
> for this, because ctrl-< sucks.
>
I agree with the need for a better key, but I can't think of  
anything. I really believe it should be a key-combo involving either  
tab or space, but they are both so overloaded. Maybe a combination  
with backtick? I am only used to a US keyboard, in which case it's  
right about the tab, so I don't know if this would be good for other  
keyboards.
> Jeroen.

Haris


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate-dev/attachments/20051203/5a49b130/attachment.html>


More information about the textmate-dev mailing list