[OS X TeX] Opustex and TexShop on OSX

Claus Gerhardt gerhardt at math.uni-heidelberg.de
Wed Jun 7 01:14:58 CEST 2006


There seems to be several errors in the shell script.

For combining several shell scripts an Applescript  seems to be best  
suited. Try the one below. TeXShop's help section explains the use  
and syntax of shell and Applescripts and their interaction very  
detailed.

The Applescript assumes that opusflex is in
~/Library/TeXShop/bin/opusflex

You have to be sure that opusflex is called with a filename not  
ending in a suffix!

The Applescript only works when called from within TS as a macro. The  
shell script pdflatexc should be present.

Claus

--Applescript
-- Apply only to an already saved file
-- Claus Gerhardt, Nov. 2003


set frontName to setname(#NAMEPATH#,#TEXPATH#)



set fileName to  #NAMEPATH#
set n to (number of characters of contents of fileName)
set fileNamequoted to quoted form of fileName
set baseName to do shell script "basename " & fileNamequoted
set m to (number of characters of contents of baseName)
set dirName to quoted form of (characters 1 thru (n - m - 1) of  
fileName as string)
set texName to baseName & ".tex"

set shellScript to "cd " & dirName & ";"
set shellScript to shellScript & "~/Library/TeXShop/bin/pdflatexc  "  
& texName
do shell script shellScript


set shellScript to "cd " & dirName & ";"
set shellScript to shellScript & "~/Library/TeXShop/bin/opusflex  " &  
baseName
do shell script shellScript

set shellScript to "cd " & dirName & ";"
set shellScript to shellScript & "~/Library/TeXShop/bin/pdflatexc  "  
& texName
do shell script shellScript


tell document frontName of application "TeXShop"
refreshpdf
end tell


on setname(x, y)
	set texName to x
	set theFile to POSIX file texName as string
	tell application "Finder"
		if the file theFile exists then
			set theAnswer to "yes"
		else
			set theAnswer to "no"
		end if
	end tell
	if theAnswer is equal to "yes" then
		set texName to quoted form of x
	else
		set texName to quoted form of y
	end if
	set frontName to do shell script "basename " & texName
	tell application "TeXShop"
		save document frontName
	end tell
	return frontName
end setname






On Jun 7, 2006, at 0:39, Teresa Clark wrote:

> Thanks Frank
>
> It's almost there. Runs on some files but not others. Frustrating.
>
> Why did you use pdftex instead of Latex, etc?
>
> The typeset encounters errors on the second pass of pdftex using  
> files I know compiled under Windows.
>>
>> -8<-----
>> #!/bin/tcsh
>> echo $1
>> set basefname="`basename "$1" .tex`"
>> pdftex "$1"
>> ~/Library/TeXShop/bin/opusflex "$basefname"
>> pdftex "$1"
>> rm "$basefname".ox*
>> -8<----
>>
> Is there a way to split the three compilations so that I can track  
> the errors. Or a pause between?
>
> From now, it could be just adjusting to a different version of TeX.
>
> Thanks again for your assistance
>
> Teresa Clark
> ------------------------- 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 macostex-archives mailing list