summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemstyle/chemscheme.sty
blob: 461cbe2cb760dd0695a8473388cb16d53a331e2f (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
%%
%% This is file `chemscheme.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% chemscheme.dtx  (with options: `package')
%%  ----------------------------------------------------------------
%%  The chemstyle bundle --- Schemes and style for chemistry
%%  Maintained by Joseph Wright
%%  E-mail: joseph.wright@morningstar2.co.uk
%%  Released under the LaTeX Project Public License v1.3c or later
%%  See http://www.latex-project.org/lppl.txt
%%  ----------------------------------------------------------------
%% 
\NeedsTeXFormat{LaTeX2e}
\def\csh@id$#1: #2.#3 #4 #5-#6-#7 #8 #9${%
    #5/#6/#7\space v1.4a\space}
\ProvidesPackage{chemscheme}
  [\csh@id $Id: chemscheme.dtx 48 2008-07-31 19:22:43Z joseph $
   Support for chemical schemes]
\RequirePackage{kvoptions,psfrag,iflang}
\SetupKeyvalOptions{
  family=csh,
  prefix=csh@}
\newif\ifcsh@bpchem
\define@key{csh}{tracking}
  {\csh@bpchemtrue
   \lowercase{\edef\@tempa{#1}}%
   \def\@tempb{bpchem}%
   \ifx\@tempa\@tempb\else
     \def\@tempb{chemcompounds}%
     \ifx\@tempa\@tempb
       \csh@bpchemfalse
     \else
       \PackageError{chemscheme}
         {Unknown value `#1' for option numbers}
         {The `tracking' option accepts values `bpchem'
          and `chemcompounds'}%
     \fi
   \fi}
\DeclareVoidOption{chemcompounds}{\csh@bpchemfalse}
\DeclareVoidOption{bpchem}{\csh@bpchemtrue}
\DeclareVoidOption{chapter}
  {\PackageInfo{chemscheme}
    {Ignoring obsolete option `chapter'}}
\define@key{csh}{floats}
  {\lowercase{\renewcommand*{\csh@fltpkg}{#1}}%
   \def\@tempa{floatrow}%
   \ifx\csh@fltpkg\@tempa\else
     \def\@tempa{float}%
     \ifx\csh@fltpkg\@tempa\else
       \def\@tempa{memoir}%
       \ifx\csh@fltpkg\@tempa
         \@ifclassloaded{memoir}{}
           {\PackageWarning{chemscheme}
            {You asked for floats to be created using memoir,
             \MessageBreak but have used a different document
             class\MessageBreak Using floatrow instead}%
            \renewcommand*{\csh@fltpkg}{floatrow}}%
       \else
         \PackageError{chemscheme}
           {Unknown value `#1' for option numbers}
           {The `floats' option accepts values `float',
            `floatrow' and `memoir'}%
       \fi
     \fi
   \fi}
\@ifpackageloaded{floatrow}
  {\newcommand*{\csh@fltpkg}{floatrow}%
   \define@key{csh}{floats}
     {\PackageInfo{chemscheme}{Package floatrow already
      loaded\MessageBreak Option `floats' disabled}}}
  {\@ifpackageloaded{float}
     {\newcommand*{\csh@fltpkg}{float}%
      \define@key{csh}{floats}
        {\PackageInfo{chemscheme}{Package float already
         loaded\MessageBreak Option `floats' disabled}}}
     {\@ifclassloaded{memoir}
        {\newcommand*{\csh@fltpkg}{memoir}}
        {\newcommand*{\csh@fltpkg}{floatrow}}}}
\ProcessKeyvalOptions{csh}
\newcommand*{\csh@load@memoir}{}
\newcommand*{\csh@load@float}{%
  \@ifpackageloaded{float}{}
    {\let\newfloat\@undefined}
  \RequirePackage{float,caption}}
\newcommand*{\csh@load@floatrow}{%
  \@ifpackageloaded{floatrow}{}
    {\let\newfloat\@undefined}
  \RequirePackage{floatrow,caption}}
\csname csh@load@\csh@fltpkg\endcsname
\newcommand*{\schemename}{Scheme}
\newcommand*{\listschemename}{List of Schemes}
\newcommand*{\csh@makesch@memoir}{%
  \AtBeginDocument{\csh@mksch@memoir}}
\newcommand*{\csh@mksch@memoir}{%
  \newfloat[chapter]{scheme}{los}{\schemename}
  \kill@lastcounter{losdepth}
  \renewcommand*{\thescheme}{\thechapter.\@arabic\c@scheme}
  \addtodef{\@smemfront}{}{\counterwithout{scheme}{chapter}}
  \addtodef{\@smemmain}{}{%
    \ifartopt\else
      \counterwithin{scheme}{chapter}
    \fi}
  \addtodef{\backmatter}{}{%
    \ifartopt\else
      \counterwithout{scheme}{chapter}%
      \setcounter{scheme}{0}%
    \fi}
  \ifartopt
    \counterwithout{scheme}{chapter}%
  \fi
  \newlistof{listofschemes}{los}{\listschemename}
  \kill@lastcounter{losdepth}
  \newlistentry[chapter]{scheme}{los}{0}
  \cftsetindents{scheme}{0em}{2.3em}
  \addtodef{\insertchapterspace}{}%
    {\addtocontents{los}{\protect\addvspace{10pt}}}
  \@ifundefined{c@losdepth}%
    {\newcounter{losdepth}\setcounter{losdepth}{1}}{}}
\newcommand*{\csh@makesch@float}{%
  \AtBeginDocument{\csh@mksch@float}}
\newcommand*{\csh@mksch@float}{%
  \@ifundefined{chapter}
    {\newfloat{scheme}{tbp}{los}}
    {\newfloat{scheme}{tbp}{los}[chapter]%
     \csh@fixchapter}%
  \floatname{scheme}{\schemename}
  \newcommand*{\listofschemes}{%
    \listof{scheme}{\listschemename}}}
\newcommand*{\csh@makesch@floatrow}{%
  \@ifundefined{chapter}
    {\DeclareNewFloatType{scheme}
      {fileext=los,placement=tbp,name=Scheme}}
    {\DeclareNewFloatType{scheme}
      {fileext=los,placement=tbp,name=Scheme,within=chapter}%
     \csh@fixchapter}%
  \newcommand*{\listofschemes}{%
    \listof{scheme}{\listschemename}}}
\newcommand*{\csh@fixchapter}{%
  \@ifundefined{KOMAScriptVersion}
    {\renewcommand*{\thescheme}{%
       \ifnum\c@chapter>\z@ \thechapter.\fi \@arabic\c@scheme}}
    {}%
    \let\csh@chapter\@chapter
    \renewcommand{\@chapter}{%
      \addtocontents{los}{\protect\addvspace{10\p@}}%
      \csh@chapter}}
\csname csh@makesch@\csh@fltpkg\endcsname
\def\@tempa{floatrow}
\ifx\@tempa\csh@fltpkg
  \newcommand*{\floatcontentscentre}{%
    \floatsetup{objectset=centering}}
  \newcommand*{\floatcontentscenter}{%
    \floatsetup{objectset=centering}}
  \newcommand*{\floatcontentsright}{%
    \floatsetup{objectset=raggedleft}}
  \newcommand*{\floatcontentsleft}{%
    \floatsetup{objectset=raggedright}}
\else
  \let\csh@floatboxreset\@floatboxreset
  \renewcommand*{\@floatboxreset}{%
    \csh@everyfloat
    \csh@floatboxreset}
  \newcommand*{\floatcontentscentre}{%
    \let\csh@everyfloat\centering}
  \newcommand*{\floatcontentscenter}{%
    \let\csh@everyfloat\centering}
  \newcommand*{\floatcontentsleft}{%
    \let\csh@everyfloat\relax}
  \newcommand*{\floatcontentsright}{%
    \let\csh@everyfloat\raggedleft}
\fi
\floatcontentsleft
\newif\ifcsh@babel
\@ifpackageloaded{babel}
  {\csh@babeltrue}
  {}
\@ifclassloaded{memoir}{}
  {\@ifpackageloaded{babel}
     {\IfLanguageName{french}
        {\let\floatc@plain\FB@makecaption}
        {\IfLanguageName{frenchb}
          {\let\floatc@plain\FB@makecaption}
          {}}}
  {}}
\AtBeginDocument{
  \@ifpackageloaded{babel}
    {\addto{\captionsngerman}{%
       \renewcommand*{\schemename}{Schema}}
     \addto{\captionsngerman}{%
       \renewcommand*{\listschemename}{Schemenverzeichnis}}
     \addto{\captionsgerman}{%
       \renewcommand*{\schemename}{Schema}}
     \addto{\captionsgerman}{%
       \renewcommand*{\listschemename}{Schemenverzeichnis}}
     \addto{\captionsfrench}{%
       \renewcommand*{\schemename}{\scshape Sch\`eme}}
     \addto{\captionsfrench}{%
       \renewcommand*{\listschemename}{Table des sch\`emes}}
     \addto{\captionsfrenchb}{%
       \renewcommand*{\schemename}{\scshape Sch\`eme}}
     \addto{\captionsfrenchb}{%
       \renewcommand*{\listschemename}{Table des sch\`emes}}
     \expandafter\selectlanguage\expandafter{\languagename}
     \@ifclassloaded{memoir}{}
       {\IfLanguageName{french}
          {\ifcsh@babel\else
             \let\floatc@plain\FB@makecaption
           \fi}
          {\IfLanguageName{frenchb}
            {\ifcsh@babel\else
               \let\floatc@plain\FB@makecaption
             \fi}
          {}}}
      {}}{}}
\newcommand*{\schemerefmarker}{TMP}
\newcommand*{\schemerefformat}{\textsf}
\ifcsh@bpchem
  \RequirePackage{bpchem}
  \let\csh@label\CNlabel
\else
  \RequirePackage{chemcompounds}
  \let\csh@label\compound
\fi
\newcount\csh@num
\newcommand*{\schemeref}{%
  \advance\csh@num\@ne
  \@ifnextchar[%]
    {\csh@schemeref}
    {\csh@schemeref[\schemerefmarker\the\csh@num]}}
\def\csh@schemeref[#1]#2{%
  \psfrag{#1}[b][b]
    {\schemerefformat{\csh@label{#2}}}}
\def\csh@schemerefsub[#1]#2#3{%
  \psfrag{#1}[b][b]
    {\schemerefformat{\CNlabelsub{#2}{#3}}}}
\newcommand*{\chemschemeref}[1]{\schemeref[#1]}
\ifcsh@bpchem
  \newcommand*{\schemerefsub}{%
    \advance\csh@num\@ne
    \@ifnextchar[%]
      {\csh@schemerefsub}
      {\csh@schemerefsub[\schemerefmarker\the\csh@num]}}
  \newcommand*{\chemschemerefsub}[1]{\schemerefsub[#1]}
\else
  \newcommand*{\schemerefsub}[3][]{%
    \advance\csh@num\@ne
    \PackageWarning{chemscheme}
      {`chemcompound' option active\MessageBreak
       Command \string\chemschemerefsub\space not used
       \MessageBreak Please alter your source to \MessageBreak
       \string\chemschemeref}}
  \newcommand*{\chemschemerefsub}{\schemerefsub}
\fi
\endinput
%%
%% End of file `chemscheme.sty'.