2

Want to create book with two types of pages.

  1. page contains

    a) chapter name

    b) normal text paragraphs

  2. page contains only normal text paragraphs

The question is how to do it when I want to have normal text paragraphs with fixed top page margin on all pages? For example 5cm from top of the page.

+————————-—+
| chapter  |
|          |
| text ..  |
| .. text. |
+—————————-+
1) Page with chapter


+————————-—+
|          | <— here I want empty space
|          |
| text ..  |
| .. text. |
+—————————-+
2) Page without chapter

EDIT:

Here is sample code https://www.overleaf.com/3771752458rvswcxcnhzwk

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{fancyhdr}
\pagestyle{plain}
\begin{document}

\chapter{Introduction}

\lipsum[1-10]

\end{document}

enter image description here

4
  • What have you tried? Where are page numbers or headers to be placed on non-chapter pages? What about moving chapter titles up? Sep 25 at 17:13
  • @PeterWilson I added more info to my question. Page numbers are in footer. Chapter is on right position.
    – kolisko
    Sep 25 at 20:13
  • Have you tried \vspace{} or something li that? Sep 25 at 20:37
  • @AntonMn putting vspace is not a good solution I think because it has to be on each site and every time the text is going to change it means all vspaces rearrange.
    – kolisko
    Sep 25 at 22:20
3

You can redefine \@makechapterhead to make a zero height box and then back up by a line. You also need to modify similarly \@makeschapterhead for unnumbered chapters.

\documentclass{book}
\usepackage[top=225pt,bottom=3cm,heightrounded]{geometry}

\usepackage{lipsum}

\makeatletter
\def\@makechapterhead#1{%
  \vbox to 0pt{%
    \vss
    \parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
      \fi
    \fi
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }%
  \vspace{-\baselineskip}%
}
\def\@makeschapterhead#1{%
  \vbox to 0pt{%
   \parindent \z@ \raggedright
     \normalfont
     \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }%
  \vspace{-\baselineskip}%
}
\makeatother

\pagestyle{plain}

\begin{document}

\chapter{Introduction}

\lipsum[1-20]

\end{document}

enter image description here

You'll need to adjust the top and bottom values to suit your needs, and quite likely also the line width.

5
  • Seems it works, thanks! One question - When the 'chapter text' is longer it is wrapped on two lines and the 'normal text' is shifted down. Is possible somehow to keep the 'normal text' on same possition as long as possible? For example when the space between 'chapter text' and 'normal text' is 4 lines the chapter can be long on 4 lines and 'normal text' will be still on same possition.
    – kolisko
    Sep 25 at 22:28
  • @kolisko This of course would need adjustments to be done when you're sure about the length of your chapter titles. To be honest, four lines would require too much white space on the top of the pages. But I tried two or three lines and the text after the chapter title doesn't move.
    – egreg
    Sep 25 at 22:35
  • I wanted to replace the \chapter{Introduction} line to \section{Introduction} and your code stopped working. Could you help me what I need to change to work with \section please?
    – kolisko
    Sep 29 at 20:38
  • @kolisko Why would you? Modify the definition of \@makechapterhead to suit your needs instead.
    – egreg
    Sep 29 at 21:22
  • I switched the section back to chapter so it is ok now. But there is one thing, I added the \tableofcontents and TOC page is shifted down. Could you help me how to change the TOC according to the chapters?
    – kolisko
    Oct 15 at 9:23
2

If I have understood the question correctly, the requirement is to put the chapter number and title in the top margin. This can be done using the geometry and titlesec packages. Using the geometry package, it's possible to define the top margin of all pages. And to put the chapter no and title in the top margin, the \titlespacing* and \titleformat commands can be used. An MWE is added here assuming a top margin of 5cm.

\documentclass{book}
\usepackage{inputenc}
\usepackage{lipsum}
\usepackage[top=5cm]{geometry}
\usepackage{titlesec}

\titlespacing*{\chapter}{0pt}{-4cm}{1cm}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{10pt}{\Huge}

\pagestyle{plain}
\begin{document}
    
    \chapter{Introduction}
    
    \lipsum[1-10]
    
    \chapter{Another chapter}
    
    \lipsum[1-10]
    
\end{document}

Chapter 1: output 1

Chapter 2: output 2

2
  • Seems it works, thanks! One question - When the 'chapter text' is longer it is wrapped on two lines and the 'normal text' is shifted down. Is possible somehow to keep the 'normal text' on same possition as long as possible? For example when the space between 'chapter text' and 'normal text' is 4 lines the chapter can be long on 4 lines and 'normal text' will be still on same possition.
    – kolisko
    Sep 25 at 22:29
  • Does 'chapter text' mean 'chapter title'? If it is so, then you can change the \titlespacing command accordingly.
    – Imran
    Sep 25 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.