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.

My document contains a title page followed by some text. In order to create my title page, I have to change the page margins on the title page using \newgeometry, and after the title page I return to the usual default margins using \restoregeometry. It includes graphics, uses Tikz, and uses a new environment called changemargin whose code is placed at the beginning of the code before \begin{document}.

MWE:

\documentclass[10pt, a4paper, titlepage, draft]{article}
% USING DRAFT BECAUSE WE DO NOT HAVE THE PDFs TO BE INCLUDED
\usepackage{geometry}
\usepackage{tikz}
\usepackage{graphicx}

\usetikzlibrary{calc}% ADDED !!!!!

\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
}%
\item[]}
{\end{list}}

\begin{document}

\begin{titlepage}

\newgeometry{left=6.75cm, right=1.25cm, top=1.25cm, bottom=1.25cm}

\mbox{}\hfill
\begin{minipage}[c]{8cm} 
\flushright \textbf{University of ...}
\end{minipage}%
\hspace{0.5cm} % your specified distance
\begin{minipage}[c]{2.5cm}
\flushright \includegraphics[width=2.50cm]{logo.pdf}
\end{minipage}%

\begin{tikzpicture}[overlay, remember picture]

\useasboundingbox [fill=blue!20] ($ (current page.south west) + (1, 1)  $) rectangle ($ (current page.north west) + (6.75, -1) $) ;
\draw [line width=0.01mm, blue] ($ (current page.north west) + (1, -1)  $) rectangle ($ (current page.south east) + (-1, 1) $) ; 
\draw ($ (current page.north west) + (9.625, -4.00)  $) -- ($ (current page.north east) + (-1.25, -4.00)  $) ;
\draw ($ (current page.south west) + (9.625, 4.00)  $) -- ($ (current page.south east) + (-1.25, 4.00)  $) ;

\node[anchor=south west, %anchor is upper left corner of the graphic
xshift=1.125cm, %shifting around
yshift=1.125cm]  
at (current page.south west) %left upper corner of the page
{\includegraphics[width=5.25cm]{logo2.pdf}}; 

\end{tikzpicture}

\begin{changemargin}{0cm}{-0.25cm}

\centering

\vspace*{\baselineskip}
\vspace*{\baselineskip}

\rule{127mm}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt}    
\rule{127mm}{0.4pt}\\[\baselineskip]
\vspace*{\baselineskip}
{\large \textbf{Title}}\\[\baselineskip]
{ Subtitle}\\[0.2\baselineskip]
\rule{127mm}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt}
\rule{127mm}{1.6pt}\\[\baselineskip]
\vspace*{\baselineskip}

\end{changemargin}

\mbox{} \vfill \hfill
\begin{minipage}[c]{8cm}
\flushright \textbf{Faculty of Science}
\end{minipage}%
\hspace{0.5cm} % your specified distance
\begin{minipage}[c]{2.5cm}
\flushright \includegraphics[width=2.50cm]{logo3.pdf}
\end{minipage}%

\restoregeometry

\end{titlepage}

\newpage

article text

\end{document}

However, the text on the first page overflows into the bottom margin of the document. This does not happen for all the other pages, only the first one.

What have I done wrong?

