[OS X TeX] Re: TeXShop Engine to use Acrobat as previewer
Ramón Figueroa-Centeno
ramonf at hawaii.edu
Sat May 22 23:01:38 CEST 2010
Aloha Again,
I added some functionality to the engine I posted yesterday: assuming that
you have, like me, chosen in the preferences to have "[a]ll windows start at
fixed position" then the modifications to the engine will place the preview
in Acrobat where the preview would be in TeXShop.
----------------------------------code begins below this
line--------------------------------------------
#!/bin/bash
PATH="$PATH:/usr/texbin:/usr/local/bin"
name=$(basename "$1" .tex)
basefname="`pwd`/${name}"
# Change this line to whatever typesetting command you like that produces
PDFs.
# pdflatex --file-line-error --shell-escape --synctex=1 "$1"
# comment the line above and uncomment the one below if you wish to use an
# installed TeXShop engine. Here we use pdflatexmk as an example.
~/Library/TeXShop/Engines/pdflatexmk.engine "$1"
# Get TeXShop's PDF window position
window=`defaults read TeXShop "NSWindow Frame PdfKitWindow"`
# replace every space run by a single space
window=`echo $window | sed 's/ +/ /g'`
x=`echo "$window" | cut -d ' ' -f 1`
y=`echo "$window" | cut -d ' ' -f 2`
w=`echo "$window" | cut -d ' ' -f 3`
h=`echo "$window" | cut -d ' ' -f 4`
# Close any preview that already exists (if any) and open the new one.
/usr/bin/osascript <<END
tell application "Adobe Acrobat Pro"
activate
set pg to 1
try
set pg to page number of the PDF Window of the document "$name.pdf"
set b to bounds of the PDF Window of the document "$name.pdf"
close document "$name.pdf"
on error
set b to {$x, 0, $x + $w, $y + $h}
end try
open POSIX file "$basefname.pdf"
try
set bounds of (the PDF Window of the document "$name.pdf") to b
goto PDF Window of the document "$name.pdf" page pg
end try
end tell
END
# We close the pdf window in TeXShop
close_window="tell application \"TeXShop\" to close (every window whose name
is \"$name.pdf\")"
/usr/bin/nohup /usr/bin/osascript -e "$close_window" &
--
View this message in context: http://macosx-tex.576846.n2.nabble.com/TeXShop-Engine-to-use-Acrobat-as-previewer-tp5087826p5089223.html
Sent from the MacOSX-TeX mailing list archive at Nabble.com.
More information about the macostex-archives
mailing list