-
Notifications
You must be signed in to change notification settings - Fork 0
/
nmd-title.sty
112 lines (99 loc) · 2.96 KB
/
nmd-title.sty
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
% The code that makes the article title is so horrible that it must
% be hidden in its own file. The horribleness is because of the
% need to handle multiple authors.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{nmd/nmd-title}[2014/08/31 - Semester start edition]
% Code for names, title, etc. Mostly taken from amsart
% Save the title
\renewcommand{\title}[2][]{\gdef\@title{#2}}
% Formating for addresses at the end
\newcommand{\nmd@author}[1]{#1\par}
\newcommand{\nmd@address}[1]{#1\par}
\newcommand{\nmd@email}[1]{email: \texttt{#1}\par}
\newcommand{\nmd@urladdr}[1]{\url{#1}\par \vspace{10bp}}
% For combining the authors names, we need this giant mess
\let\@xp=\expandafter
\let\@nx=\noexpand
\long\def\@ifempty#1{\@xifempty#1@@..\@nil}
\long\def\@xifempty#1#2@#3#4#5\@nil{%
\ifx#3#4\@xp\@firstoftwo\else\@xp\@secondoftwo\fi}
\long\def\@ifnotempty#1{\@ifempty{#1}{}}
\csname newtoks\endcsname\@emptytoks
\newcommand{\xandlist}[4]{\@andlista{{#1}{#2}{#3}}#4\and\and}
\def\@andlista#1#2\and#3\and{\@andlistc{#2}\@ifnotempty{#3}{%
\@andlistb#1{#3}}}
\def\@andlistb#1#2#3#4#5\and{%
\@ifempty{#5}{%
\@andlistc{#2#4}%
}{%
\@andlistc{#1#4}\@andlistb{#1}{#3}{#3}{#5}%
}}
\let\@andlistc\@iden
\newcommand{\nxandlist}[4]{%
\def\@andlistc##1{\toks@\@xp{\the\toks@##1}}%
\toks@{\toks@\@emptytoks \@andlista{{#1}{#2}{#3}}}%
\the\@xp\toks@#4\and\and
\edef#4{\the\toks@}%
\let\@andlistc\@iden}
\def\@@and{and}
\newcommand{\andify}{%
\nxandlist{\unskip, }{\unskip{} \@@and~}{\unskip, \@@and~}}
\def\and{\unskip{ }\@@and{ }\ignorespaces}
% End giant mess
\let\authors\@empty
\let\addresses\@empty
\renewcommand{\author}[2][]{%
\ifx\@empty\authors
\gdef\authors{#2}%
\gdef\addresses{\nmd@author{#2}}
\else
\g@addto@macro\authors{\and#2}%
\g@addto@macro\addresses{\nmd@author{#2}}%
\fi
}%
% Save addresses, emails, and urls.
\newcommand{\address}[2][]{%
\g@addto@macro\addresses{\nmd@address{#2}}}
\newcommand{\email}[2][]{%
\g@addto@macro\addresses{\nmd@email{#2}}}
\newcommand{\urladdr}[2][]{%
\g@addto@macro\addresses{\nmd@urladdr{#2}}}
% The abstract.
\newsavebox\abstractbox
\renewenvironment{abstract}{%
\global\setbox\abstractbox=\vtop \bgroup%
\begin{leftruledparagraph}{3bp}{8bp}{nmdmedium}
\textbf{Abstract.} \setlength{\parindent}{1.667em}}
{\end{leftruledparagraph}\egroup}
% The dedication
\newsavebox\dedicationbox
\newenvironment{dedication}{%
\global\setbox\dedicationbox=\vtop \bgroup%
\begin{center} \dedicationfont
}
{\end{center}\egroup}
\def\maketitle{\par
\@topnum\z@ % this prevents figures from falling at the top of page
\thispagestyle{empty}
\
\vspace{20bp}
{\titlefont\setlength{\baselineskip}{30bp}
\noindent
\@title
}
\vspace{40bp}
\noindent
\andify\authors
{\authorfont \authors}
\vspace{10bp}
\noindent
\usebox{\dedicationbox}
\noindent
\usebox{\abstractbox}
}
\AtEndDocument{%
\small
\interlinepenalty\@M
\setlength{\parindent}{0pt}
\ifaddress \addresses \fi
}