one LaTeX source file to produce two different pdf files: one main manuscript and one Supplementary Materials
Reinhard Kotucha
reinhard.kotucha at gmx.de
Tue Jul 19 09:01:56 CEST 2022
On 2022-07-18 at 21:32:52 -0700, Boris Veytsman wrote:
> 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.
Hi Boris,
there is probably a more efficient solution. What I dislike is that
you have to pass --jobname on the command line.
For people I support when writing their theses I provide two files,
thesis.tex and thesis-print.tex. The print version does not have
colored hyperlinks, for example.
The print-version adds a few commands to the preamble and then loads
thesis.tex. But you still have to compile both documents multiple
times in order to get everyting right.
But what happens if thesis-print.tex contains the line
\def\jobname{thesis} ?
The output file will still be "thesis-print.pdf" because the PDF
file is opened before this piece of code processed.
But LaTeX is using \jobname in order to determine the names of toc,
aux, ... files.
With \def\jobname{thesis} thesis-print.tex steals all the auxiliary
files from the previous run (theis.tex). This saves a lot of time.
Regards,
Reinhard
Згинуть наші вороженьки, як роса на сонці.
--
------------------------------------------------------------------
Reinhard Kotucha Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover mailto:reinhard.kotucha at gmx.de
------------------------------------------------------------------
More information about the texhax
mailing list.