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
% Please check for updates
\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}
{\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?
Best Answer
Just load
geometry
conditionally. Of course the documentation should make it clear that the package must be loaded aftergeometry
, if this package is used. A test for this could be added.columbidaeTitle.sty
test.tex
Output
Output if the call of
geometry
intest.tex
is removed