[OS X TeX] Applescript/Texshop/outlines
msharpe at ucsd.edu
Fri Jan 27 11:53:32 EST 2012
On Jan 27, 2012, at 8:19 AM, Stephen Lienhard wrote:
> I use the LaTeX outlines package extensively. It basically allows one to use \1 \2 \3 \4 at the beginning of a line to indicate the levels of outline.
> When I type up my content I never use soft returns so each line is continuous beginning with \1 .. \4.
> I would like to develop a way to "promote" or "demote" either the current line or a selection of lines. ie for promoting I would add 1 to \1 to make it \2, etc..
> Does anyone have any hints at where to begin to add this functionality to Texshop?
> Ideally I would like to invoke a script or command when I am anywhere on the line for a single line. For a group of lines, I would like to be able to begin highlighting anywhere on a line and end anywhere as well and do this to the line.
> Any helps or hints would be appreciated.
That could be achieved without much trouble as an AppleScript macro in the Macros menu.
1. Use the search verb from TeXShop's AppleScript dictionary to grab the text from the beginning of the first line before the beginning of the selection to the end of the last line after the end of the selection and copy that into Applescript.
2. Break that into individual paragraphs (ie, split at linefeeds).
3. If the line starts with \ parse the following number and change as appropriate.
4. Write back to the document.
More information about the MacOSX-TeX