从章节标题页删除页码

从章节标题页删除页码

我正在排版一本书,每一章都有自己的标题页。这是代码:

\documentclass[10pt]{book}
\usepackage[spanish, es-lcroman]{babel}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{extsizes}
\usepackage{longtable}
\usepackage{fixltx2e}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
%\usepackage{graphicx, lmodern}
\usepackage{fancyhdr}
\usepackage{wasysym}
\usepackage{translator}
\usepackage{array,booktabs,arydshln,xcolor}
\makeatletter
\def\@makechapterhead#1{%
\vspace*{250\p@}%
\noindent\hspace*{.1\linewidth}\smash{\rule[-2\textheight]{15pt}{3\textheight}}% Thick rule
\hspace{.02\linewidth}\smash{\rule[-2\textheight]{1pt}{3\textheight}}% Thin rule
\hspace{.1\linewidth}%
{\parbox[t]{\dimexpr.75\linewidth-7pt}{\raggedright
\ifnum \c@secnumdepth >\m@ne
    \normalfont\bfseries\fontsize{30\p@}{36\p@}\selectfont
    \@chapapp\space \scalebox{2}{\thechapter}
    \par\nobreak
    \vskip 30\p@
\fi
\interlinepenalty\@M
\fontsize{35\p@}{45\p@} \bfseries #1
}
}\thispagestyle{empty}\clearpage}
\def\@makeschapterhead#1{%
\vspace*{250\p@}%
\noindent\hspace*{.1\linewidth}\smash{\rule[-2\textheight]{15pt}{3\textheight}}% Thick rule
\hspace{.02\linewidth}\smash{\rule[-2\textheight]{1pt}{3\textheight}}% Thin rule
\hspace{.1\linewidth}%
{\parbox[t]{\dimexpr.75\linewidth-7pt}{\raggedright
\fontsize{35\p@}{45\p@} \bfseries #1
}
}\thispagestyle{empty}\clearpage}
\makeatother

在每个章节标题页中我都得到了我想要的内容,除了出现页码的那个: 在此处输入图片描述

我想删除该页码,但到目前为止我尝试过的所有方法都没有奏效。

\usepackage{titlesec}
\assignpagestyle{\chapter}{empty}

\usepackage{etoolbox}
\patchcmd{\chapter}{plain}{empty}{}{}

\makeatletter
\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
                \thispagestyle{empty}% original style: plain
                \global\@topnum\z@

               \@afterindentfalse
                \secdef\@chapter\@schapter}
\makeatother

\renewcommand*\chapterpagestyle{empty}

答案1

问题是该章节的标题太长,因此整个标题页块被移至下一页,该页已编号。您可以更改章节宏,以便将标题设置在固定高度的框中:在末尾写入\parbox[t][height]...并包含一些可以拉伸或收缩的内容:\vspace

示例输出

\documentclass[10pt]{book}
\usepackage[spanish, es-lcroman]{babel}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{extsizes}
\usepackage{longtable}
\usepackage{fixltx2e}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
\usepackage{fancyhdr}
\usepackage{wasysym}
\usepackage{translator}
\usepackage{array,booktabs,arydshln,xcolor}

\makeatletter
\def\@makechapterhead#1{%
\vspace*{250\p@}%
\noindent\hspace*{.1\linewidth}\smash{\rule[-2\textheight]{15pt}{3\textheight}}% Thick rule
\hspace{.02\linewidth}\smash{\rule[-2\textheight]{1pt}{3\textheight}}% Thin rule
\hspace{.1\linewidth}%
{\parbox[t][10ex]{\dimexpr.75\linewidth-7pt}{\raggedright
\ifnum \c@secnumdepth >\m@ne
    \normalfont\bfseries\fontsize{30\p@}{36\p@}\selectfont
    \@chapapp\space \scalebox{2}{\thechapter}
    \par\nobreak
    \vskip 30\p@
\fi
\interlinepenalty\@M
\fontsize{35\p@}{45\p@} \bfseries #1\par
\vspace{0pt plus 1fill minus 1fill}
}
}\thispagestyle{empty}\clearpage}

\def\@makeschapterhead#1{%
\vspace*{250\p@}%
\noindent\hspace*{.1\linewidth}\smash{\rule[-2\textheight]{15pt}{3\textheight}}% Thick rule
\hspace{.02\linewidth}\smash{\rule[-2\textheight]{1pt}{3\textheight}}% Thin rule
\hspace{.1\linewidth}%
{\parbox[t][10ex]{\dimexpr.75\linewidth-7pt}{\raggedright
\fontsize{35\p@}{45\p@} \bfseries #1 \par
\vspace{0pt plus 1fill minus 1fill}
}
}\thispagestyle{empty}\clearpage}
\makeatother

\begin{document}
\chapter{Test}
Text
\chapter{Test}
Text
\chapter[test]{Test text test text test text test text test text test text
test text test text test text}
Text
\end{document}

相关内容