TransWikia.com

Combining multiple .tex files, *rendered as if they were compiled independently*

TeX - LaTeX Asked by capybaralet on December 8, 2020

I want a way to create a document that just concatenates the PDFs I would get from compiling multiple .tex files independently.

I can do this "manually" by compiling each file to produce a PDF independently, and then combining the results using pdfpages (see below), but I’d rather save myself the trouble.

documentclass{report}
usepackage{pdfpages}
begin{document}
includepdf[pages=-]{compiled_tex_file1.pdf}
includepdf[pages=-]{compiled_tex_file2.pdf}
end{document}

I’ve tried cargo-culting online examples using various combinations of standalone, subfiles, input, import, include, combine, but haven’t managed to get any of them working.

One Answer

In my opinion, this is more about manipulating PDFs than LaTeX-related. I normally use pdftk (it is called pdftk-server on the site, but it's basically a command-line version of the app) which is normally available in your distribution:

pdftk file1.pdf file2.pdf cat output file1+2.pdf

will merge the files.

If you have a full TeXLive install, you have already pdfjam, where you can do the same with

pdfjam file1.pdf file2.pdf -o file1+2.pdf

which basically is a wrapper around the pdfpages LaTeX package and can do almost everything the package can.

Both packages can select, shuffle, rotate, resize, add watermarks, and so on on the pages.

Answered by Rmano on December 8, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP