summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemcompounds/chemcompounds.sty
blob: 80aefcf7372faa647b8c771f397756d20e84a3f9 (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
%%
%% This is file `chemcompounds.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% chemcompounds.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from chemcompounds.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file chemcompounds.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
%% File: chemcompounds.dtx Copyright (C) 2005-2007 Stephan Schenk
%%       $Id: chemcompounds.dtx,v 1.8 2006/12/01 15:21:58 schenk Exp $
%%
%% Stephan Schenk (mail@schenk-stephan.de)
%%
%%
%%  To produce the documentation, do the following:
%%
%%    latex chemcompounds.dtx
%%    latex chemcompounds.dtx
%%    makeindex -s gglo.ist -o chemcompounds.gls chemcompounds.glo
%%    latex chemcompounds.dtx
%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{chemcompounds}
  [2006/12/01 v1.1.3 Dictionary for compound numbering]
\newif\ifchemcompounds@implicit
\DeclareOption{implicit}{\chemcompounds@implicittrue}
\DeclareOption{noimplicit}{\chemcompounds@implicitfalse}
\ExecuteOptions{implicit}
\ProcessOptions
\def\compoundseparator{,\penalty\@m\ }
\let\compoundglobalprefix\@empty
\let\compoundglobalsuffix\@empty
\let\compoundprefix\@empty
\let\compoundsuffix\@empty
\def\compoundstyle{\textbf}
\def\printcompound#1{{\compoundprefix}{\compoundstyle{#1}}{\compoundsuffix}}
\def\declarecompound{\@ifnextchar[\@ldeclarecompound\@declarecompound}
\@onlypreamble\declarecompound
\newif\ifchemcompounds@print
\newif\ifchemcompounds@create
\DeclareRobustCommand{\compound}{%
  \chemcompounds@createtrue
  \chemcompounds@printtrue
  \@ifnextchar *{\chemcompounds@printfalse\@firstoftwo\@compound}
    {%
      \@ifnextchar +{\chemcompounds@createfalse\@firstoftwo\@compound}
        {\@compound}
    }
}
\def\@compound#1{%
  \ifchemcompounds@print
    \compoundglobalprefix
  \fi
  \let\@compounda\@empty
  \@for\@compoundb:=#1\do{%
    \edef\@compoundb{\expandafter\@firstofone\@compoundb}%
    \ifchemcompounds@print
      \@compounda
      \def\@compounda{{\compoundseparator}}%
    \fi
    \@ifcompoundundefined{\@compoundb}{%
      \ifchemcompounds@print
        \mbox{\reset@font\bfseries ?}%
      \fi
      \G@refundefinedtrue
      \@latex@warning
        {compound `\@compoundb' on page \thepage\space undefined}%
    }{%
      \ifchemcompounds@print
        \mbox{\printcompound{\@nameuse{comp@\@compoundb}}}%
      \fi
    }%
    \@createcompoundhook{\@compoundb}%
  }%
  \ifchemcompounds@print
    \compoundglobalsuffix
  \else
    \unskip
  \fi
}
\newcounter{chemcompounds@counter}
\def\chemcompounds@label{\@newl@bel {comp}}
\def\chemcompounds@writelabel#1#2{%
  \if@filesw
    \begingroup
      \def\protect{\noexpand}%
      \immediate\write\@auxout{
        \string\chemcompounds@label{#1}{#2}
      }%
    \endgroup
  \fi
  \ignorespaces
}
\def\@ldeclarecompound[#1]#2{%
  \AtBeginDocument{\@createcompound[#1]{#2}}
}
\@onlypreamble\@ldeclarecompound
\ifchemcompounds@implicit
  \let\@declarecompound\@gobble
\else
  \def\@declarecompound#1{%
    \AtBeginDocument{\@createcompound{#1}}
  }
\fi
\@onlypreamble\@declarecompound
\def\@ifcompoundundefined#1{%
  \@ifundefined{comp@#1}
}
\def\@createcompound{%
  \@ifnextchar[\@@lcreatecompound\@@createcompound
}
\def\@@createcompound#1{%
  \@ifnotcompoundcreated{#1}{%
    \stepcounter{chemcompounds@counter}%
    \chemcompounds@writelabel{#1}{\the\value{chemcompounds@counter}}
    \@compoundcreated{#1}%
  }%
}
\def\@@lcreatecompound[#1]#2{%
  \chemcompounds@writelabel{#2}{#1}
  \@compoundcreated{#2}%
}
\ifchemcompounds@implicit
  \def\@compoundcreated#1{%
    \global\@namedef{compc@#1}{}%
  }
\else
  \let\@compoundcreated\@gobble
\fi
\ifchemcompounds@implicit
  \def\@ifnotcompoundcreated#1#2{%
    \@ifundefined{compc@#1}{#2}{}%
  }
\else
  \let\@ifnotcompoundcreated\@secondoftwo
\fi
\ifchemcompounds@implicit
  \def\@createcompoundhook#1{%
    \ifchemcompounds@create
      \@createcompound{#1}%
    \fi
  }
\else
  \let\@createcompoundhook\@gobble
\fi
\endinput
%%
%% End of file `chemcompounds.sty'.