summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/titlepic/titlepic.sty
blob: 2aca230a8d433228eff11c1ea62061637516cff2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
% titlepic.sty is a LaTeX package to show a picture on the cover produced by \maketitle.
% By Thomas ten Cate <ttencate@gmail.com>. Free software, no warranty of any kind.
%
% Version history:
% 1.2: works without titlepage as well
% 1.1: now more self-contained, comes with a PDF manual
% 1.0: first release
%
% -----------------------------------------------------------------------------

% No idea whether it works on older LaTeXes.
\NeedsTeXFormat{LaTeX2e}

% Package identification and version number.
\ProvidesPackage{titlepic}[2017/03/14 1.2 Package to display a picture on the title page]

% Declare the options.
\DeclareOption{tt}{\gdef\@tptopspace{}\gdef\@tpsepspace{\vskip 3em}}
\DeclareOption{tc}{\gdef\@tptopspace{}\gdef\@tpsepspace{\vfil}}
\DeclareOption{cc}{\gdef\@tptopspace{\null\vfil}\gdef\@tpsepspace{\vskip 3em}}
\ExecuteOptions{cc}
\ProcessOptions

% Define the sole command introduced by this package.
% Very similar to the definition of \title, etc.
\def\titlepic#1{\gdef\@titlepic{#1}}
\def\@titlepic{\@empty} % default: no picture

% If a title page was requested from the document class (article/report/book),
% override \maketitle to show our picture.
\if@titlepage
	\renewcommand\maketitle{
		\begin{titlepage}%
			\let\footnotesize\small
			\let\footnoterule\relax
			\let \footnote \thanks
			\@tptopspace%
			\begin{center}%
				{\LARGE \@title \par}%
				\vskip 3em%
				{\large
					\lineskip .75em%
					\begin{tabular}[t]{c}%
					\@author
					\end{tabular}\par%
				}%
				\vskip 1.5em%
				{\large \@date \par}%       % Set date in \large size.
			\end{center}\par
			\@tpsepspace%
			{\centering\@titlepic\par}
			\vfil
			\@thanks
		\end{titlepage}%
		\setcounter{footnote}{0}%
		\global\let\thanks\relax
		\global\let\maketitle\relax
		\global\let\@thanks\@empty
		\global\let\@author\@empty
		\global\let\@date\@empty
		\global\let\@title\@empty
		\global\let\@titlepic\@empty
		\global\let\title\relax
		\global\let\author\relax
		\global\let\date\relax
		\global\let\and\relax
		\global\let\titlepic\relax
	}
\else
	\def\@maketitle{%
		\newpage
		\null
		\vskip 2em%
		\begin{center}%
			\let \footnote \thanks
			{\LARGE \@title \par}%
			\vskip 1.5em%
			{\large
			\lineskip .5em%
			\begin{tabular}[t]{c}%
				\@author
			\end{tabular}\par}%
			\vskip 1em%
			{\large \@date}%
		\end{center}%
		\vskip .5em%
		{\centering\@titlepic\par}
		\par
		\vskip 1.5em}
\fi