summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemstyle/chemstyle.sty
blob: 70db3750fdb02950f89b18a6bcd521c885c8455e (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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
%%
%% This is file `chemstyle.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% chemstyle.dtx  (with options: `package')
%% ----------------------------------------------------------------
%% The chemstyle bundle --- Schemes and style for chemistry
%% 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}
\ProvidesPackage{chemstyle}
  [2010/06/06 v2.0i Schemes and style for chemistry]
\RequirePackage{amstext,caption,chemscheme,xspace}
\SetupKeyvalOptions{
  family=cst,
  prefix=cst@
}
\@ifclassloaded{achemso}
  {
    \PackageWarning{chemstyle}
      {%
        The chemstyle package should not\MessageBreak
        be used with the achemso class:\MessageBreak
        loading chemstyle will abort%
      }
    \endinput
  }
  {}
\newcommand*\cst@tempa{}
\DeclareBoolOption[false]{abbrcomma}
\DeclareBoolOption[true]{abbremph}
\DeclareBoolOption[true]{notesbefore}
\DeclareBoolOption[true]{phrases}
\DeclareComplementaryOption{nophrases}{phrases}
\DeclareBoolOption[true]{rademph}
\DeclareBoolOption[true]{radhyphen}
\DeclareBoolOption[true]{radprefix}
\DeclareBoolOption[false]{radsuper}
\DeclareBoolOption[true]{varioref}
\DeclareBoolOption[true]{xspace}
\DeclareStringOption{journal}
\DeclareDefaultOption{%
  \ifx\CurrentOptionValue\relax
    \edef\cst@journal{\CurrentOptionKey}%
  \else
    \PackageWarning{chemstyle}{%
      Unknown key option `\CurrentOptionKey'%
    }%
  \fi
}
\DeclareStringOption{language}
\setkeys{cst}{%
  journal  = ,
  language = english,
  varioref = true
}
\newif\ifcst@notes
\newif\ifcst@autonotes
\newcommand*\cst@opt@auto{auto}
\define@key{cst}{notes}[true]{%
  \edef\KVO@param{#1}%
  \@onelevel@sanitize\KVO@param
  \ifx\KVO@param\KVO@true
    \expandafter\cst@opt@notestrue
  \else
    \ifx\KVO@param\KVO@false
      \expandafter\expandafter\expandafter\cst@opt@notesfalse
    \else
      \ifx\KVO@param\cst@opt@auto
        \expandafter\expandafter\expandafter\expandafter\expandafter
        \expandafter\expandafter\cst@opt@notesauto
      \else
        \expandafter\expandafter\expandafter\expandafter\expandafter
        \expandafter\expandafter\cst@opt@noteserror
      \fi
    \fi
  \fi
}
\newcommand*\cst@opt@notestrue{%
  \cst@notestrue
  \cst@autonotesfalse
}
\newcommand*\cst@opt@notesfalse{%
  \cst@notesfalse
  \cst@autonotesfalse
}
\newcommand*\cst@opt@notesauto{%
  \cst@notestrue
  \cst@autonotestrue
}
\newcommand*\cst@opt@noteserror{%
  \PackageWarning{chemstyle}{%
    Value `\KVO@param' is not supported by\MessageBreak
    option `notes'%
  }%
}
\DeclareComplementaryOption{nonotes}{notes}
\newcommand*\cstsetup{%
  \setkeys{cst}
}
\newcommand*\cst@xspace{%
  \ifcst@xspace
    \expandafter\xspace
  \fi
}
\@ifpackageloaded{siunitx}{%
}{%
  \@ifpackageloaded{SIunits}{}{%
    \@ifpackageloaded{unitsdef}{}{%
      \IfFileExists{siunitx.sty}{%
        \RequirePackage{siunitx}
      }{%
        \IfFileExists{SIunits.sty}{%
          \RequirePackage{SIunits}
        }{%
          \PackageWarning{chemstyle}{%
            Could not find siunitx or SIunits package:\MessageBreak
            additional units not defined%
          }
        }
      }
    }
  }
}
\@ifpackageloaded{siunitx}{%
  \sisetup{load-configurations = abbreviations}
  \DeclareSIUnit\cubiccentimeter{\cubic\centi\metre}
  \DeclareSIUnit\cmc{\cubic\centi\metre}
  \DeclareSIUnit\molar{\mole\per\cubic\deci\metre}
  \DeclareSIUnit\Molar{\textsc{m}}
  \DeclareSIUnit\torr{torr}
  \sisetup{load-configurations = abbreviations}
}{}
\@ifpackageloaded{SIunits}{%
  \newcommand*\cubiccentimeter{\centi\metre\cubed}
  \newcommand*\Molar{\textsc{m}}
  \newcommand*\molar{\mole\usk\deci\metre\rpcubed}
  \newcommand*\mmHg{\milli\metre Hg}
  \newcommand*\mol{\mole}
  \newcommand*\cmc{\cubiccentimeter}
  \newcommand*\Hz{\hertz}
}{%
  \@ifpackageloaded{unitsdef}{%
    \newunit{\cubiccentimeter}{\cm\unitsuperscript{3}}
    \newunit{\Molar}{\textsc{m}}
    \newunit{\molar}{\mole\unitsep\dm\unitsuperscript{--3}}
    \newunit{\mmHg}{mmHg}
    \newunit{\mol}{\mole}
    \newcommand*\cmc{\cubiccentimeter}
    \newcommand*\Hz{\hertz}
  }{}
}
\providecommand*\standardstate{%
  {%
    \ensuremath{\protect\cst@standardstate}%
  }%
}
\newcommand*\cst@standardstate{%
  \mathpalette\cst@standardstate@aux\circ
}
\newcommand*\cst@standardstate@aux[2]{%
  \ooalign{%
    \hfil
    $#1-$%
    \hfil
    \cr
    \hfil
    $#1#2$%
    \hfil
    \cr
  }%
}
\newcommand*\cst@latin{%
  \ifcst@abbremph
    \expandafter\emph
  \else
    \expandafter\@firstofone
  \fi
}
\newcommand*{\latinemphon}{%
  \cstsetup{abbremph=true}%
}
\newcommand*{\latinemphoff}{%
  \cstsetup{abbremph=false}%
}
\AtBeginDocument{%
  \providecommand*\latin{\cst@latin}%
}
\newcommand*\cst@phrases@make{%
  \providecommand*\etal{%
    \cst@phrase{et~al}%
  }%
  \providecommand*\eg{%
    \cst@phrase@comma{e.g\spacefactor999\relax}%
  }%
  \providecommand*\etc{%
    \cst@phrase{etc}%
  }%
  \providecommand*\ie{%
    \cst@phrase@comma{i.e\spacefactor999\relax}%
  }%
  \providecommand*\invacuo{%
    \latin{in vacuo}%
    \cst@xspace
  }%
}
\AtBeginDocument{%
  \ifcst@phrases
    \expandafter\cst@phrases@make
  \fi
}
\newcommand*\cst@phrase[1]{%
  \latin{#1}%
  \@ifnextchar.{}{%
    .%
    \cst@xspace
  }%
}
\newcommand*\cst@phrase@comma{%
  \ifcst@abbrcomma
    \expandafter\cst@phrase@with@comma
  \else
    \expandafter\cst@phrase
  \fi
}
\newcommand*\cst@phrase@with@comma[1]{%
  \latin{#1}%
  \cst@phrase@with@comma@aux@i\relax
}
\newcommand*\cst@phrase@with@comma@token{}
\newcommand*\cst@phrase@with@comma@aux@i[1]{%
  \futurelet\cst@phrase@with@comma@token\cst@phrase@with@comma@aux@ii
}
\newcommand*\cst@phrase@with@comma@aux@ii{%
  \let\cst@phrase@with@comma@next\cst@phrase@with@comma@aux@i
  \if.\cst@phrase@with@comma@token\else
    \if,\cst@phrase@with@comma@token\else
      \let\cst@phrase@with@comma@next\cst@phrase@with@comma@end
    \fi
  \fi
  \cst@phrase@with@comma@next
}
\newcommand*\cst@phrase@with@comma@end{%
  .,%
  \cst@xspace
}
\newcommand*\cst@phrase@with@comma@next{}
\newcommand*\cst@radical@make[2]{%
  \expandafter\DeclareRobustCommand\expandafter*\csname #1#2\endcsname{%
    \text{\cst@radical{#1}{#2}}%
    \cst@xspace
  }%
}
\cst@radical@make{n}{Pr}
\cst@radical@make{i}{Pr}
\cst@radical@make{n}{Bu}
\cst@radical@make{i}{Bu}
\cst@radical@make{s}{Bu}
\cst@radical@make{t}{Bu}
\newcommand*\cst@radical@emph{}
\newcommand*\cst@radical@hyphen{}
\newcommand*\cst@radical@hyphen@true{-}
\newcommand*\cst@radical@super{}
\newcommand*\cst@radical{%
  \let\cst@radical@emph\@firstofone
  \ifcst@rademph
    \let\cst@radical@emph\emph
  \fi
  \let\cst@radical@hyphen\relax
  \ifcst@radhyphen
    \let\cst@radical@hyphen\cst@radical@hyphen@true
  \fi
  \let\cst@radical@super\@firstofone
  \ifcst@radsuper
    \let\cst@radical@super\textsuperscript
  \fi
  \ifcst@radprefix
    \expandafter\cst@radical@pre
  \else
    \expandafter\cst@radical@post
  \fi
}
\newcommand*\cst@radical@pre[2]{%
  \cst@radical@super{%
    \cst@radical@emph{#1}%
  }%
  \cst@radical@hyphen
  #2%
}
\newcommand*\cst@radical@post[2]{%
  #2%
  \cst@radical@hyphen
  \cst@radical@super{%
    \cst@radical@emph{#1}%
  }%
}
\AtBeginDocument{\@ifundefined{c@bibnote}{\newcounter{bibnote}}{}}
\newcommand*\cst@refsec@name{}
\newcommand*\cst@refsec@find[1]{%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname #1\endcsname\relax
    \expandafter\cst@refsec@set@name
  \else
    \expandafter\@gobble
  \fi
  {#1}%
}
\newcommand*\cst@refsec@set@name[1]{%
  \def\cst@refsec@name{#1}%
}
\cst@refsec@find{bibname}%
\cst@refsec@find{refname}%
\ifx\cst@refsec@name\@empty
  \expandafter\cst@notesfalse
\fi
\newcommand*\cst@refsec@lang{}
\newcommand*\cst@refsec@lang@clist{}
\newcommand*\cst@refsec@lang@define[4]{%
  \ifx\cst@refsec@lang@clist\@empty
    \def\cst@refsec@lang@clist{#1}%
  \else
    \edef\cst@refsec@lang@clist{%
      \cst@refsec@lang@clist
      ,#1%
    }%
  \fi
  \@namedef{cst@refsec@lang@#1@references}{#2}%
  \@namedef{cst@refsec@lang@#1@and}{#3}%
  \@namedef{cst@refsec@lang@#1@notes}{#4}%
}
\cst@refsec@lang@define{english}{References}{and}{Notes}
\cst@refsec@lang@define{UKenglish}{References}{and}{Notes}
\cst@refsec@lang@define{ngerman}{Literatur}{und}{Notizen}
\cst@refsec@lang@define{german}{Literatur}{und}{Notizen}
\cst@refsec@lang@define{french}{R\'ef\'erences}{et}{Notes}
\cst@refsec@lang@define{frenchb}{R\'ef\'erences}{et}{Notes}
\ifcst@notes
  \AtBeginDocument{\cst@refsec@set}
\fi
\newcommand*\cst@refsec@set{%
  \@ifpackageloded{biblatex}{%
    \@for\cst@refsec@lang:=\cst@refsec@lang@clist\do{%
      \cst@refsec@set@biblatex\cst@refsec@lang
    }%
  }{%
    \@ifpackageloded{babel}{%
      \@for\cst@refsec@lang:=\cst@refsec@lang@clist\do{%
        \cst@refsec@set@babel\cst@refsec@lang
      }%
      \expandafter\selectlanguage\expandafter{\languagename}%
    }{%
      \@for\cst@refsec@lang:=\cst@refsec@lang@clist\do{%
        \cst@refsec@set@language\cst@refsec@lang
      }%
    }%
  }
}
\newcommand*\cst@refsec@set@biblatex[1]{%
  \edef\cst@tempa{%
    \noexpand\csgappto{bib@strings@#1}{%
      \noexpand\def\expandafter\noexpand
        \csname\cst@refsec@name\endcsname{%
        \noexpand\cst@refsec@make@name{#1}%
      }%
    }%
  }%
  \cst@tempa
}
\newcommand*\cst@refsec@set@babel[1]{%
  \edef\cst@tempa{%
    \noexpand\addto{\expandafter\noexpand\csname captions#1\endcsname}{%
      \noexpand\def\expandafter\noexpand
        \csname\cst@refsec@name\endcsname{%
        \noexpand\cst@refsec@make@name{#1}%
      }%
    }%
  }%
  \cst@tempa
}
\newcommand*\cst@refsec@set@language[1]{%
  \ifx#1\cst@language
    \edef\cst@tempa{%
      \noexpand\def\expandafter\noexpand
        \csname\cst@refsec@name\endcsname{%
        \noexpand\cst@refsec@make@name{#1}%
      }%
    }%
    \cst@tempa
  \fi
}
\newcommand*\cst@refsec@make@name@fixed[1]{%
  \ifcst@notesbefore
    \@nameuse{cst@refsec@lang@#1@notes}
    \@nameuse{cst@refsec@lang@#1@and}
    \@nameuse{cst@refsec@lang@#1@references}%
  \else
    \@nameuse{cst@refsec@lang@#1@references}
    \@nameuse{cst@refsec@lang@#1@and}
    \@nameuse{cst@refsec@lang@#1@notes}%
  \fi
}
\newcommand*\cst@refsec@make@name@auto{%
  \ifnum\the\value{bibnote}>\z@\relax
    \expandafter\cst@refsec@make@name@fixed
  \else
    \expandafter\cst@refsec@make@name@nonotes
  \fi
}
\newcommand*\cst@refsec@make@name@nonotes[1]{%
  \@nameuse{cst@refsec@lang@#1@references}%
}
\let\cst@refsec@make@name\cst@refsec@make@name@fixed
\ifcst@notes
  \ifcst@autonotes
    \let\cst@refsec@make@name\cst@refsec@make@name@auto
  \fi
\fi
\ProcessKeyvalOptions{cst}
\ifcst@varioref
  \RequirePackage{varioref}
  \labelformat{figure}{\figurename~#1}
  \labelformat{table}{\tablename~#1}
  \AtEndOfPackage{%
    \AtBeginDocument{%
      \labelformat{scheme}{\schemename~#1}%
    }%
  }
\fi
\newcommand*\cst@float@memoir@correct{%
  \let\newfloat\@undefined
}
\ifx\cst@float@pkg\cst@opt@memoir
  \expandafter\cst@float@memoir@correct
\fi
\cst@float@load
\cst@float@execute{\@nameuse{cst@float@make@\cst@float@pkg}}
\@ifpackageloaded{floatrow}{%
  \floatsetup{objectset=centering}
  \floatplacement{figure}{htbp}
  \floatplacement{scheme}{htbp}
  \floatplacement{table}{htbp}
  \floatsetup[table]{style=plaintop}
}{%
  \floatstyle{plaintop}
  \restylefloat{table}
  \floatstyle{plain}
  \restylefloat{figure}
  \floatplacement{table}{htbp}
  \floatplacement{figure}{htbp}
  \AtBeginDocument{%
    \restylefloat{scheme}
    \floatplacement{scheme}{htbp}
  }
}
\ifx\cst@journal\@empty\else
  \InputIfFileExists{\cst@journal.chemstyle.cfg}{%
    \setkeys{cst}{
      abbrcomma   = false,
      abbremph    = true,
      notesbefore = true,
      rademph     = true,
      radhyphen   = true,
      radprefix   = true,
      radsuper    = false,
    }
  }{%
    \PackageWarning{chemstyle}{%
      Requested style `\cst@journal' does not exist\MessageBreak
    }
  }
\fi
\cst@ref@load

%% 
%% Copyright (C) 2006-2010 by
%%   Joseph Wright <joseph.wright@morningstar2.co.uk>
%% 
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version.  The latest
%% version of this license is in the file:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status) by
%%   Joseph Wright.
%% 
%% This work consists of the file  chemstyle.dtx and
%%                                 chemstyle.cdx,
%%           and the derived files chemstyle.pdf,
%%                                 chemstyle.ins,
%%                                 chemstyle.sty,
%%                                 chemscheme.sty,
%%                                 and a number of .cfg files.
%% 
%%
%% End of file `chemstyle.sty'.