I want to adjust textwidth and textheight to papersize in mid document, that simple.

I am planning to change some pages paper size, but I need both the header, footer and text to adjust (better if automatically) to the paper size.

I've been playing around with geometry package and I was unable to find an option that help me.



\newlength{\classpageheight} \setlength{\classpageheight}{\pdfpageheight}
\newlength{\classpagewidth} \setlength{\classpagewidth}{\pdfpagewidth}

\eject \pdfpagewidth=17in \pdfpageheight=18in

\eject \pdfpagewidth=\classpagewidth \pdfpageheight=\classpageheight


MWE compiled here.

  • you can see tex.stackexchange.com/questions/226930/… maybe it help – touhami Mar 16 '15 at 7:45
  • @HarishKumar Thank you for answering, I did so, but it didn't worked, can you please post the full answer?. – Hans Mar 16 '15 at 7:55
  • @touhami Thanks for answering. I did just took a look at that post and tried to implemented, but failed doing so, would you please help me getting that to work?. – Hans Mar 16 '15 at 7:57
  • @HarishKumar I did so, but it is still not working, I don't know if I didn't make myself clear. What I am trying to do is change the paper size, just for a couple of pages, to a large customize paper size, then be able to write all over the page without scaling the text and having the header all the way through the paper size as well. Please feel free to have a look to the link I provided in my question, the second page will make my question more explicit. Also feel free to ask, maybe I am not being clear in off. – Hans Mar 16 '15 at 8:12
  • @Hans Sorry I made a mistake in my last comment. → Remember that you can't change paper size midway though. Read as can't. – user11232 Mar 16 '15 at 8:24

Here is my solution your remarks are welcome


\def\vcoef#1{#1=\dimexpr #1*\pdfpageheight/\paperheight\relax}
\def\hcoef#1{#1=\dimexpr #1*\pdfpagewidth/\paperwidth\relax}

\pdfpagewidth=#1 \pdfpageheight=#2
% this is important but does nothing here

%----->I change something here






  • maybe you need to adjust the \columnsep befor \iftwocolumn – touhami Mar 16 '15 at 19:15
  • Thanks sir, the output is just what I need, but I have two questions so far, How do I get it to work with two columns if the document was with two columns, and with one column? (maybe this is explained in the \columnsep advice, but I couldn't implement it), and How do I manually set the margins?. As you may notice, I've never toggled with code in LaTeX. – Hans Mar 16 '15 at 19:45
  • edit your question and add exemple with twocolumn to explain what you need – touhami Mar 16 '15 at 19:56
  • All right, cool. – Hans Mar 16 '15 at 20:03
  • 1
    you can for example try \adjustpagedim{17in}{18in} \evensidemargin=5cm \oddsidemargin=5cm \topmargin=10cm – touhami Mar 16 '15 at 21:18

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.