1

I'm new to Tex, I use shareLatex specifically. When I write my 'book' document every page that has "Chapter ..." on it is displaying fine and the text aligns to the odd-side margin (?) nicely. But then every page after that is strangely shifted to the right (I don't believe it has something to do with indentation as the chapter title at the top of the page is also shifted). This also happens with the table of contents.

Here is an image, the top page has the 'chapter' text on it and the bottom page is strangely shifted. Please excuse the quality, I have limited resources atm. Please excuse the quality, I have limited resources atm "Hoofdstuk 4" means chapter 4 in my native language.

My document is built up like this:

\documentclass[12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[dutch]{babel}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage[backend=biber,
style=alphabetic,
sorting=ynt]{biblatex}
\addbibresource{references.bib}

\usepackage[hidelinks]{hyperref}

\setlength{\parskip}{1.2ex}    % space between paragraphs
\setlength{\parindent}{0cm}%2em}       % amount of indention
\setlength{\textwidth}{175mm}      % default = 6.5"
\setlength{\oddsidemargin}{-5mm}   % default = 0"
\setlength{\textheight}{225mm}     % default = 9"
\setlength{\topmargin}{-12mm}      % default = 0" -12mm


\begin{document}

\begin{titlepage}
    \begin{center}
        \vspace*{3cm}
        {...}\\[1cm]
        {...}\\[1cm]
        {...}
    \end{center}
...\\
...\\
... 

\begin{center}
\textit{...}\\[2cm]
\includegraphics[scale= 0.5]{picture.jpg}
\end{center}
   \let\newpage\relax  % Avoid following page break
\end{titlepage}

\tableofcontents

\chapter{chapter 1}

\section{section 1}
etc..

Hopefully this can be sorted out as I have looked everywhere for a solution. Thank you for reading all this.

5
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. You might look at the geometry package if you have a particular set of margins in mind. It tends to be easier than working out the lower-level lengths like you've used. Jan 3, 2017 at 17:25
  • you would be better to use the geometry package than setting page size by hand but as it is you have increased \textwidth on all pages but only reduced \oddsidemargin so even pages are shifted off too far you need to set \evensidemargin. Also textheight should be \topskip + an integer multiple of \baselineskip otherwise a large block of text with no vertical space on the page can never fit on the page. Jan 3, 2017 at 17:26
  • Or use the oneside option, i.e., \documentclass[oneside,12pt]{book}.
    – gernot
    Jan 3, 2017 at 17:28
  • Thanks, all of you! That's what you get for copy pasting something without truly understanding it. I thought 'odd' was in this case another term for left or something, English...
    – G4A
    Jan 3, 2017 at 17:30
  • @DavidCarlisle Could you make it an answer so I can mark it as 'the answer'? Thanks
    – G4A
    Jan 3, 2017 at 17:30

1 Answer 1

1

You would be better to use the geometry package than setting page size by hand but as it is you have increased \textwidth on all pages but only reduced \oddsidemargin so even pages are shifted off too far you need to set \evensidemargin.

Also \textheight should be \topskip + an integer multiple of \baselineskip otherwise a large block of text with no vertical space on the page can never fit on the page.

A possible set of settings for geometry, leaving to the package to compute the other parameters:

\documentclass[12pt]{book}

\usepackage[
  a4paper,
  textwidth=175mm,
  textheight=225mm,
  heightrounded,
]{geometry}

\usepackage[T1]{fontenc} % <-- don't forget
\usepackage[utf8]{inputenc}
\usepackage[dutch]{babel}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage[
  backend=biber,
  style=alphabetic,
  sorting=ynt,
]{biblatex}
\addbibresource{references.bib}

\usepackage[hidelinks]{hyperref}

\setlength{\parskip}{1.2ex}    % space between paragraphs
\setlength{\parindent}{0cm}%2em}       % amount of indention

\begin{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .