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

Duncan Murdoch murdoch.duncan at gmail.com
Tue Dec 3 18:38:18 CET 2013


On 03/12/2013 12:08 PM, Herbert Schulz wrote:
> On Dec 3, 2013, at 10:26 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>
> > I'm writing a TeXShop engine for Sweave.  On a complicated project, it might be that the current file is Chapter.Rnw, but the engine will eventually run pdflatex on Book.tex, producing Book.pdf.  My engine can determine all of these names from the Chapter.Rnw file.
> >
> > Is there a way for the engine to tell TeXShop that the PDF from the current typesetting operation is Book.pdf?
> >
> > I have found that using Applescript to open Book.pdf is not quite right:  if the preview was already open from typesetting Book.tex, then I get a second copy.  (I don't get two copies from "open"ing it twice; there's something different about the way TeXShop opens it as a preview than opening it just as a file on its own.)
> >
> > Thanks for any help.
> >
> > P.S.  I posted a very similar question on tex.stackexchange.com yesterday but got no responses; I hope it's not rude to post here as well.
> >
>
> Howdy,
>
>  From what you say I assume you are starting with a Book.tex file and ending with a Book.pdf file. If you are creating an engine that takes you from Book.tex->Book.pdf running Sweave, pdflatex, etc., in between TeXShop should update the resulting Book.pdf automatically.

No, I start with Chapter.Rnw, and Book.pdf gets produced.
>
> Could you let me know what the processing steps are for using Sweave, etc., in this engine? I wonder if a latexmk engine could be built to take care of all of the necessary processing.

They are very simple:  I just pass a function call on the command line 
to Rscript, e.g.

Rscript -e 'SweavePDF("Chapter.Rnw")'

and R runs Sweave on Chapter.Rnw, which tells it that Book.tex is the 
main .tex file, so then it runs pdflatex on Book.tex, which produces 
Book.pdf.   Presumably what SweavePDF does could all be done via 
makefiles, so I guess latexmk could do it as well, but there would still 
be the problem that I start from asking to typeset Chapter.Rnw, and end 
up producing Book.pdf.

Duncan Murdoch



More information about the macostex-archives mailing list