one LaTeX source file to produce two different pdf files: one main manuscript and one Supplementary Materials
Stephen Hicks
stephenhicks at gmail.com
Mon Jul 18 21:24:44 CEST 2022
In the past I've used `\jobname` as a switch to generate different outputs
from the same source file, but it requires two separate compile jobs (i.e.
`pdflatex -jobname=solutions problems.tex`, and then I'd use something like
(note: it's been a while so my syntax could be way off here)
```
\newif\ifsolutions
\def\solutionsjob{solutions}
\ifx\jobname\solutionsjob\solutionstrue\fi
```
If you really want to do it with a single pdflatex invocation, you could
potentially use `--shell-escape` with `\write18{pdflatex ...}` but this of
course opens up a security hole and I wouldn't recommend it for the benefit
you're gaining over a simple shell script (for instance).
On Mon, Jul 18, 2022 at 3:15 PM Christopher W. Ryan via texhax <
texhax at tug.org> wrote:
> I suppose this is a question at the intersection of LaTeX, R, Sweave. So
> not entirely sure which listserve is the best place to post it.
>
> For my statistical/academic work, I create a noweb .Rnw file and use an
> R -> Sweave -> pdflatex workflow (incidentally using emacs and Emacs
> Speaks Statistics as an IDE of sorts, but I think that is immaterial.)
>
> Model-fitting produces many graphs. I generate these each as their own
> pdf file, and then use
>
> \begin{figure}
> \includegraphics{}
> \caption{}\label{}
> \end{figure}
>
> blocks to include them in the manuscript.
>
> Some grpahs are for inclusion in a main manuscript, while others are
> diagnostic plots assessing the adequacy of the model that probably
> should be relegated at a separate pdf file of "Supplementary Materials".
> Many journals accept/encourage such materials these days.
>
> Is there a way to generate two pdf files, the main manuscript and the
> Supplementary Materials, in one fell swoop (meaning compile the Rnw file
> just once)? Or do I need to write a separate LaTeX source file that
> includes the supplementary graphics and compile that separately? I
> suspect the latter is true, and the former would be expecting too much
> magic. But thought I'd ask.
>
> Thanks.
>
> --Chris Ryan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20220718/8b95283f/attachment.html>
More information about the texhax
mailing list.