I am trying to insert a PDF or doc file as an appendix in my LaTeX file. Do you know how I can do this?
- 16Are you just appending the pdf, or do you want to embed it like a picture?zdav– zdav2010-04-29 16:52:10 +00:00Commented Apr 29, 2010 at 16:52
- 17Note to anyone thinking of suggesting we migrate this to text.stackexchange - we can't. It's from 2010 which makes it far too old to migrate.ChrisF– ChrisF2015-03-27 17:11:16 +00:00Commented Mar 27, 2015 at 17:11
- 1See also: Insert PDF file in LaTeX documentMartin Thoma– Martin Thoma2016-01-22 19:36:39 +00:00Commented Jan 22, 2016 at 19:36
- See also: tex.stackexchange.com/questions/8662/…0 _– 0 _2017-09-17 16:38:38 +00:00Commented Sep 17, 2017 at 16:38
7 Answers
Use the pdfpages package.
\usepackage{pdfpages} To include all the pages in the PDF file:
\includepdf[pages=-]{myfile.pdf} To include just the first page of a PDF:
\includepdf[pages={1}]{myfile.pdf} Run texdoc pdfpages in a shell to see the complete manual for pdfpages.
15 Comments
\includepdf[pages={1,3,5}]{myfile.pdf} would include pages 1, 3, and 5 of the file. To include the entire file, you specify pages={-}, where {-} is a range without the endpoints specified which default to the first and last pages, respectively.\includepdf[pages=-,scale=.8,pagecommand={}]{file}\includepdf[page={-},offset=<offset in x>mm <offset in y>mm]{myfile.pdf}pages={1-48,50-100}. Not as simple as say something like, pages={!49}, but not that arduous.For putting a whole pdf in your file and not just 1 page, use:
\usepackage{pdfpages} \includepdf[pages=-]{myfile.pdf} \includegraphics{myfig.pdf} 5 Comments
\usepackage{graphicx} is required to be able to use this commandThe \includegraphics function has a page option for inserting a specific page of a PDF file as graphs. The default is one, but you can change it.
\includegraphics[scale=0.75,page=2]{multipage.pdf} You can find more here.
Comments
I don't think there would be an automatic way. You might also want to add a page number to the appendix correctly. Assuming that you already have your pdf document of several pages, you'll have to extract each page first of your pdf document using Adobe Acrobat Professional for instance and save each of them as a separate pdf file. Then you'll have to include each of the the pdf documents as images on an each page basis (1 each page) and use newpage between each page e,g,
\appendix \section{Quiz 1}\label{sec:Quiz} \begin{figure}[htp] \centering{ \includegraphics[scale=0.82]{quizz.pdf}} \caption{Experiment 1} \end{figure} \newpage \section{Sample paper}\label{sec:Sample} \begin{figure}[htp] \centering{ \includegraphics[scale=0.75]{sampaper.pdf}} \caption{Experiment 2} \end{figure} Now each page will appear with 1 pdf image per page and you'll have a correct page number at the bottom. As shown in my example, you'll have to play a bit with the scale factor for each image to get it in the right size that will fit on a single page. Hope that helps...
1 Comment
There is an option without additional packages that works under pdflatex
Adapt this code
\begin{figure}[h] \centering \includegraphics[width=\ScaleIfNeeded]{figuras/diagrama-spearman.pdf} \caption{Schematical view of Spearman's theory.} \end{figure} "diagrama-spearman.pdf" is a plot generated with TikZ and this is the code (it is another .tex file different from the .tex file where I want to insert a pdf)
\documentclass[border=3mm]{standalone} \usepackage[applemac]{inputenc} \usepackage[protrusion=true,expansion=true]{microtype} \usepackage[bb=lucida,bbscaled=1,cal=boondoxo]{mathalfa} \usepackage[stdmathitalics=true,math-style=iso,lucidasmallscale=true,romanfamily=bright]{lucimatx} \usepackage{tikz} \usetikzlibrary{intersections} \newcommand{\at}{\makeatletter @\makeatother} \begin{document} \begin{tikzpicture} \tikzset{venn circle/.style={draw,circle,minimum width=5cm,fill=#1,opacity=1}} \node [venn circle = none, name path=A] (A) at (45:2cm) { }; \node [venn circle = none, name path=B] (B) at (135:2cm) { }; \node [venn circle = none, name path=C] (C) at (225:2cm) { }; \node [venn circle = none, name path=D] (D) at (315:2cm) { }; \node[above right] at (barycentric cs:A=1) {logical}; \node[above left] at (barycentric cs:B=1) {mechanical}; \node[below left] at (barycentric cs:C=1) {spatial}; \node[below right] at (barycentric cs:D=1) {arithmetical}; \node at (0,0) {G}; \end{tikzpicture} \end{document} This is the diagram I included
2 Comments
\includegraphics[page=2,width=0.5\textwidth,height = 0.3\textheight]{file.pdf}Write the command in the preamble of the Latex document before \begin{document}.
\usepackage{pdfpages} Add the following command to include the myfile.pdf:
\includepdf[pages={6-7}, scale=0.9, angle=-90, offset=0 0]{myfile.pdf} Here, the angle option is used to rotate the PDF pages and offset x and y coordinates are used to create margins.
