0

I am trying to do a document in which I have a text box in the first page and the rest of document I have fancy style.

I tried to do it and I can do it if I do two different documents (and so two different tex files). In the first one I used

\usepackage[paperwidth=16cm,paperheight=24cm]{geometry}
\usepackage[a4,frame,center]{crop}

and in the second one I used:

\documentclass[a4paper,twoside]{report}
\pagestyle{fancy}

Is there any way to do just one document?

0

1 Answer 1

1

Short explanation of the changes needed

  • Pagestyle: You can easily change the pagestyle for a single page using \thispagestyle{style}, or for all pages following, using the macro \pagestyle{style}, both from the fancyhdr-package.

  • Layout The geometry-package makes it quite easy to change margins, textwidth, height and so on for a page with it's commands \newgeometry{arguments} and \restoregeometry to the original settings.

  • Papersize Changing the size of the paper in the middle of a document is more difficult, and to make those changes I have been using the information found in the answer by Charles Stewart in the post Change paper size in mid-document. There are other alternative answers there, well worth the read.


What I've done is first setting a standard-pagesize, and then storing the the dimensions of that page into the lengths called \originalPaperWidth and \originalPaperHeight to be able to restore the page to that dimension.

Usage

I've created two macros, \changePaper{width}{height}[optional arguments for \newgeometry] and \restorePaper, which should make it easy to create custom pages. Use this in combination with \thispagestyle{style} or \pagestyle{style}

Output

enter image description here

Code

\documentclass[a4paper,11pt]{article}
\usepackage{fancyhdr}
\usepackage{geometry}
\usepackage{xparse} % Needed for newdocumentcommand
\usepackage{lipsum}
%\usepackage{showframe}

\pagestyle{fancy}

\newlength{\originalPaperHeight}
\newlength{\originalPaperWidth}
\setlength{\originalPaperHeight}{\pdfpageheight}
\setlength{\originalPaperWidth}{\pdfpagewidth}

\newcommand{\restorePaperSize}{%
\clearpage%
\pdfpagewidth=\originalPaperWidth \pdfpageheight=\originalPaperHeight
\restoregeometry
}

\NewDocumentCommand{\changePaper}{mmO{}}{%
    % Input:
    % #1: width
    % #2: height
    % #3: optional arguments for \newgeometry
    \pdfpagewidth=#1 \pdfpageheight=#2
\newgeometry{layoutwidth=#1,layoutheight=#2,#3}
    }
\begin{document}
\thispagestyle{empty}
\changePaper{16cm}{23cm}[margin=1cm,top=2cm]
\section{Special page}
\lipsum[1-2]
\restorePaperSize
\section{Back to normal fancy pages}
\lipsum[3-5]
\end{document}
2
  • I am trying with this code: ### Code \documentclass{article} \usepackage[paperwidth=16cm,paperheight=24cm]{geometry} \usepackage[a4,frame,center]{crop} \usepackage{lipsum} \begin{document} \thispagestyle{empty} \lipsum %now i want to use \documentclass[a4paper,twoside] \newpage \newgeometry{a4paper,twoside} \restoregeometry \lipsum \end{document} The first part is ok but the second is not...what is supposed to write in newgeometry?
    – pipita
    Aug 11, 2016 at 17:17
  • '\newgeometry' cannot change the papersize.
    – Runar
    Aug 12, 2016 at 4:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .