# Page layout: problems setting margins and placing footer

I am having trouble setting the correct margins for my page, especially the bottom margin in combination with a footer which includes only my page number. I feel like I'm close to making it work but I seem to need help for the last bits of code.

I read posts about similar problems but I just couldn't find a solution. I don't think it's a printer issue as the document written with LibreOffice turns out fine.

How it should be:
1. top, right, left margin = 25mm
2. bottom margin (from the bottom up to the page number) = 20mm
3. space between footer (i.e. page number) and last line of text = 10mm
4. text fills up the document until the page is full => starts on a new page

What works:
1. Setting the left and right margins to 25mm using the package geometry
5. Using titlesec to delete the extra space above the chapter head using -\topskip

Here is what I tried so far:

\documentclass[12pt, a4paper, oneside]{report}
\usepackage[a4paper, showframe, tmargin=25mm, lmargin=25mm, rmargin=25mm, bmargin=20mm]{geometry}
\usepackage{titlesec}

\titleformat{\chapter}[hang]{}{\thechapter.\ }{0pt}{}
\titlespacing*{\chapter}{0cm}{-\topskip}{0pt}[0pt]

\setlength{\parindent}{0mm}

\begin{document}
Top margin doesn't work even though this is normal text :(

\chapter{Hello World}
Does this work? I don't know, man...

\end{document}


What doesn't work:
1. using the code above, the 25mm top margin starts from the top of the page but goes all the way down to the baseline of the text! So that with a 12pt font I only get about 20mm of white space from the top.
2. using bmargin or bottom=20mm seems to work but when I use a footer it doesn't. The page number is located in the bottom margin of 20mm where it shouldn't be
3. I couldn't figure this out yet
4. When there is a section or a subsection anywhere near the end of the page which would cause the section or subsection head to be the last line of the page it takes away the section head and puts it on the next page, which results in one or two blank lines on the previous page. The section head needs to be the last line of the page even if the first line of text belonging to this section is on the next page! (we have to do this even though it may look ugly)

I hope someone can help me. This is my first post here. I used the search function to find similar problems but couldn't find anything.

Edit: I forgot to mention that the top margin is 1-2mm bigger when the first line is a chapter head. So maybe -\topskip doesn't do the trick?

• I can't see a problem on my install; the horizontal line at the top of the textblock showframe is exactly 25mm from the top of the page. Could you add a screenshot? – Brent.Longborough Jan 5 '14 at 15:04
• Or is this a printer alignment problem? – Brent.Longborough Jan 5 '14 at 15:05