[OS X TeX] Insert Reference Macro

Max Pagel moodgorning at alice-dsl.net
Fri Dec 4 09:03:56 CET 2009


Hey Folks,
I encountered some Problems while using the insert reference Macro  
from Texshop. After I told the macro to search inside other texfiles  
for labels too I encountered an applescript error : "Finder got an  
error. Can't get container of document foo.tex."

Accourding to http://www.apfelwiki.de/forum/viewtopic.php?f=6&t=1932&p=6653#p6653 
  I don't seem to be the only one with this Problem.
I did some research on the topic and found a solution which works for  
me.

I you open the Macro editor in texshop and edit the insert Reference  
Macro in the following way the macro should work again:
replace the line :"tell application "Finder" to set texfolder to the  
container of (texloc as alias) -- Get the folder: "path:to:""
with the following code:
set oldDelimiters to AppleScript's text item delimiters -- always  
preserve original delimiters
set AppleScript's text item delimiters to {":"}
set pathItems to text items of (texloc as text)
if last item of pathItems is "" then set pathItems to items 1 thru -2  
of pathItems -- its a folder
set texfolder to ((reverse of the rest of reverse of pathItems) as  
string) & ":"
set AppleScript's text item delimiters to oldDelimiters -- always  
restore original delimiters

see ttp://www.apfelwiki.de/forum/viewtopic.php?f=6&t=1932&p=6653#p6653  
for details. Hope this works for others too.
Best regards
Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/macostex-archives/attachments/20091204/e815d6d4/attachment.html>


More information about the macostex-archives mailing list