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

Herbert Schulz herbs at wideopenwest.com
Mon Jun 4 15:47:53 CEST 2012

On Jun 4, 2012, at 8:29 AM, Nicolae Garleanu wrote:

> Hi,
> I don't think this is worth much of anyone's time, so let me rephrase succinctly what I was looking for: a macro that replicates exactly the behavior of my typing in hand <Enter> followed by "\item". For instance, if I first type
> "
> \begin{itemize}
>  \item
> "
> with the indentation of "\item" added by hand, and then type <Enter>, then the cursor is not placed at the beginning of the line, but directly under "\" in "\item". My macro, on the other hand, puts everything at the beginning of the line. I think that the `right' macro, if it exists, would mimic the behavior of TexShop when I type directly — how does TexShop end up preserving the indentation?
> I think that Tidy would achieve a certain look close to, if not identical to, what I wish for, but I would prefer the formatting to happen in real time and not to have to go through additional motions such as selecting text, etc.
> Nicolae


Hmmm... Please try the following... Go to ~/Library/TeXShop/CommandCompletion and replace the CommandCompletion.txt file found there by the one found in the IndentedCC sub-folder. (You can always retrieve the original version of CommandCompletion.txt by quiting TeXShop, removing that CommandCompletion folder and restarting TeXShop. You can also Edit the CommandCompletion.txt file to suit your needs by using Source->Command Completion->Edit Command Completion File… .

That will indent the \item relative to the \begin{itemize} line as well as the text line that follows when you generate an itemize environment. Note: TeXshop uses Soft Wrap so a long line will wrap back to the left hand side and not be indented.

You may also wish to change the ``size'' of an indent tab in TeXShop->Preferences->Source->Editor->Tab Spaces:.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)

More information about the macostex-archives mailing list