[OS X TeX] Feature Request Math Bracket

Herbert Schulz herbs at wideopenwest.com
Sat Mar 15 09:17:00 EDT 2008


On Mar 15, 2008, at 6:24 AM, Charilaos Skiadas wrote:

>
> The way I have solved this in TextMate is to record a macro that is  
> triggered only when inside a math environment, and is bound to the $  
> key. This macro uses a simple search to move the caret outside the  
> math environment. So with this addition, whenever I want to start a  
> math environment I press $ (and \( ... \) is inserted), and whenever  
> I want to get out of any kind of math environment, I press $ again.  
> (And of course the interior of math environments is colored  
> different from everything else, in user-defined colors).
>
> Would something similar be possible in TeXShop?
>

Howdy,

I don't think so since I don't believe there is a way to save the  
state (e.g., mathmode, displaymathmode, textmode) once the macro  
completes (it's applescript).

What I do in TeXShop is have a macro that inserts the \([what you call  
caret]\)• (that last character is a bullet) and I then use another  
macro, assigned to a keystroke, that searches for and selects the `•'.  
I only add the final `•' if I'm going to have to skip more than a  
single character (e.g., not if I'm going to use $[caret]$) since  
either case will require one more keystroke to exit the environment.

I use the `•' search macro, and another one that searches backward for  
`•' with Command Completion to place complete environments using  
abbreviations; the `•' act as placeholders for arguments, etc. E.g.,  
typing

benu

at the start of a line and then pressing the ESC key gives

\begin{enumerate}
\item
[caret]
\end{enumerate}•

and then a second press of ESC changes that to

\begin{enumerate}[[caret]]
\item
•
\end{enumerate}•

for use with an optional argument (I use the paralist package to add  
flexibility to list environments). Then I can jump to the next part  
using my macros to search for and select the `•'s.

Right now I don't get automatic indenting, but that gives me something  
to think about.

Good Luck,

Herb Schulz
(herbs at wideopenwest.com)





More information about the MacOSX-TeX mailing list