我想设计一份所有章节标题都不同的报告。我使用了以下最少的代码:
\documentclass[11pt,twoside]{report}
\usepackage[showframe]{geometry}
\usepackage{graphicx}
\usepackage[explicit]{titlesec}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\Chapter}[2]
{
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}
{}
{1ex}
{\Huge #2}[]
\titleformat{name=\chapter,numberless,page=odd}[display]
{\filright}
{}
{1ex}
{\tikz[baseline=(a.base)]
{%
\node[anchor=south east, outer sep=0, inner sep=0, minimum height=10mm, label={[text=black]right:
\textbf{\Large{~~ #2}}}] (a) {\resizebox{10mm}{10mm}{#1}};
\fill[overlay, draw=none,line width=0pt, left color=black,right color=black!10]
($(a.south west)$) rectangle ++(\textwidth-10mm,3pt);
}}
[]
\titleformat{name=\chapter,numberless,page=even}[display]
{\filleft}
{}
{0pt}
{\tikz[baseline=(a.base)]
{%
\node[anchor=south west, outer sep=0, inner sep=0, minimum height=10mm, label={[text=black]left:
\textbf{\Large{~~ #2}}}] (a) {\resizebox{10mm}{10mm}{#1}};
\fill[overlay, draw=none,line width=0pt, left color=black!10,right color=black]
($(a.south west)$) rectangle ++(-\textwidth+10mm,3pt);
}}
[]
\titlespacing*{\chapter}{0pt}{-50pt}{20pt}
\clearpage
\addcontentsline{toc}{chapter}{#2}
\chapter*{#2}
}
\begin{document}
\Chapter{tt}{Abstract}
Lorem Ipsum etc. etc.
\Chapter{tt}{Abstract}
Lorem Ipsum etc. etc.
\end{document}
我的代码中出现以下错误是什么意思?
Undefined control sequence.
l.3 \ttlp@append{chapter}{e}
\titleformat{\chapter}[display]
为什么当我删除代码中的部分时,章节*标题保持不变?