Wow ! Right on the spot ! Thanks very much, cyberSingularity !
- Main error = not all my PDF documents had 2 pages, whereas
sometimes the command
\IncludeMyPDFThatBugs
called for the first,
and sometimes it called for the second page.
- Many missing closing braces:
{\FirstLanguageSecondLanguage{first language}{second language}}
had
some missing closing braces.
{\FirstLanguageSecondLanguage{\textbf{first}\textbf{language}}{\textbf{second}\textbf{language}}}
had some missing closing braces.
- Elsewhere, in my main code, I had
\hyperlink{name-target}{\FirstLanguageSecondLanguage{}{}}
with some missing closing braces.
- Some missing closing braces at the end of the last argument of another of my "home-made" command, not related to \includepdf.
TextWrangler / View / Balance or Balance and fold can help in looking for the "missing closing braces". But, be sure to close TeXShop when doing that.
Here is my final code without bug: \IncludeMyPDF
%!TEX TS-program = pdflatex
\PassOptionsToPackage{table,x11names,svgnames}{xcolor}
\documentclass[10pt,twoside,openright,usletter]{book}
\usepackage{lipsum}
\usepackage{pdfpages}
\usepackage{hyperref}
\usepackage{minitoc}
\usepackage{url}
\usepackage{fancyhdr}
\hypersetup{
backref=true,
pagebackref=true,
hyperindex=true,
colorlinks=true,
breaklinks=true,
urlcolor= blue,
linkcolor= purple,
bookmarks=true,
pdftoolbar=true,
pdfmenubar=true,
bookmarksopen=true,
pdftitle={title of book},
pdfauthor={author of book},
pdfsubject={subject of book}
}
%---------------------------- begin selection of language
% 2 languages, here = second language selected
\mtcselectlanguage{english} % for minitoc
\newcommand{\FirstLanguageSecondLanguage}[2]{#2}
%---------------------------- begin macro for including a PDF document
% includepdf syntax:
% addtotoc={⟨page number⟩,⟨section⟩, ⟨level⟩,⟨heading⟩,⟨label⟩}
% addtolist={⟨page number⟩,⟨type⟩,⟨heading⟩,⟨label⟩}
%
% \IncludeMyPDF
% {1} % page number to be included
% {0.9} % scale
% {true} % landscape = true or false
% {false} % turn = true or false
% {subsection,2} % level in TOC: section, subsection, subsubsection + level 1,2,3
% {TitleTOC} % heading for TOC / list
% {Label} % label: label-toc-#7, label-list-#7, #7-target for hyperlinks
% {table} % addtolist = table or figure
% {mindmaps.pdf} % file
\newcommand{\IncludeMyPDF}[9]{%
\newpage\hypertarget{#7-target}
{\includepdf[pages={#1},nup=1x1,
scale=#2,landscape=#3,turn=#4,
pagecommand={\thispagestyle{fancy}},
addtotoc={#1,#5,#6,label-toc-#7},
addtolist={#1,#8,#6,label-list-#7}]
{#9}}}
%---------------------------- end macro for including a PDF document
\title{Title of book}
\author{Author of book}
\date{\today}
\begin{document}
\frontmatter
\maketitle
\cleardoublepage
\dominitoc
\dominilof
\tableofcontents
\mainmatter
\cleardoublepage
\chapter{Chapter one}
\minitoc
\cleardoublepage
\section{Section one Chapter one}
\lipsum
\IncludeMyPDF
{2}
{1}
{false}
{false}
{subsection,2}
{\FirstLanguageSecondLanguage{Nam dui ligula, fringilla}{Hamlet speaks this on his entry to Act 3 scene 1}}
{table-mind-one}
{table}
{mindmaps.pdf}
\IncludeMyPDF
{1}
{0.9}
{false}
{true}
{subsection,2}
{\FirstLanguageSecondLanguage{Nam dui ligula, fringilla a}{Hamlet speaks this on his entry to Act 3 scene 1}}
{figure-mind-one}
{figure}
{mindmaps.pdf}
\chapter{Chapter two}
\minitoc
\cleardoublepage
\section{Section one Chapter two}
\lipsum
\section{Section two Chapter two}
\lipsum
\IncludeMyPDF
{1}
{0.9}
{false}
{true}
{subsection,2}
{\FirstLanguageSecondLanguage{Nam dui ligula, fringilla}{To be, or not to be, that is the question}}
{figure-mind-two}
{figure}
{mindmaps.pdf}
\IncludeMyPDF
{1}
{0.9}
{false}
{true}
{subsection,2}
{\FirstLanguageSecondLanguage{Nam dui ligula, fringilla}{To be, or not to be, that is the question}}
{table-mind-two}
{table}
{mindmaps.pdf}
\IncludeMyPDF
{2}
{0.9}
{false}
{true}
{subsection,2}
{\FirstLanguageSecondLanguage{Nam dui ligula, fringilla}{To be, or not to be, that is the question}}
{nrp-algo}
{figure}
{mindmaps.pdf}
\cleardoublepage
\listoftables
\addcontentsline{toc}{chapter}{List of Tables}
\cleardoublepage
\listoffigures
\addcontentsline{toc}{chapter}{List of Figures}
\cleardoublepage
\end{document}
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':
Best Answer
Note the warning issued by
pdfpages
in your.log
:Being in DVI mode suggests you're compiling this using
latex
. You should compile usingpdflatex
.If you have EPS figures that you want to include and feel that this forces you to use a
latex
->dvips
->ps2pdf
compilation sequence, consider reading the following posts: