重新定义零件时出错

重新定义零件时出错

我想用以下代码定制乳胶中的部分:

\documentclass{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{titlesec}
\usepackage{tikz}

\newcommand*\partlabel{}
\titleformat{\partlabel}
  {\gdef\partlabel{}
   \normalfont\sffamily\Huge\bfseries\scshape}
  {\gdef\partlabel{\thechapter\ }}{0pt}
  {\begin{tikzpicture}[remember picture,overlay]
    \node[yshift=-3cm] at (current page.north west)
      {\begin{tikzpicture}[remember picture, overlay]
        \draw[fill=darkblue2!20] (0,0) rectangle
          (\paperwidth,3cm);
        \node[anchor=east,xshift=.9\paperwidth,rectangle,
              rounded corners=20pt,inner sep=15pt,
              fill=darkblue2]
              {\color{white}\partlabel#1};
       \end{tikzpicture}
      };
   \end{tikzpicture}
  }

\usepackage{minitoc}%

\doparttoc% Prepare minitoc package for part tocs usage

\begin{document}
\sffamily
\tableofcontents

\part{Document 1}
\parttoc
\section{Document 1} % (fold)
\label{sec:document_1}
\section{Document 1} % (fold)
\label{sec:document_2}
\subsection{Subsection document 1} % (fold)
\label{sub:subsection_document_1}
a
  \part{Document 2}
  \parttoc
   %========HERE THE TOC OF THE SECOND DOC SHOULD APPEAR and from here this will be the content of the second doc
   \section{Document 2.1} % (fold)
   \label{sec:document_2_1}
    \subsection{Subsection document 2}
    \section{Document 2.2} %


\end{document}   

但我不明白为什么我会得到:

C:\Users\Adriano\OneDrive\HEIA-FR\3eme\Bachelor\temp\temp.tex:24: \ttlf@partlabel 定义中的参数编号非法。[] 因为第 24 行没有声明任何特殊内容。有人能帮我找到这个错误吗?

谢谢

相关内容