29 Comments

  1. Do you know if this will allow you to insert a page into a Beamer presentation?

    One of the things I’d like to be able to do is show graphs that fill the full page (no headers, slide design, etc.) of a slide. I’ve had the thought that since I already export graphs to pdf and import them that way, it’d be great if I could just show the graph pdf instead of showing it in a frame.

    • That’s funny, I was just trying to do that and yes it works :-):

      \documentclass[]{beamer}
      \usepackage{pdfpages}
      \begin{document}
      {
      \setbeamercolor{background canvas}{bg=}
      \includepdf[pages=1-4]{file.pdf}
      }
      \end{document}

      Found it on stackexchange. Best, Tom.

  2. Allan

    Hi Tom,

    I am preparing my manuscript for publication and my co-authors want me to remove the trailing dots and page number in the Figure legend. I tried using \renewcommand{\cftdotsep}{\cftnodots}. This does remove the dots but I get an error message saying that cftnodots is undefined. I still haven’t found a way to remove page numbers that trail after each caption.

    Also, in the figure legend each caption is labelled 1, and so forth, my co-authors want it to read Fig. 1 etc., according to the style of the journal we are submitting to. Do you have any advice as to how I clear up these details?

    I found tonnes of other stuff on your site and really appreciate your efforts. Thanks a lot.

    Allan

    • Hi Allan,

      I wasn’t able to reproduce the error you get with cftnodots, unless I don’t load the tocloft package.

      You’ll find an answer to your question on how to remove the page number in the list-of-figures / list-of-tables here.

      This comment will help you adding the word Fig. in front of the figure number.

      Best, Tom.

      • Allan

        Hi Tom,

        Thanks for your comments. I already have loaded the tocloft package, and the only thing that comes to my mind is that it may be interfering with the subfig package. One of the errors I get is that loft depth is already defined and it points towards the subfigure package that I use.

        Thanks

        Allan

      • Allan

        Sorry about my rant here Tom. I figured out how to change lof into Fig., but when I use your advice about getting rid of page numbers (from a previous advice), it completely screws up my lof. I don’t have a loc, would that be why?

        Almost ready to use OpenOffice…

        Allan

      • Hi Allan,

        Sorry for not getting back to you sooner. There is a known conflict between the subfig and the tocloft packages. Try loading the tocloft package with the subfigure option:

        \usepackage[subfigure]{tocloft}

        Or the more flexible solution from here.

        Concerning your list of figures issue, I doubt it’s because you don’t have a table of contents. They are independent, with their respective content saved in two different meta-files (*.lof and *.toc).

        I briefly tried the piece of code that I linked to in my previous comment and it works smoothly. But it’s only a minimal example and your document might have lots of other stuff that may interfere so…

        \documentclass{article}
        \usepackage{tocloft, graphicx}
        \begin{document}
        \let\Contentsline\contentsline
        \renewcommand\contentsline[3]{\Contentsline{#1}{#2}{}}
        \listoffigures
        \begin{figure}[ht]
        \begin{center}
        \includegraphics[width=0.5\textwidth]{test}
        \caption{default}
        \label{default}
        \end{center}
        \end{figure}
        \end{document}

        Do you get any errors when typesetting?

        Best, Tom.

      • Allan

        Hi Tom,

        I finally figured out how to get my tables into the main text so that endfloat isn’t affecting them. I used tabular and now my tables are where they should be, but table captions are not following the tables (I don’t want captions in list of tables as I do for the figures).

        I used this code to get FIGURE CAPTIONS in list of figures in my class file:

        \renewcommand{\@makecaption}[2]{%
        \vskip\abovecaptionskip
        \hbox to \hsize{\hfil #1\hfil}%
        \vskip\belowcaptionskip}
        \let\OrigCaption\caption
        \renewcommand{\caption}[2][X]{\OrigCaption[#2]{}}

        Is this preventing me from having TABLE captions appear below tables in the main text?

        I used the package \capt-off to get captions in TABLES inside the tabular environment such that my tabular looks like this:

         \begin{center}
          \begin{tabular}
              \toprule \toprule
        
              \bottomrule
            \end{tabular}
        \captionof{table}{Hypothesized caption}
        \label{Hypotheses}
        \end{center}

        But, I still don’t get the captions below each their table. Do you have any idea of what’s going on? It’s the last thing I need to have fixed before I can submit.

        Allan

      • Hi Allan,

        When I use the code pieces above, the caption appears below the table. Have you tried surrounding the whole thing with a table floating environment? If that doesn’t help, please provide a full minimal example that I can paste into a document and typeset.

        Thanks, Tom

      • By the way, you’ll need to surround any code that has “@” within your tex-document by \makeatletter...\makeatother. Tom.

      • Allan

        Hi Tom,

        I finally solved the problem. Because I use endfloat latex put both figure and table captions in listoffigures and listoftables (and figures and tables on subsequent pages). To avoid tables being affected by endfloat I avoided the table environment and sufficed with tabular. Using this approach tables remained in text, but not the captions. So here’s what I did in my class file to solve that:

        \RequirePackage{caption}
        \DeclareCaptionTextFormat{empty}{}
        \captionsetup[figure]{labelsep=none,textformat=empty}
        \captionsetup[table]{list=no}
        
        % Use the full caption text (instead of the list-of text)
        % for the List of Figures
        \DeclareCaptionOption{fulltextforlist}[]{%
         \let\OrigCaption\caption
         \renewcommand{\caption}[2][X]{\OrigCaption[##2]{}}}
        \captionsetup[figure]{fulltextforlist}

        Now it all works

        Allan

  3. vishal

    I am trying this code but it does not work with pdflatex

    \documentclass{article}
    \usepackage[final]{pdfpages}
    \begin{document}
    \begin{figure}
     \centering
     \includepdf{incylinder.pdf}
    \end{figure}
    \end{document}

    Please help me include pdf

    • tom

      Hi Vishal,

      If your PDF covers the whole page, you should remove the figure environment. In case your PDF contains a figure that you’d like to add to your document, use the graphicx package instead.

      \documentclass{article}
      \usepackage{graphicx}
      \usepackage[final]{pdfpages}
      \begin{document}
      
      %Full page include
      \includepdf[pages=-]{incylinder.pdf}
      
      %Regular figure
      \begin{figure}[ht]
      \centering
      \includegraphics[width=0.5\linewidth]{incylinder}
      \caption{default}
      \label{fig:cylinder}
      \end{figure}
      \end{document}
      • vishal

        I tried your code does not work pdflatex. When I eliminate the figure section it does and generate dvi and the pdf it gives me blank page as output.

        Thank you

      • tom

        If \includepdf is wrapped in a \begin{figure} ... \end{figure}, the output is blank on my system. Once I removed that, it worked. Not sure what the problem is if that didn’t help. The log file my give you some clue…

        Cheers, Tom

  4. Esben Poulsen

    Dear Tom,

    Thanks for the epic trick! It works like a charm.

    One tiny (but probably tricky request): Is it possible to have the header/footer/page numbers of the main tex file overlay the inserted full page pdf?

    I need this because I am including papers into my PhD-thesis, and I don’t want the reader to be confused by the papers page numbers :).

    Thanks!
    /Esben

  5. Esben Poulsen

    Got it!

    \includepdf[pages=-,frame=true,scale=0.9,pagecommand={}]{include/papers/paper.pdf}

    is what I needed 🙂

    • tom

      Hi Sven,

      Thanks for your comment. Use pax to keep links in PDFs. Check the readme/documentation for details on how it works.

      HTH,
      Tom

  6. SARTORETTO FLAVIO

    Using \includepdf, by pdflatex on Mac, I obtain one page with all pdf pages superimposed.
    Any hint to fix this problem?
    Thank you in advance

    • tom

      Hi Flavio,

      Thanks for your comment. You can find a possible solution here. If this doesn’t solve the problem, please provide a minimal working example. To help, I need to replicate the problem on my computer.

      Best,
      Thomas

Leave a Reply