How to move the title of one chapter upwards on the page

chaptersspacingtitles

I have this code:

    \documentclass[oneside]{book}
    
    \begin{document}
    
    \chapter{Example 1}
    
    Text chapter 1
    
    \chapter{Example 2}
    
    Text chapter 2
    
    \end{document}

Which gives me these two pages:

enter image description here

enter image description here

My question is: how can I move, for example, the title of chapter 2 upwards on the page while leaving the title of chapter 1 in the same place?

PS: My question is similar to this one but I would like to move the title of only one chapter upwards.

Best Answer

Much easier if you use the memoir class (a superset of book and report).

% upchapterprob.tex  SE 615713

%   \documentclass[oneside]{book}
   \documentclass[oneside]{memoir}

    \begin{document}
    \setlength{\textheight}{0.4\textheight} %% just for printing convenience   
    
    \chapter{Example 1}
    
    Text chapter 1

    \addtolength{\beforechapskip}{-0.5in} % reduce space above title
    \chapter{Example 2}
    \addtolength{\beforechapskip}{0.5in} % restore space above title

    Text chapter 2

    \chapter{Example 3}

    Text chapter 3
    
    \end{document}

%%%% if using the book class instead of memoir then put the following,
%%%% less any typos, in the preamble. It is a redefinition of some book 
%%%% class code.

\newlength{\beforechapskip}
\setlength{\beforechapskip}{50pt}
\makeatletter
%% revised \@makechapterhead
\renewcommand{\@makechapterhead}[1]{%
  \vspace*{\beforechapskip}%
  {\parindent \z@ \raggedright \normalfont
   \ifnum \c@secnumdepth > \m@ne
     \if@mainmatter
       \huge\bfseries \@chapapp\space \thechapter
       \par\nobreak
       \vskip 20\p@
     \fi
   \fi
   \interlinepenalty\@M
   \Huge \bfseries #1\par\nobreak
   \vskip 40\p@
 }}
\makeatother

First page:

enter image description here

Second page:

enter image description here

Third page:

enter image description here

Related Question