2

I'm writing a report in LaTeX using the Overleaf online editor. For some reason - when translating to pdf - it arranges all contents far-left and doesn't fill out to the right. Does someone know how to fix this?

Below is an example of what it looks like. First page of my ToC is aligned as should be, but the second page f*cks up and then the rest of the pages in my pdf stay left-aligned as well.

This

I've styled my Overleaf project with several .tex files. My main.tex looks like this:

\documentclass[11pt]{article}
\usepackage{outline}
\usepackage{pmgraph}
\usepackage[utf8]{inputenc}
\usepackage[normalem]{ulem}
\usepackage{appendix}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{float}
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{setspace}
\usepackage{pdfpages}

\begin{document}

\title{\textbf{xxx}}
\author{xxx}
\maketitle
\newpage

\setlength{\parskip}{0.4em}
\renewcommand{\contentsname}{Indholdsfortegnelse}
\tableofcontents

%--------------------Make usable space all of page
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\topmargin}{0in}
\setlength{\headsep}{-.25in}
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{8.5in}
%--------------------Indention
\setlength{\parindent}{0cm}
\setlength{\parskip}{1em}

%.TEX LOADING HERE

\end{document}

Please, if anyone has any suggestions as to how I can fix this, it will be greatly appreciated!

4

You have not posted a testable fragment but the cause is clearly

\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\topmargin}{0in}
\setlength{\headsep}{-.25in}
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{8.5in}

You can not change these settings mid page. Changing them after \begin{document} is not really supported, latex has to set up various page parameters and it does this at \begin{document}.

Move that block to the preamble (or better use the geometry package rather than low level assignments to set the page size.

If you really want to change the page size mid-document, you need to reset the internal parameters to match, and do it after a \clearpage forced page break, or more simply use the geometry package interface to changing the page size for specific pages.

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.