\newpage 和 \clearpage 不起作用

\newpage 和 \clearpage 不起作用

出现以下问题:通常在我的文档中,每章结束后,在新章节开始之前都会有一页空白页。有趣的是,我的 pdf 中有一处在章节结束和新章节之间没有空白页。我试过,\newpage\clear没有成功。也许我的 .cls 文件导致了这个问题。我在下面添加了几行。如果我添加一个

\newpage $\mbox{ }$

它会生成两个空白页。如果没有 $\mbox{ }$,则什么也不会发生。 也一样\clearpage。希望有人能帮助我!谢谢你的建议。

数学

.cls 文件的缩写

% RPI option chap:
\newif\ifchap  % true for chap option
  \chapfalse   % false by default
\DeclareOption{chap}{\chaptrue} % option to print "Chapter" at each new chapter
\newcommand\docsize{}  % to allow 10pt or 11pt to be specified as option
\DeclareOption{10pt}{\renewcommand\docsize{10pt}}
\DeclareOption{11pt}{\renewcommand\docsize{11pt}}
\DeclareOption{12pt}{\renewcommand\docsize{12pt}}
%  Prepare to load the standard report class (12pt):
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ExecuteOptions{12pt}         % define 12pt as the default doc size
\ProcessOptions
\LoadClass[\docsize]{report}  % load report.cls

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                            SECTION HEADINGS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
\newcommand\chaptersize{\large}
\newcommand\sectionsize{\large}
\newcommand\subsectionsize{\normalsize}
\newcommand\subsubsectionsize{\normalsize}
\newcounter{firstchapter}
\setcounter{firstchapter}{0}

\setcounter{secnumdepth}{3}    % Number subsubsections in the chapters
\setcounter{tocdepth}{0}       % Put subsubsections in the table of contents

% Print "CHAPTER" if chap option is specified:
\ifchap
  \renewcommand\@chapapp{\chaptername}
\else
  \renewcommand\@chapapp{}
\fi

\def\specialhead#1{%   GENERAL HEADING WITHOUT A NUMBER (for abstract, etc.)
     \ifx\phantomsection\undefined
     \else
        \clearpage\phantomsection
     \fi
     \addcontentsline{toc}{chapter}{#1}
     \chapter*{\centering #1 \@mkboth{#1}{#1}}}


\def\@chapter[#1]#2{\ifnum\c@firstchapter=0    % start of rpi added stuff
                      \if@twoside\cleardoublepage\suppressfloats[t]\fi
                      \pagenumbering{arabic} 
                      \setcounter{firstchapter}{1}
                    \fi
                    \renewcommand{\thepage}{\arabic{page}}
                    \thispagestyle{plain}
                    \pagestyle{myheadings}      % end of rpi added stuff
                    \ifnum \c@secnumdepth >\m@ne
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\protect\numberline{\thechapter.}#1}%
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}% 
%                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
%                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
\def\@makechapterhead#1{%
  \vspace*{0\p@}%
  {\parindent \z@ \raggedright \centering \normalfont \chaptersize
    \ifnum \c@secnumdepth >\m@ne
      \ifchap
         \bfseries \@chapapp{} \thechapter    % print "Chapter" and number
         \vskip -3pt           %\par\nobreak (original)
       \else
         \bfseries \thechapter. 
       \fi
    \fi
    \interlinepenalty\@M
    \bfseries #1\par\nobreak
    \vskip 15\p@
  }}

\def\@makeschapterhead#1{%    heading for chapter* command (no numbering)
  \vspace*{0\p@}%
  {\parindent \z@ \raggedright \centering
    \normalfont  \chaptersize 
    \interlinepenalty\@M
    \bfseries  #1\par\nobreak
    \vskip 15\p@
  }}

