4

I have \pagestyle{fancy} with usual settings. And names of my chapters sometimes are so huge (above the top line) that somehow the number of page (which is in foot of the page) is going down, down and down with each page until it'll disappear. It is ridiculous to see at the first page approximately 2cm between number and end of the page and 1mm on the page 100 and nothing at the last page.

%document information
\documentclass[10pt,a4paper]{book}

% packages
\usepackage{cmap}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage[russian]{babel}
\usepackage{amsfonts,longtable} 
\usepackage{indentfirst}
\usepackage{amsmath,amsthm,amstext,amssymb,amscd} 
\usepackage{fancyhdr}                           
\usepackage{hyperref}
\usepackage[margin=2.3cm, footskip = 0.5 cm]{geometry}
\usepackage{epigraph}
\usepackage{tikz}                                   
\usepackage{cancel}
\usepackage{upgreek}
\usepackage{bm}                         
\usepackage{xcolor}
\definecolor{darkblue}{rgb}{0,0,.6}

% page settings
\frenchspacing 
\parindent=1cm
\sloppy
\fancyfoot[C]{\thepage}

% other settings
\pdfcompresslevel=9
\pdfobjcompresslevel=9

\hypersetup{
  pdfsubject         = {Matan},
  pdfstartview       = {FitH},
  pdfborder          = {0 0 0},
  bookmarksopen      = true,
  bookmarksnumbered  = true,
  bookmarksopenlevel = 2,
  colorlinks = true,     linkcolor  = darkblue,
}


%own commands

\begin{document}

\pagestyle{plain}
\frontmatter
\tableofcontents

\mainmatter
\pagestyle{fancy}

\setcounter{chapter}{0}
\foreach \n in {1,...,36}{\include{chapters/chapter\n}}

\end{document}

And don't blame me for using text about Eminem for test in future math book. :)

PS. In chapters/chapter\n there are just texts about Eminem with no commands expect \chapter{}

enter image description here enter image description here

  • 1
    Welcome to TeX.SE. I am sure not many will note the word EMINEM in a Cyrillic font text ;-) But your question is not quite unclear unless you provide a compilable version of your document that shows this issue –  Feb 15 '16 at 17:40
  • Welcome, the title put a song into my head: The wheels on the bus go round and round... ;-) – Johannes_B Feb 15 '16 at 17:42
  • 1
    Try to prepare a minimal working example (<- simple method linked) and show it to us. Right now, we cannot have a clue. Check the log file for fancyhdr warnings concerning the headheight, though. – Johannes_B Feb 15 '16 at 17:44
  • Have I done your request? –  Feb 15 '16 at 17:50
  • @Dida: Da, choroscho ;-) –  Feb 15 '16 at 17:55
  • Could be http://tex.stackexchange.com/a/85179/38080 ? You should provide headheight space for the biggest of your headings... (or cut them, with the \chapter optional argument). – Rmano Feb 15 '16 at 18:06
  • Off-topic: Please load hyperref at the end of the preamble, not somewhere surrounded by a bunch of other packages! –  Feb 15 '16 at 18:24
  • Why? Is it convenience or real benefit? –  Feb 15 '16 at 18:32
  • @Dida: In many cases benefit since hyperref redefines a couple of things to make the whole hyperlinking work. –  Feb 15 '16 at 18:33

1 Answers1

3

There's a clear warning about headheight being to small (see the .log file.) It's recommended, depending on the current very long chapter titles, that the headheight is set to about 35pt at least.

In my opinion, footskip is too small here, I increased its value to 1cm.

Now the page number position remains fixed.

%document information
\documentclass[10pt,a4paper]{book}

% packages
\usepackage{cmap}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage[russian]{babel}
\usepackage{amsfonts,longtable} 
\usepackage{indentfirst}
\usepackage{amsmath,amsthm,amstext,amssymb,amscd} 
\usepackage{fancyhdr}                           
\usepackage[includeheadfoot,margin=2.3cm, footskip = 1 cm,headheight=36pt]{geometry}
\usepackage{epigraph}
\usepackage{tikz}                                   
\usepackage{cancel}
\usepackage{upgreek}
\usepackage{bm}                         
\usepackage{xcolor}
\definecolor{darkblue}{rgb}{0,0,.6}

% page settings
\frenchspacing 
\parindent=1cm
\sloppy
\fancyfoot[C]{\thepage}

% front page
\author{Андрей Диденко}
\title{Подготовка к ГОСу по МатАнализу
\date{16 Апреля 2016}.
\LaTeX}
\usepackage{hyperref}    
% other settings
\pdfcompresslevel=9
\pdfobjcompresslevel=9

\hypersetup{
  pdftitle           = {GOS_MatAn},
  pdfauthor          = {Didenko Andre},
  pdfsubject         = {Matan},
  pdfstartview       = {FitH},
  pdfborder          = {0 0 0},
  bookmarksopen      = true,
  bookmarksnumbered  = true,
  bookmarksopenlevel = 2,
  colorlinks = true,     linkcolor  = darkblue,
}


%own commands

\usepackage{blindtext}

\begin{document}

\pagestyle{plain}
\frontmatter
\maketitle
\epigraph{Дорогой моей и любимой Настеньке посвящается}{Диденко А.А.}
\tableofcontents

\mainmatter
\pagestyle{fancy}

\setcounter{chapter}{0}
\foreach \n in {1,...,36}{\chapter{A long long long long long long long long long long long long long long long long long long long long chapter title which is totally boring}\blindtext[10]}

\end{document}
Mico
  • 506,678
  • Yeap. Thanks.

    It works. I am so dissapointed that I wasted a lot of my time for this easiest problem.

    –  Feb 15 '16 at 18:20
  • 3
    You may also want to provide the option includeheadfoot when loading the geometry package. – Mico Feb 15 '16 at 18:21
  • Can you answer me another little question? (I am not very good at LaTeX as you can see)

    I have a title page. But if you look at it more carefully - you will see, that cyrillic symbols are very wrong and crooked.

    But Main Part is Ok.

    –  Feb 15 '16 at 19:12
  • @Dida: Actually, the rule is: One question -- one answer and if it's ok, accepting them, then asking a new question ;-) –  Feb 15 '16 at 19:14
  • @Mico: Thanks for correcting my stupid typo! –  Feb 15 '16 at 19:16
  • Oh, no. It is so little and unimportant that I don't want all people to waste their time –  Feb 15 '16 at 19:18
  • 3
    @Dida: Go ahead ... and don't forget the acceptance rule nevertheless ;-) –  Feb 15 '16 at 19:19