[OS X TeX] TexShop: macro to insert text, preserve indentation

Herbert Schulz herbs at wideopenwest.com
Mon Jun 4 07:45:45 EDT 2012

On Jun 3, 2012, at 8:32 PM, Nicolae Garleanu wrote:

> Hi,
> I wanted to write a macro that inserts "\item" on the line below — specifically, that behaves exactly as when I type <Enter>, the type the text. When I do that, in particular, "\item" is indented just like the previous instance of "\item". For my macro, the only thing I could think of was to have an empty line followed by my text ("\item"). As some of you might guess, that does what I want save for inserting the text at the very beginning of the second line, rather than preserving the indentation as when I type it directly in the source code. (Command completion, for instance, places the first "\item" indented, all the others follow.)
> How could I get the desired behavior? I should also say clearly that the more explicit the answer, the better. (I have virtually no experience with Applescript, although I expect to be able to modify reasonably closely related code.)
> Thank you.
> Nicolae


Don't have a direct answer for you but have you tried the LaTeX Tidy Service? YOu can get it at <http://www.inf.unibz.it/~franconi/sw/Tidy.service.zip>. Once in place you can make a selection of a region go to your Apple->Services menu and select the Tidy service and that region gets re-formatted. Unfortunately I don't know how to make it format in different ways and it tends to put the text starting on the same line as the \item and indents all the \item commands.

Can you show how you'd like things to look?

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)

More information about the MacOSX-TeX mailing list