Re: What is the ESC sequence for the "Matching Double Brakets"? From
- To: mathgroup at smc.vnet.net
- Subject: [mg113132] Re: What is the ESC sequence for the "Matching Double Brakets"? From
- From: Michael <mcdt200 at gmail.com>
- Date: Wed, 13 Oct 2010 23:28:57 -0400 (EDT)
- References: <i9278n$3ht$1@smc.vnet.net>
On Oct 12, 6:52 pm, Gianluca Gorni <gianluca.go... at uniud.it> wrote: > On 11/ott/2010, at 11.28, Peter Breitfeld wrote: > > > > > "Nasser M. Abbasi" wrote: > > >> Mathematica Experts; > > >> What is the ESC key stroke combination to enter the "Matching double > >> brackets" into my notebook? > > >> I can't find the ESC sequence for this. Are these documented somewhere= ? > > >> I remember that before when one moved the mouse over one of those > >> things, then the ESC sequence would show up at he bottom of the palett= e. > > >> (Just noticed that some do show the ESC sequence in the ballon help th= at > >> comes up when the mouse is over them, but some do not. The ballon help > >> only shows the name, but not the ESC sequence as well. Strange). > > >> thanks > >> --Nasser > > > The escape sequences are esc[[esc and esc]]esc. But you I prefer to > > add a keystroke for that. I use "Ctrl <" to produce the opening and > > closing double bracket and to position the cursor between the brackets. > > > To do that, open the Mathematica file KeyEventTranslations.tr in an > > editor and add this code: > > > Item[KeyEvent["<",Modifiers->{Control}], > > FrontEndExecute[{FrontEnd`NotebookWrite[FrontEnd`SelectedNot= ebook[], > > "\[LeftDoubleBracket]\[RightDoubleBracket]",After], > > FrontEndToken["MovePrevious"]}]] > > > WARNING: Be careful when changing this file. Make a copy of it before > > altering. If you made an error (e.g. missing a comma) Mathematica will > > not start. > > > // Peter > > -- > > _________________________________________________________________ > > Peter Breitfeld, Bad Saulgau, Germany --http://www.pBreitfeld.de > > I tried to adapt your KeyEvent to get "matching double quotes" > on my Macintosh system: > > Item[KeyEvent["\"",Modifiers->{Command,Shift}], > FrontEndExecute[{FrontEnd`NotebookWrite[FrontEnd`SelectedNoteb= ook[], > "\"\"",After], > FrontEndToken["MovePrevious"]}]] > > but it does not seem to work. What am I doing wrong? > > Gianluca Thanks Peter, this works fine for me. I didn't realise one could assign key shortcuts but that is fantastic to know now. I think the problem other users have found is with '<' requiring CTRL plus the SHIFT button as well, since it is a shift character. If the SHIFT key is omitted, it is correct that nothing happens. Beware of conflict with other keyboard shortcuts; Nasser, remember CTRL + x is already the keystroke for "cut" It's nothing new, but I modified this code to be a bit more intuitive for me: I have CTRL + [ to produce the left and right double brackets. Item[KeyEvent["[",Modifiers- >{Control}],FrontEndExecute[{FrontEnd`NotebookWrite[FrontEnd`SelectedNotebo= ok[],"\ [LeftDoubleBracket]\ [RightDoubleBracket]",After],FrontEndToken["MovePrevious"]}]] Best wishes, Michael.