Are you a physicist or a mathematician? If so, you certainly would use LaTeX markup language to write complex text because LaTeX is excellent at handling equations, tables, and mathematical expressions. After finishing a long-form scholarly writing, you may want to include an appendix or some attachments for project work. In this situation, you can insert a PDF wrapping all information you need into the existing file. This sounds easy but may get you stumped especially when you are a novice to LaTeX typesetting system. In this article, I am going to share you with a rapid way to include PDF in LaTeX.
How to insert PDF file into LaTeX document.
LaTeX provides innumerable functionalities that are added by means of countless packages. Packages make it possible to use extra commands without having to involve tons of codes in the preamble. One of these packages is “pdfpages”, which simplifies the insertion of external PDFs in LaTeX documents. Because of the requirement of this package, you should make sure it is installed on your computer. If the “pafpages” package is not found in your package manager, go to ctan.org to download this package and install it to your TeX distribution.
To insert PDF into LaTeX, we are going to use two commands: \usepackage{padfpages} and \includepdf.
Insert a portion of PDF into LaTeX file.
Step 1.
Place the PDF in the same directory as the TeX file.
Open your TeX file with a LaTeX editor.
Step 2.
Type \userpackage{pdfpages} above \begin{document}.
Step 3.
Type \includepdf[page={page number}]{filename} between \begin{document} and \end{document}.
For instance, to include pages 1,2,4 of a file named “introduction”, input the content like:
\includepdf[page={1,2, 4}]{introduction}
Step 4.
Once you are done, save the changes.
Insert an entire PDF into LaTeX file.
Step 1.
Put the PDF in the same directory as the .tex file.
Import your TEX file to your LaTeX editing program.
Step 2.
Make sure there is the command line \userpackage{pdfpages} above \begin{document}
Step 3.
Type \includepdf[page=-]{filename} between \begin{document} and \end{document}.
For instance, to include a PDF named “introduction”, enter the content like this: \includepdf[page=-]{introduction}
Step 4.
Save your file to apply the changes made.
Now you have mastered a quick method to insert a whole PDF or specified pages into a TEX file. Whenever you face such a need, there is nothing you won’t be able to do. Hope this tutorial will help you a lot and bring a great convince to your LaTeX editing work. Perhaps there are some other ways of accomplishing the same thing. If you know it, share it with me!