[OS X TeX] command completion file for inline and display math mode
herbs at wideopenwest.com
Thu Jan 19 20:00:39 EST 2012
On Jan 19, 2012, at 6:10 PM, Dilan Fernando wrote:
> Hello All,
> Does anybody know how to achieve the following:
> I want to be able to write something like \mathin (or some other
> appropriate key board short cut)
> and hit the trigger key and get $$ for the inline math mode with the cursor
> conveniently placed inside the
> double dollar signs and a 'mark' out side the environment to move out of
> the in- line
> math mode quickly.
> Also, how does one do the same for the display math mode ($$ $$)?.
> May be this question has already been asked or may be this command
> already exists. But I was not able to figure it out.
> Any help is greatly appreciated.
> Dilan Fernando
> University of Missouri, Columbia
> Mathematics Department.
Ummm... what Editor are you using?
If you are using TeXShop the there are two ways to go: use a macro or a keybinding.
You can create a simple macro by clicking on Macros->Open Macro Editor… and then open a new macro (press the + sign in the lower left. Then simply enter $#SEL##INS#$ and choose a keyboard shortcut (e.g., Cmd-9) and save the macro. You can do a similar thing for displayed math equations using $$#SEL##INS#$$ (and assign, e.g., Cmd-0). Then Save the macros. Thereafter pressing Cmd-9 or Cmd-0 will insert what you wish. This is the method I use but I use \(#SEL##INS#\) and \[#SEL#INS#\] for the two commands.
To use a keybinding open the Key Bindings Editor with Source->Key Bindings->Edit Key Bindings File… and add a key binding such that pressing $ will produce $#SEL##INS#$ and Save it. From then on pressing $ will produce $(your selection and then your cursor)$, Pressing $ twice will give you the displaymath version. Finally, if you `escape' the $ by placing a \ in front of it (\$) it will simply produce \$ to pring a $ sign in the text.
You could produce the things using Command Completion but I think that's a waste in this case.
(herbs at wideopenwest dot com)
More information about the MacOSX-TeX