1

I am trying to alter the margins of a certain page in my document to have different margins from rest of document. So I'm using the geometry package. However, the margins of my document look weird even when I call \restoregeometry. In my latex class file I have a line like this:

\usepackage{vmargin} \setmarginsrb           { 1.5in}  % left margin
                        { 0.6in}  % top margin
                        { 1.0in}  % right margin
                        { 0.8in}  % bottom margin
                        {  20pt}  % head height
                        {0.25in}  % head sep
                        {   9pt}  % foot height
                        { 0.3in}  % foot sep

I try to replicate this using geometry but without any luck

\usepackage[ left=1.5in,
top=0.6in,
right=1.0in,
bottom=0.8in,
headsep=0.25in,
headheight=20pt,
heightrounded,
a4paper]
{geometry}

What am I missing?

UPDATE

I've created a minimum working example. If you comment out the geometry bits, it works, otherwise, it looks weird.

\documentclass{ecsthesis}      % Use the Thesis Style 
\usepackage[utf8]{inputenc}

%\usepackage[ left=1.5in, 
%top=0.6in, 
%right=1.0in, 
%bottom=0.8in, 
%headsep=0.25in, 
%headheight=20pt, 
%heightrounded, 
%a4paper] 
%{geometry}        
    \begin{document}        
    %\restoregeometry

    \frontmatter \title{Title page title page}

    \authors    {\texorpdfstring
                 {\href{mailto:}{Name}}
                 {Name}
                } \addresses  {\groupname\\\deptname\\\univname} \date       {\today} \subject    {} \keywords   {} \maketitle

    \end{document}
  • 1
    it would be easier to answer if you provided test documents using the two forms and say how they differ – David Carlisle Jul 25 '17 at 20:58
  • 1
    vmargin is outdated (and weird) – user31729 Jul 25 '17 at 21:02
  • @DavidCarlisle Question updated. – picasso Jul 25 '17 at 21:18
3

With geometry the settings in the preamble are for the whole document. \restoregeometry after \begin{document} has no effect, since it sets the layout back to the way it was set up in the preamble.

You need to use \newgeometry before the pages with changed margins and \restoregeometry after them.

In the following code, I did not use your class, but it nevertheless shows how to change and restore the layout mid document.

\documentclass[a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{lipsum}      

\begin{document}        
\frontmatter
\title{Title page title page}
\author{Some One}
\maketitle

\mainmatter
\chapter{Normal Pages}
\lipsum[1-20]

\newgeometry{left=1.5in, 
top=0.6in, 
right=1.0in, 
bottom=0.8in, 
headsep=0.25in, 
headheight=20pt, 
heightrounded}
\chapter{Special Pages}
\lipsum[1-20]

\restoregeometry
\chapter{Normal Pages again}
\lipsum[1-20]

\end{document}

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.