Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible, using the geometry package, to store (and restore) the original layout specified by the document class (in my case, the class is report)?

Here is some context. I have been editing a long document in the default page layout for the report document class. Now I found out that I need a title page. There is a particular title page layout, and in fact, it works perfectly if I just load the geometry package with its default and change just two settings. But then I want the rest of the document back in the original page layout! I can't do something like \restoregeometry, since I think geometry just overrides the class options... i.e. there doesn't seem to be anything to restore. Similarly, it seems I can't use \savegeometry or \loadgeometry. So how can I get back to my original layout for the rest of the document without painstakingly hard-coding in all of the specific page layout variables?


Here is a minimum working example:

\documentclass[a4paper,10pt]{report}

\RequirePackage[a4paper,dvips]{geometry} % g1
\geometry{top=2.5cm,bottom=2.3cm}        % g2

\begin{document}

\input{the_title_page}

\SomeGeometryCommandsHere  % g3

\input{the_rest}

\end{document}

If I run the above code with the lines labeled "g" commented out, then the title page does not have the correct page layout, but the rest of the document is formatted perfectly.

If I leave lines g1 and g2 uncommented, then the title page has exactly the correct layout, but no matter what I put for g3 (e.g. \loadgeometry, \restoregeometry, etc.) I can't recover the original layout that I had when g1 and g2 were commented.

Of course, I could completely specify the original layout exhaustively in line g3, and this should in principle work. However, I spent almost one hour on this last night and when I still couldn't get it formated correctly I decided I really needed a smarter solution.

share|improve this question
    
Steve, 1) any chance of providing a minimum working example, or at least identifying the two settings involved? And 2) what is your execution order: \usepackage{geometry} then LoadClass{report} or vice versa? At what stages in the execution order are you performing your \savegeometry, \restoregeometry, etc commands? MWE please. –  Geoffrey Jones Sep 1 '10 at 5:34
    
You need to provide more detail. See this question for how to write a minimal example. –  TH. Sep 1 '10 at 17:23
    
I have often ran into a similar problem. I have a document which already has "almost" the right layout, and I'd like to use the geometry package to slightly tweak the layout. However, the geometry package by default changes everything, and it's difficult to recover the original layout with the geometry package. –  Jukka Suomela Sep 2 '10 at 16:02
add comment

2 Answers

up vote 13 down vote accepted

With pass option, geometry package will change nothing and use the original layout. You can restore the original layout with \restoregeometry. For example,

\documentclass[a4paper,10pt]{report}
\usepackage[pass]{geometry}

\begin{document}%<-- the original layout for 'report' is saved here.
\newgeometry{top=2.5cm,bottom=2.3cm}
\input{the_title_page}
\restoregeometry %<-- the original layout is restored.
\input{the_rest}
\end{document}

The \newgeometry/\restoregeometry commands have been introduced since v5.0, but use v5.6 or later, because in v5.6 a bug was fixed where \newgeometry didn't work when pass is specified in the preamble.

share|improve this answer
add comment

I don't believe geometry provides such tools. An alternative that I'd suggest is to use the changepage package to create a single page with different margins. E.g.

\begin{adjustwidth}{2em}{-2em}
Title page goes here
\end{adjustwidth}

There are other environments in changepage that you can use that change more than just the left/right margin.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.