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.

Possible Duplicate:
Change paper size in mid-document

How can I use default

\documentclass[a4paper]

styles in Title page, index pages, header and footer - but the text itself as if I were using

\documentclass[a4paper]
\usepackage[top=2.5cm, bottom=2.5cm, left=1.5cm, right=6cm]{geometry}

The point is - long lines are not convenient to read, while I want to use A4 paper - to include code listings (I can exceed right=6cm manually in verbatim environment). And code listings look better at A4 paper (otherwise I have to cut lines all the time...)

P.S. Actually I get latex from sphinx. But I'm interested in general solutions as well.

share|improve this question

marked as duplicate by egreg, Harish Kumar, Marco Daniel, percusse, Tom Bombadil Aug 23 '12 at 20:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 2 down vote accepted

With

\newgeometry{<args>}

you can change the geometry options for the page that follows; and then

\restoregeometry

get you back to the initial config.

Here's a MWE:

\documentclass[a4paper]{article}
\usepackage{blindtext}%
\usepackage[top=2.5cm, bottom=2.5cm, left=1.5cm, right=6cm]{geometry}
\begin{document}
\blindtext
\clearpage
\newgeometry{top=2.5cm, bottom=2.5cm, left=1.5cm, right=2.5cm}
\blindtext
\clearpage
\restoregeometry
\blindtext
\end{document}

Here's the result:

enter image description here

share|improve this answer
    
MWE gives me: Undefined control sequence. l.7 \newgeometry. I'm also interested in specifiying newgeometry inside a single page. Is it possible? –  Adobe Aug 16 '12 at 16:20
    
I don't have the Undefined control sequence warning here (maybe it's a sphinx issue). Specifying a new geometry within a single page is precisely what the example does: both \newgeometry and \restoregeometry commands will start a clear page by their very definition (I only added the \clearpage commands to illustrate it). Please, check if this question is not a duplicate to <tex.stackexchange.com/questions/6834/…;, as suggested by egreg (if so, consider closing this question) –  henrique Aug 16 '12 at 21:29
    
I've googled my udefined newgeometry and found out that I have an outdated texlive and in particular - outdated geometry (I'm on kubutnu 12.04). I'm now updating it all (using the ppa) - and I think everything will be working after that. –  Adobe Aug 17 '12 at 11:56
    
Now it works - but I get the page breaks even without \clearpage. –  Adobe Aug 17 '12 at 13:43

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