[Mac OS X TeX] Using CMacTeX with TeXShop

Maarten Sneep sneep at nat.vu.nl
Wed Nov 14 08:26:21 EST 2001



Hello,

Ive written a script that will allow you to use CMacTeX with TeXShop (sort off,
it needs some more work, but it is a start). If you use networked drives, this
script needs more work for you. (don't say I didn't warn you).

The script starts after the signature. A few lines are probably too long to fit
on a single line in this mail. See the comments.

Maarten Sneep

>>>-----------------------------------------------------------------------
A prune isn't really a vegetable... Cabbage is a vegetable
>>>-----------------------------------------------------------------------
Maarten Sneep
Atomic- and Laser Physics group
vrije Universiteit, amsterdam
The Netherlands

#!/bin/sh

# this is a simple script to use CMacTeX with TeXShop.
# save this script (with unix line breaks!) to a file (cmacpdflatex) and 
# set the executable bits (chmod a+x cmacpdflatex)

# This script was written by Maarten Sneep (sneep at nat.vu.nl)
# do whatever you want with it, although I'm the irresponsible guy... ;-)

# variables

temporary_script_file="/tmp/cmactex_temp_script.$$"
dir=`pwd`
file_name="$1"

# create an AppleScript to call CMacTeX

echo "set unix_path to \"$DIR\"" > $temporary_script_file
echo "set tile_name to \"$file_name\"" >> $temporary_script_file

cat >> $temporary_script_file <<EOF
(* This is a template for a complete AppleScript. You'll need to add a few
   lines above to define unix_path and file_name. If those are defined, 
   you're set *)

(* translate the unix path to a mac path. If someone has a better idea, 
   please let me know *)
set mac_path to ""
repeat with i from 1 to ( number of characters in unix_path )
    set c to character i of unix_path
    if ( c is equal to "/" ) then
        set mac_path to mac_path & ":"
    end if
    if ( c is equal to ":" ) then
        set mac_path to mac_path & "/"
    end if
    if ( c is not equal to ":" and c is not equal to "/" ) then
        set mac_path to mac_path & c
    end if
end repeat

if ( mac_path starts with ":Volumes:" ) then
-- the next two lines should be on a single line !!
    set mac_path to (((characters 10 through (number of characters in
        mac_path)) of mac_path) as string) as alias)
else
    set mac_path to (((path to startup disk) as string) & mac_path) as alias)
end if

tell application "CMacTeX"
    activate
    exec ("pdflatex " & file_name) in the folder mac_path
end tell

(* end of the applescript *)
EOF

# run the script, dump output in the bitbucket
osascript -l AppleScript $temporary_script_file > /dev/null

# remove temp script file
rm $temporary_script_file

# last line of this script


-----------------------------------------------------------------
To UNSUBSCRIBE, send email to <info at email.esm.psu.edu> with
"unsubscribe macosx-tex" (no quotes) in the body.
For additional HELP, send email to <info at email.esm.psu.edu> with
"help" (no quotes) in the body.
This list is not moderated, and I am not responsible for
messages posted by third parties.
-----------------------------------------------------------------





More information about the MacOSX-TeX mailing list