下面是我的代码的一部分。
\documentclass[11pt,table,a5paper]{article}
\usepackage{array,ragged2e}
\usepackage{graphicx}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{lipsum}
\usepackage[top=2cm, bottom=2cm, outer=1cm, inner=2.1cm,twoside, headsep=16pt]{geometry}
\usepackage{ifthen}
\usepackage{wrapfig}
\usepackage{comment}
\usepackage{parskip}
\usepackage{framed}
\usepackage{sidecap}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{url}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{transparent}
\usepackage{hyphenat}
\usepackage{bm}
\newcommand{\+}{\discretionary{\mbox{${\bm\cdot}\mkern-1mu$}}{}{}}
\usepackage{microtype}
\usepackage{xstring}
\usepackage{forloop}
\usepackage{collcell}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{varwidth}
\usepackage{textcomp}
\usepackage{enumitem}
\usepackage[T1,T2A]{fontenc}
\usepackage{CJKutf8}
\usepackage{alltt}
\usepackage{caption}
\captionsetup{skip=5pt,font=footnotesize}
\usepackage[labelformat=empty]{caption}
\usepackage{needspace}
\usepackage{setspace}
\singlespacing
\raggedbottom
\usepackage{keyval}% http://ctan.org/pkg/keyval
\makeatletter
\newlength{\mylist@beforeskip}
\newlength{\mylist@afterskip}
\define@key{mylist}{beforeskip}{\setlength{\mylist@beforeskip}{#1}}
\define@key{mylist}{afterskip}{\setlength{\mylist@afterskip}{#1}}
\newenvironment{mylist}[1][,]
{\setkeys{mylist}{beforeskip=10pt,afterskip=10pt,#1}%
\par\vspace*{\mylist@beforeskip}%
\begin{itemize}}
{\end{itemize}%
\vspace*{\mylist@afterskip}}
\makeatother
\usepackage{etoolbox,graphicx}% http://ctan.org/pkg/{etoolbox,graphicx}
\newcommand{\addstufftotoc}[2][toc]{% \addimagetotoc[<toc>]{<stuff>}
\addtocontents{#1}{#2}}
\makeatletter
\patchcmd{\l@section}% <cmd>
{\begingroup}% <search>
{\begingroup\normalfont\Large\bfseries}% <replace>
{}{}% <success><failure>
\makeatother
\usepackage{etoolbox}
\newcounter{cnt}
\newcommand\textlist{}
\newcommand\settext[2]{%
\csdef{text#1}{#2}}
\newcommand\addtext[1]{%
\stepcounter{cnt}%
\csdef{text\thecnt}{#1}}
\newcommand\gettext[1]{%
\csuse{text#1}}
\newcounter{colnum}
\newcommand\maketabularrow[1]{%
\setcounter{colnum}{0}%
\whileboolexpr
{ test {\ifnumcomp{\value{colnum}}{<}{#1}} }%
{&\stepcounter{colnum}\thecolnum}
}
%
\def\hlinewd#1{%
\noalign{\ifnum0=`}\fi\hrule \@height #1 %
\futurelet\reserved@a\@xhline}
\newcolumntype{P}[1]{>{\RaggedRight\hspace{0pt}}p{#1}}
\begin{document}
\tableofcontents
\begin{mdframed}[roundcorner=0pt,leftmargin=0, rightmargin=0, linecolor=gray,outerlinewidth=.1, innerleftmargin=0, innerrightmargin=0, innertopmargin=0,innerbottommargin=0, everyline = true, splittopskip=.6cm, splitbottomskip=.3cm]
\end{mdframed}
\small
\leavevmode
\newline
\leavevmode
\newline
\scriptsize
\addcontentsline{toc}{section}{\protect\numberline{}AAA}
\addstufftotoc{\nobreak\smallskip\protect\includegraphics[trim=0.6cm 4.5cm 0cm 1cm, clip=true,width=1.0\linewidth]{./tmp/AAA.pdf}\par}
\leavevmode
\newline
\\
}
\newpage
\end{document}linecolor=goldenpoppy
我收到了此错误信息。
Underfull \hbox (badness 10000) in paragraph at lines 295--307
Underfull \vbox (badness 10000) detected at line 323
! TeX capacity exceeded, sorry [input stack size=30000].
\par ->\@restorepar
\everypar {}\par \@endpefalse
l.329 ..../tmp/image.pdf}\par}
! ==> Fatal error occurred, no output PDF file produced!
我发现了许多类似问题的回复,但没有一个能解决我的问题。
答案1
目录以列表形式排版,\par
不再具有其原始含义。
\addstufftotoc
将的定义改为
\newcommand{\addstufftotoc}[2][toc]{% \addimagetotoc[<toc>]{<stuff>}
\addtocontents{#1}{%
\unexpanded{\unexpanded{\nobreak\smallskip#2\par\medskip}}%
}%
}
并将其用作
\addstufftotoc{\includegraphics[trim=0.6cm 4.5cm 0cm 1cm,
clip=true,width=1.0\linewidth]{./tmp/AAA.pdf}}
从而节省了您添加固定格式指令的负担\addstufftotoc
。