Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

PDFpages produces this error. How could I fix it ?

Package pdfpages Warning: There's something wrong with the entries
(pdfpages)                of `addtotoc'. Not all entries were
(pdfpages)                processed. Check `addtotoc' on input line 144.


Package pdfpages Warning: There's something wrong with the entries
(pdfpages)                of `addtolist'. Not all entries were
(pdfpages)                processed. Check `addtolist' on input line 144.

Here is the code (mindmaps.pdf has 2 pages):

    %!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

    %   \def\ColorSecondLanguage{\textcolor{DarkViolet}}  % produces an error, why ?
        \def\ColorSecondLanguage{}

    %\newcommand{\FirstLanguageSecondLanguage}[2]{\ColorSecondLanguage{#2}}
    \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⟩}

    %   
    %   \IncludeMyPDFThatBugs
    %   {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


    \def\MYpagesPDF{2}  
    \def\pageAddtoTOC{2}
    \def\pageAddtoList{2}

    \newcommand{\IncludeMyPDFThatBugs}[9]{%
    \newpage\hypertarget{#7-target}
    {\includepdf[pages={#1},nup=1x1,
        scale=#2,landscape=#3,turn=#4,
        pagecommand={\thispagestyle{fancy}},
        addtotoc={\pageAddtoTOC,#5,#6,label-toc-#7},
        addtolist={\pageAddtoList,#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


    \IncludeMyPDFThatBugs
    {\MYpagesPDF}
    {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}


    \IncludeMyPDFThatBugs
    {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


    \IncludeMyPDFThatBugs
    {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}


    \IncludeMyPDFThatBugs
    {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}


    \IncludeMyPDFThatBugs
    {1}
    {0.9}
    {false}
    {true}
    {subsection,2}
    {\FrancaisEnglishSubSections{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}

I cloned the code, and took out the language selection. It compiled well afterwards. But - I have to keep the language selection - how could I improve it to make it work adequately ?

            %!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

    %   \def\ColorSecondLanguage{\textcolor{DarkViolet}}  % produces an error, why ?
    %   \def\ColorSecondLanguage{}

    %\newcommand{\FirstLanguageSecondLanguage}[2]{\ColorSecondLanguage{#2}}
    %\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⟩}

    %   
    %   \IncludeMyPDFThatBugs
    %   {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


    \def\MYpagesPDF{2}  
    \def\pageAddtoTOC{2}
    \def\pageAddtoList{2}

    \newcommand{\IncludeMyPDFThatBugs}[9]{%
    \newpage\hypertarget{#7-target}
    {\includepdf[pages={#1},nup=1x1,
        scale=#2,landscape=#3,turn=#4,
        pagecommand={\thispagestyle{fancy}},
        addtotoc={\pageAddtoTOC,#5,#6,label-toc-#7},
        addtolist={\pageAddtoList,#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


    \IncludeMyPDFThatBugs
    {\MYpagesPDF}
    {1}
    {false}
    {false}
    {subsection,2}
    {Hamlet speaks this on his entry to Act 3 scene 1}
    {table-mind-one}
    {table}
    {mindmaps.pdf}


    \IncludeMyPDFThatBugs
    {1}
    {0.9}
    {false}
    {true}
    {subsection,2}
    {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


    \IncludeMyPDFThatBugs
    {1}
    {0.9}
    {false}
    {true}
    {subsection,2}
    {Hamlet speaks this on his entry to Act 3 scene 1}
    {figure-mind-two}
    {figure}
    {mindmaps.pdf}


    \IncludeMyPDFThatBugs
    {1}
    {0.9}
    {false}
    {true}
    {subsection,2} 
    {Hamlet speaks this on his entry to Act 3 scene 1}
    {table-mind-two}
    {table} 
    {mindmaps.pdf}


    \IncludeMyPDFThatBugs
    {1}
    {0.9}
    {false}
    {true}
    {subsection,2}
    {Hamlet speaks this on his entry to Act 3 scene 1}
    {nrp-algo}
    {figure}
    {mindmaps.pdf}



    \cleardoublepage
    \listoftables
    \addcontentsline{toc}{chapter}{List of Tables}



    \cleardoublepage
    \listoffigures
    \addcontentsline{toc}{chapter}{List of Figures}


    \cleardoublepage


    \end{document}
share|improve this question
1  
Both versions of your code produce the same warnings. Consider each \IncludeMyPDFThatBugs separately. Comment out all but that one. Note that for ones where it fails, you are trying to add an entry for page 2 in the toc but are only importing page 1. This is (at least part of) what pdfpages is complaining about. Further, some of the places where you use \FirstLanguageSecondLanguage are missing closing braces. –  cyberSingularity Dec 24 '12 at 10:07

1 Answer 1

up vote 3 down vote accepted

Wow ! Right on the spot ! Thanks very much, cyberSingularity !

  1. 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.
  2. 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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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