PDFpages 出现此错误。我该如何修复它?
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.
以下是代码(mindmaps.pdf 有 2 页):
%!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}
我克隆了代码,并删除了语言选择。之后编译得很好。但是 - 我必须保留语言选择 - 我该如何改进它以使其正常工作?
%!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}
答案1
哇!太对了!非常感谢,cyberSingularity!
- 主要错误 = 我的 PDF 文档并非全部都有 2 页,而有时命令
\IncludeMyPDFThatBugs
需要第一页,有时则需要第二页。 - 缺少很多右括号:
{\FirstLanguageSecondLanguage{first language}{second language}}
缺少一些右括号。{\FirstLanguageSecondLanguage{\textbf{first}\textbf{language}}{\textbf{second}\textbf{language}}}
缺少一些右括号。- 在其他地方,在我的主代码中,缺少
\hyperlink{name-target}{\FirstLanguageSecondLanguage{}{}}
一些右括号。 - 我的另一个“自制”命令的最后一个参数末尾缺少一些右括号,与 \includepdf 无关。
TextWrangler / View / Balance 或 Balance and fold 可以帮助查找“缺失的右括号”。但是,执行此操作时请务必关闭 TeXShop。
以下是我最终的、没有错误的代码:\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}