(I know my question is similar to this one:

Margin overflow when setting the geometry \AtBeginDocument

but the answer given there doesn't solve my problem.)

share|improve this question
    
What kind of material goes inside titlepage (images, only text)? Can you please add it (you can use some dummy text) to your example code so that we can reproduce the problem? –  Gonzalo Medina Nov 28 '12 at 17:13
    
Perhaps you could use \enlargethispage{amount} in the title page instead of changing geometry? –  JLDiaz Nov 28 '12 at 17:17
1  
I have combined your three code snippets into a single one, changed the class option from final to draft (because we do not have the pdfs to be included) and added \usetikzlibrary{calc}. Now we have got a minimal working example (MWE) (well, not so minimal, but it can be copied, pasted, and compiled). –  Stephen Nov 28 '12 at 17:48
1  
Adding either \geometry{showframe} or \usepackage{showframe} after \usepackage{geometry} one gets frames around text/header/margin/footer. Where does the text flow into the bottom margin? Another thought: What about placing \restoregeometry after \end{titlepage} \newpage? –  Stephen Nov 28 '12 at 17:58
2  
I believe the problem is that \newgeometry will affect the following page, so it needs to be moved to before \begin{titlepage}. And you will probably want to move \restoregeometry to be after \end{ttilepage}, before \newpage. –  Peter Grill Nov 28 '12 at 18:00

1 Answer 1

up vote 2 down vote accepted

\newgeometry affects the following page, so moving it to be before \begin{titlepage} will ensure that it effects the title page.

And since you probably want pages after the title page to have the original geometry, moving \restoregeometry to be after \end{ttilepage}, and before \newpage will make it effective on the first page of the document.

Notes:

Code:

\documentclass[10pt, a4paper, titlepage, draft]{article}
% USING DRAFT BECAUSE WE DO NOT HAVE THE PDFs TO BE INCLUDED
\usepackage{geometry}
\usepackage{tikz}
\usepackage{graphicx}

\usetikzlibrary{calc}% ADDED !!!!!
\usepackage{showframe}% ADDED !!!!!
\usepackage{lipsum}% ADDED !!!!!

\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
}%
\item[]}
{\end{list}}

\begin{document}
\newgeometry{left=6.75cm, right=1.25cm, top=1.25cm, bottom=1.25cm}
\begin{titlepage}

%\newgeometry{left=6.75cm, right=1.25cm, top=1.25cm, bottom=1.25cm}

\mbox{}\hfill
\begin{minipage}[c]{8cm} 
\flushright \textbf{University of ...}
\end{minipage}%
\hspace{0.5cm} % your specified distance
\begin{minipage}[c]{2.5cm}
\flushright \includegraphics[width=2.50cm]{logo.pdf}
\end{minipage}%

\begin{tikzpicture}[overlay, remember picture]

\useasboundingbox [fill=blue!20] ($ (current page.south west) + (1, 1)  $) rectangle ($ (current page.north west) + (6.75, -1) $) ;
\draw [line width=0.01mm, blue] ($ (current page.north west) + (1, -1)  $) rectangle ($ (current page.south east) + (-1, 1) $) ; 
\draw ($ (current page.north west) + (9.625, -4.00)  $) -- ($ (current page.north east) + (-1.25, -4.00)  $) ;
\draw ($ (current page.south west) + (9.625, 4.00)  $) -- ($ (current page.south east) + (-1.25, 4.00)  $) ;

\node[anchor=south west, %anchor is upper left corner of the graphic
xshift=1.125cm, %shifting around
yshift=1.125cm]  
at (current page.south west) %left upper corner of the page
{\includegraphics[width=5.25cm]{logo2.pdf}}; 

\end{tikzpicture}

\begin{changemargin}{0cm}{-0.25cm}

\centering

\vspace*{\baselineskip}
\vspace*{\baselineskip}

\rule{127mm}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt}    
\rule{127mm}{0.4pt}\\[\baselineskip]
\vspace*{\baselineskip}
{\large \textbf{Title}}\\[\baselineskip]
{ Subtitle}\\[0.2\baselineskip]
\rule{127mm}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt}
\rule{127mm}{1.6pt}\\[\baselineskip]
\vspace*{\baselineskip}

\end{changemargin}

\mbox{} \vfill \hfill
\begin{minipage}[c]{8cm}
\flushright \textbf{Faculty of Science}
\end{minipage}%
\hspace{0.5cm} % your specified distance
\begin{minipage}[c]{2.5cm}
\flushright \includegraphics[width=2.50cm]{logo3.pdf}
\end{minipage}%

\end{titlepage}

\restoregeometry
\newpage

\lipsum[1-12]% Added

\end{document}
share|improve this answer

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.