# Create a titlepage: package .sty

I would like to create a package (.sty) for a titlepage. I followed this guide https://en.wikibooks.org/wiki/LaTeX/Title_Creation from which I took the following two codes: the first code is the package called columbidaeTitle.sty, the second code is the document where the package, earlier created, is loaded.

columbidaeTitle.sty

% Copyright note: This package defines how titles should
% be typeset at the columbidae University
\ProvidesPackage{columbidaeTitle}[2015/08/10 v.01 an
example package^^J for wikibooks]
\RequirePackage{graphicx}
\newcommand*{\project}[1]{\gdef\@project{#1}%
}
\newcommand*{\@project}{Final Year Project}
\newcommand*{\supervisor}[1]{\gdef\@supervisor{#1}%
}
\newcommand*{\@supervisor}{\texttt{\string\supervisor} currently
\renewcommand*{\maketitle}{%
\begin{titlepage}
{\raggedleft%
\includegraphics[width=3cm]{example-image-16x9}\par
}\vspace{1cm}
\centering
{\scshape\LARGE Columbidae University \par}
\vspace{1cm}
{\scshape\Large\@project\unskip\strut\par}
\vspace{1.5cm}
{\huge\bfseries\@title\unskip\strut\par}
\vspace{2cm}
{\Large\itshape\@author\unskip\strut\par}
\vfill
supervised by\par
\@supervisor\unskip\strut\par

\vfill

{\large \@date\par}
\end{titlepage}
}
\endinput


Document:

\documentclass{book}
\usepackage{columbidaeTitle}
\supervisor{Dr. James Miller}
\project{Bachelor Thesis}
\author{A LaTeX enthusiast}
\title{Why i want to be a duck}

\begin{document}
\maketitle
\tableofcontents
\chapter{Ducks are awesome}
\end{document}


I have an issue. I would like the whole document to have this margin:

\usepackage[bindingoffset=1.5cm, left=3cm, right=3cm, top=3cm, bottom=3cm]{geometry}


except for the titlepage, for which I would like to have

\newgeometry{left=3cm,right=3cm,bottom=2cm,top=3cm}


I tried to insert \RequirePackage{geometry} in the columbidaeTitle.sty file and then

\newgeometry{left=3cm,right=3cm,bottom=2cm,top=3cm}
\begin{titlepage}
...
\end{titlepage}
\restoregeometry


but it didn't work. How can I make?

• try \begin{titlepage}\newgeometry{left=3cm,right=3cm,bottom=2cm,top=3cm} ... \restoregeometry \end{titlepage}  – touhami Jan 11 '16 at 17:39
• But since the titlepage is quite static, you can use an extra document and just include the pdf as stated in .... well, it was somewhere. Isn't that written on that wiki page? – Johannes_B Jan 11 '16 at 17:49
• By the way, packing up a new package is only a good idea, if you have a standard page and you want to save your colleagues some time. Else, c.f. How to customize my titlepage? – Johannes_B Jan 11 '16 at 17:50
• This is my first time trying to create (copy and paste it truthfully) a simple package. I would not like to create it inside the document but I wish to create this package. Anyway: I tried \RequirePackage{geometry} , then \begin{titlepage}\newgeometry{left=3cm,right=3cm,bottom=2cm,top=3cm} ... \restoregeometry \end{titlepage} and in document .tex I inserted \usepackage[bindingoffset=1.5cm, left=3cm, right=3cm, top=3cm, bottom=3cm]{geometry} but I get an error: ! LaTeX Error: Option clash for package geometry. – Marco Jan 11 '16 at 18:04
• Yes of course, you cannot load the document with different options. Use \geometry{bindingoffset=1.5cm, left=3cm, right=3cm, top=3cm, bottom=3cm} – Johannes_B Jan 11 '16 at 18:07

Just load geometry conditionally. Of course the documentation should make it clear that the package must be loaded after geometry, if this package is used. A test for this could be added.

## columbidaeTitle.sty

% Copyright note: This package defines how titles should
% be typeset at the columbidae University

\ProvidesPackage{columbidaeTitle}[2015/08/10 v.01 an example package^^J for wikibooks]
\RequirePackage{graphicx}

\newcommand*{\project}[1]{\gdef\@project{#1}}
\newcommand*{\@project}{Final Year Project}
\newcommand*{\supervisor}[1]{\gdef\@supervisor{#1}}
\newcommand*{\@supervisor}{\texttt{\string\supervisor} currently not set. Please fix this.}
\renewcommand*{\maketitle}{%
\begin{titlepage}
\newgeometry{left=3cm,right=3cm,bottom=2cm,top=3cm}
{\raggedleft\includegraphics[width=3cm]{example-image-16x9}\par}
\vspace{1cm}
\centering
{\scshape\LARGE Columbidae University \par}
\vspace{1cm}
{\scshape\Large\@project\unskip\strut\par}
\vspace{1.5cm}
{\huge\bfseries\@title\unskip\strut\par}
\vspace{2cm}
{\Large\itshape\@author\unskip\strut\par}
\vfill
supervised by\par
\@supervisor\unskip\strut\par
\vfill
{\large \@date\par}
\end{titlepage}
}
\endinput


## test.tex

\documentclass{book}

\usepackage[bindingoffset=1.5cm, left=3cm, right=3cm, top=3cm, bottom=3cm,showframe]{geometry}

\usepackage{columbidaeTitle}
\supervisor{Dr. James Miller}
\project{Bachelor Thesis}
\author{A LaTeX enthusiast}
\title{Why i want to be a duck}

\begin{document}
\maketitle
\tableofcontents
\chapter{Ducks are awesome}
\end{document}


## Output if the call of geometry in test.tex is removed

• Title and chapters sound suspiciously like the ones in my thesis... :) – Paulo Cereda Jan 17 '16 at 14:09