# include number - Inserting a pdf file in latex

## includegraphics pages (5)

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.

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?

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...

There is an option without additional packages that works under pdflatex

\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

For putting a whole pdf in your file and not just 1 page, use:

\usepackage{pdfpages}

\includepdf[pages=-]{myfile.pdf}


Expanding lolo's answer from above, here is a little more automation if you have to include a lot of files:

<script>
$(function(){ var includes =$('[data-include]');
jQuery.each(includes, function(){
var file = 'views/' + $(this).data('include') + '.html';$(this).load(file);
});
});
</script>


And then to include something in the html:

<div data-include="header"></div>
<div data-include="footer"></div>


Which would include the file views/header.html and views/footer.html