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

Duncan Murdoch murdoch.duncan at gmail.com
Thu Dec 5 04:16:31 CET 2013


On 13-12-04 7:35 PM, Claus Gerhardt wrote:
> 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
>

I haven't tried that yet, but it does look like it would work.  Thanks 
for the suggestion.  The only problem I see is if foo.tex is itself the 
product of the preprocessing of foo.Rnw (but I am currently editing 
bar.Rnw, a chapter or subordinate file).  In that case, I don't want to 
open foo.tex, because having the intermediate file open makes it too 
tempting to edit it, and those edits will be lost the next time I run 
the preprocessor.  I wouldn't mind opening foo.Rnw, but in this 
situation, I don't think I could determine which of foo.tex and foo.Rnw 
is the desired filename, based on what information I have in bar.Rnw.

I think I'll stick with naming foo.Rnw as the "root" file.  It's not 
ideal, but it's very simple, and it does work.

Duncan Murdoch

> 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
>>
>
>
> ----------- 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