one LaTeX source file to produce two different pdf files: one main manuscript and one Supplementary Materials

Boris Veytsman borisv at lk.net
Tue Jul 19 06:32:52 CEST 2022


CWRvt> Date: Mon, 18 Jul 2022 15:14:11 -0400
CWRvt> From: "Christopher W. Ryan via texhax" <texhax at tug.org>

CWRvt> I suppose this is a question at the intersection of LaTeX, R, Sweave. So
CWRvt> not entirely sure which listserve is the best place to post it.

Well, since you posted this to a TeX list, I will propose a TeX solution.

CWRvt> Is there a way to generate two pdf files, the main manuscript and the
CWRvt> Supplementary Materials, in one fell swoop (meaning compile the Rnw file
CWRvt> just once)? Or do I need to write a separate LaTeX source file that
CWRvt> includes the supplementary graphics and compile that separately? I
CWRvt> suspect the latter is true, and the former would be expecting too much
CWRvt> magic. But thought I'd ask.

It *is* possible to compile Rnw file once and output two TeX files,
but it is far from trivial.   A much easier (and a fully TeX solution)
is to generate one TeX file, and then use it to generate two different
pdf files, one for the main text, one for supplement.  There are many
ways to do it;  I'd suggest multiaudience package written exactly for
this purpose (https://ctan.org/pkg/multiaudience).  The additional
advantage is that the resulting documents can overlap: for example,
you probably want to enter the list of authors only once for both
pdfs. 

-- 
Good luck

-Boris


More information about the texhax mailing list.