[TxMt] LaTeX and \emph

Charilaos Skiadas skiadas at hanover.edu
Tue Sep 19 13:46:03 UTC 2006


On Sep 19, 2006, at 3:26 AM, Helge Hartmann wrote:

> No, there is no command  for \emph. I was also wondering about  
> that. But it's easy to add it yourself.

I've been wanting this myself. The command for textit is part of a  
general triple of commands "bold,underline,typewriter" that a bunch  
of languages have, and they are bound to the same keystrokes in all  
these languages. But I would be more than happy to add a command for  
emph, since it is IMO the most used way of highlighting stuff. We  
just need to find a good key equivalent for it.

Another option is to simply have ctrl-shift-W default to it. For  
those not aware of it, while ctrl-shift-W traditionally works with a  
selection, and then wraps it in a command, you can use it without a  
selection. In that case, after you've typed the command and pressed  
tab, you are taken inside the braces. In other  words, with selection  
the command inserts the snippet:
\\\\${1:text${2:bf}}}\{$TM_SELECTED_TEXT\}
and without selection, it inserts the snippet:
\\\\${1{text${2:bg}}\{$3\}

The idea the first part was that one could quickly and easily insert  
textbf and friends, but seeing how we have special commands for it  
there's no much reason to keep them here as well. So we could have  
this command default to, with selection:
\\\\${1:emph}\{$TM_SELECTED_TEXT\}
and without selection:
\\\\${1:emph}\{$2\}

So this would provide one easy way of creating emph'ed text, via ctrl- 
shift-W.
Then you/we can further add the shortcut:
e = '\\emph{$1} ';
in the LaTeX configuration file. It currently contains:
em = '\\emph{$1} ';

So right now the fastest way to produce a new emph is to type em and  
press cmd-{. We could make that even faster with the above, so that  
pressing e + cmd-{ would create an emph environment (and add an extra  
space after it, which I find I commonly need when typing).

And of course we could create a dedicated snippet, so that em+tab or e 
+tab creates an emph-ed environment, or we could bind it to one of  
the (not that many) free key equivalents. So we have:

1. Set default behavior for ctrl-shift-W.
2. Add even shorter trigger for cmd-{.
3. Add dedicated command, with tab trigger "e" or with some (??) key  
equivalent.

I personally would prefer on of the first two options, and I think  
option 1 is the more appropriate at the moment. And of course 1 and 2  
could be both implemented. Let me know what you think.

> Helge

Haris





More information about the textmate mailing list