part使用了
\titleformat{\part}[display]{\Huge\bf}{第\thepart 部分}{1em}{}进行定制,然后在运行下面的代码时
\begin{document}
\small
\setcounter{page}{1}
\pagenumbering{Roman}
\tableofcontents
\newpage
\setcounter{page}{1}
\pagenumbering{arabic}
\part{测试测试测试}
\thispagestyle{empty}
\chapter{测试测试测试}
\thispagestyle{empty}
\end{document}part所在那一页的页码没有被取消,chapter所在那一页的页码成功取消,请问怎么取消part所在那一页的页码?
\part 的结构为:
\clearpage (\cleardoublepage)
...
\thispagestyle{<pagestyle>}
...
\newpage
...由于使用了 \clearpage 和 \newpage,使用 \thispagestyle 无法修改 part 页的 pagestyle。\chapter 则没有尾部的 \newpage,thispagestyle` 可以生效。
如果使用 titlesec 宏包,它提供了 \assignpagestyle 来修改页面样式。如:
\assignpagestyle{\part}{empty}
\assignpagestyle{\chapter}{empty}将修改 \part 和 \chapter 的 pagestyle 为 empty。此命令应在 \titleformat{<command>}... 后使用。它可以在任意位置使用,将影响其后的 pagestyle。
当使用 ctex 文档类时,可使用 \ctexset{part/pagestyle=..., chapter/pagestyle=...} 直接设置 pagestyle。但当加载 titlesec 后无效。
对于本例,若要全局修改,只需在导言区使用:
%\usepackage{titlesec}
\titleformat{\part}[display]{\Huge\bf}{第\thepart 部分}{1em}{}
\assignpagestyle{\part}{empty}若只修改个别,则
\assignpagestyle{\part}{empty}
\part{...}
\assignpagestyle{\part}{plain} % 改回来,默认为 plain