summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/amsaddr/amsaddr.dtx
blob: 58ab734fcf5fe05f052b68cdaef54e68697bfd2c (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
% \iffalse meta-comment
%
% Copyright 2006 Jérôme Lelong <jerome.lelong@gmail.com>
% 
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% 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.3c or later is part of all distributions of LaTeX 
% version 2005/12/01 or later.
% 
% 
% \fi
% \iffalse
%<*driver>
\ProvidesFile{amsaddr.dtx}
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{amsaddr}
%<*class>
    [2013/04/02 v1.1 .dtx amsaddr file]
%</class>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{a4}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{amsaddr.dtx}
  \PrintIndex
\end{document}
%</driver>
% \fi
%
% \GetFileInfo{amsaddr.dtx}
% \CheckSum{327}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \changes{v1.0}{2004/11/05}{Initial version}
% \changes{v1.1}{2013/04/02}{Fix space alignment}
%
% \GetFileInfo{amsaddr.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
% \date{\today}
% \title{The \textsf{amsaddr} class\thanks{This document
%   corresponds to \textsf{amsaddr}~\fileversion, dated \filedate.}}
% \author{J\'er\^ome Lelong \\ \texttt{jerome.lelong@gmail.com}}
%
% \maketitle
%
% \begin{abstract}
%   This package is intended to be used with the \textsf{amsart} documentclass only. It
%   lets you move the authors' affiliations either just below the
%   authors' names on the front page or as footnotes on the first page. The email
%   addresses are always listed as a footnote on the front page.
% \end{abstract}
%
%
% \tableofcontents
%
% \section{License}
%
% This package is copyright \textcopyright\ 2006-2013 by:
%
% \begin{quote}
%   J\'er\^ome Lelong,
%   Univ. Grenoble Alples, Grenoble Institute of Technology,
%   Grenoble, France\\
%   E-Mail: \texttt{jerome.lelong@gmail.com}
% \end{quote}
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License, distributed from CTAN
% archives available from \texttt{http://www.latex-project.org/lppl.txt}; either
% version 1.3c of the License, or (at your option) any later version. 
%
%
% \section{Usage}
%
%
% To use this package, you need to include the directive |\usepackage{amsaddr}| in your
% |.tex| file. Alternatively, you may also use it with the |foot| option
% |\usepackage[foot]{amsaddr}|. When using the |foot| option, the adresses are put as
% footnotes on the first page of the document.
%
% A typical usage looks like the following
%
% \begin{verbatim}
% \author{author one and author two}
% \address{common address of authors one and two}
% 
% \author{author three}
% \address{author three address}
% 
% \email{list of emails}
% \end{verbatim}
% 
% If |amsaddr| is used without the |foot| option, the addresses declared with the
% |\address| command are printed just below the authors'names declared with the
% preceeding |\author| command. The emails appear as a footnote like this
% \\
% 
% {\it E-mail addresses:} {\texttt{email one}, \texttt{email two}, and so on}
% \\
%
% If the option |foot| was passed to the package, you may consider numbering
% authors' names so that you can use numbered footnotes for the affiliations.
% 
% \begin{verbatim}
% \author{author one$^1$ and author two$^1$}
% \address{$^1$common address of authors one and two}
% 
% \author{author three$^2$}
% \address{$^2$author three address}
% 
% \email{list of emails}
% \end{verbatim}
%
% As in standard |amsart| documents, an option can be passed to the |\author| command
% to specify the replacement for the author's name on the running headers.
%
%\begin{center}
%  \begin{verbatim}
%\author[header name of the author]{author name}
%  \end{verbatim}
%\end{center}
%
%  
% \StopEventually{}
%
% \section{Implementation}
%
%    \begin{macrocode}
  \def\filename{amsaddr}
  \def\fileversion{v1.0}
  \def\filedate{2006/12/12}
  \ifx\protected@edef\@undefined
     \let\protected@edef\edef
  \fi
%    \end{macrocode}
%
% The |foot| option enables to move the affiliation related material to the bottom of
% the fisrt page as footnotes.
%
%    \begin{macrocode}
\newif\if@footaddr
\DeclareOption{foot}{\@footaddrtrue}
\ProcessOptions\relax
%    \end{macrocode}
%
%
% \begin{macro}{\author}
%
% The |\author| macro can be used the same way as in other |amsart| documents. The
% variable |g@author| is used to count the total number of authors.
%
%    \begin{macrocode}
\newcounter{g@author}
\setcounter{g@author}{0}
\renewcommand{\author}[2][]{%
  \stepcounter{g@author}
  \ifx\@empty\authors
    \gdef\authors{#2}%
  \else
    \g@addto@macro\authors{\and#2}%
  \fi
  \g@addto@macro\addresses{\author{#2}}%
  \@ifnotempty{#1}{%
    \ifx\@empty\shortauthors
      \gdef\shortauthors{#1}%
    \else
      \g@addto@macro\shortauthors{\and#1}%
    \fi
  }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\email}
% The |\email| command is used to specify the different authors. The email addresses
% can be specified in a unique command or using separate invocations of the command.
%    \begin{macrocode}
\let\emails\@empty
\renewcommand{\email}[2][]{
  \ifx\@empty\emails
    \gdef\emails{\mbox{#2}}
  \else
    \g@addto@macro\emails{,\space\mbox{#2}}
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% Process |\author| and |\address| macros 
%
%    \begin{macrocode}
\def\@set@authors@addresses{\par
  \skip@30\p@ 
  \centering
  \begingroup
  \def\author##1{\par\vskip\skip@\MakeUppercase{##1}}%
  \def\\{\protect\linebreak}%
  \centering
  \def\address##1##2{\par\addvspace\bigskipamount%
    {\itshape\ignorespaces##2}%
  }%
  \def\email##1##2{%
    \@ifnotempty{##2}{, \ignorespaces{\ttfamily##2}}}%
  \def\curraddr##1##2{}%
  \def\urladdr##1##2{}%
  \addresses
  \endgroup
}
%    \end{macrocode}
%
% \begin{macro}{\@setfoot@addresses}
% The |\@setfoot@addresses| macro is used to print the addresses as footnotes. This
% macro is called when the |foot| option is passed to the package.
%    \begin{macrocode}  
\def\@setfoot@addresses{
  \def\author##1{}%
  \def\\{\unskip, \ignorespaces}%
  \newif\if@firstaddr
  \@firstaddrtrue
  \def\address##1##2{%
    \if@firstaddr\@firstaddrfalse\else\par\fi
    \@ifnotempty{##1}{(\ignorespaces##1\unskip) }%
    {\scshape\ignorespaces##2}%
  }%
  \def\email##1##2{}%
  \def\curraddr##1##2{}%
  \def\urladdr##1##2{}%
  \addresses
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@setaddresses}
% The |\@setaddresses| macro is used to process the addresses when they are to appear
% just below the authors' names on the front page.
%    \begin{macrocode}  
\def\@setaddresses{\par
  \nobreak \begingroup
  \def\author##1{\nobreak\addvspace\bigskipamount}%
  \def\\{\unskip, \ignorespaces}%
  \interlinepenalty\@M
  \def\address##1##2{}%
  \def\email##1##2{}%
  \def\curraddr##1##2{\begingroup
    \@ifnotempty{##2}{\nobreak\indent{\itshape Current address}%
      \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\space
      ##2\par}\endgroup}%
  \def\urladdr##1##2{\begingroup
    \@ifnotempty{##2}{\nobreak\indent{\itshape URL}%
      \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\space
      \ttfamily##2\par}\endgroup}%
  \addresses
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@setemails}
% The |\@setemails| macro is called by the |\maketitle| command to print the email
% addresses.
%    \begin{macrocode}
\def\@setemails{%
  \ifnum\theg@author > 1
    \mbox{{\itshape E-mail addresses}:\space}{\ttfamily\emails}.
  \else
    \mbox{{\itshape E-mail address}:\space}{\ttfamily\emails}.
  \fi%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@maketitle}
% The |\@maketitle| macro is used to replace the standard |\makefile| command. Before
% issuing this command, no authors, affiliations, nor emails are printed.
%    \begin{macrocode}  
\def\@maketitle{%
  \normalfont\normalsize
  \let\@makefnmark\relax  \let\@thefnmark\relax
  \if@footaddr\@footnotetext{\@setfoot@addresses}\fi
  \ifx\@empty\emails\else \@footnotetext{\@setemails}\fi
  \ifx\@empty\@date\else \@footnotetext{\@setdate}\fi
  \ifx\@empty\@subjclass\else \@footnotetext{\@setsubjclass}\fi
  \ifx\@empty\@keywords\else \@footnotetext{\@setkeywords}\fi
  \ifx\@empty\thankses\else \@footnotetext{%
    \def\par{\let\par\@par}\@setthanks}\fi
  \@mkboth{\@nx\shortauthors}{\@nx\shorttitle}%
  \global\topskip42\p@\relax % 5.5pc   "   "   "     "     "
  \@settitle
  \if@footaddr\ifx\@empty\authors \else \@setauthors \fi
  \else%
     \ifx\@empty\authors \else \@set@authors@addresses \fi
  \fi
  \ifx\@empty\@dedicatory
  \else
    \baselineskip18\p@
    \vtop{\centering{\footnotesize\itshape\@dedicatory\@@par}%
      \global\dimen@i\prevdepth}\prevdepth\dimen@i
  \fi
  \@setabstract
  \normalsize
  \if@titlepage
    \newpage
  \else
    \dimen@34\p@ \advance\dimen@-\baselineskip
    \vskip\dimen@\relax
  \fi
  \let\addresses\relax
  \let\@setfoot@addresses\relax
} % end \@maketitle
%    \end{macrocode}
% \end{macro}
%
% In |amsart| documents, affiliations are normally printed by the |\enddoc@text|
% command . To avoid a double printing of the considered material, the |\enddoc@text|
% macro has to be redefined.
%
%    \begin{macrocode}
\def\enddoc@text{
  \ifx\@empty\addresses\else \@setaddresses\fi
}
%    \end{macrocode}
% \Finale
\endinput