summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/makecmds/makecmds.sty
blob: 89cc467fe5a2c0e9898a8de03755065497d398c8 (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
%%
%% This is file `makecmds.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% makecmds.dtx  (with options: `usc')
%% 
%%  Copyright 2000 Peter R. Wilson
%% 
%%  This program is provided under the terms of the
%%  LaTeX Project Public License distributed from CTAN
%%  archives in directory macros/latex/base/lppl.txt.
%% 
%% Author: Peter Wilson, Herries Press
%% Maintainer: Will Robertson (will dot robertson at latex-project dot org)
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{makecmds}[2009/09/03 v1.0a extra command making commands]

\newif\ifm@kwarn
  \m@kwarnfalse
\DeclareOption{warn}{\m@kwarntrue}
\ProcessOptions\relax

\def\makecommand{\@star@or@long\m@ke@command}
\def\m@ke@command#1{%
  \ifx #1\undefined\else
    \ifm@kwarn
      \PackageWarning{makecmds}{Redefining command `\protect#1'}
    \fi
  \fi
  \let\@ifdefinable\@rc@ifdefinable
  \new@command#1}

\def\provideenvironment{%
  \@star@or@long\m@kprovide@environment}
\def\m@kprovide@environment#1{%
  \@ifundefined{#1}{%
    \expandafter\let\csname#1\endcsname\relax
    \expandafter\let\csname end#1\endcsname\relax
    \new@environment{#1}}{\m@kdiscardenvargs{#1}}
}
\def\m@kdiscardenvargs#1{%
  \@testopt{\m@kenva#1}0}
\def\m@kenva#1[#2]{%
  \@ifnextchar [{\m@kenvb#1[#2]}{\m@kthrowenv{#1}{[#2]}}}
\def\m@kenvb#1[#2][#3]{\m@kthrowenv{#1}{[#2][#3]}}
\def\m@kthrowenv#1#2#3#4{}

\def\makeenvironment{\@star@or@long\m@ke@environment}
\def\m@ke@environment#1{%
  \@ifundefined{#1}{\new@environment{#1}}{%
    \ifm@kwarn
      \PackageWarning{makecmds}{Redefining environment `#1'}
    \fi
    \renew@environment{#1}}
}

\def\providelength#1{%
  \ifx #1\undefined
    \newlength{#1}
  \fi
}
\def\makelength#1{%
  \ifx #1\undefined
    \newlength{#1}
  \else
    \ifm@kwarn
      \PackageWarning{makecmds}{Redefining length `\protect#1'}
    \fi
    \newskip#1
  \fi
}

\def\providecounter#1{%
  \@ifundefined{c@#1}{\newcounter{#1}}{%
    \@ifnextchar[{\m@k@gobbleendoptarg}{}}%
}
\def\makecounter#1{%
  \expandafter\ifx \csname c@#1\endcsname \undefined
  \else
    \ifm@kwarn
      \PackageWarning{makecmds}{Redefining counter `#1'}
    \fi
  \fi
  \@definecounter{#1}%
  \@ifnextchar[{\@newctr{#1}}{}
}

\def\m@k@gobbleendoptarg[#1]{}

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