summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/latex-tds/tex/ams.drv
blob: 681bbe95e34b1b35a4035cda79c914c997eac050 (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
% ams.drv
% 2013/02/15 v1.5 Driver file for amslatex documentation files
% Copyright 2006-2013 Heiko Oberdiek.
%
% This file is part of project `latex-tds'.
%
% It 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.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Heiko Oberdiek.
%
% See `README' for a list of all files belonging to the
% project `latex-tds' and additional information.
%
% 2006/06/02 v1.0
% 2007/10/17 v1.1: Fix for subeqn, amsmath before hyperref.
% 2008/08/02 v1.2: Destination of bookmark "Index" fixed for amsldoc.
% 2010/10/27 v1.3
%   * Update/fix for instr-l.tex.
%   * Adding missing macro definitions for amsrefs.dtx.
%   * Fix for changes.tex.
% 2012/05/12 v1.4
%   * Update for ForestGreen, option `dvipsnames' also added for xcolor.
% 2013/02/15 v1.5
%   * Support for amsfonts added.
%
\NeedsTeXFormat{LaTeX2e}
\makeatletter

%%% Paper size
\@for\reserved@a:=article,report,book,amsdtx,amsart\do{%
  \PassOptionsToClass{a4paper}{\reserved@a}%
}

%%% Skip for cite-xa (unsupported)
\begingroup
  \edef\x{\jobname}%
  \def\y{cite-xa}%
  \@onelevel@sanitize\y
\expandafter\endgroup
\ifx\x\y
  \expandafter\@firstofone
\else
  \expandafter\@gobble
\fi
{%
  \input{\jobname.tex}%
  \endinput
}

%%% Support math symbols for amsfonts/amsfonts.dtx
\PassOptionsToPackage{pdfencoding=auto,psdextra}{hyperref}

%%% Patch for amsrefs/changes.tex and amsfonts/amsfonts.dtx
\AtBeginDocument{%
  \@ifundefined{pdfstringdefDisableCommands}{}{%
    \pdfstringdefDisableCommands{%
      \def\cs#1{\textbackslash#1}%
      \let\fnt\@firstofone
      \def\meta#1{\textlangle#1\textrangle}%
    }%
  }%
}

%%% Patch \documentclass
\let\PATCH@ORG@documentclass\documentclass
\renewcommand*{\documentclass}[2][]{%
  \let\documentclass\PATCH@ORG@documentclass
  \begingroup
    \toks@{\documentclass}%
    \def\x{#1}%
    \ifx\x\@empty
    \else
      \toks@\expandafter{\the\toks@[{#1}]}%
    \fi
    \toks@\expandafter{\the\toks@{#2}}%
    \PATCH@documentclass
}
\newcommand*{\PATCH@documentclass}[1][]{%
    \def\x{#1}%
    \ifx\x\@empty
    \else
      \toks@\expandafter{\the\toks@[#1]}%
    \fi
  \expandafter\endgroup
  \the\toks@
  %
  % page layout
  \addtolength{\topmargin}{-10mm}%
  \addtolength{\textheight}{20mm}%
  %
  % load package amsmath before hyperref for subeqn
  \def\@tempa{subeqn}%
  \@onelevel@sanitize\@tempa
  \edef\@tempb{\jobname}%
  \ifx\@tempa\@tempb
    \usepackage{amsmath}\relax
  \fi
  %
  %%% Add hyperref support
  \PassOptionsToPackage{hyperref}{draft=false}%
  \IfFileExists{\jobname.dtx}{%
    \RequirePackage{hypdoc}[2006/06/01]%
  }{}{}%
  \usepackage[pdfusetitle]{hyperref}%
  \hypersetup{
    draft=false,
    colorlinks,
    bookmarksnumbered,
  }%
  \pdfstringdefDisableCommands{%
    \def\BibTeX{BibTeX}%
    \let\pkg\@firstofone
    \let\cls\@firstofone
    \let\opt\@firstofone
    \let\fld\@firstofone
    \let\ntt\relax
    \let\fn\@firstofone
    \let\env\@firstofone
    \def\cn{\textbackslash}%
    \def\begend##1{%
      \textbackslash begin\{##1\} \dots\space
      \textbackslash end\{##1\}%
    }%
    \def\and{, }%
    \def\linebreak[##1]{}%
  }%
}

%%% Patch for instr-l.tex
\begingroup
  \edef\x{\jobname}%
  \def\y{instr-l}%
  \@onelevel@sanitize\y
\expandafter\endgroup
\ifx\x\y
  \PassOptionsToPackage{dvipsnames,usenames}{color}%
  \PassOptionsToPackage{dvipsnames}{xcolor}%
  \RequirePackage{color}%
  \definecolor{ForestGreen}{cmyk}{0.91,0,0.88,0.12}%
  \PassOptionsToPackage{%
    pdfusetitle,%
    pdftex,breaklinks=true,colorlinks,%
    citecolor=ForestGreen,plainpages=false,%
    pdfpagelabels,bookmarksopen,bookmarksnumbered,%
  }{hyperref}%
  \AtBeginDocument{%
    \hypersetup{%
      pdfauthor={American Mathematical Society},%
      pdfkeywords={latex, AMS, amslatex, ams-latex, author instructions},%
      pdftitle={Instructions for Preparation of Papers and Monographs}%
    }%
    \let\ORG@title\title
    \let\ORG@thepage\thepage
    \def\title{%
      \let\thepage\ORG@thepage
      \ORG@title
    }%
    \renewcommand*{\thepage}{\roman{page}}%
  }%
\fi

%%% Patch for cite-xh.tex
\begingroup
  \edef\x{\jobname}%
  \def\y{cite-xh}%
  \@onelevel@sanitize\y
\expandafter\endgroup
\ifx\x\y
  \PassOptionsToPackage{%
    colorlinks,citecolor=red,pagebackref,hypertexnames=false,hypertexnames%
  }{hyperref}%
\fi

%%% Patch theindex for amsldoc.tex
\begingroup
  \edef\x{\jobname}%
  \def\y{amsldoc}%
  \@onelevel@sanitize\y
\expandafter\endgroup
\ifx\x\y
\else
  \expandafter\@gobbletwo
\fi
\AtBeginDocument{%
  \let\PATCH@ORG@theindex\theindex
  \def\theindex{%
     \let\endtheindex\relax
     \end{theindex}%
     \let\theindex\PATCH@ORG@theindex
     \clearpage
     \phantomsection
     \InputIfFileExists{\jobname.ind}{}{}%
     \end{document}%
  }%
}

%%% Patch for amsrefs.dtx
% Adding missing macro definitions (from amsrdoc.tex)
\begingroup
  \edef\x{\jobname}%
  \def\y{amsrefs}%
  \@onelevel@sanitize\y
\expandafter\endgroup
\ifx\x\y
  \AtBeginDocument{%
    \providecommand{\cnbreak}{\penalty999\hskip0pt\relax}%
    \providecommand{\cnm}[2]{\cn{#1}\cnbreak\embrace{#2}}%
    \providecommand{\cnmm}[3]{%
      \cn{#1}%
      \cnbreak
      \embrace{#2}%
      \cnbreak
      \embrace{#3}%
    }%
    \providecommand{\cnom}[1]{\cn{#1}\cnbreak\ommitude}%
    \providecommand{\ommitude}[2][]{{\ntt[#1]}\cnbreak\embrace{#2}}%
    \providecommand{\cnmsm}[4]{%
      \cn{#1}\cnbreak\embrace{#2}\cnbreak *\embrace{#4}%
    }%
    \@ifundefined{lbracechar}{%
      \DeclareTextSymbol{\lbracechar}{OT1}{123}%
      \DeclareTextSymbolDefault{\lbracechar}{OT1}%
      \DeclareTextSymbol{\rbracechar}{OT1}{125}%
      \DeclareTextSymbolDefault{\rbracechar}{OT1}%
    }{}%
    \providecommand{\embrace}[1]{%
      \begingroup\ntt\lbracechar#1\rbracechar\endgroup
    }%
  }%
\fi

\makeatother

%%% Load document source file
\InputIfFileExists{\jobname.tex}{%
  \typeout{* Document source: \jobname.tex}%
}{%
  \InputIfFileExists{\jobname.dtx}{%
    \typeout{* Document source: \jobname.dtx}%
    \AtBeginDocument{\CodelineIndex}%
    \AtEndDocument{\PrintIndex}%
  }{%
    \PackageError{ams.drv}{%
      Cannot find document source%
    }{\csname @ehc\endcsname}%
  }%
}
\endinput