\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {3.5ex \@plus 1ex \@minus .2ex}%
                                   {.5ex \@plus .3ex}%{1.4ex \@plus.2ex}%
                                   {\normalfont\sectionsize\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {3.25ex\@plus 1ex \@minus .2ex}%
                                     {.3ex \@plus .2ex}%{1.2ex \@plus .2ex}%
                                     {\normalfont\subsectionsize\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {3.25ex\@plus 1ex \@minus .2ex}%
                                     {.2ex \@plus .1ex}%{1ex \@plus .2ex}%
                                     {\normalfont\subsubsectionsize\bfseries}}
% \paragraph and \subparagraph headings unchanged from report.cls.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  FOR RPI TITLEPAGE, ABSTR. TITLEPAGE & COPYRIGHT PAGE 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 \def\thesistitle#1{\gdef\@thesistitle{#1}}
 \def\author#1{\gdef\@author{#1}}
 \def\degree#1{\gdef\@degree{#1}}
 \def\department#1{\gdef\@department{#1}}
 \newcount\numcomm \numcomm=1
 \def\signaturelines#1{\numcomm=#1}
 \def\thadviser#1{\gdef\@thadviser{#1}} 
 \def\projadviser#1{\gdef\@projadviser{#1}} \projadviser{*}
 \def\cothadviser#1{\gdef\@cothadviser{#1}} \cothadviser{*} 
 \def\coprojadviser#1{\gdef\@coprojadviser{#1}} \coprojadviser{*}
 \def\cocothadviser#1{\gdef\@cocothadviser{#1}} \cocothadviser{*}
 \def\cocoprojadviser#1{\gdef\@cocoprojadviser{#1}} \cocoprojadviser{*} 
 \def\doctype{\if \@projadviser *Thesis \else Project \fi}
 \def\adviser{\if \@projadviser *\@thadviser \else \@projadviser\fi}
 \def\coadviser{\if \@coprojadviser *\@cothadviser\else \@coprojadviser\fi}
 \def\cocoadviser{\if \@cocoprojadviser *\@cocothadviser\else \@cocoprojadviser\fi}
 \def\memberone#1{\gdef\@memberone{#1}}
 \def\membertwo#1{\gdef\@membertwo{#1}}
 \def\memberthree#1{\gdef\@memberthree{#1}}
 \def\memberfour#1{\gdef\@memberfour{#1}}
 \def\memberfive#1{\gdef\@memberfive{#1}}
 \def\membersix#1{\gdef\@membersix{#1}}
 \def\copyrightyear#1{\gdef\@copyrightyear{#1}} \copyrightyear{\the\year}
 \def\submitdate#1{\gdef\@submitdate{#1}}

\newcount\numcount
\def\sigblock{
   \ifnum\numcomm < 4  % master's thesis or project
     \vskip .8in plus 24pt minus 24pt
     %\leftline{Approved: \hfil}\vskip 48pt plus 2pt minus 10pt
     %\hrule width 2.6in\hfil \vskip -6pt
     \leftline{Supervisor: \adviser\hfil}
     \if \coadviser * % no co-adviser
       \else \vskip 12pt plus 6pt minus 2pt %\hrule width 2.6in\hfil \vskip -6pt        
       \leftline{Coordination: \coadviser\hfil}
     \fi
     \if \cocoadviser * % no coco-adviser 
       \else \vskip 36pt %plus 6pt minus 2pt \hrule width 2.6in\hfil \vskip -6pt
      \leftline{\cocoadviser, \doctype Adviser\hfil}
     \fi   
     \vskip 6pt 
   \else  % PhD thesis
      \numcount=\numcomm
      \leftline{Approved by the\hfil}
      \leftline{Examining Committee:\hfil}
      \vskip 28pt \vfil 
      \hrule width 2.8in \hfil \vskip -3pt
      \leftline{\adviser, \doctype Adviser\hfil} 
      \advance \numcount by -1
      \if \coadviser * \else % there's a co-adviser
        \vskip 19pt\vfil\hrule width 2.8in\hfil\vskip -3pt
        \leftline{\coadviser, \doctype Adviser\hfil}
        \advance \numcount by -1
      \fi
      \vskip 19pt\vfil\hrule width 2.8in\hfil\vskip -3pt
      \leftline{\@memberone, Member\hfil}
      \advance \numcount by -1
      \vskip 19pt\vfil\hrule width 2.8in\hfil\vskip -3pt
      \leftline{\@membertwo, Member\hfil}
      \advance \numcount by -1 \ifnum\numcount > 0
      \vskip 19pt\vfil\hrule width 2.8in\hfil\vskip -3pt
      \leftline{\@memberthree, Member\hfil}  \fi
      \advance \numcount by -1 \ifnum\numcount > 0
      \vskip 19pt\vfil\hrule width 2.8in\hfil\vskip -3pt
      \leftline{\@memberfour, Member\hfil}   \fi
      \advance \numcount by -1 \ifnum\numcount > 0
      \vskip 19pt\vfil\hrule width 2.8in\hfil\vskip -3pt
      \leftline{\@memberfive, Member\hfil}  \fi
      \advance \numcount by -1 \ifnum\numcount > 0
      \vskip 19pt\vfil\hrule width 2.8in\hfil\vskip -3pt
      \leftline{\@membersix, Member\hfil} \fi
      \fi} 

 \def\sigblockabs{%
   \ifnum\numcomm < 4  % master's thesis or project
     \vskip 1.8in plus 24pt minus 24pt
     \leftline{Approved: \hfil}\vskip 24pt plus 2pt minus 10pt
     \leftline{\adviser, \doctype Adviser\hfil}
     %\leftline{Supervisor: \adviser \hfil}%my corrections
     \if \coadviser * % no co-adviser
       \else \vskip 8pt plus 6pt minus 2pt         
       \leftline{\coadviser, \doctype Adviser\hfil}
       %\leftline{Coordination: \coadviser} %my corrections
     \fi
     \if \cocoadviser * % no coco-adviser 
       \else \vskip 8pt plus 6pt minus 2pt 
      \leftline{\cocoadviser, \doctype Adviser\hfil}
     \fi 
 %    \vglue 24pt 
  \else  % PhD thesis
    \numcount=\numcomm
    \leftline{Examining Committee: \hfil}
    \begin{quote}   
      \adviser, \doctype Adviser\\[4pt]  \advance \numcount by -1
      \if \coadviser * \else 
        \coadviser, \doctype Adviser\\[4pt]    \advance\numcount by -1
      \fi
      \@memberone, Member\\[4pt] \advance \numcount by -1
      \ifnum\numcount > 0
      \@membertwo, Member\\[4pt] \advance \numcount by -1 \fi
      \ifnum\numcount > 0
      \@memberthree, Member\\[4pt] \advance \numcount by -1 \fi
      \ifnum\numcount > 0
      \@memberfour, Member\\[4pt] \advance \numcount by -1  \fi
      \ifnum\numcount > 0
      \@memberfive, Member\\[4pt]\advance \numcount by -1  \fi
      \ifnum\numcount > 0
      \@membersix, Member\\[4pt] \advance \numcount by -1\fi
    \end{quote}
  \fi  
 }

 \def\titlepage{%
     \pagenumbering{roman}
     \thispagestyle{empty}
     \ifnum\numcomm<4 \vglue .5in\vfil \fi  % masters
     \ifnum\numcomm>5 \hbox{ } \vspace{-24pt}\fi % make more space on page
     \begin{singlespace}
     \begin{center}
         \parindent=0pt
         {\large\uppercase\expandafter{\@thesistitle}}\\ [36pt]
         A Bachelor-\doctype Submitted to\\ [8pt]
         ETH ZURICH\\ [12pt]
         Departement of Mathematics\\ [36pt]
         Presented By \\ [12pt]
         \@author\\ [36pt]
         \@date
        % in Partial Fulfillment of the\\ [8pt]
        % Requirements for the Degree of\\ [8pt]
        % \uppercase\expandafter{\@degree}\\ [8pt]
        % Major Subject:~~\uppercase\expandafter{\@department}\\ 
         \ifnum\numcomm < 7 \vskip 64pt \else \vskip 24pt \fi
         \sigblock 
          \ifnum \numcomm < 7 \vskip 32pt \else \vskip 24pt \fi
        %  Rensselaer Polytechnic Institute\\
        % Troy, New York\\ [14pt]
         \ifnum\numcomm>6 \vskip -8pt \fi
         \@submitdate
     \end{center}
     \end{singlespace}
     \newpage
     \pagestyle{plain}
%    \pagenumbering{roman}
%    \setcounter{page}{2}
}

 \def\abstitlepage{%
     \if@twoside\thispagestyle{empty}\cleardoublepage\fi
     \pagenumbering{roman}
     \thispagestyle{empty}
     \ifnum\numcomm<4 \vglue .5in \fi  % masters
     \begin{singlespace}
     \begin{center}
         \parindent=0pt
         \vglue 24pt plus 24pt minus 12pt
         {\large\uppercase\expandafter{\@thesistitle}}\\ [11pt]
         By \\ [11pt]
         \@author\\ [11pt]
         An Abstract of a Thesis Submitted to the Graduate\\ [7pt]
         Faculty of Rensselaer Polytechnic Institute\\ [7pt]
         in Partial Fulfillment of the\\ [7pt]
         Requirements for the Degree of\\ [7pt]
         \uppercase\expandafter{\@degree}\\ [7pt]
         Major Subject:~~\uppercase\expandafter{\@department}\\  [7pt]
         The original of the complete thesis is on file\\
         in the Rensselaer Polytechnic Institute Library\\
       \vfill
       \sigblockabs 
       \vskip 36pt plus 2pt minus 12pt 
        Rensselaer Polytechnic Institute\\
        Troy, New York\\ [12pt]
         \@submitdate
     \end{center}
     \end{singlespace}
     \newpage
     \pagestyle{plain}
%    \pagenumbering{roman}
%    \setcounter{page}{2}
}

\def\copyrightpage{
    \hbox{ }
    \vfill
    \begin{center}
    \copyright\ Copyright \@copyrightyear \\
    by \\
    \@author \\
    All Rights Reserved \\ [12pt]
    \end{center}
    \clearpage}

答案1

空白页并不是真的空白。让我们看看 的定义\cleardoublepage

\def\cleardoublepage{%
  \clearpage
  \if@twoside
    \ifodd\c@page
    \else
    \hbox{}\newpage
      \if@twocolumn\hbox{}\newpage\fi
    \fi
  \fi}

\clearpage发出A。然后,如果文档使用该twoside选项,则检查当前页码(它是正确的,因为 TeX 刚刚弹出一页):如果它是奇数,则我们在右侧页面上,无需执行任何操作。如果我们在左侧页面上,则必须弹出其中没有任何内容的页面:

\hbox{}\newpage

(如果启用了双列模式,则需要 \newpage命令。

需要空框是因为垂直间距和惩罚(\newpage发出的内容)在分页符处被丢弃;因此

\newpage\newpage\newpage

不会给出空白页。

相反,\hbox{}人们可以说\null

相关内容