summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/onlyamsmath/onlyamsmath.sty
blob: 1dd37ecf289ac095dc3bc96b3a5911b961dccb02 (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
%%
%% This is file `onlyamsmath.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% onlyamsmath.dtx  (with options: `package')
%% 
%%   onlyamsmath package
%% 
%%   Copyright  2001, 2012 Harald Harders
%% 
%%   This program can be redistributed and/or modified under the terms
%%   of the LaTeX Project Public License Distributed from CTAN
%%   archives in directory macros/latex/base/lppl.txt; either
%%   version 1 of the License, or any later version.
%% 
%%   harald.harders@gmx.de
%% 
\ProvidesPackage{onlyamsmath}
  [2012/01/01  v0.10  Destroy the standard math environments]
\RequirePackage{amsmath}
\newif\ifonlyams@eqnarray
\DeclareOption{eqnarray}{\onlyams@eqnarraytrue}
\newif\ifonlyams@all
\DeclareOption{all}{
  \onlyams@alltrue
  \onlyams@eqnarraytrue
}
\newif\ifonlyams@error
\onlyams@errortrue
\DeclareOption{error}{\onlyams@errortrue}
\DeclareOption{warning}{\onlyams@errorfalse}
\ExecuteOptions{error}
\ProcessOptions\relax
\newcommand{\onlyams@error}[1]{%
  \ifonlyams@error
    \PackageError{onlyamsmath}{Environment #1 used}{Please use only the
      environments provided by the amsmath package.}%
  \else
    \PackageWarning{onlyamsmath}{Environment #1 used, please use
      \MessageBreak only the environments provided by the amsmath
      \MessageBreak package}%
  \fi
}
\ifonlyams@eqnarray
  \let\onlyams@eqnarray\eqnarray
  \def\eqnarray{%
    \onlyams@error{eqnarray or eqnarray*}%
    \onlyams@eqnarray}
\fi
\ifonlyams@all
  \def\displaymath{%
    \onlyams@error{displaymath}%
    \[}
\fi
\def\dollarcode{\ifx\protect\@typeset@protect
   \expandafter\futurelet\expandafter\next\expandafter\checkdsp
   \else \expandafter$\fi}
\begingroup
\lccode`\~=`\$
\lowercase{\endgroup\let~}\dollarcode
\def\checkdsp{\ifx\next\dollarcode\expandafter\dspcomplain
  \else\expandafter$\fi}
\def\dspcomplain#1{%
  \ifmmode
    \expandafter \]%
  \else
    \onlyams@error{$$ $$}%
    \expandafter \[
  \fi}
\AtBeginDocument{\catcode`\$=13 }

\endinput
%%
%% End of file `onlyamsmath.sty'.