1

Hey I wonder why includepdf / pdfpages is not working...

In the isolated case a file works perfectly fine:

\documentclass{tudelft-report}
\usepackage{pdfpages}

\begin{document}
\frontmatter
\title[Control, fuel and landing gears]{WP3 Wing subsystems}

\author{D06}
\affiliation{Technische Universiteit Delft}
\coverimage{cover/cover}
%\makecover

\mainmatter
\chapter{Schematic of parts} 
\label{app:schematic parts}
In this appendix a schematic view of all part positions and their shape is show. Table lists the reference values.
\clearpage
\includepdf[pages={1}]{graphs_tables_figures/schematic_parts.pdf}




\end{document}

But once I uncomment the command \makecover the pdfpages fails (showing just a blank page instead of the pdf). How can I find the bug in this? And/or is there another way to "scale" an image easily to the full page?

EDIT: looking through our "official" style file I find this as \makecover:

%% Define the options for the makecover command.
\define@boolkey{cover}{back}[true]{}
\define@boolkey{cover}{nospine}[true]{}
\define@boolkey{cover}{frontbottom}[true]{}
\define@key{cover}{spinewidth}{\setlength\@cover@spinewidth{#1}}
\define@key{cover}{frontboxwidth}{\setlength\@cover@frontboxwidth{#1}}
\define@key{cover}{frontboxheight}{\setlength\@cover@frontboxheight{#1}}
\define@key{cover}{backboxwidth}{\setlength\@cover@backboxwidth{#1}}
\define@key{cover}{backboxheight}{\setlength\@cover@backboxheight{#1}}
\define@key{cover}{x}{\setlength\@cover@x{#1}}
\define@key{cover}{y}{\setlength\@cover@y{#1}}
\define@key{cover}{margin}{\setlength\@cover@margin{#1}}

\newcommand*\makecover[1][]{%
    \setkeys{cover}{#1}%
    %% Create a purple empty page without margins.
    \clearpage%
    \newgeometry{margin=0pt}%
    \pagecolor{tudelft-purple}%
    \thispagestyle{empty}%
    %% We need the this to perform coordinate calculations in TikZ.
    \usetikzlibrary{calc}%
    \begin{tikzpicture}[remember picture,overlay]
        \ifKV@cover@nospine
            \setlength\@cover@spinewidth{0pt}
        \fi
        %% If a back cover is present, stretch the cover image to extend onto
        %% the spine.
        \ifKV@cover@back
            \setlength\@cover@imagewidth{0.5\paperwidth}
            \addtolength\@cover@imagewidth{0.5\@cover@spinewidth}
        \else
            \setlength\@cover@imagewidth{\paperwidth}
        \fi
        %% If a cover image was specified, attach it to the top right of the
        %% front cover.
        \ifx\@cover@image\undefined\else
            \node at (current page.north east)[anchor=north east,inner sep=0pt]{
                \includegraphics[width=\@cover@imagewidth]{\@cover@image}
            };
        \fi
        %% The 'bies' with the TU Delft logo is inserted on top of the over
        %% image. If a back cover is present, insert the appropriate image there
        %% as well. To ensure the full bies is visible, we anchor the images to
        %% the bottom of the page.
        \ifKV@cover@back
            \node at (current page.south west)[anchor=south west,inner sep=0pt]{
                \includegraphics{cover/back}
            };
            \node at (current page.south east)[anchor=south east,inner sep=0pt]{
                \includegraphics{cover/front}
            };
        \else
            \node at (current page.south west)[anchor=south west,inner sep=0pt]{
                \includegraphics{cover/front}
            };
        \fi
        %% Calculate the coordinate of the top left corner of the front cover.
        \ifKV@cover@back
            \coordinate (top left) at ($(current page.north)+(0.5\@cover@spinewidth,0pt)$);
        \else
            \coordinate (top left) at (current page.north west);
        \fi
        \ifKV@cover@back\ifKV@cover@nospine\else
            %% If a back cover is present, calculate the coordinates of the
            %% spine box.
            \coordinate (spine top left) at ($(top left)-(\@cover@spinewidth,0pt)$);
            \coordinate (spine bottom right) at ($(top left)+(0pt,-\@cover@y)$);
            \ifKV@cover@frontbottom
                \coordinate (spine bottom right) at ($(spine bottom right)+(0pt,\@cover@backboxheight)$);
            \fi
            \coordinate (spine bottom center) at ($(spine bottom right)+(-0.5\@cover@spinewidth,0pt)$);
            %% Extend the spine box by 1pt to the left to ensure it completely
            %% covers the cover image.
            \coordinate (spine top left) at ($(spine top left)-(1pt,0pt)$);
            %% Draw a black box on the spine.
            \fill[fill=tudelft-black](spine top left) rectangle (spine bottom right);
            %% Print the title on the center right of the spine box.
            \node at (spine bottom center)[rotate=-90,anchor=east,inner sep=\@cover@margin]{
                \tudrmfamily\color{tudelft-white}\LARGE\@title
            };
        \fi\fi
        %% Calculate the coordinate of the corner where the front and back boxes
        %% meet.
        \coordinate (corner) at ($(top left)+(\@cover@x,-\@cover@y)$);
        %% Calculate the top left and bottom right coordinates of the front and
        %% back boxes.
        \ifKV@cover@frontbottom
            \coordinate (front top left) at (corner);
            \coordinate (back top left) at ($(corner)+(-\@cover@backboxwidth,\@cover@backboxheight)$);
        \else
            \coordinate (front top left) at ($(corner)+(0pt,\@cover@frontboxheight)$);
            \coordinate (back top left) at ($(corner)+(-\@cover@backboxwidth,0pt)$);
        \fi
        \coordinate (front bottom right) at ($(front top left)+(\@cover@frontboxwidth,-\@cover@frontboxheight)$);
        \coordinate (back bottom right) at ($(back top left)+(\@cover@backboxwidth,-\@cover@backboxheight)$);
        %% Draw the front box in black.
        \fill[fill=tudelft-black](front top left) rectangle (front bottom right);
        %% Calculate the width and height of the front text box.
        \setlength\@cover@fronttextwidth{\@cover@frontboxwidth}
        \addtolength\@cover@fronttextwidth{-2\@cover@margin}
        \setlength\@cover@fronttextheight{\@cover@frontboxheight}
        \addtolength\@cover@fronttextheight{-2\@cover@margin}
        %% Create the front text box.
        \node at (front top left)[anchor=north west,inner sep=\@cover@margin]{
            \begin{minipage}[t][\@cover@fronttextheight]{\@cover@fronttextwidth}
                %% Print the title and optional subtitle at the top in white.
                \tudrmfamily\color{tudelft-white}\Huge\@title
                \ifx\@subtitle\undefined\else
                    \\
                    \LARGE\@subtitle
                \fi
                %% Print the author at the bottom in cyan.
                \vfill
                \color{tudelft-cyan}\LARGE\@author
            \end{minipage}
        };
        %% Draw the back box in cyan.
        \fill[fill=tudelft-cyan](back top left) rectangle (back bottom right);
        %% Print the affiliation.
        \ifx\@affiliation\undefined\else
            \node at (back bottom right)[rotate=90,anchor=south west,inner sep=\@cover@margin]{
                \tudsffamily\color{tudelft-white}\@affiliation
            };
        \fi
        \ifKV@cover@back\ifx\@cover@text\undefined\else
            %% Calculate the width and height of the back text box.
            \setlength\@cover@backtextwidth{\@cover@backboxwidth}
            \addtolength\@cover@backtextwidth{-2\@cover@margin}
            \setlength\@cover@backtextheight{\@cover@backboxheight}
            \addtolength\@cover@backtextheight{-2\@cover@margin}
            %% Create the back text box.
            \node at (back top left)[anchor=north west,inner sep=\@cover@margin]{
                \begin{minipage}[t][\@cover@backtextheight]{\@cover@backtextwidth}
                    \tudsffamily\color{tudelft-white}\@cover@text
                \end{minipage}
            };
        \fi\fi
    \end{tikzpicture}%
    %% Restore the margins and turn the page white again.
    \restoregeometry%
    \pagecolor{white}%
}

Link to full style: Style + example use

  • You are using different packages to manage the layout of the page. On the one hand, you are using geometry and, on the other, you are using typearea to access Koma's page layout mechanisms. This is bound to lead to disputes and I imagine that it explains why stuff breaks when you \makecover. That command is invoking the facilities of geometry but you're trying to use Koma. If you need to use the class unmodified, you need to stick to geometry rather than using Koma's package. – cfr Oct 20 '14 at 0:25
  • If you can modify the class, I recommend taking the \usetikzlibrary command out of the \makecover command. Invoke it in the preamble - not in the document itself. – cfr Oct 20 '14 at 0:28
  • @cfr well leaving out the koma paging and just using a4 sheets doesn't work/solve the problem though. – paul23 Oct 20 '14 at 0:35
  • Does \makecover work without pdfpages? Can you provide a link to the class file? It will be hard for people to help if they cannot reproduce the problem. – cfr Oct 20 '14 at 0:49
1

You need to specify a page colour before loading pdfpages. It does not matter what the colour is. See page 11 of pdfpages documentation for information about why you need to do this.

\documentclass{tudelft-report}
\pagecolor{green}
\usepackage{pdfpages}

\begin{document}
\frontmatter
\title[Control, fuel and landing gears]{WP3 Wing subsystems}

\author{D06}
\affiliation{Technische Universiteit Delft}
\coverimage{example-image-b}%cover/cover}
\makecover

\mainmatter
\chapter{Schematic of parts}
\label{app:schematic parts}
In this appendix a schematic view of all part positions and their shape is show. Table lists the reference values.
\clearpage
\includepdf[pages={1}]{example-image-a}%graphs_tables_figures/schematic_parts.pdf}


\end{document}

Obviously my output includes standard images as I don't have your PDFs but it shows the solution does, indeed, work with my choice of 'green':

output with included pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.