Hot answers tagged

94

graphicx knows the page option: \includegraphics[page=3]{foo} should work, or \includegraphics[page=..,trim=...,clip]{foo} for only parts of the page. If you want to include more than one page then use Package pdfpages and the command \includepdf


40

Here is a possible start: (code streamlined in edit) The idea is to use the box model of TeX. In a \vbox we construct the page. Then the \vbox self-includes itself with a scale of .7 thanks to \scalebox of package \graphicx. The box includes an hyperref link, and all reduced copies up to the tiniest work. \documentclass[a4paper]{article} \usepackage[margin=...


37

Loading the graphicx package in the preamble it is possible to import PDF images in the document: \documentclass{article} \usepackage{graphicx} \begin{document} \includegraphics[<options>]{filename.pdf} \end{document} Here <options> can be e.g. width=<width>, height=<height or page=<page number>. See the Graphics Guide for ...


35

run pdfcrop on the whole document, then every page is cropped and you can input it as usual with pdfpages. I always use the pdfcrop from Heiko Oberdiek which is already part of every TeX distribution. And, of course, Windows user need an installed Perl, eg http://www.activestate.com/perl


33

pdfpages provides the pagecommand option for \includepdf, which can be used to apply a page style for each page, to print headings and more. For example, add plain page style or your own page style to get page numbers on all included pages: \includepdf[pages=-,pagecommand=\thispagestyle{plain}]{filename}


32

You can crop/trim a pdf when including it using the trim=left botm right top. Full example: \begin{figure}[htbp] \centering \includegraphics[clip, trim=0.5cm 11cm 0.5cm 11cm, width=1.00\textwidth]{gfx/BI-yourfile.pdf} \caption{Title} \label{fig:somthing} \end{figure} Note: Figuring out how far to trim can take time. To speed things ...


32

for a single page of a multipage .pdf: \documentclass{article} \usepackage{graphicx} \begin{document} \includegraphics[page=2,scale=0.75]{bplot.pdf} \end{document} or if you want all pages: \documentclass{article} \usepackage{pdfpages} \begin{document} \includepdf[pages={1-},scale=0.75]{bplot.pdf} \end{document}


27

EDIT ... include a more sinister version... I'm not sure if this is what you want. Strictly speaking, this file does not include itself. It includes its own output. This is what your images suggest you want but your description is ambiguous. Anyway, since you mention using this with bashful, I thought I might as well use bashful. This needs to be ...


26

You can use the pagecommand key to declare the desired page style for the included pages: \documentclass{book} \usepackage[a6paper]{geometry}% just for the example \usepackage{fancyhdr} \usepackage{pdfpages} \pagestyle{fancy} \fancyhf{} \fancyhead[C]{Some centered header} \fancyfoot[C]{\thepage} \begin{document} \includepdf[pages=-,pagecommand={\...


25

You can use the pagecommand key: \includepdf[scale=0.8,pages=1,pagecommand=\subsection{blub}]{testpdf} You get the empty page when you use \includegraphics because the graphics is too large for the textbody, so latex tries if it fits on the next page (and then complain). pdfpages hides the size of the graphics so it is possible to insert complete pages ...


23

Using your current settings, the pdfpages inserts the pages of an external PDF file as full page additions to your existing document. That is, the external file page setup is copied to the "main" output PDF on a page-by-page basis. The "main" file's page setup (including header/footer) is ignored. If you wish to include the same header/footer style of your ...


21

As already said by others in the comments you need to use \includegraphics directly because \includepdf uses a page of its own. You can use a tabular to get the 2x2 layout and use the page=<number> key to select the page: \documentclass{article} \usepackage{graphicx} \usepackage{blindtext} \begin{document} \blindtext \begin{figure}[h] \centering ...


21

Apologies to David Gilmour \documentclass[tikz,border=4mm]{standalone} \begin{document} \def\dsotm{\node[scale around={\x:(0,-1)}, draw=white,ultra thin] at(0,0){\includegraphics[height=4cm]{dsotm}};} \tikz{\foreach\x in{2,1.75,...,0.25}{\dsotm}} \end{document}


20

\documentclass[a4paper]{article} \usepackage[1-10]{pagesel} \begin{document} % text \end{document} Thanks to Heiko Oberdiek. Remember, though, that references and table of contents will be incomplete. An alternative way is to compile the whole document and load its first ten pages in another one via pdfpages.


20

Have a look at the pdfpages package \documentclass{article} \usepackage{pdfpages} \begin{document} \includepdf[<options>]{<file>} Your Text \end{document} Edit Miguel suggested graphicx to include a graphic which is correct, the difference between graphicx and pdfpages is that graphicx puts the PDF as a graphic on a text page (maybe ...


19

The beamer user guide (p.19) provides a solution: Commands like \includepdf only work outside frames as they produce pages “by themselves.” You may also wish to say \setbeamercolor{background canvas}{bg=} when you use such a command since the background (even a white background) will otherwise be printed over the image you try to ...


18

Use in the document with pdfpages \pdfinclusioncopyfonts=1. (The source of the problem is that two fonts of libertine now have the same internal fontname, and this leads to problems).


18

I found the solution : \setboolean{@twoside}{false} And \includepdf[pages=-, offset=75 -75]{file.pdf} And it works !


18

A bit out of topic, since it is a MetaPost example and it is not strictly speaking a picture including itself recursively but I could not resist to have a go at it, however clumsy, the visual effects being addictive! I've borrowed the original heart-shaped picture's coding from the documentation of Stephan Hennig's wonderful texpath package, and slightly ...


17

For me the following worked just fine: \includepdf[pages=1,pagecommand=\section{Section Heading}]{testpdf} \includepdf[pages=2-,pagecommand={}]{testpdf}


17

About the tilde: Apparently the ~ is taken in its usually meaning, not as literal ~. I get a Package pdfpages Error: Cannot find file `test\nobreakspace {}it' error for a test~it file. Taking the filename verbatim should help. This can be done by \Verbdef from the newverbs package: \usepackage{newverbs} % ... \Verbdef\filename{C:/Users/MYUSER~1/AppData/...


16

You could use the pagecommand option, such as \includepdf[pagecommand={\begin{tikzpicture}...\end{tikzpicture}}]{filename}


16

If the coordinates of the valuable parts in your PDF images is fixed, then the following method can be automated. Use the following template to trim or crop images and compile it with xelatex. You will get 2 pages, one for navigation and the other one is the cropped image. % cropping.tex \documentclass{article} \usepackage{pstricks} \usepackage{...


15

The inserted link is a hyper-link, not a LaTeX \label. Therefore the \hyperlink macro works but not the \pageref. I don't think you can get the page information from a hyper-link, so I think you need to add \labels manually. This can be done best using the pagecommand key and a custom counter: \documentclass{article} \usepackage{hyperref} \usepackage{...


15

The default pagecommand uses \thispagestyle{empty} which disables page numbers, headers and footers etc. You can use pagecommand={} to overwrite this and get normal layout for these pages.


15

You can use decorations in TikZ to morph a path using random steps. Of course, you can customize these random steps. I used a \clip with hard-coded coordinates starting from the top left of the image, then top right, down to about 2/3 then left again before closing the path. If you change the width of the includegraphics, make sure to change the clipping ...


14

It occurred to me that all of the answers given so far – while in themselves valiant and skillful efforts – fail to fulfill a requirement clearly specified in the question's title: The document should include itself recursively ad infinitum. There's an obvious problem with this: as soon as the document contains a single element, say the letter “x”, it has ...


13

Spaces at file names of PDF files at \includegraphics or \includepdf are allowed, if you are using package grffile: \usepackage{grffile} \usepakcage{pdfpages} % … \includepdf[pages=-]{test this.pdf} And for more verbatim interpretation of the file name you may use \detokenize: \usepackage{grffile} \usepakcage{pdfpages} % … \includepdf[pages=-]{\...


13

Using fancyhdr you can define your own page style and move the page number/counter into the appropriate position. \usepackage{pdfpages}% http://ctan.org/pkg/pdfpages \usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr \fancypagestyle{mylandscape}{% \fancyhf{}% Clear header/footer \fancyfoot{% Footer \makebox[\textwidth][r]{% Right \rlap{\...


12

You can create entries in the table of contents (TOC) when importing a PDF. Here is an example: \documentclass{article} \usepackage{pdfpages} \begin{document} \tableofcontents \includepdf[pages=-,addtotoc={ 1,section,1,First Section Entry,p1, 1,subsection,1,Subsection Entry,p2, 2,section,1,Second Section Entry,p3}] {publishing-...



Only top voted, non community-wiki answers of a minimum length are eligible