% \iffalse meta-comment
%
% rutitlepage - A Radboud University titlepage
% Copyright 2017 Mart Lubbers (mart@martlubbers.net)
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
%<*driver>
% \fi
\ProvidesFile{rutitlepage.dtx}[2017/05/30 v1.0 Initial package]
% \iffalse
\documentclass{ltxdoc}
\usepackage{rutitlepage}
\usepackage{verbatim}
\usepackage{booktabs}
\usepackage{url}
\GetFileInfo{rutitlepage.dtx}

\urlstyle{tt}
\title{A Radboud University titlepage}
\date{\filedate{}}
\author{Mart Lubbers}

\begin{document}
\maketitle
 \DocInput{\filename}
 \PrintChanges
\end{document}
%</driver>
% \fi
%
% \changes{v1.0}{2017/05/30}{Initial package}
%
% \section{Introduction}
% \texttt{rutitlepage} is an unofficial \LaTeX{} package to generate titlepages
% for the Radboud University. It uses official vector logos from the
% university. The package depends on: \texttt{geometry}, \texttt{graphicx},
% \texttt{ifpdf}, \texttt{keyval} and \texttt{iflang}. \texttt{babel-dutch}
% (optional).
%
% \subsection{Contributors}
% \texttt{rutitlepage} is maintained by Mart Lubbers but work has been done by
% (in order of date of contribution):
% \begin{itemize}
% 	\item Camil Staps\footnote{\url{https://github.com/camilstaps}}
% 	\item Daan Sprenkels\footnote{\url{https://github.com/dsprenkels}}
% 	\item Chris Kamphuis\footnote{\url{https://github.com/chriskamphuis}}
% \end{itemize}
%
% Previously this titlepage originally flew around on the university for at
% least several years in many forms. I'm not sure who created it first but
% credits to them!
%
% \subsection{Issues}
% \begin{itemize}
% 	\item No issues\ldots
% \end{itemize}
%
% \section{Usage}
% \DescribeMacro\maketitleru
% This macro creates the actual titlepage and has the following options
% available. Note that all options are optional.
%
% \begin{tabular}{lp{.5\linewidth}l} 
% 	\toprule
%	Option & Description & Default\\
% 	\midrule
% 	\texttt{authorstext} & The left column header.
% 		& \texttt{Author:}\\
% 	\texttt{authors} & The left column.
%		& \texttt{\textbackslash{}author}\\
% 	\texttt{course} & The top middle text.\\
% 	\texttt{date} & The date. 
%		& \texttt{\textbackslash{}date}\\
% 	\texttt{institute} & The text under the logo.
%		& Radboud University Nijmegen\\
% 	\texttt{pagenr} & The page number of the page, this might be required to
%		set to e.g.\ $1$ for some document classes.\\
% 	\texttt{righttextheader} & The right column.\\
% 	\texttt{righttext} & The right column header.\\
% 	\texttt{righttextBheader} & The right bottom column header.\\
% 	\texttt{righttextB} & The right bottom column.\\
% 	\texttt{subtitle} & The text under the title.\\
% 	\texttt{title} & The text between the lines. 
%		& \texttt{\textbackslash{}title}\\
% 	\bottomrule
% \end{tabular}
%
% \section{Example}
% The following fully equipped code generates the next page:
% 
% \begin{tabular}{rl}
% 	\texttt{\textbackslash{}maketitleru[}
%		& \texttt{authors=\{John Doe\},}\\
%		& \texttt{authorstext=\{Author:\},}\\
%		& \texttt{course=\{Master Thesis\},}\\
%		& \texttt{date=\{Tomorrow\},}\\
%		& \texttt{institute=\{Radboud University Nijmegen\},}\\
%		& \texttt{righttext=\{Jane Doe\},}\\
%		& \texttt{righttextB=\{Joanne Dune\},}\\
%		& \texttt{righttextBheader=\{Second reader:\},}\\
%		& \texttt{righttextheader=\{Supervisors:\},}\\
%		& \texttt{subtitle=\{A cool subtitle for your report\},}\\
%		& \texttt{title=\{Some interesting title\}]}\\
% \end{tabular}
%\maketitleru[
%	title={Some interesting title},
%	date={Tomorrow},
%	course={Master Thesis},
%	institute={Radboud University Nijmegen},
%	authorstext={Author:},
%	authors={John Doe},
%	righttextheader={Supervisors:},
%	righttext={Jane Doe},
%	righttextBheader={Second reader:},
%	righttextB={Joanne Dune},
%	subtitle={A cool subtitle for your report}]
%\endinput
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{rutitlepage}[2017/05/30 Mart Lubbers]
\RequirePackage{geometry,graphicx,ifpdf,keyval,iflang}
\def\@rutitletitle{\@title}
\def\@rutitledate{\@date}
\def\@rutitleauthors{\@author}
\def\@rutitlepagenr{\thepage}
\define@key{maketitleru}{authorstext}{\def\@rutitleauthorstext{#1}}
\define@key{maketitleru}{authors}{\def\@rutitleauthors{#1}}
\define@key{maketitleru}{course}{\def\@rutitlecourse{#1}}
\define@key{maketitleru}{date}{\def\@rutitledate{#1}}
\define@key{maketitleru}{institute}{\def\@rutitleinst{#1}}
\define@key{maketitleru}{pagenr}{\def\@rutitlepagenr{#1}}
\define@key{maketitleru}{righttextBheader}{\def\@rutitlerighttextbheader{#1}}
\define@key{maketitleru}{righttextB}{\def\@rutitlerighttextb{#1}}
\define@key{maketitleru}{righttextheader}{\def\@rutitlerighttextheader{#1}}
\define@key{maketitleru}{righttext}{\def\@rutitlerighttext{#1}}
\define@key{maketitleru}{subtitle}{\def\@rutitlesubtitle{#1}}
\define@key{maketitleru}{title}{\def\@rutitletitle{#1}}
\setkeys{maketitleru}{%
	course={},
	institute={Radboud Universit\IfLanguageName{dutch}{eit}{y} Nijmegen},
	authorstext={\IfLanguageName{dutch}{Auteurs: }{Authors:}},
	righttextheader={},
	righttext={}
}	
\newcommand{\maketitleru}[1][]{
	\setkeys{maketitleru}{#1}
	\newgeometry{hmarginratio=1:1}
	\begin{titlepage}
		\setcounter{page}{\@rutitlepagenr}
		\begin{center}
			\textsc{\LARGE\@rutitlecourse}\\[1.5cm]
			\ifpdf\includegraphics[height=150pt]{logo.pdf}\\
			\else\includegraphics[height=150pt]{logo.eps}\\
			\fi
			\vspace{0.4cm}
			\textsc{\Large\@rutitleinst}\\[1cm]
			\hrule
			\vspace{0.4cm}
			\textbf{\large\@rutitletitle}\\[0.4cm]
			\hrule
			\ifdefined\@rutitlesubtitle
				\vspace{0.4cm}
				\textit{\@rutitlesubtitle}\\[1cm]
			\else
				\vspace{2cm}			
			\fi
			\begin{minipage}[t]{0.45\textwidth}
				\begin{flushleft}\large
					\textit{\@rutitleauthorstext}\\
					\@rutitleauthors{}
				\end{flushleft}
			\end{minipage}
			\begin{minipage}[t]{0.45\textwidth}
				\begin{flushright}\large
					\textit{\@rutitlerighttextheader}\\
					\@rutitlerighttext%
				\end{flushright}
			\end{minipage}

			\vspace{1cm}
			\ifdefined\@rutitlerighttextb
				\begin{minipage}[t]{0.45\textwidth}
					~
				\end{minipage}
				\begin{minipage}[t]{0.45\textwidth}
					\begin{flushright}\large
						\textit{\@rutitlerighttextbheader}\\
						\@rutitlerighttextb%
					\end{flushright}
				\end{minipage}
			\fi
			\vfill
			{\large\@rutitledate}
		\end{center}
	\end{titlepage}
	\restoregeometry{}
}
