[OS X TeX] Automatic indentation of TeXShop macros

Claus Gerhardt gerhardt at math.uni-heidelberg.de
Sun Oct 29 19:41:53 EST 2006


Though I don't understand the need for your request in case of your  
particular example, I have written an Applescript that inserts the  
contents of any file at the position of the cursor in TS.

Claus

--AppleScript
-- Apply only to an already saved file
-- Claus Gerhardt, October 2006
(*This script pastes  the text in the file "~/Documents/fileName"  
into front most document in TeXShop at the position of cursor. The  
script needs BBEdit. Enable acces for assistive devices in "Universal  
Access" has to be checked in the System Preferences.*)

set fileName to "myName" --enter fileName

set scriptPath to (do shell script "dirname " & "~/Documents/ex")
set scriptPath to scriptPath & "/" & fileName
set theFile to scriptPath as POSIX file


tell application "BBEdit"
	open the file theFile
	select text 1 of text window 1
	extended copy of selection
	close document of text window 1
end tell

tell application "TeXShop"
	activate
	tell application "System Events"
		tell process "TeXShop"
			keystroke "v" using command down
		end tell
	end tell
end tell


On Oct 29, 2006, at 15:40, Alan Munn wrote:

> I have a bunch of macros defined for commonly used structures.  Is  
> there any way to have them inserted so that they line up with the  
> current tab stop?  So for example, if I have a nested itemize  
> structure, and I insert another \begin{itemize}\end{itemize} pair  
> with a macro, it will line up at the beginning of the line and not  
> aligned with the \item which has been tabbed out 1 tab stop as  
> below (may need monospaced font for this to be clear)
>
> Alan
>
>
> \begin{itemize}
>        \item
>        ^can it line up here?
> ^instead of here?
> \end{itemize}
> -- 
> Alan Munn amunn at msu.edu
> Department of Linguistics
> and Germanic, Slavic, Asian and African Languages   Fax.   
> +1-517-432-2736
> Michigan State University, East Lansing MI 48824       Tel.   
> +1-517-355-7491
> ------------------------- Info --------------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>          & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Archive: http://tug.org/pipermail/macostex-archives/
>

------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the MacOSX-TeX mailing list