3

I am new to LaTeX and in my first article I am facing the following problem. Although I set the margins to 1 in all around the A4 page, the text does not justify till the end of the right margin. It justifies almost one 1 in before the margin. Header and footer follow the margins but the texts isn't.

\documentclass[12pt,a4paper]{article}
\usepackage{lipsum}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[lmargin=2.5cm, rmargin=2.5cm,tmargin=2.50cm,bmargin=2.50cm]{geometry}
\usepackage{lastpage}
\usepackage{setspace}
\singlespace
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0.5pt}
\fancyhead[l]{MSc Lift Engineering\\LIFM005DL-Assignment LCK}
\fancyhead[r]{Christoforos Milionis}
\renewcommand{\footrulewidth}{0.5pt}
\fancyfoot[l]{30/05/2013}
\fancyfoot[r]{Page \thepage\ of \pageref{LastPage}}
\usepackage{graphicx}
\usepackage{caption}
\author{Christoforos Milionis}
\title{2nd Assignment}
\begin{titlepage}
\begin{document}
\begin{minipage}{0.10\textwidth}\begin{flushleft}
\end{flushleft}
\end{minipage}
\begin{minipage}{1.1\textwidth}\begin{center}
\LARGE\textbf\\ Oadsdadsn \\
\Large dassdasdas
\end{center}\end{minipage}
\begin{center}
\vskip2.5cm
\LARGE \textbf{dhdjdj uygkygk}\\
\large Student No. jyfgkugy
\end{center}
\vskip6cm
\large \ \ \ \ \ \ \textbf{Supervisor}
\par  \ \  hgfhdfj hgkhg
\end{titlepage}
\doublespace
\tableofcontents
\newpage
\section{Assignment Brief}
\doublespace
\lipsum[23]
\end{document}

This is the preamble.

4

You have a very big header for the default header height; so fancyhdr warns you and pushes the material down the page. This is what you get in your log file

Package Fancyhdr Warning: \headheight is too small (12.0pt):
 Make it at least 27.18335pt.
 We now make it that large for the rest of the document.
 This may cause the page layout to be inconsistent, however.

Never underestimate warnings; for instance you get also other warnings, see later.

A way to fix it is to say

\usepackage[margin=1in,headheight=28pt]{geometry}

The other warning you get is

(\end occurred inside a group at level 1)

### semi simple group (level 1) entered at line 48 (\begingroup)
### bottom level

which is due to incorrect usage of \doublespace which should be \doublespacing.

Also move \begin{titlepage} after \begin{document}.

2

The problem is a faulty construction of the titlepage environment. You can cut down the example to

\documentclass[12pt,a4paper]{article}
\usepackage{lipsum}
\usepackage[margin=1in]{geometry}
\begin{titlepage}
\begin{document}
\end{titlepage}
\lipsum[23]
\end{document}

Notice that \begin{document} is inside the titlepage environment. This is not correct and messes up some of the margin setting. Try moving this line

\documentclass[12pt,a4paper]{article}
\usepackage{lipsum}
\usepackage[margin=1in]{geometry}
\begin{document}
\begin{titlepage}
\end{titlepage}
\lipsum[23]
\end{document}

(I've simplified the application of margins in geometry.)

0

load the package layout and then after \begin{document} write \layout. Then you can see your margin settings in the output:

enter image description here

  • Thank you for the response.I did that, the margins seem to be okay but on the layout the bottom and right margin are not shown. – chris Apr 24 '13 at 8:02
  • the above image shows exactly your layout. I used your preamble setting. – user2478 Apr 24 '13 at 8:04

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.