|
Applescript fot BBEit+TeXShop+pdfsync: msg#00390tex.macosx
Below is an Applescript for people using BBEdit as editor. The tex file has to be a TeXShop file, but it can be opened, saved and edited in BBEdit. The script runs pdflatex - or a shell script of your choice - and catches any latex errors for BBEdit. If there are no errors, then it tells TeXShop to open resp. refresh the tex file, tpyesetting it again, and putting the cursor in the same line as it was in BBEdit. That way you can use pdfsync. If you don't want pdfsync, then the typesetting part in TeXShop can be commented, or you can use an altered copy of the script. When I tested the script, TeXShop's preferences weren't set for external editor - only the preview update was checked. My TeX-Scripts-BBEdit should be installed. Claus -- Applescript -- The file has to be a TeXShop file, but can be opened, saved and edited in BBEdit. -- pdflatex_special -- Claus Gerhardt, Nov. 2004 (* The subroutine setnamebbedit returns baseName, texName, pdfName, namePath, dirName, dirNameunquoted, and saves the document of window texName. *) set previewer to "TeXShop" --set previewer to "Acrobat 6.0.1 Professional" --set previewer to "Preview" if previewer is equal to "Acrobat 6.0.1 Professional" then set process_name to "acrobat" else set process_name to previewer end if tell application "BBEdit" get file of window 1 set filepath to result set fileName to POSIX path of filepath as string set scriptPath to (do shell script "dirname " & "~/Library/TeXShop/Scripts/ex") set scriptPath to scriptPath & "/setnamebbedit.scpt" set scriptName to POSIX file scriptPath as alias set scriptLiB to (load script scriptName) tell scriptLiB set {baseName, texName, pdfName, namePath, dirName, dirNameunquoted, logName, logPath, rtfName} to setnamebbedit(fileName) end tell select document texName set sourceLine to startLine of selection as number set texPath to namePath & ".tex" set texFile to texPath as POSIX file set shellScript to "cd " & dirName & ";" set shellScript to shellScript & "~/Library/TeXShop/bin/pdflatexc " & texName do shell script shellScript set logFile to logPath as POSIX file set findString to "Emergency stop" set findString to "'Emergency stop'" set foundText to "no error" try set shellScript to "cd " & dirName & ";" set shellScript to "/usr/bin/egrep -w -n " & findString & " " & logPath do shell script shellScript set foundText to result as string set n to (number of characters of contents of foundText) set i to 1 as number repeat while i < (n + 1) if character i of foundText is equal to ":" then set k to i exit repeat else set i to (i + 1) end if end repeat set lineNumber to (characters 1 thru (k - 1) of foundText as string) set theLine to lineNumber as number end try if foundText is equal to "no error" then set thePDF to POSIX file pdfName as alias set scriptPath to (do shell script "dirname " & "~/Library/TeXShop/Scripts/ex") set scriptPath to scriptPath & "/preview_bbedit.scpt" set scriptName to POSIX file scriptPath as alias set scriptLiB to (load script scriptName) tell scriptLiB preview_bbedit(texName, thePDF, previewer, process_name) end tell tell application "TeXShop" activate open texFile tell front document of application "TeXShop" refreshtext end tell typeset front document end tell tell front document of application "TeXShop" refreshtext goto line sourceLine end tell else beep do shell script "bbedit " & "+" & theLine & " " & logPath end if end tell --------------------- 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 Post: <mailto:MacOSX-TeX-yNUTs0qEFpZ/1wmUHrjjoYdd74u8MsAO@xxxxxxxxxxxxxxxx>
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: New TeX i-Package version in the *EXPERIMENTAL* i-Directory, Piet van Oostrum |
|---|---|
| Next by Date: | Re: Applescript fot BBEit+TeXShop+pdfsync, Claus Gerhardt |
| Previous by Thread: | Re : newbie question about installing musixtex, delanoy-Y6odx2uUvR80qePryEAPxVAUjnlXr6A1 |
| Next by Thread: | Re: Applescript fot BBEit+TeXShop+pdfsync, Claus Gerhardt |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |