0

having the following code, how is it possible to insert another page, which would have different margin paramaters as opposed to those seen in the code? Basically, the first page is cover page with different margins (top=20, bottom=20, right=20, left=20) and this is the one I would like to integrate into this code. Thanks!

\documentclass[12pt,oneside,a4paper]{article}

\usepackage[
 left=40mm,
 top=30mm,
 right=20mm,
 bottom=20mm,
 headsep=12.5mm,
 headheight=14.5pt, %%% 3mm is too small
 heightrounded
]{geometry}

\usepackage{fancyhdr,xpatch}

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.0pt}
\fancyhf{}
\fancyhead[R]{Title of topic --- \thepage}

\makeatletter
\let\ORI@section\section
\renewcommand{\section}{\@ifstar\s@section\ORI@section}
\newcommand{\s@section}[1]{%
  \ORI@section*{#1}
  \csname phantomsection\endcsname % for hyperref
  \addcontentsline{toc}{section}{#1}
}
\xpatchcmd{\tableofcontents}{\section}{\ORI@section}{}{} % toc not in toc
\makeatother

\begin{document}
\pagenumbering{roman}

\tableofcontents
\clearpage

\listoffigures
\clearpage

\listoftables 
\clearpage

\section*{Section A}

\clearpage
\pagenumbering{arabic}

\section{Section B}

\end{document}
  • 3
    The \newgeometry command from the geometry package takes mostly the same options as \usepackage[...]{geometry} and does what you want. See the package documentation for more details. – ChrisS Sep 2 '13 at 11:06
  • thanks, are there are any other alternatives? – ajafarov Sep 2 '13 at 11:19
  • There are other alternatives, but it is not clear why you would want to use them given you are already using the geometry package. – StrongBad Dec 10 '13 at 16:22
1

Using the \newgeometry macro is the way to go here. Changing the page is as simple as adding to you MWE

\newgeometry{top=20mm, bottom=20mm, right=20mm, left=20mm}
A Title Page
\restoregeometry%
\clearpage

This gives a new complete MWE of

\documentclass[12pt,oneside,a4paper]{article}

\usepackage[
 left=40mm,
 top=30mm,
 right=20mm,
 bottom=20mm,
 headsep=12.5mm,
 headheight=14.5pt, %%% 3mm is too small
 heightrounded
]{geometry}

\usepackage{fancyhdr,xpatch}

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.0pt}
\fancyhf{}
\fancyhead[R]{Title of topic --- \thepage}

\makeatletter
\let\ORI@section\section
\renewcommand{\section}{\@ifstar\s@section\ORI@section}
\newcommand{\s@section}[1]{%
  \ORI@section*{#1}
  \csname phantomsection\endcsname % for hyperref
  \addcontentsline{toc}{section}{#1}
}
\xpatchcmd{\tableofcontents}{\section}{\ORI@section}{}{} % toc not in toc
\makeatother

\begin{document}
\newgeometry{top=20mm, bottom=20mm, right=20mm, left=20mm}
A Title Page
\restoregeometry%
\clearpage

\pagenumbering{roman}

\tableofcontents
\clearpage

\listoffigures
\clearpage

\listoftables 
\clearpage

\section*{Section A}

\clearpage
\pagenumbering{arabic}

\section{Section B}

\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.