[OS X TeX] Can a TeXShop engine give the PDF name?

Claus Gerhardt claus.gerhardt at uni-heidelberg.de
Thu Dec 5 01:35:49 CET 2013


The tex file should be opened in TeXShop, no need to be front. The command below should the last command in the osascript.

set docName to "foo.tex" -- You should omit the suffix if the suffix isn't shown Finder.
tell document docName of application "TeXShop"
	activate
	refreshpdf
end tell


I did run the command as an Applescript without a problem. If being part of the osascript should cause problems - which I don't believe - replace the osascript/shell script by an Applescript application or save only the commands above as an Applescript application and call the application by the unix command open -a fullpath.app

Claus


On Dec 5, 2013, at 0:56, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:

> On 13-12-04 6:15 PM, Chris Goedde wrote:
>> On Dec 4, 2013, at 10:47 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>> 
>>> On 04/12/2013 11:34 AM, Michael Sharpe wrote:
>>>> tell application "TeXShop"
>>>> 	try
>>>> 		open posix file "$cwd/foo.pdf"
>>>> 	on error
>>>> 	end try
>>>> 	activate
>>>> 	set index of window "$1:foo.pdf" to 1
>>>> 	tell document "$1:foo.pdf" to refreshpdf
>>>> end tell
>>> 
>>> This still seems to have the same problem, namely that if TeXShop already has processed foo.tex to produce and preview foo.pdf, then this opens a new window, also named foo.pdf.
>> 
>> I assume that you mean processing foo.tex produces and previews bar.pdf, correct?
> 
> No, I mean that I have both foo.tex and bar.Rnw.  What I want to happen is that when I typeset bar.Rnw, it runs my engine, which figures out from the contents of bar.Rnw that foo.tex is the main file, and then runs pdflatex on foo.tex producing foo.pdf, and opens that for preview.  That's what I want, that's not what actually happens.
> 
> If I use your script to open foo.pdf, it opens.  If I call your script again, foo.pdf stays open, no new preview opens.  That's all fine.
> 
> The problem is that if I open foo.tex and get TeXShop to typeset that, it opens foo.pdf for preview.  If I then open bar.Rnw and get it to use your script to open foo.pdf, I get a new window showing the same file.
> 
> I'm not on Mavericks, I'm on 10.6.8.
> 
> Duncan Murdoch
> 
>> 
>> Anyway, this is not what I see. For me under Mavericks, the first use of this script does the correct thing, the second doesn’t do anything, I guess because now its getting and catching the error Michael mentioned. I don’t see two open pdf windows, though.
>> 
>> Chris
>> 
>> 
>> ----------- Please Consult the Following Before Posting -----------
>> TeX FAQ: http://www.tex.ac.uk/faq
>> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
>> List Archive: http://tug.org/pipermail/macostex-archives/
>> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
>> List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
>> 
> 
> 
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
> List Archive: http://tug.org/pipermail/macostex-archives/
> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
> List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
> 




More information about the macostex-archives mailing list