summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/chemstyle/chemstyle.dtx
blob: d7f219e11e096dd6b8bac0a15e9f5b03afd3d098 (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
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
% \iffalse meta-comment
%
% Copyright (C) 2007 by
%    Joseph Wright <joseph.wright@morningstar2.co.uk>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3 of this license or (at your option) any later
% version. The latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of
% LaTeX version 2003/12/01 or later.
%
% This work has the LPPL maintenance status ``maintained.''
%
% The current maintainer of this work is Joseph Wright.
%
% This work consists of the main source files chemstyle.dtx
% and chemstyle.ins and the derived files chemstyle.sty,
% chemstyle.pdf and a number of .jdf files.
%
%<*driver>
\PassOptionsToClass{a4paper}{article}
\documentclass{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
%\OnlyDescription
\usepackage[T1]{fontenc}
\usepackage[english,UKenglish]{babel}
\usepackage{mathpazo,booktabs,array,url,graphicx,courier,unitsdef}
\usepackage{upgreek,ifpdf}
\usepackage[scaled=0.95]{helvet}
\usepackage[version=3]{mhchem}
\usepackage[final]{microtype}
% Some tricks from Heiko Oberdiek
\ifpdf
  \usepackage{embedfile}
  \embedfile[%
    stringmethod=escape,%
    mimetype=plain/text,%
    desc={LaTeX docstrip source archive for package `\jobname'}%
    ]{\jobname.dtx}
\fi
\usepackage{\jobname}
\usepackage[numbered]{hypdoc}
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
%\CheckSum{604}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \GetFileInfo{\jobname.sty}
%
%\changes{v1.0}{2006/08/06}{Initial release of package}
%\changes{v1.0b}{2007/09/04}{Added |microtype| and |notes2bib| to
%  template}
%\changes{v1.1}{2007/09/17}{License changed from GPL to LPPL}
%\changes{v1.1}{2007/09/17}{Phrases modified to better avoid clash
%  with user's own commands}
%\changes{v1.1}{2007/09/17}{Fixed error with spacing after
%  \emph{e.g.}~and \emph{i.e.}}
%\changes{v1.1a}{2007/09/18}{Fixed error in documentation compilation
%  under LaTeX}
%
%\DoNotIndex{\@fs@capt,\@fs@cfont,\@fs@iftopcapt,\@fs@mid,\@fs@post}
%\DoNotIndex{\@fs@pre,\@ifclassloaded,\@ifnextchar,\@ifpackageloaded}
%\DoNotIndex{\@undefined,\abovecaptionskip,\addto,\AtBeginDocument}
%\DoNotIndex{\begin,\begingroup,\belowcaptionskip,\bfseries,\bibname}
%\DoNotIndex{\captionsetup,\cm,\color,\csname,\CurrentOption}
%\DoNotIndex{\DeclareCaptionFormat,\DeclareCaptionLabelSeparator}
%\DoNotIndex{\DeclareOption,\DeclareRobustCommand,\def}
%\DoNotIndex{\documentclass,\edef,\else,\emph,\end,\endcsname}
%\DoNotIndex{\endgroup,\ensuremath,\ExecuteOptions,\expandafter}
%\DoNotIndex{\femtogram,\fg,\fi,\figurename,\floatc@plain}
%\DoNotIndex{\floatc@ruled,\floatcontentscentre,\floatplacement}
%\DoNotIndex{\floatstyle,\hertz,\hrule,\iffalse,\iftrue,\ifx,\input}
%\DoNotIndex{\InputIfFileExists,\kern,\labelformat,\languagename}
%\DoNotIndex{\let,\MakeUppercase,\MessageBreak,\NeedsTeXFormat}
%\DoNotIndex{\newcommand,\newfloat,\newif,\newunit,\PackageInfo}
%\DoNotIndex{\PackageWarning,\PassOptionsToPackage,\ProcessOptions}
%\DoNotIndex{\providecommand,\ProvidesFile,\ProvidesPackage,\quad}
%\DoNotIndex{\refname,\relax\renewcommand,\RequirePackage}
%\DoNotIndex{\restylefloat,\rotatebox,\selectlanguage,\space}
%\DoNotIndex{\tablename,\textsc,\textsuperscript,\unitsep}
%\DoNotIndex{\unitsuperscript,\usepackage,\varnothing,\vspace}
%\DoNotIndex{\xspace,\@tempa,\@tempb,\centi,\cubed,\deci}
%\DoNotIndex{\DeclareMathSymbol,\DeclareSymbolFont,\dm}
%\DoNotIndex{\mathord,\metre,\milli,\mole,\relax,\spacefactor}
%\DoNotIndex{\usk}
%
% \title{\texttt{chemstyle} --- Writing chemistry with style%
%   \thanks{This file describes version \fileversion, last revised
%           \filedate.}}
% \author{Joseph Wright%
%   \thanks{E-mail: joseph.wright@morningstar2.co.uk}}
% \date{Released \filedate}
%
% \maketitle
%
%\begin{abstract}
% The |chemstyle| package provides a ``one-stop shop'' for setting up
% formatting of LaTeX documents following the editorial policies of
% various chemical journals.  It provides a number of handy
% chemistry-related commands, and loads several support packages to
% aid the chemist.
%\end{abstract}
%
%\begin{multicols}{2}
%\tableofcontents
%\end{multicols}
%
%\section{Introduction}
% The aim of |chemstyle| is to provide a quick method to set up
% various document parameters (such as caption formatting), simply by
% specifying the model journal.  The package has also been designed
% to allow rapid addition of new journal styles.  Each style
% definition is a separate file, and new styles can be added very
% readily. |chemstyle| has grown out of the |rsc| package, which had
% a similar aim but was much more limited (and less robustly
% implemented).  The |chemstyle| package is also designed with the
% use of |biblatex| in mind: the |rsc| package is closely bound to
% traditional BibTeX use.
%
% As a successor to the |rsc| package, |chemstyle| provides a range
% of chemistry-related additional macros.  The set provided here is
% an extended version of those provide by |rsc|.  Everything that can
% be done using the |rsc| LaTeX package is therefore possible using
% the |chemstyle| package.
%
% The formatting system provided by |chemstyle| are intended for
% writing a variety of documents.  Thus the stylistic changes made by
% the package do not seek to reproduce the appearance of printed
% journal articles.  The package aims to be suitable for use in
% preparing drafts of papers, but also for writing reports, theses
% and so on.
%
%\section{Style options for \texttt{chemstyle}}
% |chemstyle| should be loaded with a package option specifying which
% journal style to follow.  Currently, |chemstyle| is aware of a the
% styles listed in Table~\ref{styles}.  New styles can be developed
% by creating a new file modelled on the existing definitions;
% |chemstyle| will automatically search for correctly-named styles.
% \begin{table}
%   \begin{tabular}{ll}
%     \toprule
%     Option & Journals using this style \\
%     \midrule
%     none &  Not applicable\\
%     angew & \emph{Angew.\ Chem.}, \emph{Chem.\ Eur.\ J.} \\
%     ic & \emph{Inorg.\ Chem.} \\
%     jacs & \emph{J.\ Am.\ Chem.\ Soc.} \\
%     jcp & \emph{J.\ Phys.\ Chem.\ A}, \emph{J.\ Phys.\ Chem.\ B} \\
%     orglett & \emph{Org.~Lett.}\\
%     rsc & \emph{Chem.\ Commun.}, \emph{Org.\ Biomol.\ Chem.} \\
%      & \emph{Dalton Trans.} \\
%     \bottomrule
%   \end{tabular}
%   \caption{Styles provided by \texttt{chemstyle}}\label{styles}
% \end{table}
% The style files provided with |chemstyle| have been derived from
% current practice in the target journals.  It is not always easy to
% pick the correct stylistic settings from (sometimes inconsistent)
% real-world examples.  The package author welcomes feedback on
% the styles provided.
%
% The |none| style is notable as it is not based on a journal.
% Instead this is a minimal style, which provides the additional
% commands without making formatting changes.  It is also the default
% style if no option is given.  This document has been compiled
% implicity using the |none| option, for example.
%
%\subsection{Package options}
%
% As well as the various journal styles provided with the package, a
% number of options are recognised to alter compatibly with other
% packages and to give the desired output. |chemstyle| will also pass
% options through to the |chemscheme| package, which is used to
% provide support for schemes.  Users should consult the |chemscheme|
% documentation for the options applicable.
%
% Currently, |chemstyle| has options |nonotes|, |nophrases|,
% |siunits| and |xspace|.  These are explained at the appropriate
% places within this document.  All are hopefully relatively clearly
% named.
%
%\section{Naming of the references section}
%
% |chemstyle| alters the naming of the references section of a
% document. By default, |chemstyle| alters the value of
% \cmd{\bibname} or \cmd{\refname} (as appropriate) to the form of
% words chosen by the target journal for the ``\refname'' section.
%
% The ``References'' naming commands are language-aware, \emph{via}
% the |babel| interface.  Currently, |chemstyle| includes appropriate
% labels for babel languages |english|, |UKenglish|, |ngerman| and
% |french|.\footnote{The \texttt{french} option for \texttt{babel}
% causes a clash with \texttt{unitsdef} concerning the command
% \texttt{\textbackslash fg}.  \texttt{babel} uses this for
% \emph{guillemets}, while \texttt{unitsdef} uses it as an
% abbreviation for \texttt{\textbackslash femtogram}.  The
% \texttt{chemstyle} package prevents the clash, and leaves the
% \texttt{babel} definition intact.} Other languages can be added if
% appropriate wordings are provided to the author.
%
% The |chemstyle| packages recognises the |nonotes| option, which
% affects how the References section is headed.   With the |nonotes|
% option, the ``Notes'' part of the section name is omitted, and only
% the ``References'' phrase is output.
%
%\section{Additional macros}
%
%\subsection{Additional units}
% Both the |unitsdef| and |siunits| packages provide a great number
% of easy to use unit commands, and handles spacing between numbers
% and units very well. However, a few useful units seem to be
% missing, and are provided here. By default, |chemstyle| uses the
% |unitsdef| package to achieve this, but using the |siunits| option
% will use that package instead.
%\DescribeMacro{\Hz}
%\DescribeMacro{\mmHg}
%\DescribeMacro{\molar}
%\DescribeMacro{\Molar}
%\DescribeMacro{\cmc}
% The most obvious of these is \cmd{\Hz}, which simply gives \Hz. The
% command \cmd{\mmHg} has a non-breaking thin space, leading to
% \mmHg. Two related commands are given for concentration:
% \cmd{\molar} gives \molar, whilst \cmd{\Molar} gives \Molar.
% Finally, the command \cmd{\cmc} is provided for generating \cmc.
% When using |unitsdef|, all of the new macros space correctly with
% numbers, so inputting |10\cmc| gives 10\cmc, with a non-breaking
% space.  Users of |siunits| will be familiar with the approach used
% by that package.
%
%\subsection{The standard state symbol}
%\DescribeMacro{\standardstate}
% Related to the above, but not exactly a unit is the
% \cmd{\standardstate} command.  This generates the tricky
% \standardstate\ symbol: |$\Delta S\standardstate$|
% generates $\Delta S\standardstate$.  Note that this is safe in
% either text or maths mode.
%
%\subsection{Alkyl radicals}
%
%\DescribeMacro{\iPr}
%\DescribeMacro{\iPr}
%\DescribeMacro{\nBu}
%\DescribeMacro{\iBu}
%\DescribeMacro{\sBu}
%\DescribeMacro{\tBu}
% There are a few alkyl radicals that come up all of the time.  No
% one seems to have put these into a package, so they are provided
% here. As you would expect, \cmd{\iPr} gives \iPr, \cmd{\iBu} gives
% \iBu\ and \cmd{\tBu} gives \tBu, and so on.  The style of the
% output depends on the journal style specified; most journals seem
% to favour one version of the abbreviation.  When |chemstyle| is
% loaded using the |xspace| option, the |xspace| package is
% automatically used to add space after the command names, so that
% |\iPr group| will result in ``\iPr\ group'' being
% typeset.\footnote{Reader of the source of this document will see
% that this document has been compiled \emph{without} the |xspace|
% option!}
%
%\subsection{Latin phrases}
%\DescribeMacro{\latin}
%\DescribeMacro{\etc}
%\DescribeMacro{\eg}
%\DescribeMacro{\ie}
%\DescribeMacro{\etal}
%\DescribeMacro{\invacuo}
% The various Latin phrases commonly used in chemistry are made
% available as the obvious commands.  By altering the definition of
% \cmd{\latin}, this allows ready switching from italic to Roman
% typesetting.  Notice that \cmd{\etc}, \cmd{\ie} and \cmd{\eg} are
% aware of trailing periods, and so doubling-up should not occur. The
% Once again, these macros use |xspace|, when given as a package
% option, to handle automatic addition of spaces after these phrases.
%  For American journals, where it is obligatory to follow ``\eg''
% and ``\ie'' with a comma, the package provides a mechanism for
% handling this automatically.  Thus, when using an appropriate
% journal style, |\eg|, |\eg.| and |\eg,| will all result in
% typesetting ``\eg,''.
%
% The \cmd{\etc} and \cmd{\etal} commands are set up on the
% assumption that they come at the end of a sentence.  Hence the
% spacing after these will default to an inter-sentence space.  If
% you desire an inter-word space, use the normal methods
% |\etc\ more text|, |\etc~more text|, \etc.  If this is a big issue,
% the package author may look at it again.
%
% \iffalse
%<*template>
% \fi
% \section{A template for chemical articles}
% This is a very simple template for chemistry-related documents.
% Hopefully it contains a few extra hints for getting well-formatted
% documents quickly.  For simplicity, the template assumes that the
% user is writing a thesis for a U.K.~university.  Hence it uses
% U.K.~defaults and RSC-based styling.
%
% The versatile \textsc{koma-script} bundle provides more advanced
% versions of the standard document classes.  If you want paragraphs
% separated out, with no indents (a common style for theses), add the
% |parskip| option to the font and paper size ones given here.
%    \begin{macrocode}
\documentclass[fontsize=10pt,paper=a4]{scrreprt}
%    \end{macrocode}
% The |geometry| package allows the users to alter page layout
% with ease; much better than trying to hack the raw LaTeX system.
%    \begin{macrocode}
\usepackage{geometry}
%    \end{macrocode}
% The |babel| system is loaded to sort out hyphenation and so on,
% and could be useful if there are any foreign-language quotes.
%    \begin{macrocode}
\usepackage[english,UKenglish]{babel}
%    \end{macrocode}
% Load |chemstyle| (of course) to give not only some easy formatting,
% but also to automatically provide a float type for schemes, thanks
% to the |chemscheme| package.  This also loads either |bpchem| or
% (optionally) |chemcompounds| to track compound numbers.
%    \begin{macrocode}
\usepackage[rsc,xspace]{chemstyle}
%    \end{macrocode}
% The |mhchem| package provides the \cmd{\ce} command for rapidly
% typesetting formulas, so that you can type |\ce{H2SO4}| and get
% \ce{H2SO4}.
%    \begin{macrocode}
\usepackage[version=3]{mhchem}
%    \end{macrocode}
% Greek letters should be italic if used for variables, but upright
% (Roman) if used otherwise.  So the standard LaTeX |$\delta$| is
% fine for typesetting an NMR shift (\eg\ $\delta = \dots$ ppm.),
% but not for a $\upsigma$-bond or a $\uppi$-complex.  The |upgreek|
% package provides commands such as |$\upsigma$| and |$\uppi$| which
% are ideal for this.
%    \begin{macrocode}
\usepackage{upgreek}
%    \end{macrocode}
% The default LaTeX table formatting is not very good.  The
% |booktabs| package does things properly, and has good
% advice in the manual.  A highly-recommended package for
% those interested in formatting (\ie all (La)TeX users!).
%    \begin{macrocode}
\usepackage{booktabs}
%    \end{macrocode}
% The |microtype| package improves formatting when used with the
% pdfTeX engine.
%    \begin{macrocode}
\usepackage[final]{microtype}
%    \end{macrocode}
% Using |notes2bib| allows the user to automatically add notes to the
% bibliography from within the document body.  So you can put
% |\bibnote{A note}| in the source, and this will move into the
% References section without any further effort.  The |footnotes|
% option means that footnotes do the same.
%    \begin{macrocode}
\usepackage[footnotes]{notes2bib}
%    \end{macrocode}
% Finally, the |hyperref| package makes headings, citations and so on into
% hyperlinks.
%    \begin{macrocode}
\usepackage[colorlinks]{hyperref}
%    \end{macrocode}
% The bulk of the document can then start.
%    \begin{macrocode}
\begin{document}
\end{document}
%    \end{macrocode}
% \iffalse
%</template>
% \fi
%
%\section{Advice for users of \texttt{rsc} and \texttt{achemso}}
% The |chemstyle| package is intended as a replacement for the |rsc|
% package.  As such, it covers almost everything the the |rsc| LaTeX
% package does, and more.  Users of |rsc| are strongly encouraged to
% update to using |chemstyle|.  The bibliography styles provided by
% |achemso| and |rsc| will continue to be required, of course.
% Migration of these styles to |biblatex| is an on-going project.
%
% \StopEventually{}
%
% \iffalse
%<*package>
% \fi
%\section{The package code}
%
%\subsection{Setup code}
% First of all, the package identifies itself and loads other
% packages needed to function.  Loading |chemscheme| is deferred
% until later, to allow processing of options at the correct point.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{chemstyle}
  [2007/09/18 v1.1a Writing chemistry with style]
%    \end{macrocode}
% Packages that are needed under all circumstances are loaded here.
%\changes{v1.0a}{2007/08/23}{No longer load \texttt{fixltx2e}
%  package}
%    \begin{macrocode}
\RequirePackage{graphicx,varioref}
%    \end{macrocode}
%
% \subsection{Alkyl radicals}
%
%\begin{macro}{\cst@emph}
%\begin{macro}{\cst@hyph}
%\begin{macro}{\cst@super}
% Alkyl radical abbreviations are produced using the macro
% \cmd{\cst@radical}.  This uses a series of formatting commands,
% which have default values provided here.  The names are hopefully
% pretty self-explanatory.
%    \begin{macrocode}
\let\cst@emph\relax
\def\cst@hyph{}
\let\cst@super\relax
\newif  \ifcst@prefix   \cst@prefixtrue
%    \end{macrocode}
%\end{macro}
%\end{macro}
%\end{macro}
%\begin{macro}{\cst@radical}
% The \cmd{\cst@radical} macro does the hard work of declaring
% each abbreviation.  To ensure there is no unexpected clash of
% names, \cmd{\newcommand} is used first to check for any problems.
% The commands are made robust so they can (hopefully) be used
% anywhere.
%    \begin{macrocode}
\def\cst@radical#1#2{%
  \expandafter\newcommand\expandafter{\csname #1#2\endcsname}{}%
  \expandafter\DeclareRobustCommand\expandafter{%
    \csname #1#2\endcsname}{%
    \ifcst@prefix
      \cst@super{\cst@emph{#1}}\cst@hyph#2%
    \else
      #2\cst@hyph\cst@super{\cst@emph{#1}}%
    \fi%
    \cst@xspace
  }
}
%    \end{macrocode}
%\end{macro}
% With a mechanism in place, the abbreviations are declared.  The
% format of the resulting output will depend upon the configuration
% file used.
%    \begin{macrocode}
\cst@radical{n}{Pr}%
\cst@radical{i}{Pr}%
\cst@radical{n}{Bu}%
\cst@radical{i}{Bu}%
\cst@radical{s}{Bu}%
\cst@radical{t}{Bu}%
%    \end{macrocode}
%
% \subsection{Option handling}
% Firstly, the ``pass through'' options are handled, as these will be
% sent through to |chemscheme|.  The package options for |chemstyle|
% are also handled here.
%\changes{v1.1}{2007/09/17}{Added \texttt{phrases} option}
%\changes{v1.1}{2007/09/17}{Added \texttt{siunits} option}
%\changes{v1.1}{2007/09/17}{Added \texttt{xspace} option}
%    \begin{macrocode}
\newif  \ifcst@notes    \cst@notestrue
\newif  \ifcst@phrases  \cst@phrasestrue
\newif  \ifcst@si       \cst@sifalse
\newif  \ifcst@xspace   \cst@xspacefalse
\DeclareOption{ch}{\ExecuteOptions{chapter}}
\DeclareOption{chapter}%
  {\PassOptionsToPackage{chapter}{chemscheme}}
\DeclareOption{chemcompounds}%
  {\PassOptionsToPackage{chemcompounds}{chemscheme}}
\DeclareOption{nonotes}{\cst@notesfalse}
\DeclareOption{nophrases}{\cst@phrasesfalse}
\DeclareOption{siunits}{\cst@sitrue}
\DeclareOption{xspace}{\cst@xspacetrue}
%    \end{macrocode}
% In order to handle the loading of style definitions correctly, a
% bit of care is needed.  The package options need to be loaded
% \emph{before} |chemscheme|, but the style definitions need to
% be loaded after |chemscheme|.  This is achieved by saving the
% options and looking at them again once the package loading is done.
% Notice that only one style definition can be used, so this is
% taken care of with a warning if needed.
%    \begin{macrocode}
\let\cst@option\relax
\DeclareOption*{%
  \ifx\cst@option\relax\else
    \PackageWarning{chemstyle}
      {Extra option \cst@option\space ignored}
  \fi
  \edef\cst@option{\CurrentOption}
}
%    \end{macrocode}
% If |siunits| is already loaded, then the option has to be set.
%    \begin{macrocode}
\@ifpackageloaded{siunits}
  {\ExecuteOptions{siunits}}
  {}
\ProcessOptions*
\ifcst@si
  \@ifpackageloaded{unitsdef}
    {\PackageWarning{chemstyle}{%
      You have set the siunits option,\MessageBreak
      but have already loaded unitsdef!\MessageBreak
      unitsdef will be used for extra unit macros}
    \cst@sifalse}
    {\RequirePackage{siunits}}
\else
%    \end{macrocode}
% The \cmd{\fg} macro is defined in French as a \emph{guillemet} sign,
% and so to avoid a clash a bit of patching is needed. A check to see
% if |babel| has already defined \cmd{\fg}. If it has, the definition
% is saved and deleted.
%    \begin{macrocode}
  \ifx\fg\@undefined
  \else
    \ifx\fg\relax
    \else
      \let\cst@fg\fg
      \let\fg\@undefined
    \fi
  \fi
  \RequirePackage{unitsdef}
%    \end{macrocode}
% If \cmd{\cst@fg} exists, it is restored here, otherwise \cmd{\fg}
% is undefined.  At the beginning of the document, \cmd{\fg} is
% defined as an abbreviation for a femtogram if it is not being used
% by |babel|.  This way there is not a problem if |babel| is loaded
% after |chemstyle|.
%    \begin{macrocode}
  \ifx\cst@fg\@undefined
    \let\fg\@undefined
  \else
    \let\fg\cst@fg
  \fi
  \AtBeginDocument{%
    \ifx\fg\@undefined
      \newcommand{\fg}{\femtogram}
    \fi
  }
\fi
\RequirePackage{chemscheme}
%    \end{macrocode}
%
%\subsection{Extra units and related commands}
%
%\begin{macro}{\cubiccentimeter}
%\begin{macro}{\cmc}
%\begin{macro}{\Hz}
%\begin{macro}{\Molar}
%\begin{macro}{\molar}
%\begin{macro}{\mmHg}
%\begin{macro}{\mol}
%\changes{v1.0b}{2007/09/04}{New macro}
% A few additional unit types are provides, which |unitsdef| and
% |siunits| do not provide. Most of these require different set up
% for the two supported packages.
%    \begin{macrocode}
\ifcst@si
  \newcommand{\cubiccentimeter}{\centi\metre\cubed}
  \newcommand{\Molar}{\textsc{m}}
  \newcommand{\molar}{\mole\usk\deci\metre\rpcubed}
  \newcommand{\mmHg}{\milli\metre~Hg}
  \newcommand{\mol}{\mole}
\else
  \newunit{\cubiccentimeter}{\cm\unitsuperscript{3}}
  \newunit{\Molar}{\textsc{m}}
  \newunit{\molar}{\mole\unitsep\dm\unitsuperscript{--3}}
  \newunit{\mmHg}{mm\unitsep{}Hg}
  \newunit{\mol}{\mole}
\fi
\newcommand{\cmc}{\cubiccentimeter}
\newcommand{\Hz}{\hertz}
%    \end{macrocode}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\begin{macro}{\cst@varnothing}
%\changes{v1.1}{2007/09/17}{New macro}
%\begin{macro}{\standardstate}
% In a very similar vein, the ``standard state'' symbol is handy.
% This is produced by rotating the ``varnothing'' symbol from the
% \textsc{ams} set. Note that the rotation angle here has been
% carefully checked, but is set by eye. The symbol is loaded directly
% here, rather than using the |amssymb| package, to avoid any
% clashes.
%    \begin{macrocode}
\DeclareSymbolFont{CSTAMS}{U}{msb}{m}{n}
\DeclareMathSymbol{\cst@varnothing}     {\mathord}{CSTAMS}{"3F}
\newcommand*{\standardstate}%
  {\textsuperscript{\rotatebox[origin=c]{140.8}%
  {\ensuremath{\cst@varnothing}}}}
%    \end{macrocode}
%\end{macro}
%\end{macro}
%
% \subsection{Float formatting}
%
% The next step is to format the floats correctly. Unfortunately,
% |memoir| does not provide all of the commands needed to achieve
% this.  Thus the |float| package is needed; in order to load it, the
% \cmd{\newfloat} command in |memoir| is killed off.  The
% |chemscheme| package does not load |float| when |memoir| is being
%  used, because creating a new float type is catered for directly
% by |memoir|.  Unfortunately, the |memoir| system isn't flexible
% enough for what is needed by |chemstyle|, so the hard work of
% |chemscheme| is undone here!  For other document classes, |float|
% will already have been loaded by |chemscheme|.
%    \begin{macrocode}
\@ifclassloaded{memoir}
  {\let\newfloat\@undefined
   \RequirePackage{float}}
  {}
%    \end{macrocode}
% The standard float types are now restyled to place the captions
% correctly (for most journals).  Normally in chemical documents
% the author expects the float to be ``here'' if possible; this is
% therefore set as the default.
%    \begin{macrocode}
\floatstyle{plaintop}
\restylefloat{table}
\floatstyle{plain}
\restylefloat{scheme}
\restylefloat{figure}
\floatplacement{table}{htbp}
\floatplacement{scheme}{htbp}
\floatplacement{figure}{htbp}
%    \end{macrocode}
% The contents of floats are centred by default, using the hook
% from the |chemstyle| package.
%    \begin{macrocode}
\floatcontentscentre
%    \end{macrocode}
%
% \subsection{Cross-references}
%
% The naming for cross-references is sorted out properly using the
% |varioref| package.
%    \begin{macrocode}
\labelformat{scheme}{\schemename~#1}
\labelformat{figure}{\figurename~#1}
\labelformat{table}{\tablename~#1}
%    \end{macrocode}
%
% \subsection{Latin words}
%
%\begin{macro}{\latin}
%\begin{macro}{\cst@latin}
%\changes{v1.1}{2007/09/17}{New macro}
%\begin{macro}{\latinemphon}
%\begin{macro}{\latinemphoff}
% A series of Latin phrases are provided, with a quick switch to
% print them in Roman letters if needed.  A mechanism is needed
% to alter the effect of the \cmd{\latin} command \emph{only}
% if the user does not have their own version.  This is achieved
% here, with precautions taken to ensure the user can define
% their own \cmd{\latin} command \emph{after} loading |chemstyle|
% and still have everything work properly.
%    \begin{macrocode}
\let\latinemphon\relax
\let\latinemphoff\relax
\let\cst@latin\relax
\ifcst@phrases
  \newcommand{\latinemphon}{\let\cst@latin\emph}
  \newcommand{\latinemphoff}{\let\cst@latin\relax}
  \AtBeginDocument{%
    \providecommand\latin{\cst@latin}
  }
\fi
\latinemphon
%    \end{macrocode}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%
% In ACS journals, the abbreviations ``\eg'' and ``\ie'' are always
% followed by a comma.  In order to provide an automated way to do
% this, a series of macros are needed to test the punctuation
% trailing the macro names.  Firstly, a switch is provided for the
% journal style files.
%    \begin{macrocode}
\newif  \ifcst@comma    \cst@commafalse
%    \end{macrocode}
% The implementation of the testing code is delayed until the
% beginning of the document to allow the switching to occur.  First
% the case where a comma is needed is handled.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifcst@comma
%    \end{macrocode}
%\begin{macro}{\cst@punct}
% The \cmd{\cst@punct} macro holds the comma-containing punctuation
% to be added.
%    \begin{macrocode}
    \def\cst@punct{.,\cst@xspace}
%    \end{macrocode}
%\end{macro}
%\begin{macro}{\cst@addpunct}
%\changes{v1.1}{2007/09/17}{New macro}
%\begin{macro}{\cst@add@punct}
%\changes{v1.1}{2007/09/17}{New macro}
%\begin{macro}{\cst@add@punct@}
%\changes{v1.1}{2007/09/17}{New macro}
% The following macros are very closely based on those in the |cite|
% package used for moving citations after punctuation.  The first
% macro is used as an initial hook.  Notice that \cmd{\relax} is
% essential here, as it provides an argument for \cmd{\cst@add@punct}
% in the first round of checking.
%    \begin{macrocode}
    \def\cst@addpunct{%
      \cst@add@punct\relax%
    }
%    \end{macrocode}
% Here, a plain TeX \cmd{\futurelet} is used to test the next
% character. Notice that this macro takes a single argument, which is
% used to recursively gobble up punctuation.
%    \begin{macrocode}
    \def\cst@add@punct#1{%
      \futurelet\@tempa\cst@add@punct@%
    }
%    \end{macrocode}
% The checking occurs here.  If a match is made, then the process is
% repeated to allow the punctuation to be gobbled.
%    \begin{macrocode}
    \def\cst@add@punct@{%
      \ifx\@tempa.%
        \let\@tempb\cst@add@punct%
      \else
        \ifx\@tempa,%
          \let\@tempb\cst@add@punct%
%    \end{macrocode}
% No match, and so new punctuation is to be added and the loop ended.
%    \begin{macrocode}
        \else
          \let\@tempb\cst@punct%
        \fi
      \fi
      \@tempb%
    }
%    \end{macrocode}
%\end{macro}
%\end{macro}
% The case where a comma is not needed is much more simple.  No fancy
% work is done; instead a single check is made on the next character.
%    \begin{macrocode}
  \else
    \def\cst@addpunct{\@ifnextchar.{}{\spacefactor999.\cst@xspace}}
  \fi
}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\cst@xspace}
% The use of |xspace| is optional; this is handled using a package
% option and the internal macro \cmd{\cst@xspace}.
%    \begin{macrocode}
\ifcst@xspace
  \RequirePackage{xspace}
  \let\cst@xspace\xspace
\else
  \let\cst@xspace\relax
\fi
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\etc}
%\begin{macro}{\invacuo}
%\begin{macro}{\etal}
%\begin{macro}{\eg}
%\changes{v1.1}{2007/09/17}{Adds comma for ACS journals}
%\begin{macro}{\ie}
%\changes{v1.1}{2007/09/17}{Adds comma for ACS journals}
% For the macros themselves, care is taken about trailing full stops.
% The \cmd{\xspace} command deals with any problems of spacing.
% Things could go wrong with complex punctuation, as no other checks
% are performed.  All of these functions use \cmd{\providecommand}
% to avoid standing on the user's own versions, if they exist.
%    \begin{macrocode}
\ifcst@phrases
  \AtBeginDocument{
    \providecommand{\etc}%
      {\latin{etc}\@ifnextchar.{}{.\cst@xspace}}
    \providecommand{\invacuo}%
      {\latin{in vacuo}\cst@xspace}
    \providecommand{\etal}%
      {\latin{et~al}\@ifnextchar.{}{.\cst@xspace}}
    \providecommand{\eg}%
      {\latin{e.g}\cst@addpunct}
    \providecommand{\ie}%
      {\latin{i.e}\cst@addpunct}
  }
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Handling section naming}
%
% First, a new if is needed to differentiate between ``Notes and
% References'' and ``References and Notes.''
%    \begin{macrocode}
\newif  \ifcst@notesbefore  \cst@notesbeforetrue
%    \end{macrocode}
% \begin{macro}{\cst@name@refs}
% To keep life simple in the main macro, and to save on redundant
% code, the ordering of ``Notes,'' ``and'' and ``References'' is
% handled here.
%    \begin{macrocode}
\def\cst@name@refs#1#2#3{%
  \ifcst@notesbefore
    #3\space#2\space#1%
  \else
    #1\space#2\space#3%
  \fi
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cst@language}
% The default language of the document is probably English.  However,
% this is alterable if needed, as it is not set in stone.
% Anyone needing to mess with this is probably happy using
% \cmd{\makeatletter}, so the command is kept out of user space.
%    \begin{macrocode}
\def\cst@language{english}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cst@refsection}
% The existence of a suitable reference section name command is
% checked here.  Some document classes (\eg\ minimal) may not define
% a suitable command. Assuming that is not the case,
% \cmd{\cst@refsection} is used to store the name of the macro
% holding the references section.
%    \begin{macrocode}
\ifx\refname\@undefined
   \ifx\bibname\@undefined
      \PackageWarning{chemstyle}%
        {No bibliography name command defined in document class}
      \def\cst@namerefs#1#2#3#4{}%
    \else
      \def\cst@refsection{\bibname}
    \fi
 \else
   \def\cst@refsection{\refname}
\fi
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cst@namerefs}
% \begin{macro}{\cst@language@check}
% The main macro of the heading-altering section takes four
% arguments, \marg{language}, \marg{references}, \marg{and}
% and \marg{notes}.  The first is the |babel| label for the language
% that the words are four, and the other three parameters and the
% words ``References'', ``and'' and ``Notes'', respectively.
%    \begin{macrocode}
\ifx\cst@namerefs\@undefined
  \def\cst@namerefs#1#2#3#4{%
    \ifcst@notes%
%    \end{macrocode}
% The non-|babel| version of the function only does anything if the
% language passed in |#1| is the default document language (probably
% English). The check for this needs the macro
% \cmd{\cst@language@check} to get |\ifx| to behave as desired.
%    \begin{macrocode}
      \def\cst@language@check{#1}
      \ifx\cst@language\cst@language@check
        \expandafter\renewcommand\expandafter{\cst@refsection}%
          {\cst@name@refs{#2}{#3}{#4}}%
      \fi
%    \end{macrocode}
% To ensure that things work whether |babel| is loaded or not, a few
% hoops have to be jumped through.  Altering the |babel| strings is
% delayed until the start of the document, in case |babel| is loaded
% after |chemstyle|.  There is also a complication that MikTeX
% defines \cmd{\languagename} even if |babel| is not loaded.  This
% may contain an undesired value, and so the presence of |babel|
% needs to be tested for to avoid strange errors.
%    \begin{macrocode}
      \AtBeginDocument{%
        \@ifpackageloaded{babel}{%
          \expandafter\addto\expandafter{\csname captions#1\endcsname}%
            {\expandafter\renewcommand\expandafter{\cst@refsection}%
            {\cst@name@refs{#2}{#3}{#4}}}%
          \expandafter\selectlanguage\expandafter{\languagename}}
        {}}
    \else%
      \ifx#1\cst@language
        \expandafter\renewcommand\expandafter{\cst@refsection}{#2}%
      \fi
      \AtBeginDocument{%
        \@ifpackageloaded{babel}{%
          \expandafter\addto\expandafter{\csname captions#1\endcsname}%
            {\expandafter\renewcommand\expandafter{\cst@refsection}{#2}}%
          \expandafter\selectlanguage\expandafter{\languagename}}%
        {}}
    \fi%
  }
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% Finally, default names are loaded for a range of languages.  Most
% journals stick to the same words, with only the order changing.
%    \begin{macrocode}
\cst@namerefs{english}{References}{and}{Notes}
\cst@namerefs{UKenglish}{References}{and}{Notes}
\cst@namerefs{ngerman}{Literatur}{und}{Notizen}
\cst@namerefs{french}{R\'ef\'erences}{et}{Notes}
%    \end{macrocode}
%
% \subsection{Loading the style definition}
%
% The style definition is loaded here, once else  everything is in
% place.  A style must be loaded, so a default is provided to be on
% the safe side.  The journal style file must have extension
% |.jdf|.
%    \begin{macrocode}
\ifx\cst@option\relax
  \PackageWarning{chemstyle}
    {You didn't say which style to use \MessageBreak
     Defaulting to the ``no change'' style: none}
  \def\cst@option{none}
\fi
\InputIfFileExists{\cst@option.jdf}
  {\PackageInfo{chemstyle}
    {Loaded \cst@option.jdf}}
  {\PackageWarning{chemstyle}
    {Required style \cst@option\space does not exist}}
%    \end{macrocode}
% \iffalse
%</package>
% \fi
%
% \section{Configuration files}
%
% Each journal style needs slightly differing commands to get the
% formatting just right.  This is handled here, with each style in
% a separate file.  There is not a lot happening in most of these
% files, as the information is by its nature quite repetitive.
%
% \iffalse
%<*rsc>
% \fi
%
% \subsection{RSC style}
%\changes{v1.0b}{2007/09/04}{Fixed formatting of alkyls}
%\changes{v1.1}{2007/09/17}{Fixed (another) error in alkyl formatting}
%    \begin{macrocode}
\ProvidesFile{rsc.jdf}[2007/09/18 v1.1a]
%    \end{macrocode}
%\changes{v1.0b}{2007/09/04}{Sorted a problem with \texttt{babel}
% and figure name format}
%    \begin{macrocode}
\AtBeginDocument{%
  \renewcommand{\figurename}{Fig.}}
\RequirePackage[labelsep=quad,labelfont=bf]{caption}
\let\cst@emph\emph
\def\cst@hyph{-}
\let\cst@super\relax
\cst@prefixtrue
\latinemphon
%    \end{macrocode}
% \iffalse
%</rsc>
%<*angew>
% \fi
%
%\subsection{\emph{Angew.~Chem.}~style}
%\changes{v1.0a}{2007/08/23}{Fixed incorrect Latin formatting for
%  \texttt{angew} option}
%    \begin{macrocode}
\ProvidesFile{cst-angew.def}[2007/09/18 v1.1a]
\RequirePackage[labelsep=period,labelfont={bf,it},font=sf]{caption}
\captionsetup[table]{labelsep=colon}
\captionsetup{singlelinecheck=off}
\let\cst@emph\emph
\def\cst@hyph{}
\let\cst@super\relax
\cst@prefixtrue
\latinemphoff
%    \end{macrocode}
% \iffalse
%</angew>
%<*jacs>
% \fi
%
%\subsection{\emph{J.~Am.~Chem.~Soc.}~style}
%    \begin{macrocode}
\ProvidesFile{jacs.jdf}[2007/09/18 v1.1a]
\RequirePackage[labelfont={bf,it,sf},textfont=sf]{caption}
\DeclareCaptionLabelSeparator{perquad}{.\quad}
\captionsetup{labelsep=perquad}
\captionsetup[figure]{textfont=rm}
\captionsetup{singlelinecheck=off}
\let\cst@emph\emph
\def\cst@hyph{}
\let\cst@super\textsuperscript
\cst@prefixtrue
\floatstyle{plaintop}
\restylefloat{scheme}
\floatstyle{plain}
\latinemphoff
\cst@notesbeforefalse
\cst@commatrue
%    \end{macrocode}
% \iffalse
%</jacs>
%<*ic>
% \fi
%
%\subsection{\emph{Inorg.~Chem.}~style}
% Almost exactly the same as for \emph{J.~Am.~Chem.~Soc.}, so most of
% the work is left to |jacs.jdf|.
%    \begin{macrocode}
\ProvidesFile{ic.jdf}[2007/09/18 v1.1a]
\input {jacs.jdf}
\captionsetup{textfont=rm}
%    \end{macrocode}
%\iffalse
%</ic>
%<*jpc>
%\fi
%
%\subsection{\emph{J.~Phys.~Chem.}~style}
%\changes{v1.0a}{2007/08/23}{Added \emph{J.~Phys.~Chem.}~style}
%    \begin{macrocode}
\ProvidesFile{jpc.jdf}[2007/09/18 v1.1a]
\RequirePackage[font=bf,labelsep=colon]{caption}
\DeclareCaptionFormat{labelcaps}{\MakeUppercase{#1}#2#3}
\captionsetup{format=labelcaps}
\captionsetup[figure]{format=plain,textfont=md,labelsep=period}
\captionsetup{singlelinecheck=off}
\let\cst@emph\emph
\def\cst@hyph{}
\let\cst@super\textsuperscript
\cst@prefixtrue
\floatstyle{plaintop}
\restylefloat{scheme}
\floatstyle{plain}
\latinemphoff
\cst@notesbeforefalse
\cst@commatrue
%    \end{macrocode}
%\iffalse
%</jpc>
%<*orglett>
% \fi
%
%\subsection{\emph{Org.~Lett.}~style}
%\changes{v1.0a}{2007/08/23}{Added \emph{Org.~Lett.}~style}
%    \begin{macrocode}
\ProvidesFile{orglett.jdf}[2007/09/18 v1.1a]
\RequirePackage{xcolor}
%    \end{macrocode}
%\begin{macro}{\OrgLettColour}
% To allow the user to control the colour of the ``bars'' in this
% style, an additional macro is provided.  The |purple| colour looks
% about right for matching the printed journal, but if anyone has a
% better suggestion please let the package author know.
%    \begin{macrocode}
\newcommand*{\OrgLettColour}{purple}
%    \end{macrocode}
%\end{macro}
% In order to get the distinctive coloured bars used by
% \emph{Org.~Lett.}, a new style for floats is needed.  This is based
% on the |ruled| style from the |float| package.
%    \begin{macrocode}
\newcommand\fs@orglett{\def\@fs@cfont{\bfseries}
  \let\@fs@capt\floatc@ruled
  \def\@fs@pre{\begingroup\color{\OrgLettColour}
    \hrule height12pt depth0pt \kern2pt\endgroup}%
%    \end{macrocode}
% This is the same \cmd{\@fs@mid} as is used in the |float| package
% for |plaintop| floats.
%    \begin{macrocode}
  \def\@fs@mid{\vspace\belowcaptionskip\relax}%
  \def\@fs@post{\begingroup\color{\OrgLettColour}\kern2pt
    \hrule height1.5pt depth0pt\endgroup}%
  \let\@fs@iftopcapt\iftrue}
%    \end{macrocode}
% Figures need to be slightly different, so an almost identical
% command is needed.
%    \begin{macrocode}
\newcommand\fs@orglettfig{\def\@fs@cfont{\bfseries}
  \let\@fs@capt\floatc@plain
  \def\@fs@pre{\begingroup\color{\OrgLettColour}
    \hrule height12pt depth0pt \kern2pt\endgroup}%
  \def\@fs@mid{\vspace\abovecaptionskip\relax}%
  \def\@fs@post{\begingroup\color{\OrgLettColour}\kern2pt
    \hrule height1.5pt depth0pt\endgroup}%
  \let\@fs@iftopcapt\iffalse}
%    \end{macrocode}
% The new style is now applied.  Users can change back to normal
% floats by changing back to the |plain| style.
%    \begin{macrocode}
\floatstyle{orglettfig}
\restylefloat{figure}
\floatstyle{orglett}
\restylefloat{scheme}
\restylefloat{table}
%    \end{macrocode}
% The more usual style commands now occur.
%    \begin{macrocode}
\RequirePackage[labelfont=bf]{caption}
\DeclareCaptionLabelSeparator{perquad}{.\quad}
\captionsetup{labelsep=perquad}
\let\cst@emph\emph
\def\cst@hyph{}
\let\cst@super\textsuperscript
\cst@prefixtrue
\latinemphoff
\cst@notesbeforefalse
\cst@commatrue
%    \end{macrocode}
% \iffalse
%</orglett>
%<*none>
%\fi
%
% \subsection{The empty style --- none}
%
% To allow the user to load the extra macros provided here without
% any style changes, a ``do nothing'' style is provided.  It simply
% makes sure that nothing changes compared to the LaTeX kernel.
% This requires undoing the defaults provided above.  For commands
% where a default is needed (\eg\ the \cmd{\latin} command) the
% style of the RSC is followed.
%    \begin{macrocode}
\ProvidesFile{none.jdf}[2007/09/18 v1.1a]
\RequirePackage{caption}
\floatstyle{plain}
\restylefloat{table}
\labelformat{scheme}{#1}
\labelformat{figure}{#1}
\labelformat{table}{#1}
\floatplacement{table}{tbp}
\floatplacement{scheme}{tbp}
\floatplacement{figure}{tbp}
%    \end{macrocode}
% \iffalse
%</none>
% \fi
% \PrintChanges
% \PrintIndex
% \Finale