0

I have the following problem: As I compile my code, the vmargin on the top of the first text page (right above the title for chapter 1) is bigger than it should be. On the following pages everything is as wished and expected.

Due to my preceding search I assume it has something to do with the titlesec package and my modification of titlespacing, but I cannot explain why this extra margin space only appears above the first chapter. Sadly, I could not find the exact problem anywhere else and I am not too proficient with LaTeX.

My code looks as follows:

\documentclass[12pt]{report}
\usepackage[a4paper,hmargin={3cm,3cm},vmargin={3cm,3cm}]{geometry}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lmodern} %better font look in .pdf
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{lipsum}
\usepackage{setspace} %set spacing between lines
    \onehalfspacing
\usepackage{titlesec} %other chapter style
    \titleformat{\chapter}
      {\normalfont\LARGE\bfseries}{\thechapter}{1em}{}
    \titlespacing*{\chapter}{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\usepackage{etoolbox} %no new page for chapters
    \makeatletter
    \patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
    \makeatother
\usepackage{hyperref} %clickable table of contents
    \hypersetup{colorlinks, citecolor=black, filecolor=black, linkcolor=black, urlcolor=black}
\usepackage{csquotes} %ensure correct quotes (necessary for biblatex)
\usepackage[authordate,maxcitenames=2,backend=biber]{biblatex-chicago} %references, citations
    \addbibresource{references.bib}
\usepackage{chngcntr} %count figures etc. continuously
    \counterwithout{figure}{chapter}
    \counterwithout{footnote}{chapter}
\usepackage{caption} %center captions   

\title{Title}
\author{mich0r}
\date{\today}

\begin{document}
\maketitle
\pagenumbering{roman}
\tableofcontents
\clearpage
\setcounter{page}{0}
\pagenumbering{arabic}
\chapter{One}
\lipsum{10}

\chapter{Two}

\end{document}

The observed discrepancy then appears as the following picture shows. The margin on the left page is bigger than on the following ones:

!https://imgur.com/a/x7jOq

I know it's only optical but the issue bothers me quite a bit. Any help is appreciated!

0

It suffices to change the class of chapter. Needless to patch it. I took the opportunity to simplify she parameters handed on to geometry, and loaded hyperref at the end, as should be (cleveref is an exception, but you don't use it).

\documentclass[12pt]{report}
\usepackage[a4paper, margin = 3cm, showframe]{geometry}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lmodern} %better font look in .pdf
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{lipsum}
\usepackage{setspace} %set spacing between lines
\onehalfspacing
\usepackage{titlesec} %other chapter style
\titleformat{\chapter}
{\normalfont\LARGE\bfseries}{\thechapter}{1em}{}
\titlespacing*{\chapter}{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\titleclass{\chapter}{straight}%no new page for chapters

\usepackage{etoolbox}
\usepackage{csquotes} %ensure correct quotes (necessary for biblatex)
\usepackage[authordate,maxcitenames=2,backend=biber]{biblatex-chicago} %references, citations
\addbibresource{references.bib}
\usepackage{chngcntr} %count figures etc. continuously
\counterwithout{figure}{chapter}
\counterwithout{footnote}{chapter}
\usepackage{caption} %center captions
\usepackage{hyperref} %clickable table of contents
\hypersetup{colorlinks, citecolor=black, filecolor=black, linkcolor=black, urlcolor=black}
\title{Title}
\author{mich0r}
\date{\today}

\begin{document}
\maketitle
\pagenumbering{roman}
\tableofcontents
\clearpage
\setcounter{page}{0}
\pagenumbering{arabic}

\chapter{One}
\lipsum[10]

\chapter{Two}

\lipsum[11]

\end{document} 

enter image description here

  • Wow, thank you very much! It is more parsimonious and works excellently. As I thrive to gain some understanding: - Why must hyperref be at the end? - As you simplified my problems with titleclass, isn't etoolbox now useless for me? Thank you again! – mich0r Jan 25 '18 at 19:52

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.