From 8f0c39ea0736ec81b5d289f9699c5343cc3c88e3 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 7 Jun 2009 23:22:28 +0000
Subject: chemstyle 2 (6jun09)

git-svn-id: svn://tug.org/texlive/trunk@13659 c570f23f-e606-0410-a88d-b1316a301751
---
 .../source/latex/chemstyle/chemstyle.dtx           | 4327 +++++++++++++-------
 1 file changed, 2823 insertions(+), 1504 deletions(-)

(limited to 'Master/texmf-dist/source/latex/chemstyle/chemstyle.dtx')

diff --git a/Master/texmf-dist/source/latex/chemstyle/chemstyle.dtx b/Master/texmf-dist/source/latex/chemstyle/chemstyle.dtx
index 3bead4da261..d212c772739 100644
--- a/Master/texmf-dist/source/latex/chemstyle/chemstyle.dtx
+++ b/Master/texmf-dist/source/latex/chemstyle/chemstyle.dtx
@@ -1,139 +1,14 @@
 % \iffalse meta-comment
-% !TEX encoding = ISO-8859-1 
-%
-% Copyright (C) 2007-08 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.3c 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.3c or later is part of all distributions of
-% LaTeX version 2005/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 source file chemscheme.dtx
-%                 and the derived files chemstyle.ins,
-%                                       chemstyle.sty,
-%                                       chemstyle.pdf,
-%                                       chemstyle-manual.pdf,
-%                                       chemstyle-demo.ltx,
-%                                       rsc.jdf,
-%                                       angew.jdf,
-%                                       tetlett.jdf,
-%                                       jomc.jdf,
-%                                       jacs.jdf,
-%                                       ic.jdf,
-%                                       jpc.jdf,
-%                                       orglett.jdf,
-%                                       none.jdf,
-%                                       jawltxdoc.sty and
-%                                       README
-%
-% TDS-ready files:
-%    The compressed file chemstyle.tds.zip contains an unpacked
-%    version of all of the files included here, and pre-compiled
-%    documentation in PDF format.  Simply decompress
-%    chemstyle.tds.dtx in your local TeX directory, run your hash
-%    program (texhash, initexmf --update-fndb, etc.) and everything
-%    will be ready to go.  The user documentation for the package is
-%    called chemstyle-manual.pdf; the file chemstyle.pdf includes the
-%    user manual and the fully-indexed source code.
-%
-% Unpacking:
-%    (a) If chemstyle.ins is present:
-%           tex chemstyle.ins
-%    (b) Without chemstyle.ins:
-%           tex chemstyle.dtx
-%    (c) If you use LaTeX to generate files:
-%           latex \let\install=y\input{chemstyle.dtx}
-%
-% Documentation:
-%    (a) Without write18 enabled:
-%          pdflatex chemstyle.dtx
-%          makeindex -s gind.ist chemstyle.idx
-%          makeindex -s gglo.ist -o chemstyle.gls  chemstyle.glo
-%          pdflatex chemstyle.dtx
-%          pdflatex chemstyle.dtx
-%    (b) With write18 enabled:
-%          pdflatex chemstyle.dtx
-%          pdflatex chemstyle.dtx
-%          pdflatex chemstyle.dtx
-%
-% Installation:
-%     Copy chemstyle.sty to a location searched by TeX, and if
-%     required by your TeX installation, run the appropriate command
-%     to build a hash of files (texhash, initexmf --update-fndb,
-%     etc.)
-%
-% Note:
-%     The jawltxdoc.sty file is not needed for installation,
-%     only for building the documentation; it may be deleted
-%     after producing the documentation (if necessary).
-%
-%<*ignore>
-% This is all taken verbatim from Heiko Oberdiek's packages
-\begingroup
-  \def\x{LaTeX2e}%
-\expandafter\endgroup
-\ifcase 0\ifx\install y1\fi\expandafter
-         \ifx\csname processbatchFile\endcsname\relax\else1\fi
-         \ifx\fmtname\x\else 1\fi\relax
-\else\csname fi\endcsname
-%</ignore>
-%<*install>
-\input docstrip.tex
-\keepsilent
-\askforoverwritefalse
-\preamble
- ----------------------------------------------------------------
- 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
- ----------------------------------------------------------------
-
-\endpreamble
-\Msg{Generating chemstyle files:}
-\generate{\file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}}
-}
-\usedir{tex/latex/chemstyle}
-\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}
-          \file{chemscheme.sty}{\from{chemscheme.dtx}{package}}
-}
-\usedir{source/latex/chemstyle}
-\generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}}
-}
-\usedir{tex/latex/chemstyle/config}
-\generate{\file{rsc.jdf}{\from{chemstyle.dtx}{rsc}}
-          \file{angew.jdf}{\from{chemstyle.dtx}{angew}}
-          \file{tetlett.jdf}{\from{chemstyle.dtx}{tetlett}}
-          \file{jomc.jdf}{\from{chemstyle.dtx}{jomc}}
-          \file{jacs.jdf}{\from{chemstyle.dtx}{jacs}}
-          \file{ic.jdf}{\from{chemstyle.dtx}{ic}}
-          \file{jpc.jdf}{\from{chemstyle.dtx}{jpc}}
-          \file{orglett.jdf}{\from{chemstyle.dtx}{orglett}}
-}
-\generate{\file{none.jdf}{\from{chemstyle.dtx}{none}}
-}
-\nopreamble\nopostamble
-\usedir{doc/latex/chemstyle}
-\generate{\file{chemstyle-demo.ltx}{\from{\jobname.dtx}{demo}}
-          \file{README.txt}{\from{\jobname.dtx}{readme}}
-}
-\endbatchfile
-%</install>
+% !TEX program  = pdflatex
+% !TEX encoding = ISO-8859-1
+%<*internal>
+\iffalse
+%</internal>
 %<*readme>
 ----------------------------------------------------------------
 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.3 or later
+Released under the LaTeX Project Public License v1.3c or later
 See http://www.latex-project.org/lppl.txt
 ----------------------------------------------------------------
 
@@ -154,174 +29,376 @@ of various chemical journals.  It provides a number of handy
 chemistry-related commands, and loads several support packages
 to aid the chemist.
 %</readme>
-%<*ignore>
+%<*internal>
+\fi
+\def\nameofplainTeX{plain}
+\ifx\fmtname\nameofplainTeX\else
+  \expandafter\begingroup
+\fi
+%</internal>
+%<*install>
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+\preamble
+----------------------------------------------------------------
+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
+----------------------------------------------------------------
+
+\endpreamble
+\postamble
+
+Copyright (C) 2006-2009 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,
+                                
+\endpostamble
+\usedir{tex/latex/chemstyle}
+\generate{
+  \file{chemstyle.sty}{\from{chemstyle.dtx}{package}}
+  \file{chemscheme.sty}{\from{chemstyle.dtx}{chemscheme}}
+}
+\usedir{tex/latex/chemstyle/config}
+\generate{
+  \file{angew.chemstyle.cfg}{\from{chemstyle.dtx}{angew}}
+  \file{ic.chemstyle.cfg}{\from{chemstyle.dtx}{ic}}
+  \file{jacs.chemstyle.cfg}{\from{chemstyle.dtx}{jacs}}
+  \file{jomc.chemstyle.cfg}{\from{chemstyle.dtx}{jomc}}
+  \file{rsc.chemstyle.cfg}{\from{chemstyle.dtx}{rsc}}
+  \file{orglett.chemstyle.cfg}{\from{chemstyle.dtx}{orglett}}
+  \file{tetlett.chemstyle.cfg}{\from{chemstyle.dtx}{tetlett}}
+}
+%</install>
+%<install>\endbatchfile
+%<*internal>
+\usedir{source/latex/chemstyle}
+\generate{
+  \file{chemstyle.ins}{\from{chemstyle.dtx}{install}}
+}
+\nopreamble\nopostamble
+\usedir{doc/latex/chemstyle}
+\generate{
+  \file{README.txt}{\from{chemstyle.dtx}{readme}}
+  \file{chemstyle-demo.tex}{\from{chemstyle.dtx}{demo}}
+  \file{scheme-one.eps}{\from{chemstyle.dtx}{scheme}}
+  \file{scheme-two.eps}{\from{chemstyle.dtx}{scheme,labels}}
+}
+\ifx\fmtname\nameofplainTeX
+  \expandafter\endbatchfile
+\else
+  \expandafter\endgroup
 \fi
-% Will Robertson's trick
-\immediate\write18{makeindex -s gind.ist -o \jobname.ind  \jobname.idx}
-\immediate\write18{makeindex -s gglo.ist -o \jobname.gls  \jobname.glo}
-%</ignore>
+\immediate\write18{makeindex -s gglo.ist -o chemstyle.gls chemstyle.glo}
+\immediate\write18{makeindex -s gind.ist -o chemstyle.ind chemstyle.idx}
+%</internal>
+%<*package|chemscheme>
+\NeedsTeXFormat{LaTeX2e}
+%</package|chemscheme>
 %<*driver>
-\PassOptionsToClass{a4paper}{article}
-\documentclass[german,english,UKenglish]{ltxdoc}
+\documentclass[a4paper]{ltxdoc}
+\usepackage[T1]{fontenc}
+\usepackage{array,booktabs,chemstyle,lmodern}
+\usepackage[scaled=0.95]{helvet}
+\usepackage[final]{listings,microtype}
+\usepackage[osf]{mathpazo}
+\usepackage[version=3]{mhchem}
+\usepackage[crop=off,ext=dtx,final,runs=2]{auto-pst-pdf}
+\usepackage[numbered]{hypdoc}
 \EnableCrossrefs
 \CodelineIndex
 \RecordChanges
-%\OnlyDescription
-\usepackage[final]{graphicx}
-\usepackage[journal=none,xspace=true]{chemstyle}
-\usepackage{jawltxdoc}
-% To show the features of \eg, \ie and so on, a bit of work is
-% required, as they are defined by jawltxdoc and by chemstyle
-\let\eg\undefined
-\let\ie\undefined
-\let\latin\undefined
-\let\etc\undefined
 \begin{document}
-  \DocInput{\jobname.dtx}
+  \DocInput{chemstyle.dtx}
 \end{document}
 %</driver>
 % \fi
 %
-%\CheckSum{646}
-%
-% \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}
+%\CheckSum{0}
+%
+%\GetFileInfo{chemstyle.sty}
+%
+%\makeatletter
+%
+%^^A \DescribeOption is in l3doc but not ltxdoc
+%\newcommand*{\DescribeOption}{^^A
+%  \leavevmode
+%  \@bsphack
+%  \begingroup
+%    \MakePrivateLetters
+%    \Describe@Option
+%}
+%\newcommand*{\Describe@Option}[1]{^^A
+%    \endgroup
+%  \marginpar{^^A
+%    \raggedleft
+%    \PrintDescribeEnv{#1}^^A
+%  }%
+%  \SpecialOptionIndex{#1}^^A
+%  \@esphack
+%  \ignorespaces
+%}
+%\newcommand*{\SpecialOptionIndex}[1]{^^A
+%  \@bsphack
+%  \index{^^A
+%    #1\actualchar{\protect\ttfamily#1} (option)\encapchar usage^^A
+%  }^^A
+%  \index{^^A
+%    options:\levelchar#1\actualchar{\protect\ttfamily#1}
+%    \encapchar usage^^A
+%  }^^A
+%  \@esphack
+%}
+%
+%^^A For creating examples with nice highlighting of code, and so
+%^^A on; based on the system used in the listings source (lstsample).
+%\lst@RequireAspects{writefile}
+%\newsavebox{\LaTeXdemo@box}
+%\lstnewenvironment{LaTeXdemo}[1][code and example]{^^A
+%  \global\let\lst@intname\@empty
+%  \expandafter\let\expandafter\LaTeXdemo@end
+%    \csname LaTeXdemo@#1@end\endcsname
+%  \@nameuse{LaTeXdemo@#1}^^A
+%}{^^A
+%  \LaTeXdemo@end
+%}
+%\newcommand*\LaTeXdemo@new[3]{^^A
+%  \expandafter\newcommand\expandafter*\expandafter
+%    {\csname LaTeXdemo@#1\endcsname}{#2}^^A
+%  \expandafter\newcommand\expandafter*\expandafter
+%    {\csname LaTeXdemo@#1@end\endcsname}{#3}^^A
+%}
+%\newcommand*\LaTeXdemo@common{^^A
+%  \setkeys{lst}{
+%    basicstyle   = \small\ttfamily,
+%    basewidth    = 0.51em,
+%    gobble       = 3,
+%    keywordstyle = \color{blue},
+%    language     = [LaTeX]{TeX},
+%    moretexcs    = {
+%      ce,
+%      cmc,
+%      cstsetup,
+%      etc,
+%      eg,
+%      etal,
+%      floatcontentscenter,
+%      floatcontentscentre,
+%      floatcontentsleft,
+%      floatcontentsright,
+%      floatsetup,
+%      floatstyle,
+%      Hz,
+%      ie,
+%      iBu,
+%      iPr,
+%      includegraphics,
+%      invacuo,
+%      latin,
+%      mmHg,
+%      molar,
+%      Molar,
+%      nBu,
+%      nPr,
+%      restylefloat,
+%      sBu,
+%      standardstate,
+%      tBu
+%    }
+%  }^^A 
+%}
+%\newcommand*\LaTeXdemo@input{^^A
+%  \MakePercentComment
+%  \catcode`\^^M=10\relax
+%  \small
+%  \begingroup
+%    \setkeys{lst}{
+%      SelectCharTable=\lst@ReplaceInput{\^\^I}{\lst@ProcessTabulator}
+%    }^^A
+%    \leavevmode 
+%      \input{chemstyle.tmp}^^A
+%  \endgroup
+%  \MakePercentIgnore
+%}
+%\LaTeXdemo@new{code and example}{^^A
+%  \setbox\LaTeXdemo@box=\hbox\bgroup
+%    \lst@BeginAlsoWriteFile{chemstyle.tmp}^^A
+%    \LaTeXdemo@common
+%}{^^A
+%    \lst@EndWriteFile
+%  \egroup
+%  \begin{center}
+%    \ifdim\wd\LaTeXdemo@box>0.48\linewidth\relax
+%      \hbox to\linewidth{\box\LaTeXdemo@box\hss}^^A
+%        \begin{minipage}{\linewidth}
+%          \LaTeXdemo@input
+%        \end{minipage}
+%    \else
+%      \begin{minipage}{0.48\linewidth}
+%        \LaTeXdemo@input
+%      \end{minipage}
+%      \hfill
+%      \begin{minipage}{0.48\linewidth}
+%        \hbox to\linewidth{\box\LaTeXdemo@box\hss}^^A
+%      \end{minipage}
+%    \fi
+%  \end{center}
+%}
+%\LaTeXdemo@new{code and float}{^^A
+%  \lst@BeginAlsoWriteFile{chemstyle.tmp}^^A
+%  \LaTeXdemo@common
+%}{^^A
+%  \lst@EndWriteFile
+%  \LaTeXdemo@input
+%}
+%\LaTeXdemo@new{code only}{^^A
+%  \LaTeXdemo@common
+%}{^^A
+%}
+%
+%\providecommand*\eTeX{\ensuremath{\varepsilon}-\TeX}
+%\providecommand*\file{\texttt}
+%\providecommand*\opt{\texttt}
+%\providecommand*\pkg{\textsf}
+%
+%\DoNotIndex{\begin,\documentclass,\end,\usepackage}
+%
+%\makeatother
+%
+%\title{^^A
+%  The \textsf{chemstyle} bundle --- Schemes and style for 
+%    chemistry\thanks{^^A
+%    This file describes version \fileversion, last revised 
+%    \filedate.^^A
+%  }^^A
+%}
+%\author{^^A
+%  Joseph Wright\thanks{E-mail: joseph.wright@morningstar2.co.uk}^^A
+%}
+%\date{Released \filedate}
+%
+%\maketitle
 %
 %\changes{v1.0}{2006/08/06}{Initial release of package}
-%\changes{v1.0b}{2007/09/04}{Added \pkg{microtype} and
-%  \pkg{notes2bib} to template}
-%\changes{v1.1}{2007/09/17}{License changed from \textsc{gpl} to
-%  \textsc{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.1}{2007/09/17}{Added \opt{phrases} option}
-%\changes{v1.1}{2007/09/17}{Added \opt{siunits} option}
-%\changes{v1.1}{2007/09/17}{Added \opt{xspace} option}
-%\changes{v1.1a}{2007/09/18}{Fixed error in documentation compilation
-%  under \LaTeX}
-%\changes{v1.1c}{2007/09/23}{Fixed problems with capitalisation
-%  of \pkg{SIunits}}
-%\changes{v1.1c}{2007/09/23}{Documentation improved}
-%\changes{v1.1c}{2007/09/23}{Added \pkg{SIunits} option}
-%\changes{v1.1e}{2007/10/07}{Fixed packaging problem}
-%\changes{v1.2}{2008/03/07}{Various internal tweaks}
-%\changes{v1.2}{2008/03/07}{Removed obsolete \opt{ch} and
-%  \opt{chapter} options}
-%\changes{v1.2a}{2008/03/21}{Fixed error with restyling
-%  \texttt{scheme} floats, caused by change in \pkg{chemscheme}}
-%
-%\setkeys{lst}{language=[LaTeX]{TeX},moretexcs={mmHg,Molar,
-%  molar,cmc,Hz,SI,standardstate,iPr,nPr,nBu,sBu,tBu,iBu,
-%  cstsetup,latin,eg,ie,etc,invacuo,etal,floatstyle,restylefloat,
-%  upsigma,uppi}}
-%
-%\DoNotIndex{\@fs@capt,\@fs@cfont,\@fs@iftopcapt,\@fs@mid,\@fs@post}
-%\DoNotIndex{\@fs@pre,\@gobblefour,\@ifclassloaded,\@ifnextchar}
-%\DoNotIndex{\@ifpackagelater,\@ifpackageloaded,\@ifundefined}
-%\DoNotIndex{\@nameuse,\@undefined,\abovecaptionskip,\addto}
-%\DoNotIndex{\AtBeginDocument,\begingroup,\belowcaptionskip}
-%\DoNotIndex{\bfseries,\bibname,\captionsetup,\centi,\cm,\color}
-%\DoNotIndex{\csgappto,\csname,\cubed,\CurrentOption,\deci}
-%\DoNotIndex{\DeclareCaptionFormat,\DeclareCaptionLabelSeparator}
-%\DoNotIndex{\DeclareMathSymbol,\DeclareOptionX}
-%\DoNotIndex{\DeclareRobustCommand,\DeclareSymbolFont,\def}
-%\DoNotIndex{\define@boolkey,\define@choicekey,\define@cmdkeys}
-%\DoNotIndex{\define@key,\dm,\edef,\else,\emph,\endcsname}
-%\DoNotIndex{\endgroup,\endinput,\ensuremath,\ExecuteOptionsX}
-%\DoNotIndex{\expandafter,\fi,\figurename,\floatc@plain}
-%\DoNotIndex{\floatc@ruled,\floatcontentscentre,\floatplacement}
-%\DoNotIndex{\floatstyle,\futurelet,\gdef,\hertz,\hrule,\iffalse}
-%\DoNotIndex{\ifnum,\iftrue,\ifx,\input,\InputIfFileExists}
-%\DoNotIndex{\kern,\labelformat,\languagename,\let,\makeatletter}
-%\DoNotIndex{\makeatother,\MakeUppercase,\mathord,\MessageBreak}
-%\DoNotIndex{\metre,\milli,\mmHg,\mole,\NeedsTeXFormat,\newcommand}
-%\DoNotIndex{\newcounter,\newfloat,\newif,\newunit,\OrgLettColour}
-%\DoNotIndex{\PackageError,\PackageInfo,\PackageWarning}
-%\DoNotIndex{\PassOptionsToPackage,\ProcessOptionsX,\providecommand}
-%\DoNotIndex{\ProvidesFile,\ProvidesPackage,\quad,\refname,\relax}
-%\DoNotIndex{\renewcommand,\RequirePackage,\restylefloat,\rotatebox}
-%\DoNotIndex{\rpcubed,\schemename,\selectlanguage,\setkeys}
-%\DoNotIndex{\requiresiconfigs,\space,\spacefactor,\tablename,\textsc}
-%\DoNotIndex{\textsuperscript,\the,\unitsep,\unitsuperscript,\usk}
-%\DoNotIndex{\value,\vspace,\xspace,\z@}
-%
-%\DoNotIndex{\',\begin,\end,\documentclass,\usepackage}
-%
-% \title{\currpkg\ --- Writing chemistry with style^^A
-%   \thanks{This file describes version \fileversion, last revised
-%           \filedate.}}
-% \author{Joseph Wright^^A
-%   \thanks{E-mail: joseph.wright@morningstar2.co.uk}}
-% \date{Released \filedate}
-%
-% \maketitle
 %
 %\begin{abstract}
-% The \currpkg 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.
+%  The \textsf{chemstyle} bundle provides two packages: 
+%  \textsf{chemstyle} and \textsf{chemscheme}.  Both are intended to 
+%  help chemists create floating graphics and match published styles.
+%
+%  The \textsf{chemscheme} package consists of two parts, both related 
+%  to chemical schemes.  The package adds a scheme float type to the 
+%  \LaTeX\ default types figure and table. The scheme float type acts in
+%  the same way as those defined by the \LaTeX\ kernel, but is intended 
+%  for chemical schemes.  The package also provides a method for adding 
+%  automatic chemical numbering to schemes.
+%
+%  The \textsf{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
+%  \tableofcontents
 %\end{multicols}
 %
 %\section{Introduction}
-% The aim of \currpkg 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. \currpkg has grown out of the \pkg{rsc} package, which had
-% a similar aim but was much more limited (and less robustly
-% implemented).  The \currpkg package is also designed with the use
-% of \pkg{biblatex} in mind: the \pkg{rsc} package is closely bound
-% to traditional \BibTeX\ use.
-%
-% As a successor to the \pkg{rsc} package, \currpkg provides a range
-% of chemistry-related additional macros.  The set provided here is
-% an extended version of those provide by \pkg{rsc}.  Everything that
-% can be done using the \pkg{rsc} \LaTeX\ package is therefore
-% possible using the \currpkg package.
-%
-% The formatting system provided by \currpkg 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 \currpkg}
+%
+% The \pkg{chemstyle} bundle consists of two parts. The first, 
+% the \pkg{chemstyle} package itself, aims to provide an easy and
+% reliable 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. The formatting system provided by 
+% \pkg{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.
+% 
+% The second part of the bundle is the \pkg{chemscheme} package, which
+% is loaded automatically by \pkg{chemstyle}. \pkg{chemscheme} 
+% undertakes two tasks. First, it provides a floating \texttt{scheme} 
+% environment, which acts in the same way as the kernel \texttt{figure}
+% and \texttt{table} floats. Secondly, it interfaces with either the
+% \pkg{chemcompounds} or \pkg{bpchem} packages to allow automatic
+% numbering of chemical compounds inside graphics.
+% 
+% This manual is written to cover both packages. All of the material
+% is relevant to users of the \pkg{chemstyle} package. For those only
+% using \pkg{chemscheme}, 
+%
+%\section{Installation}
+%
+% The entire bundle is supplied with the TDS-ready ZIP file,
+% \file{chemstyle.tds.zip}.  Simply unzip this into your local texmf
+% tree and run your hash program: \texttt{texhash} should work with
+% recent versions of either \TeX\ Live or MiK\TeX.
+%
+% To extract the bundle of files from \file{chemstyle.dtx}, run 
+% (pdf)\TeX\ on \file{chemstyle.dtx}. This will produce all of the 
+% package files, and also \file{README.txt}.  To extract the
+% files and build the documentation, run (pdf)\LaTeX\ on 
+% \texttt{chemstyle.dtx}: you will need to enable ``write18'' if 
+% you compile in PDF mode.
+%
+%\section{Requirements}
+%
+% The \pkg{chemstyle} class requires the following packages:
+%\begin{itemize}
+%  \item \pkg{amstext} (part of the AMS bundle);
+%  \item \pkg{caption};
+%  \item either \pkg{float} or \pkg{floatrow};
+%  \item \pkg{kvoptions} (part of the \pkg{oberdiek} bundle);
+%  \item either \pkg{siunitx} or \pkg{SIunits} (otherwise no 
+%    units are defined);
+%  \item \pkg{psfrag};
+%  \item \pkg{varioref} (part of the standard \pkg{tools} bundle);
+%  \item \pkg{xspace} (part of the standard \pkg{tools} bundle).
+%\end{itemize} 
+% These are normally present in the current major \TeX\ distributions,
+% but are also available from \href{http://www.ctan.org}{The 
+% Comprehensive TeX Archive Network}.
+% 
+%\section{The \pkg{chemstyle} package: tools for chemistry}
+%
+% The package recognises a number of key--value options when loading.
+% Some of these are also available in the document body, and are 
+% described along with the relevant commands. Options which apply to
+% \pkg{chemscheme} can be given when loading \pkg{chemstyle} and will
+% be applied correctly.
+% 
 %\DescribeOption{journal}
-% \currpkg should be loaded with a package option specifying which
-% journal style to follow.  Currently, \currpkg is aware of a the
-% styles listed in \ref{styles}.  New styles can be developed by
-% creating a new file modelled on the existing definitions; \currpkg
-% will automatically search for correctly-named styles.
+% \pkg{chemstyle} is supplied with a number of configuration files, 
+% based on the styles adopted by a number of chemistry journals 
+% (\ref{styles}). A style can be chosen by loading the package with 
+% the \opt{journal=\meta{style}} key.
 %\begin{table}
 %  \begin{tabular}{ll}
 %    \toprule
 %    Option & Journals using this style \\
 %    \midrule
-%    none &  Not applicable\\
 %    angew & \emph{Angew.\ Chem.}, \emph{Chem.\ Eur.\ J.} \\
 %    jomc & \emph{J.\ Organomet.\ Chem.},
 %      \emph{Coord.\ Chem.\ Rev.} \\
@@ -334,79 +411,32 @@ to aid the chemist.
 %    tetlett & \emph{Tetrahedron}, \emph{Tetrahedron Lett.} \\
 %    \bottomrule
 %  \end{tabular}
-%  \caption{Styles provided by \currpkg}\label{styles}
+%  \caption{Styles provided by \pkg{chemstyle}}
+%  \label{styles}
 %\end{table}
-% The style files provided with \currpkg 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 \opt{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 \opt{none} option, for example.
-%
-%\subsection{Creating styles}
-% The process of creating a new styles for \currpkg is intended to be
-% relatively easy.  New styles should be saved as files with the
-% extension \ext{jdf} (standing for for Journal Definition File), and
-% should be saved somewhere in the path searched by
-% \TeX.\footnote{Depending on your \TeX\ distribution, you may need
-% to rebuild your file database after creating a new style.  For
-% Mik\TeX\ users, this can be done graphically or by typing
-% \texttt{mpm --update-db} at the command line; for TeXLive, run
-% \texttt{texhash}.}  The definition files included in the package
-% should provide a guide to the basic options available for producing
-% new styles.  Arbitrary \TeX\ commands can be included, if they are
-% necessary for a particular style.  For example, other packages can
-% be loaded in \cs{usepackage}.
-%
-% The maintainer of \currpkg is happy to add new styles to the
-% package, either by contribution by users or on request (when he has
-% sufficient time!).  If you have a new style to add (or corrections
-% to an existing one), please contact the package author.
-%
-%\subsection{Package options}
-%\DescribeOption{journal}
-% As of version 1.2, \currpkg uses the \pkg{keyval} system for
-% option management.  The choice of journal style can therefore be
-% given as a normal option or by using the key \opt{journal=}.  The
-% other package options provided by the package are described as they
-% arise in the documentation.
-%
+% 
 %\DescribeMacro{\cstsetup}
-% Some of the package options can only be set when loading the
-% package. The choice of journal style is one of these.  Others can
-% be altered anywhere in the document, using the \cs{cstsetup} macro.
-%  This accepts a \pkg{keyval} list and processes it as needed.
-%
-%\DescribeOption{chemcompounds}
-%\DescribeOption{floatrow}
-% \currpkg loads the \pkg{chemscheme} package, and therefore will
-% pass through the \opt{chemcompounds} option.  It can also request
-% floats are created either by \pkg{float} or \pkg{floatrow}; this is
-% controlled by the \opt{floatrow} option.  Setting
-% \opt{floatrow=false} means that \pkg{float} is used to generate
-% floats; the default value is \defaultopt{true}.
-%
+% Many of the package options can be altered anywhere in the document, 
+% using the \cs{cstsetup} macro. This accepts a \pkg{keyval} list and 
+% processes it as needed.
+% 
 %\section{Naming of the references section}
-% \currpkg alters the naming of the references section of a document.
-% By default, \currpkg alters the value of \cs{bibname} or
-% \cs{refname} (as appropriate) to the form of words chosen by the
+%
+% \pkg{chemstyle} alters the naming of the references section of a 
+% document. By default, \pkg{chemstyle} alters the value of \cs{bibname} 
+% or \cs{refname} (as appropriate) to the form of words chosen by the
 % target journal for the ``References'' section.
 %
 % The ``\refname'' naming commands are language-aware, \emph{via} the
-% \pkg{babel} interface.  Currently, \currpkg includes appropriate
-% labels for \pkg{babel} languages \opt{english}, \opt{UKenglish},
-% \opt{ngerman} and \opt{french}. Other languages can be added if
-% appropriate wordings are provided to the author.  The naming system
-% is designed to work correctly with both \pkg{natbib} and
-% \pkg{biblatex}.
+% \pkg{babel} interface.  Currently, \pkg{chemstyle} includes appropriate
+% labels for \pkg{babel} languages \opt{english}, \opt{german} and 
+% \opt{french}. Other languages can be added if appropriate wordings are
+% provided to the author. The naming system is designed to work 
+% correctly with both \pkg{natbib} and \pkg{biblatex}.
 %
 %\DescribeOption{notes}
 %\DescribeOption{nonotes}
+%\DescribeOption{notesbefore}
 % The package recognises the \opt{notes} option for controlling how
 % the references section is named.  The accepts the values
 % \opt{true}, \opt{false} and \opt{auto}.  The Boolean values either
@@ -416,100 +446,55 @@ to aid the chemist.
 % added, ``Notes and'' is included in the section title, whereas if
 % no notes are given the section title remains as ``References''.
 % The \opt{nonotes} option is equivalent to \opt{notes=false}.
-%
-%\DescribeOption{notesbefore}
 % The second option for this area is \opt{notesbefore}.  This takes
 % \opt{true} and \opt{false} only, and sets whether ``Notes and
 % References'' or ``References and Notes'' is produced.
-%
-%\section{Additional macros}
+% 
 %\subsection{Additional units}
+%
+%\DescribeMacro{\cmc}
 %\DescribeMacro{\Hz}
-%\DescribeMacro{\mmHg}
 %\DescribeMacro{\molar}
 %\DescribeMacro{\Molar}
-%\DescribeMacro{\cmc}
+%\DescribeMacro{\mmHg}
 % Both the \pkg{SIunits} and \pkg{unitsdef} packages provide methods
 % for handling a range of units, but do not include a small number of
 % unit macros useful to chemists.  In contrast, the \pkg{siunitx}
 % package provides all of these using the \opt{synchem} module.  If
-% \pkg{SIunits} or \pkg{unitsdef} are loaded, \currpkg provides the
-% missing units.  On the other hand, if no unit package is loaded,
-% \pkg{siunitx} is loaded and provides the units itself.
-%\begin{LaTeXexample}
-%  \SI{10}{\Hz}\\
-%  \SI{20}{\mmHg}\\
-%  \SI{30}{\molar}\\
-%  \SI{40}{\Molar}\\
-%  \SI{50}{\cmc}
-%\end{LaTeXexample}
+% \pkg{SIunits} or \pkg{unitsdef} are loaded, \pkg{chemstyle} provides
+% the missing units.  On the other hand, if no unit package is loaded,
+% \pkg{siunitx} is loaded and provides the units itself: if 
+% \pkg{siunitx} is not available on the system, \emph{these macros are
+% not defined}.
+%\begin{LaTeXdemo}
+%  \SI{10}{\cmc}   \\
+%  \SI{20}{\Hz}    \\
+%  \SI{30}{\molar} \\
+%  \SI{40}{\Molar} \\
+%  \SI{50}{\mmHg}  
+%\end{LaTeXdemo}
 %
 %\subsection{The standard state symbol}
+%
 %\DescribeMacro{\standardstate}
 % Related to the above, but not exactly a unit is the
 % \cs{standardstate} command.\footnote{The \cs{standardstate} macro
 % is only defined if the user does not have their own version.}  This
 % generates the tricky \cs{standardstate} symbol. The symbol will
 % adapt to local sizing.
-%\begin{LaTeXexample}
+%\begin{LaTeXdemo}
 %  the standard conditions are indicated: \standardstate\\
 %  Common but not correct:
 %    $\Delta G_\mathrm{f}^\standardstate$ or
-%    $\Delta G_\mathrm{f}{}^\standardstate$ \\
+%    $\Delta G_\mathrm{f}{}^\standardstate$  \\
 %  Better:
-%    $\Delta_\mathrm{f}G^\standardstate$\\
+%    $\Delta_\mathrm{f}G^\standardstate$ \\
 %  Sizing:
 %    $\int^{T_{\mathrm{out}}}_{T^\standardstate}$
-%\end{LaTeXexample}
-%
-%\subsection{Alkyl radicals}
-%\changes{v1.3d}{2009/01/09}{Alkyl radicals work in \cs{ce} macro}
-%\DescribeMacro{\nPr}
-%\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, \cs{iPr} gives \iPr, \cs{iBu} gives \iBu
-% and \cs{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.
-%\begin{LaTeXexample}
-%  The alkyl group could be \nPr, \iPr\\
-%  or \nBu without affecting the selectivity.
-%\end{LaTeXexample}
-% These should also work inside the \cs{ce} macro of \pkg{mhchem} when
-% if escaped mode:
-%\begin{LaTeXexample}
-%  \ce{$\nBu$2CH-C($\iPr$)3}
-%\end{LaTeXexample}
-%
-%\DescribeOption{xspace}
-% When \currpkg is loaded using the \opt{xspace} option, the
-% \pkg{xspace} package is automatically used to add space after the
-% command names, so that |\iPr group| will result in ``\iPr\ group''
-% being typeset.
-%
-%\DescribeOption{radhyphen}
-%\DescribeOption{rademph}
-%\DescribeOption{radsuper}
-%\DescribeOption{radprefix}
-% The appearance of these radical abbreviations is controlled by the
-% package options \opt{radhyphen}, \opt{rademph}, \opt{radsuper} and
-% \opt{radprefix}.  The journal styles set these automatically, but
-% they can be redefined at any point.  The options work as might be
-% expected, and are Boolean switches.
-%\begin{LaTeXexample}
-%  \cstsetup{radhyphen=false,radsuper=true}\\
-%  \iPr \tBu
-%  \cstsetup{radhyphen=true,radsuper=false,%
-%    radprefix=false,rademph=false}\\
-%  \iBu \sBu
-%\end{LaTeXexample}
-%
+%\end{LaTeXdemo}
+% 
 %\subsection{Latin phrases}
+%
 %\DescribeMacro{\latin}
 %\DescribeMacro{\etc}
 %\DescribeMacro{\eg}
@@ -520,19 +505,25 @@ to aid the chemist.
 % available as the obvious commands.  By altering the definition of
 % \cs{latin}, this allows ready switching from italic to Roman
 % typesetting.  Notice that \cs{etc}, \cs{ie} and \cs{eg} are aware
-% of trailing periods, and so doubling-up should not occur. Once
-% again, these macros use \pkg{xspace} when given as a package option
-% to handle automatic addition of spaces after these phrases.
+% of trailing periods, and so doubling-up should not occur. 
+%\begin{LaTeXdemo}
+%  \latin{some text} \\
+%  \eg               \\
+%  \etal             \\
+%  \etc              \\
+%  \ie               \\
+%  \invacuo
+%\end{LaTeXdemo}
 %
 %\DescribeOption{abbremph}
 % The use of italic for these abbreviations is set by altering the
 % package option \opt{abbremph}, which takes values \opt{true} and
 % \opt{false}.
-%\begin{LaTeXexample}
-%  \etal or \invacuo plus \latin{some text}\\
+%\begin{LaTeXdemo}
+%  \etal\ \ie \\
 %  \cstsetup{abbremph=false}
-%  \ie equals \eg perhaps \etc
-%\end{LaTeXexample}
+%  \etal\ \ie \\
+%\end{LaTeXdemo}
 %
 %\DescribeOption{abbrcomma}
 % For American journals, where it is obligatory to follow ``\eg'' and
@@ -540,57 +531,386 @@ to aid the chemist.
 % this automatically.  Thus, when using an appropriate journal style,
 % |\eg|, |\eg.| and |\eg,| will all result in typesetting ``\eg,''.
 % The Boolean package option \opt{abbrcomma} controls this.
-%\begin{LaTeXexample}
+%\begin{LaTeXdemo}
 %  \eg this\\
 %  \cstsetup{abbrcomma=true}
 %  \ie that
-%\end{LaTeXexample}
+%\end{LaTeXdemo}
 %
 % The \cs{etc} and \cs{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
-%\begin{LaTeXexample}
+%\begin{LaTeXdemo}
 %  \etc\ more text \\
 %  \etal~have shown
-%\end{LaTeXexample}
+%\end{LaTeXdemo}
 %
+%\DescribeOption{phrases}
 %\DescribeOption{nophrases}
 % The definitions of all of the phrases are designed not to overwrite
 % any given by the user \emph{in the preamble}.  So, if you have your
-% own \cs{latin} macro, it will be used even if you load \currpkg. If
-% you encounter any problems, try loading the package with the
+% own \cs{latin} macro, it will be used even if you load \pg{chemstyle}. 
+% If you encounter any problems, try loading the package with the
 % \opt{nophrases} option; this option prevents the package even
-% trying to define any of the phrase macros.
+% trying to define any of the phrase macros. The \opt{phrases} option
+% acts as a complement to \opt{nopharses}, so that \opt{phrases=false}
+% is the same as \opt{nophrases=true}.
+% 
+%\subsection{Alkyl radicals}
+%
+%\DescribeMacro{\nPr}
+%\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, \cs{iPr} gives \iPr, \cs{iBu} gives \iBu
+% and \cs{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.
+%\begin{LaTeXdemo}
+%  The alkyl group could be   \\
+%  \nPr, \iPr or \nBu without \\
+%  affecting the selectivity.
+%\end{LaTeXdemo}
+% These should also work inside the \cs{ce} macro of \pkg{mhchem} when
+% if escaped mode:
+%\begin{LaTeXdemo}
+%  \ce{$\nBu$2CH-C($\iPr$)3}
+%\end{LaTeXdemo}
 %
-%\DescribeMacro{\latinemphon}
-%\DescribeMacro{\latinemphoff}
-% For backward-compatibiltiy with previous versions of \currpkg, the
-% macros \cs{latinemphon} and \cs{latinemphoff} are provided.  These
-% work as would be expected, to alter the formatting produced by
-% \cs{latin}.  The more general \pkg{keyval} method is now preferred
-% for making this change.
+%\DescribeOption{rademph}
+%\DescribeOption{radhyphen}
+%\DescribeOption{radprefix}
+%\DescribeOption{radsuper}
+% The appearance of these radical abbreviations is controlled by the
+% package options \opt{rademph}, \opt{radhyphen}, \opt{radprefix} and
+% \opt{radsuper}.  The journal styles set these automatically, but
+% they can be redefined at any point.  The options work as might be
+% expected, and are Boolean switches.
+%\begin{LaTeXdemo}
+%  \cstsetup{
+%    radhyphen = false,
+%    radsuper = true}
+%  \iPr \tBu \\
+%  \cstsetup{
+%    radhyphen = true,
+%    radsuper  = false,
+%    radprefix = false,
+%    rademph   = false
+%  }
+%  \iBu \sBu
+%\end{LaTeXdemo}
 %
+%\DescribeOption{xspace}
+% The package can use \pkg{xspace} to automatically insert space after
+% the alkyl radical macros. This is controlled using the \opt{xspace}
+% option.
+%\begin{LaTeXdemo}
+%  \cstsetup{
+%    xspace = true
+%  }
+%  Some text \iPr some more text\\
+%  \cstsetup{
+%    xspace = false
+%  }
+%  Some text \iPr some more text
+%\end{LaTeXdemo}
+%
+%\section{The \pkg{chemscheme} package: graphics for chemistry}
+%
+%\subsection{Floating schemes}
+%
+% By default, \LaTeX\ defines two float types, \texttt{figure} and
+% \texttt{table}. Synthetic chemists make heavy use of schemes,
+% which need a \texttt{scheme} float type.  This is provided by
+% \pkg{chemscheme}, in a manner consistent with the kernel floats.
+% 
+%\DescribeEnv{scheme}
+% The package provides a new float type, scheme, accessed in the
+% usual way.
+%\begin{LaTeXdemo}[code and float]
+%  \begin{scheme}[ht]
+%    \includegraphics{scheme-one}
+%    \caption{A scheme with no compound numbers.}
+%  \end{scheme}
+%\end{LaTeXdemo}
+% The \texttt{scheme} float is designed to behave in the same way as the
+% standard \LaTeX\ float environments \texttt{figure} and 
+% \texttt{table}.  Thus schemes will be placed at the top of a page,
+% where possible. As shown in the example, the use of positional
+% modifiers is allowed. Labelling and referencing schemes also follows
+% the \LaTeX\ conventions.  \pkg{chemscheme} works hard to emulate the
+% document class in use, and so the exact behaviour will depend on 
+% whether the standard classes, \textsc{koma}-Script or \pkg{memoir} 
+% are being used.
+% 
+%\DescribeMacro{\schemename}
+% \cs{schemename} contains the text used in scheme captions (by
+% default \schemename).  This is used in the same manner as
+% \cs{figurename} or \cs{tablename} to set up the text used in scheme
+% captions.
+%\begin{LaTeXdemo}[code and float]
+%  \renewcommand*{\schemename}{Illustration}
+%  \begin{scheme}[ht]
+%    \includegraphics{scheme-one}
+%    \caption{A scheme that is not a Scheme!}
+%  \end{scheme}
+%\end{LaTeXdemo}
+% 
+%\DescribeMacro{\listofschemes}
+%\DescribeMacro{\listschemename}
+% To match the \cs{listoffigures} and \cs{listoftables} macros
+% provided by the \LaTeX\ kernel, \pkg{chemscheme} provides a
+% \cs{listofschemes} command.  This works in the same way as the
+% kernel commands, with the default text stored in the macro
+% \cs{listschemename}. The standard output is illustrated below.
+% \listofschemes
+% 
+%\DescribeOption{floats}
+% Which method is used to generate the new float is controlled by
+% the \opt{floats} option, which recognises \opt{float}, \opt{floatrow}
+% and \opt{memoir}. The \opt{memoir} option is ignored if not using
+% the \pkg{memoir} class, or if \pkg{chemstyle} is in 
+% use.\footnote{\pkg{memoir} is not capable of some of the float
+% manipulation needed by \pkg{chemstyle}.}
+%
+%\subsection{Reference numbers in graphics}
+%
+% There are a number of packages available for tracking compound 
+% reference numbers.  The two with the most up to date and
+% comprehensive features are \pkg{bpchem} and \pkg{chemcompounds}.
+% Both allow in-text numbering to be handled automatically.  However,
+% neither will allow the use of these numbers directly in schemes,
+% figures, \etc.  Both leave it to the user to manually adapt schemes
+% to match any changes in numbering.
+%
+% The \pkg{chemscheme} package provides a mechanism for rectifying this
+% issue.  The package makes use of the \pkg{psfrag} package, which
+% means that it can only directly produce DVI output (using \LaTeX).
+% However, direct PDF output using pdf\LaTeX\ is possible: see
+% Section~\ref{demo}.
+% 
+% Getting automated numbers into schemes is a two step procedure. In
+% the first step, schemes (or other graphics) should be prepared as
+% normal and saved as encapsulated postscript (EPS) files. The most
+% popular chemistry drawing package, \textsc{ChemDraw}, is able to do
+% this from the \texttt{Save As \ldots} dialogue. The positions where 
+% the auto-labels should be have to be marked in the EPS file. The 
+% marker should consist of an ``indicator'' that the text is to be 
+% replaced, followed by a reference number or letter.  For automated 
+% substitution, the ``indicator'' text should be the same in all 
+% graphics.
+% 
+%\DescribeMacro{\schemeref}
+% In the second step, the command \cs{schemeref} is used to indicate
+% the mapping of the temporary markers to the automatically-managed
+% numbering. The syntax of the command is
+% \cs{chemschemeref}\oarg{temp-marker}\marg{label}, where
+% \meta{temp-marker} is the marker used in the graphic, and
+% \meta{label} is the name assigned to the compound by the user. By
+% default, \pkg{chemscheme} will assume that \meta{temp-marker} 
+% consists of the marker plus a number, beginning at 1 and 
+% incrementing by 1 for each additional structure inside one float. 
+% Each replacement requires a separate \cs{chemschemeref}, all of 
+% which should appear before the relevant \cs{includegraphics} command.
+% 
+% An example will make usage clearer. In the example used in this
+% document, the starting material is given label \texttt{IMesHCl} and
+% the product is called \texttt{IMes}.  As is shown in the next
+% example, in the EPS file these are labelled \textsf{TMP1} and
+% \textsf{TMP2}, respectively. The automated package defaults are
+% used.
+%\begin{LaTeXdemo}[code and float]
+%  \begin{scheme}[ht]
+%    \includegraphics{scheme-two}
+%    \caption{A scheme with temporary compound numbers.}
+%  \end{scheme}
+%  \begin{scheme}[ht]
+%    \schemeref{IMesHCl}
+%    \schemeref{IMes}
+%    \includegraphics{scheme-two}
+%    \caption{A scheme with automated compound numbers.}
+%  \end{scheme}
+%\end{LaTeXdemo}
+% If the marker text is given as an optional argument to
+% \cs{schemeref}, it must include the entire text to be matched.
+%\begin{LaTeXdemo}[code and float]
+%  \begin{scheme}[ht]
+%    \schemeref[TMP1]{IMesHCl}
+%    \schemeref[TMP2]{IMes}
+%    \includegraphics{scheme-two}
+%    \caption{A scheme with explicitly numbered temporary labels.}
+%  \end{scheme}
+%\end{LaTeXdemo}
+% Notice that the new label is centred on the middle of the temporary
+% marker, with the same baseline.  This should allow the user to
+% obtain good alignment of labels and structures.
+% 
+%\DescribeMacro{\schemerefmarker}
+% When using automatic substitution mode, the ``marker'' text to be
+% searched for is stored as \cs{schemerefmarker}, which has
+% default value \texttt{\schemerefmarker}. Thus the graphics should 
+% contain labels \textsf{\schemerefmarker1}, \textsf{\schemerefmarker2}, 
+% \emph{etc}. The value can be changed using \cs{renewcommand*}.
+% 
+%\DescribeMacro{\schemerefformat}
+% The format of chemical references is controlled by the underlying
+% package, \pkg{bpchem} or \pkg{chemcompounds}.  However, it is
+% useful to be able to specify additional formatting for schemes.  By
+% default, \pkg{chemscheme} formats all reference numbers in a sans 
+% serif font. This is controlled by \cs{schemerefformat}.
+%\begin{LaTeXdemo}[code and float]
+%  % This needs the color or xcolor package loaded
+%  \renewcommand*{\schemerefformat}{%
+%    \color{magenta}\textit
+%  }%  
+%  \begin{scheme}[ht]
+%    \schemeref{IMesHCl}
+%    \schemeref{IMes}
+%    \includegraphics{scheme-two}
+%    \caption{A scheme with altered label formatting.}
+%  \end{scheme}
+%\end{LaTeXdemo}
+%
+%\DescribeMacro{\schemerefsub}
+% The \pkg{bpchem} package allows tracking of sub-labels (\textbf{1a},
+% \textbf{1b}, \emph{etc.}).  To allow use of these in schemes, the
+% \cs{schemerefsub} command is provided.  This takes an additional
+% argument \marg{sub-label}, which is used to generate the
+% appropriate text.  When used with \pkg{chemcompounds}, this command
+% will gobble its arguments and issue a warning; no substitution will
+% take place.
+% 
+%\DescribeOption{tracking}
+% The choice of using \pkg{chemcompounds} or \pkg{bpchem} can be made
+% by giving the key--value option \opt{tracking=\meta{package}} when
+% loading \pkg{chemscheme}. This recognises the values \opt{bpchem}
+% and \opt{chemcompounds}, with the later as the default.
+%
+%\section{Horizontal positioning of all floats}
+%
+%\DescribeMacro{\floatcontentscentre}
+%\DescribeMacro{\floatcontentscenter}
+%\DescribeMacro{\floatcontentsleft}
+%\DescribeMacro{\floatcontentsright}
+% The \LaTeX\ default is to position all float contents flush-left.
+% There is no ``hook'' provided to alter this.  The \pkg{chemschem} 
+% package therefore provides commands to align all float contents
+% automatically.  As the macro names make clear,
+% \cs{floatcontentscentre} will make all floats centred (for users
+% speaking U.S.~English, the alternative spelling
+% \cs{floatcontentscenter} is also available).  The default behaviour
+% is restored using the command \cs{floatcontentsleft}. Finally,
+% \cs{floatcontentsright} is provided  for use if needed. Notice that
+% the float positioning commands should be given \emph{outside}
+% floating environments, and apply to all subsequent floats.
+%\begin{LaTeXdemo}[code and float]
+%  \floatcontentsleft
+%  \begin{scheme}[ht]
+%    \includegraphics{scheme-one}
+%    \caption{A flush-left scheme.}
+%  \end{scheme}
+%  \floatcontentsright
+%  \begin{scheme}[ht]
+%    \includegraphics{scheme-one}
+%    \caption{A flush-right scheme.}
+%  \end{scheme}
+%  \floatcontentscentre
+%\end{LaTeXdemo}
+%
+% It is important to note that the positioning mechanism used here
+% relies on a low-level hack of the \LaTeX\ kernel.  This has been
+% tested with the standard \LaTeX\ classes, the \pkg{memoir} class
+% and the \textsc{koma}-Script bundled.  Other document classes may
+% not give the desired behaviour.
+% 
+%\section{Some thoughts on generating chemical schemes}
+%
+%\subsection{Overview}
+% There are a number of ways of generating the graphical content of
+% schemes.  The choice of method will depend on what is available to
+% the user, and how complex the schemes desired are. In this section,
+% an overview of several approaches is given.\footnote{Thanks to
+% Norwid-R.\ Behrnd for suggesting this section and giving a number
+% of useful examples and tips.}  The package author, who is a
+% research worker in a university, favours using \textsc{ChemDraw} as
+% it is regarded by many synthetic chemists as the best tool for this
+% job.  However, this is clearly overkill for users requiring a
+% single diagram on a one-off basis. \textsc{ChemDraw} is also a
+% commercial package running only under Windows and MacOS X. The
+% following is necessarily somewhat brief and selective.  
+% 
+%\subsection{Macro-based methods}
+% At the most basic, a chemical scheme is simply a collection of
+% lines and symbols, as with any vector diagram.  Hence, it is
+% possible to construct schemes directly using packages such as
+% PSTricks or \pkg{pgf}/Ti\emph{k}z.  This is a complex method, and
+% cannot be recommended for anyone except the very experienced and
+% brave.
+%
+% At a more practical level, there are two packages available which
+% allow typesetting of chemical structures in \TeX, using
+% specialised commands: XyM\TeX\ and ppch\TeX.  Recent versions of
+% the XyM\TeX\ package have not been made available on \textsc{CTAN}, 
+% and the version held there is therefore considered to be obsolete.  
+% On the
+% other hand, the ppch\TeX\ system, developed originally for
+% Con\TeX{}t, is available. Both systems suffer from the lack of
+% chemical logic in the input: it is very hard to tell from the code
+% what is being represented. Drawing items such as ``curly arrows'',
+% or making subtle alterations to positioning, is very challenging in
+% purely macro-based systems.  For these reasons, it is usually much
+% more sensible to examine the available graphical methods.
+%
+%\subsection{Graphical methods}
+%
+% Moving to graphical systems, there is no reason that
+% general-purpose vector drawing packages cannot be used for schemes.
+% There are obviously several commercial (\textsc{CorelDraw},
+% \textsc{Adobe Illustrator}, \etc) and freeware (for example
+% the \textsc{gimp}) drawing packages that can be used in this way.
+% Simply rings and lines can easily be constructed, although in
+% general-purpose programs the user has to watch that all bonds
+% are the same length.
+%
+% For producing a large number of complex schemes, the particular
+% abilities of dedicated software become a necessity. As well as the
+% already-mentioned \textsc{ChemDraw}, programs such as \textsc{ISIS
+% Draw} and \textsc{ChemSketch} are available free for personal
+% use;\footnote{``Free'' as in without charge, not as in open
+% source.} these programs are all Windows specific.  In the
+% open-source arena, there are a number of packages such as
+% \textsc{XDrawChem} and \textsc{BKchem}, which offer cross-platform
+% functionality.  The differences between the various packages are in
+% the ease of use, and ability to generate well-formatted output (for
+% example, aligning structures). A more recent addition to this 
+% group of packages is the cross-platform \textsc{ChemDoodle}, which
+% look promising but is not free in any sense.
+%
+% One which deserves mention for the \TeX\ user is TpX.  This is a
+% general purpose Windows graphics program specifically aimed at
+% producing \TeX-friendly output (such as PSTricks and Ti\emph{k}z
+% code) from a graphical interface. TpX can accept clipboard data
+% from other programs, so can be used to produce EPS files from
+% programs which do not have native export facilities (such as
+% \textsc{ISIS Draw}).
+% 
 %\section{Additional information}
-%\subsection{Advice for users of the \pkg{rsc} package}
-% The \currpkg package is intended as a replacement for the \pkg{rsc}
-% package.  As such, it covers almost everything the the \pkg{rsc}
-% \LaTeX\ package does, and more.  Users of \pkg{rsc} are strongly
-% encouraged to update to using \currpkg.  The bibliography styles
-% provided by \pkg{rsc} will continue to be required, of course.
-% Migration of these styles to \pkg{biblatex} is an on-going project.
 %
 %\subsection{Interactions with other packages}
-% The \currpkg package has been designed to avoid, as far as
-% possible, clashes with other packages.  The package requires the
-% presence of the standard \pkg{graphicx} and \pkg{varioref}
-% packages. If these packages need to be loaded with explicit
-% options, this should be done \emph{before} loading \currpkg. The
-% \pkg{chemscheme} package is also needed, as it provides the
-% floating \texttt{scheme} environment essential in synthetic
-% chemistry documents.
+%
+% \pkg{chemstyle} and \pkg{chemscheme} are designed to avoid, as far as
+% possible, clashes with other packages.  The standard packages
+% \pkg{graphicx} and \pkg{varioref} are used by the budnle. If you 
+% need to load these with specific options, this needs to be done
+% \emph{before} loading \pkg{chemstyle} (or \pkg{chemscheme}). 
 %
 %\subsection{Captions above floats}
+%
 % The \texttt{scheme} float type is generated using either the
 % \pkg{float} or \pkg{floatrow} package. This has the side-effect
 % that the placement of captions for floats does not depended on
@@ -598,176 +918,104 @@ to aid the chemist.
 % environment.\footnote{Normally this is a good thing.} If you wish
 % to alter the placement of captions, the mechanism of the underlying
 % package will be needed.  There are some subtle differences between
-% the two: altough \pkg{floatrow} provides the \pkg{float} macros,
-% they are not all 100\% compatible.  This document is compiled using
-% \pkg{floatrow}, and so to fix the position of captions the
+% the two: although \pkg{floatrow} provides the \pkg{float} macros,
+% they are not all $100\,\%$ compatible.  This document is compiled 
+% using \pkg{floatrow}, and so to fix the position of captions the
 % following code is appropriate.
-%
-%\begin{LaTeXexample}[float]
+%\begin{LaTeXdemo}[code and float]
 %  \begin{table}[ht]
-%    The float contents
-%    \caption{A caption below the float contents in the source}
+%    \fbox{First float contents}
+%    \caption{A caption below the float contents in the source.}
 %  \end{table}
-%  \floatsetup[table]{style=plain} % When using floatrow
-%  % \floatstyle{plain}
-%  % \restylefloat{table} When using float
+%  \floatsetup[table]{style=plain} 
 %  \begin{table}[ht]
-%    The second float contents, which should be above the caption
-%    \caption{A second caption below the float contents
-%      in the source}
+%    \fbox{Second float contents}
+%    \caption{A second caption below the float contents in the source.}
 %  \end{table}
-%\end{LaTeXexample}
-%
-%\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. Most of the packages used have
-% good documentation, but a brief summary of why they are recommend
-% follows.
-%\iffalse
-%<*demo>
-%\fi
+%\end{LaTeXdemo}
+% Using the \pkg{float} package, the same effect is achieved using:
+%\begin{LaTeXdemo}[code only]
+%  \begin{table}[ht]
+%    \fbox{First float contents}
+%    \caption{A caption below the float contents in the source.}
+%  \end{table}
+%  \floatstyle{plain}
+%  \restylefloat{table}
+%  \begin{table}[ht]
+%    \fbox{Second float contents}
+%    \caption{A second caption below the float contents in the source.}
+%  \end{table}
+%\end{LaTeXdemo}
+%
+%\section{A demonstration file\label{demo}}
+%
+% This is a simple demonstration file for using the \pkg{chemstyle}
+% package. By using the \pkg{auto-pst-pdf} package, it is possible to
+% use EPS graphics with pdf\LaTeX.
 %    \begin{macrocode}
-\documentclass[fontsize=10pt,paper=a4,english,UKenglish]
-  {scrreprt}
-\usepackage{geometry,upgreek,booktabs,babel}
-\usepackage[journal=rsc,xspace=true]{chemstyle}
-\usepackage[version=3]{mhchem}
-\usepackage[footnotes]{notes2bib}
-\usepackage[final]{microtype}
-\usepackage[final,inactive]{pst-pdf}
-\usepackage[colorlinks]{hyperref}
+%<*demo>
+\documentclass[a4paper]{article}
+\usepackage[T1]{fontenc}            % Modern font encoding
+\usepackage[runs=2]{auto-pst-pdf}   % Use EPS graphics with pdfLaTeX
+\usepackage{booktabs}               % Better table layouts
+\usepackage[journal=rsc]{chemstyle} % Of course!
+\usepackage{geometry}               % Easy page laout
+\usepackage{lmodern}                % Use Latin Modern fonts
+\usepackage[version=3]{mhchem}      % Formula subscripts using \ce{}
 \begin{document}
-  Document contents go here
 \end{document}
-%    \end{macrocode}
-%\iffalse
 %</demo>
-%\fi
-%
-% 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
-% \opt{parskip} option to the font and paper size ones given here.
-%
-% The \pkg{babel} system is loaded to sort out hyphenation and so on,
-% and could be useful if there are any foreign-language quotes.
-%
-% \pkg{geometry} allows the users to alter page layout with ease:
-% much better than trying to hack the raw \LaTeX\ system.
-% \pkg{booktabs} gives much nicer looking tables than the \LaTeXe\
-% default. \pkg{upgreek} provides non-italic lowercase Greek letters,
-% which should be used for things such as bond descriptions.
-%\begin{LaTeXexample}
-%  $\uppi$-bond $\upsigma^*$-orbital
-%\end{LaTeXexample}
-%
-% Load \currpkg (of course) to give not only some easy formatting,
-% but also to automatically provide a float type for schemes, thanks
-% to the \pkg{chemscheme} package.  This also loads either
-% \pkg{chemcompounds} or (optionally) \pkg{bpchem} to track compound
-% numbers.
-%
-% The \pkg{mhchem} package provides the \cs{ce} command for rapidly
-% typesetting formulas, so that you can type |\ce{H2SO4}| and get
-% $\ce{H2SO4}$.\footnote{There is a slight cheat here, as this
-% document uses lower-case numerals in the text.  The example is
-% written as \texttt{\$\textbackslash ce\{H2SO4\}\$}.}
-%
-% The \pkg{microtype} package improves formatting when used with the
-% pdf\TeX\ engine.  By giving the \opt{final} option, it is active
-% even when using \opt{draft} as a global option.
-%
-% Using \pkg{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 \opt{footnotes}
-% option means that footnotes do the same.
-%
-% Finally, the \pkg{hyperref} package makes headings, citations and
-% so on into hyperlinks.
-%
-%\StopEventually{}
+%    \end{macrocode}
 %
-%\iffalse
-%<*package>
-%\fi
-%\section{The package code}
-%\subsection{Setup code}
-%\begin{macro}{\cst@id}
-%\begin{macro}{\cst@ver}
-% First of all, the package identifies itself and loads other
-% packages needed to function.  Loading \pkg{chemscheme} is deferred
-% until later, to allow processing of options at the correct point.
+%\StopEventually{^^A
+%  \PrintChanges
+%  \PrintIndex
+%}
+%
+%\section{Implementation}
+%
+% A few support packages.
 %    \begin{macrocode}
-\NeedsTeXFormat{LaTeX2e}
-\def\cst@id$#1: #2.#3 #4 #5-#6-#7 #8 #9${%
-    \def\cst@ver{#5/#6/#7\space v1.3d\space}}
-\cst@id $Id: chemstyle.dtx 51 2009-01-09 16:21:24Z joseph $
+%<*package> 
 \ProvidesPackage{chemstyle}
-  [\cst@ver Writing chemistry with style]
-%    \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\changes{v1.1d}{2007/10/04}{Require caption in all cases}
-%\changes{v1.0a}{2007/08/23}{No longer load \texttt{fixltx2e}
-%  package}
-%\changes{v1.2}{2008/03/05}{Added \pkg{xkeyval} interface}
-%\changes{v1.3d}{2009/01/09}{Require \pkg{amstext}}
-% Packages that are needed under all circumstances are loaded here.
-% There are some limitations on the age of \pkg{xkeyval}.
-%    \begin{macrocode}
-\RequirePackage{xkeyval}[2005/05/07]
-\RequirePackage{amstext,graphicx,varioref,caption,xspace}
+  [2009/06/06 v2.0 Schemes and style for chemistry]   
+\RequirePackage{amstext,caption,chemscheme,varioref,xspace}
+\SetupKeyvalOptions{
+  family=cst,
+  prefix=cst@
+}
 %    \end{macrocode}
+%    
 %\begin{macro}{\cst@tempa}
-%\changes{v1.2}{2008/03/05}{New macro}
-%\begin{macro}{\cst@tempb}
-%\changes{v1.2}{2008/03/05}{New macro}
-% A couple of temporary private macros.
-%    \begin{macrocode}
-\newcommand*{\cst@tempa}{}
-\newcommand*{\cst@tempb}{}
-%    \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-%\subsection{Option handling}
-%\begin{macro}{\cst@boolkey}
-% Option handling is processed using \pkg{xkeyval}.  As a number of
-% Boolean keys are needed, a shortcut is handy.
+% A temporary macro.
 %    \begin{macrocode}
-\newcommand*{\cst@boolkey}[1]{
-  \define@boolkey[cst]{opt}[cst@]{#1}[true]{}}
+\newcommand*\cst@tempa{}
 %    \end{macrocode}
-%\end{macro}
-%\begin{macro}{\ifcst@chemcompounds}
-%\begin{macro}{\ifcst@floatrow}
-%\begin{macro}{\ifcst@xspace}
+%\end{macro}    
+%    
+%\begin{macro}{\ifcst@abbrcomma}
+%\begin{macro}{\ifcst@abbremph}
+%\begin{macro}{\ifcst@notesbefore}
 %\begin{macro}{\ifcst@phrases}
-%\begin{macro}{\ifcst@radprefix}
 %\begin{macro}{\ifcst@rademph}
-%\begin{macro}{\ifcst@radsuper}
 %\begin{macro}{\ifcst@radhyphen}
-%\begin{macro}{\ifcst@abbremph}
-%\begin{macro}{\ifcst@abbrcomma}
-%\begin{macro}{\ifcst@notesbefore}
-% The Boolean keys are now defined.
+%\begin{macro}{\ifcst@radpreix}
+%\begin{macro}{\ifcst@radsuper}
+%\begin{macro}{\ifcst@xspace}
+% Some simple Boolean options.
 %    \begin{macrocode}
-\cst@boolkey{chemcompounds}
-\cst@boolkey{floatrow}
-\cst@boolkey{xspace}
-\cst@boolkey{phrases}
-\cst@boolkey{radprefix}
-\cst@boolkey{rademph}
-\cst@boolkey{radsuper}
-\cst@boolkey{radhyphen}
-\cst@boolkey{abbremph}
-\cst@boolkey{abbrcomma}
-\cst@boolkey{notesbefore}
+\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]{xspace}
 %    \end{macrocode}
+%\end{macro} 
 %\end{macro}
 %\end{macro}
 %\end{macro}
@@ -776,124 +1024,113 @@ to aid the chemist.
 %\end{macro}
 %\end{macro}
 %\end{macro}
+%
+%\begin{macro}{\cst@language}
+%\begin{macro}{\cst@journal}
+% Simple string options.
+%    \begin{macrocode}
+\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
+}
+%    \end{macrocode}
 %\end{macro}
 %\end{macro}
-%\end{macro}
+%
 %\begin{macro}{\ifcst@notes}
 %\begin{macro}{\ifcst@autonotes}
-%\begin{macro}{\cst@tempa}
-%\begin{macro}{\cst@tempb}
-% For notes, some choices are available.  These need a bit of
-% testing.
+%\begin{macro}{\cst@opt@auto}
+%\begin{macro}{\cst@opt@notestrue}
+%\begin{macro}{\cst@opt@notesfalse}
+%\begin{macro}{\cst@opt@notesauto}
+%\begin{macro}{\cst@opt@noteserror}
+% For the \opt{notes} option, there are three possible values. Some of
+% the internal code of \pkg{kvoptions} is borrowed and modified to keep
+% things simple.
 %    \begin{macrocode}
 \newif\ifcst@notes
 \newif\ifcst@autonotes
-\define@choicekey*[cst]{opt}{notes}[\cst@tempa]
-  {true,false,auto}[true]
-  {\cst@notesfalse
-   \cst@autonotesfalse
-   \edef\cst@tempb{auto}
-   \ifx\cst@tempa\cst@tempb
-     \cst@notestrue
-     \cst@autonotestrue
-   \fi
-   \edef\cst@tempb{true}
-   \ifx\cst@tempa\cst@tempb
-     \cst@notestrue
-   \fi}
+\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}
 %    \end{macrocode}
 %\end{macro}
 %\end{macro}
 %\end{macro}
 %\end{macro}
-% Some old options are no longer needed at all.
-%    \begin{macrocode}
-\DeclareOptionX[cst]<opt>{siunits}
-  {\PackageInfo{chemstyle}{Option siunits no longer required}}
-\DeclareOptionX[cst]<opt>{SIunits}
-  {\PackageInfo{chemstyle}{Option siunits no longer required}}
-\DeclareOptionX[cst]<opt>{nonotes}
-  {\ExecuteOptionsX[cst]<opt>{notes=false}}
-\DeclareOptionX[cst]<opt>{nophrases}
-  {\ExecuteOptionsX[cst]<opt>{phrases=false}}
-%    \end{macrocode}
-%\begin{macro}{\cst@journal}
-%\begin{macro}{\cst@language}
-% The \opt{journal} option can be given with or without
-% \opt{journal=}.
-%    \begin{macrocode}
-\define@cmdkeys[cst]{opt}[cst@]{journal,language}
-\DeclareOptionX*{\edef\cst@journal{\CurrentOption}}
-%    \end{macrocode}
 %\end{macro}
 %\end{macro}
-% The default options are executed, and the user options are
-% processed.
-%    \begin{macrocode}
-\setkeys[cst]{opt}{
-  notes=true,
-  phrases=true,
-  chemcompounds=true,
-  xspace=true,
-  floatrow=true,
-  journal=none,
-  radprefix=true,
-  rademph=true,
-  radsuper=false,
-  radhyphen=true,
-  abbremph=true,
-  abbrcomma=false,
-  language=english,
-  notesbefore=true}
-\ProcessOptionsX[cst]<opt>
-%    \end{macrocode}
-% With the options processed, those to be passed to \pkg{chemscheme}
-% are sorted out.
-%    \begin{macrocode}
-\ifcst@chemcompounds
-  \PassOptionsToPackage{chemcompounds}{chemscheme}
-\fi
-\ifcst@floatrow
-  \RequirePackage[floats=floatrow]{chemscheme}
-\else
-  \RequirePackage[floats=float]{chemscheme}
-\fi
-%    \end{macrocode}
-%\begin{macro}{\cst@disablekey}
-% Some of the options are no longer relevant once the package is
-% loaded.  These are disabled here with a suitable message.
-%    \begin{macrocode}
-\newcommand*{\cst@disablekey}[1]{
-  \define@key[cst]{opt}{#1}{\PackageWarning{chemstyle}
-    {Option `#1' only valid when loading package}}}
-\AtBeginDocument{
-  \cst@disablekey{floatrow}
-  \cst@disablekey{journal}
-  \cst@disablekey{phrases}
-  \cst@disablekey{nophrases}
-  \cst@disablekey{notes}
-  \cst@disablekey{nonotes}
-  \cst@disablekey{chemcompounds}}
-%    \end{macrocode}
 %\end{macro}
+%    
 %\begin{macro}{\cstsetup}
-% A macro for changing the settings at run-time without needing to
-% know the internals of the package.
+% For allowing run-time changes.
 %    \begin{macrocode}
-\newcommand*{\cstsetup}[1]{%
-  \iffalse{\fi\ifnum0=`}\fi
-  \setkeys[cst]{opt}{#1}%
-  \ifnum0=`{\fi\iffalse}\fi}
+\newcommand*\cstsetup{%
+  \setkeys{cst}
+}
 %    \end{macrocode}
 %\end{macro}
 %
+%\begin{macro}{\cst@xspace}
+% A re-usable \cs{xspace}-based macro.
+%    \begin{macrocode}
+\newcommand*\cst@xspace{%
+  \ifcst@xspace
+    \expandafter\xspace
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
+%    
 %\subsection{Extra units}
-%\changes{v1.2}{2008/03/06}{Re-write of units section}
-%\changes{v1.2b}{2008/04/14}{Change due to name change of \pkg{si}
-%  package to \pkg{siunitx}}
-%\changes{v1.2c}{2008/06/10}{Altered call to \pkg{siunitx}
-%  function}
-%\changes{v1.3b}{2008/06/24}{Default to loading \pkg{siunitx}}
+%
 %\begin{macro}{\cmc}
 %\begin{macro}{\Hz}
 %\begin{macro}{\cubiccentimeter}
@@ -903,31 +1140,47 @@ to aid the chemist.
 %\begin{macro}{\mol}
 % The \pkg{siunitx} package provides all of the units desired here.
 % So if it is loaded, the module \opt{synchem} is all that needs to
-% be loaded.  Otherwise, a series of tests are needed for
-% \pkg{SIunits} and \pkg{unitsdef}.  If either of these are loaded,
-% they are used; if not, then \pkg{siunitx} is loaded in any case.
+% be loaded.  
 %    \begin{macrocode}
-\@ifpackageloaded{siunitx}
-  {\requiresiconfigs{synchem}}
-  {\@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}}
-      {\RequirePackage[alsoload=synchem]{siunitx}}}}
+\@ifpackageloaded{siunitx}{
+  \requiresiconfigs{synchem}
+}{%
+  \@ifpackageloaded{SIunits}{}{%
+    \@ifpackageloaded{unitsdef}{}{%
+      \IfFileExists{siunitx.sty}{%
+        \RequirePackage[alsoload=synchem]{siunitx}
+      }{%
+        \IfFileExists{SIunits.sty}{%
+          \RequirePackage{SIunits}
+        }{%
+          \PackageWarning{chemstyle}{%
+            Could not find siunitx or SIunits package:\MessageBreak
+            additional units not defined%         
+          }
+        }
+      }
+    }
+  }
+}
+\@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}
+  }{}
+}
 %    \end{macrocode}
 %\end{macro}
 %\end{macro}
@@ -938,85 +1191,193 @@ to aid the chemist.
 %\end{macro}
 %
 %\subsection{Standard state symbol}
+%
 %\begin{macro}{\standardstate}
-%\changes{v1.3a}{2008/07/21}{Completely new definition}
-%\begin{macro}{\cst@sstate}
-%\begin{macro}{\cst@s@state}
-% The ``standard state'' symbol is handy. This definition
-% is adapted from one posted several times to
-% \texttt{comp.text.tex} by Donald Arseneau.
+%\begin{macro}{\cst@standardstate}
+%\begin{macro}{\cst@standardstate@aux}
+% The ``standard state'' symbol is handy. This definition is adapted 
+% from one posted several times to \texttt{comp.text.tex} by Donald 
+% Arseneau.
 %    \begin{macrocode}
-\providecommand*{\standardstate}{%
-  {\ensuremath{\protect\cst@sstate}}}
-\newcommand*{\cst@sstate}{\mathpalette\cst@s@state\circ}
-\newcommand*{\cst@s@state}[2]{%
-  \ooalign{\hfil$#1-$\hfil\cr\hfil$#1#2$\hfil\cr}}
+\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
+  }%
+}
 %    \end{macrocode}
 %\end{macro}
 %\end{macro}
 %\end{macro}
 %
-%\subsection{Alkyl radicals}
-%\begin{macro}{\cst@radical}
-%\changes{v1.2}{2008/03/07}{Re-write to allow definition to change at
-%  run-time}
-% The \cs{cst@radical} macro does the hard work of declaring each
-% abbreviation. The commands are made robust so they can (hopefully)
-% be used anywhere.
+%\subsection{Latin phrases}
+%
+%\begin{macro}{\latin}
+%\begin{macro}{\cst@latin}
+%\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 \cs{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
+% \cs{latin} command \emph{after} loading \pkg{chemstyle} and still have
+% everything work properly.
 %    \begin{macrocode}
-\newcommand*{\cst@radical}[2]{%
-  \expandafter\DeclareRobustCommand\expandafter*\expandafter{%
-    \csname #1#2\endcsname}{%
-    \text{%
-%    \end{macrocode}
-%\begin{macro}{\cst@emph}
-%\begin{macro}{\cst@hyphen}
-%\begin{macro}{\cst@super}
-% To allow redefinition while running, the various component parts of
-% the system are defined each time an abbreviation is used.
-%    \begin{macrocode}
-      \ifcst@radhyphen
-        \def\cst@hyphen{-}%
-      \else
-        \let\cst@hyphen\relax
-      \fi
-      \ifcst@radsuper
-        \let\cst@super\textsuperscript
-      \else
-        \let\cst@super\relax
-      \fi
-      \ifcst@rademph
-        \let\cst@emph\emph
-      \else
-        \let\cst@emph\relax
-      \fi
+\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}%
+}
 %    \end{macrocode}
 %\end{macro}
 %\end{macro}
 %\end{macro}
-% The final check is for a prefix, which is easiest to do here.
+%\end{macro}
+%
+%\begin{macro}{\cst@phrases@make}
+%\begin{macro}{\eg}
+%\begin{macro}{\etal}
+%\begin{macro}{\etc}
+%\begin{macro}{\ie}
+%\begin{macro}{\invacuo}
+% The outer functions for phrases are simple.
 %    \begin{macrocode}
-      \ifcst@radprefix
-        \cst@super{\cst@emph{#1}}\cst@hyphen#2%
-      \else
-        #2\cst@hyphen\cst@super{\cst@emph{#1}}%
-      \fi
-      \cst@xspace
-    }%
+\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
+}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% 
+%\begin{macro}{\cst@phrase}
+%\begin{macro}{\cst@phrase@comma}
+% For phrases which never have a comma, life is easy. If there may be a
+% comma to add, the flag is checked before proceeding.
+%    \begin{macrocode}
+\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
+}
+%    \end{macrocode}
+%\end{macro} 
+%\end{macro}
+%\begin{macro}{\cst@phrase@with@comma}
+%\begin{macro}{\cst@phrase@with@comma@token}
+%\begin{macro}{\cst@phrase@with@comma@aux@i}
+%\begin{macro}{\cst@phrase@with@comma@aux@ii}
+%\begin{macro}{\cst@phrase@with@comma@end}
+%\begin{macro}{\cst@phrase@with@comma@next}
+% If a comma is needed, the macros here search through the trailing 
+% punctuation and gobble all of commas and full-stops. The appropriate
+% punctuation is then added. Notice that the \cs{relax} here is 
+% important, and that the test is category-code neural.
+%    \begin{macrocode}
+\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{}
 %    \end{macrocode}
+%\end{macro} 
+%\end{macro} 
 %\end{macro}
-%\begin{macro}{\cst@xspace}
-%\changes{v1.2}{2008/03/07}{New definition}
-% A re-useable \cs{xspace}-based macro.
+%\end{macro} 
+%\end{macro}
+%\end{macro}
+%
+%\subsection{Alkyl radicals}
+%
+%\begin{macro}{\cst@radical@make}
+% The \cs{cst@radical@amke} macro does the hard work of declaring each
+% abbreviation. The commands are made robust so they can (hopefully)
+% be used anywhere.
 %    \begin{macrocode}
-\newcommand*{\cst@xspace}{%
-  \ifcst@xspace
-    \expandafter\xspace%
-  \fi}
+\newcommand*\cst@radical@make[2]{%
+  \expandafter\DeclareRobustCommand\expandafter*\csname #1#2\endcsname{%
+    \text{\cst@radical{#1}{#2}}%
+    \cst@xspace
+  }%
+}
 %    \end{macrocode}
 %\end{macro}
+%
 %\begin{macro}{\nPr}
 %\begin{macro}{\iPr}
 %\begin{macro}{\nBu}
@@ -1027,12 +1388,12 @@ to aid the chemist.
 % 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}%
+\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}
 %    \end{macrocode}
 %\end{macro}
 %\end{macro}
@@ -1041,850 +1402,1808 @@ to aid the chemist.
 %\end{macro}
 %\end{macro}
 %
-%\subsection{Float formatting}
-% The next step is to format the floats correctly. 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{macro}{\cst@radical@emph}
+%\begin{macro}{\cst@radical@hyphen}
+%\begin{macro}{\cst@radical@hyphen@false}
+%\begin{macro}{\cst@radical@super}
+% A few set up macros.
 %    \begin{macrocode}
-\floatstyle{plaintop}
-\restylefloat{table}
-\floatstyle{plain}
-\restylefloat{figure}
-\floatplacement{table}{htbp}
-\floatplacement{figure}{htbp}
+\newcommand*\cst@radical@emph{}
+\newcommand*\cst@radical@hyphen{}
+\newcommand*\cst@radical@hyphen@true{-}
+\newcommand*\cst@radical@super{}
 %    \end{macrocode}
-% Work with |scheme|s needs to be done after \pkg{hyperref} might be
-% loaded.
-%    \begin{macrocode}
-\AtBeginDocument{
-  \restylefloat{scheme}
-  \floatplacement{scheme}{htbp}}
-%    \end{macrocode}
-% The contents of floats are centred by default, using the hook
-% from the \pkg{chemscheme} package.
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%
+%\begin{macro}{\cst@radical}
+%\begin{macro}{\cst@radical@pre}
+%\begin{macro}{\cst@radical@post}
+% The main body functions set everything up carefully, then actually
+% prints things.
 %    \begin{macrocode}
-\floatcontentscentre
+\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}%
+  }%
+}
 %    \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
 %
 %\subsection{Cross-references}
-%\changes{v1.1g}{2007/10/19}{Fixed problem with cross-referencing
-%  when \pkg{babel} is not loaded}
+%
 % The naming for cross-references is sorted out properly using the
-% \pkg{varioref} package.
+% \pkg{varioref} package. Schemes are done at the start of the document
+% as the definition of \cs{schemename} may not exist yet.
 %    \begin{macrocode}
 \labelformat{figure}{\figurename~#1}
 \labelformat{table}{\tablename~#1}
-\AtBeginDocument{\labelformat{scheme}{\schemename~#1}}
+\AtEndOfPackage{%
+  \AtBeginDocument{%
+    \labelformat{scheme}{\schemename~#1}%
+  }%
+}
 %    \end{macrocode}
+%    
+% \subsection{Handling reference section naming}
 %
-% \subsection{Latin phrases}
-%\begin{macro}{\latin}
-%\begin{macro}{\cst@latin}
-%\changes{v1.1}{2007/09/17}{New macro}
-%\changes{v1.2}{2008/03/07}{Change of definition to allow better
-%  working with run-time options}
-%\begin{macro}{\latinemphon}
-%\changes{v1.2}{2008/03/07}{New definition to work with \pkg{xkeyval}
-%  system}
-%\begin{macro}{\latinemphoff}
-%\changes{v1.2}{2008/03/07}{New definition to work with \pkg{xkeyval}
-%  system}
-% 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 \cs{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
-% \cs{latin} command \emph{after} loading \currpkg and still have
-% everything work properly.
+%\begin{macro}{bibnote}
+% For the \opt{notes=auto} option, the \LaTeX\ counter \texttt{bibnote}
+% needs to be defined even if \pkg{notes2bib} is not loaded.
 %    \begin{macrocode}
-\newcommand*{\cst@latin}{%
-  \ifcst@abbremph
-    \expandafter\emph%
-  \fi}
-\newcommand*{\latinemphon}{\cstsetup{abbremph=true}}
-\newcommand*{\latinemphoff}{\cstsetup{abbremph=false}}
-\AtBeginDocument{\providecommand*\latin{\cst@latin}}
+\AtBeginDocument{%
+  \@ifpackageloaded{notes2bib}{}{%
+    \newcounter{bibnote}%
+  }%
+}
 %    \end{macrocode}
 %\end{macro}
-%\end{macro}
-%\end{macro}
-%\end{macro}
-%\begin{macro}{\etc}
-%\begin{macro}{\invacuo}
-%\begin{macro}{\etal}
-%\changes{v1.1f}{2007/10/14}{Fixed problem with full stop spacing}
-%\begin{macro}{\eg}
-%\changes{v1.1}{2007/09/17}{Adds comma for \textsc{acs} journals}
-%\changes{v1.1f}{2007/10/14}{Fixed problem with full stop spacing}
-%\changes{v1.1f}{2007/10/14}{Definition comma-mode dependent}
-%\changes{v1.2}{2008/03/07}{Dynamic definition for comma mode}
-%\begin{macro}{\ie}
-%\changes{v1.1}{2007/09/17}{Adds comma for \textsc{acs} journals}
-%\changes{v1.1f}{2007/10/14}{Fixed problem with full stop spacing}
-%\changes{v1.1f}{2007/10/14}{Definition comma-mode dependent}
-%\changes{v1.2}{2008/03/07}{Dynamic definition for comma mode}
-% For the macros themselves, care is taken about trailing full stops.
-% The \cs{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 \cs{providecommand}
-% to avoid standing on the user's own versions, if they exist.
+% 
+%\begin{macro}{\cst@refsec@name}
+%\begin{macro}{\cst@refsec@find}
+%\begin{macro}{\cst@refsec@find@aux}
+%\begin{macro}{\cst@refsec@set@name}
+% A search for the references section: if this ends up empty then there
+% is no section and later code will not do anything. This is used to
+% disable the relevant code if \opt{notes=false} is set.
 %    \begin{macrocode}
-\ifcst@phrases
-  \AtBeginDocument{
-    \providecommand*{\etc}
-      {\@ifnextchar.{\cst@etc}{\cst@etc.\cst@xspace}}
-    \providecommand*{\invacuo}
-      {\latin{in vacuo}\cst@xspace}
-    \providecommand*{\etal}
-      {\@ifnextchar.{\cst@etal}{\cst@etal.\cst@xspace}}
-    \providecommand*{\eg}
-      {\ifcst@abbrcomma
-         \expandafter\cst@commaabbr%
-       \else
-         \expandafter\cst@nocommaabbr%
-       \fi
-       {eg}}
-    \providecommand*{\ie}
-      {\ifcst@abbrcomma
-         \expandafter\cst@commaabbr%
-       \else
-         \expandafter\cst@nocommaabbr%
-       \fi
-       {ie}}}
+\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
 %    \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%\begin{macro}{\cst@etal}
-%\changes{v1.1f}{2007/10/14}{New macro}
-%\begin{macro}{\cst@etc}
-%\changes{v1.1f}{2007/10/14}{New macro}
-%\begin{macro}{\cst@eg}
-%\changes{v1.1f}{2007/10/14}{New macro}
-%\begin{macro}{\cst@ie}
-%\changes{v1.1f}{2007/10/14}{New macro}
-% Internal macros are used for items ending in a full stop, to allow
-% clean handling of spacing.  Notice that \cs{ie} and \cs{eg}
-% cannot come at the end of a sentence, they are designed to give
-% only an inter-word space.
-%    \begin{macrocode}
-\newcommand*{\cst@etal}{\latin{et~al}}
-\newcommand*{\cst@etc}{\latin{etc}}
-\newcommand*{\cst@ie}{\latin{i.e\spacefactor999\relax}}
-\newcommand*{\cst@eg}{\latin{e.g\spacefactor999\relax}}
-%    \end{macrocode}
 %\end{macro}
 %\end{macro}
 %\end{macro}
 %\end{macro}
-%\begin{macro}{\cst@commaabbr}
-%\changes{v1.2}{2008/03/07}{New macro}
-%\begin{macro}{\cst@nocommaabbr}
-%\changes{v1.2}{2008/03/07}{New macro}
-% To handle the comma issue, two general macros are used.
+%
+%\begin{macro}{\cst@refsec@lang}
+%\begin{macro}{\cst@refsec@lang@clist}
+%\begin{macro}{\cst@refsec@lang@define}
+% The language-dependent definitions are created.
 %    \begin{macrocode}
-\newcommand*{\cst@commaabbr}[1]{%
-  \csname cst@#1\endcsname%
-  \cst@addpunct}
-\newcommand*{\cst@nocommaabbr}[1]{%
-  \@ifnextchar.%
-    {\csname cst@#1\endcsname}
-    {\csname cst@#1\endcsname.\cst@xspace}}
+\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}
 %    \end{macrocode}
 %\end{macro}
 %\end{macro}
-%\begin{macro}{\cst@addpunct}
-%\changes{v1.1}{2007/09/17}{New macro}
-%\changes{v1.1f}{2007/10/14}{No longer used when comma not required}
-% The following macros are very closely based on those in the
-% \pkg{cite} package used for moving citations after punctuation.
-% The first macro is used as an initial hook.  Notice that
-% \cs{relax} is essential here, as it provides an argument for
-% \cs{cst@add@punct} in the first round of checking.
-%    \begin{macrocode}
-\newcommand*{\cst@addpunct}{%
-  \cst@add@punct\relax}
-%    \end{macrocode}
 %\end{macro}
-%\begin{macro}{\cst@add@punct}
-%\changes{v1.1}{2007/09/17}{New macro}
-% Here, a plain \TeX\ \cs{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{macro}{\cst@refsec@set}
+%\begin{macro}{\cst@refsec@set@biblatex}
+%\begin{macro}{\cst@refsec@set@babel}
+%\begin{macro}{\cst@refsec@set@language}
+% The method for setting up the section heading depends on the 
+% other packages in use. \pkg{biblatex} has its own system, and with
+% \pkg{babel} there is also a mechanism to attach to.
 %    \begin{macrocode}
-\newcommand*{\cst@add@punct}[1]{%
-  \futurelet\cst@tempa\cst@add@punct@}
+\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
+}
 %    \end{macrocode}
 %\end{macro}
-%\begin{macro}{\cst@add@punct@}
-%\changes{v1.1}{2007/09/17}{New macro}
-%\changes{v1.2}{2008/03/07}{Internal tweaks}
-%\begin{macro}{\cst@tempa}
-%\begin{macro}{\cst@tempb}
-% The checking occurs here.  If a match is made, then the process is
-% repeated to allow the punctuation to be gobbled.
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%    
+%\begin{macro}{\cst@refsec@make@name}
+%\begin{macro}{\cst@refsec@make@name@fixed}
+%\begin{macro}{\cst@refsec@make@name@auto}
+%\begin{macro}{\cst@refsec@make@name@nonotes}
+% Actually making the name is pretty easy: the only complexity is
+% the possibility of automation.
 %    \begin{macrocode}
-\newcommand*{\cst@add@punct@}{%
-  \ifx.\cst@tempa
-    \let\cst@tempb\cst@add@punct
+\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
-    \ifx,\cst@tempa
-      \let\cst@tempb\cst@add@punct
-%    \end{macrocode}
-% No match, and so new punctuation is to be added and the loop ended.
-%    \begin{macrocode}
-    \else
-      \let\cst@tempb\cst@commapunct
-    \fi
+    \@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
-  \cst@tempb}
+\fi
 %    \end{macrocode}
 %\end{macro}
 %\end{macro}
 %\end{macro}
-%\begin{macro}{\cst@commapunct}
-%\changes{v1.2}{2008/03/07}{Name change from \cs{cst@punct}}
-% The \cs{cst@punct} macro holds the comma-containing punctuation to
-% be added.
+%\end{macro}
+%
+% With everything set up, options can be processed.
 %    \begin{macrocode}
-\newcommand*{\cst@commapunct}{.,\cst@xspace}
+\ProcessKeyvalOptions{cst}
 %    \end{macrocode}
-%\end{macro}
+%    
+%\subsection{Float formatting}
+%
+%\begin{macro}{\cst@float@memoir@correct}
+% Floats are now re-formatted, using the tools provided by either
+% \pkg{float} or \pkg{floatrow}. First, a check to make sure that
+% \pkg{chemscheme} was not loaded with the \opt{memoir} option. The
+% checks there mean that this is only possible if neither \pkg{floatrow}
+% nor \pkg{float} are already loaded.
+%    \begin{macrocode}
+\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}}
+%    \end{macrocode} 
+%\end{macro} 
 %
+% With that done, the package can safely re-define appearance.
+%    \begin{macrocode}
+\@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}
+  }
+}
+%    \end{macrocode}
+%    
 %\subsection{Loading the style definition}
+%
 % The style definition is loaded here, once everything necessary 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
-% \ext{jdf}.
-%\changes{v1.1b}{2007/09/19}{Load \pkg{caption} even when
-%  journal style does not exist}
+% in place. 
 %    \begin{macrocode}
-\InputIfFileExists{\cst@journal.jdf}
-  {\PackageInfo{chemstyle}
-    {Loaded \cst@journal.jdf}}
-  {\PackageWarning{chemstyle}
-    {Requested style `\cst@journal' does not exist\MessageBreak
-     Loading default style}
-    \InputIfFileExists{none.jdf}{}
-      {\PackageError{chemstyle}{Failed to load none.jdf}
-         {The default journal definition file was not
-          found\MessageBreak This is a core part of
-          chemstyle\MessageBreak Something is wrong with
-          the installation}}}
+\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
 %    \end{macrocode}
 %
-% \subsection{Handling reference section naming}
-%\changes{v1.2}{2008/03/07}{Re-write of reference-section renaming
-%  code}
-%\begin{macro}{\cst@refsec}
-%\changes{v1.2}{2008/03/07}{New macro}
-% To enable the renaming of \cs{bibname} or \cs{refname} to the
-% desired value, some work is needed.  Both \pkg{natbib} and
-% \pkg{biblatex} alter the behaviour here subtly.  The \pkg{babel}
-% package also requires careful handling.  The initial step is to fin
-% whether the document class defines chapters, as this affects
-% whether \cs{refname} or \cs{bibname} should be changed.  This is
-% done inside a group so that a false definition is not left
-% around.\footnote{If \cs{@undefined} is ever fixed, this will no
-% longer be needed.  If \eTeX\ was required, the \cs{ifdefined} would be
-% a choice here; however, \eTeX\ is not going to be required just for
-% this.}  A second check is needed, in case the document class does not
-% define any reference section at all (for example, minimal does
-% not).
+% All done for \pkg{chemstyle}. 
 %    \begin{macrocode}
-\begingroup
-  \@ifundefined{chapter}
-    {\@ifundefined{refname}
-       {\PackageInfo{chemstyle}
-          {No bibliography name command found}
-        \cstsetup{notes=false}}
-       {\gdef\cst@refsec{\refname}}}
-    {\gdef\cst@refsec{\bibname}}
-\endgroup
+\cst@ref@load
+%</package> 
+%    \end{macrocode}  
+%
+%\subsection{The \pkg{chemscheme} package}
+%
+%\subsubsection{Making new floats}
+% 
+% The code for making floats is stored in the \pkg{chemscheme} package:
+% in this way there should be no issues with loading things in any 
+% order.
+%    \begin{macrocode}
+%<*chemscheme>
+\ProvidesPackage{chemscheme}
+  [2009/06/06 v2.0 Schemes for chemistry] 
+\RequirePackage{kvoptions,psfrag}
+\SetupKeyvalOptions{
+  family=cst,
+  prefix=cst@
+}
 %    \end{macrocode}
+% 
+%\begin{macro}{\ifcst@floatrow} 
+%\begin{macro}{\ifcst@chemcompounds} 
+% Some simple Boolean options.
+%    \begin{macrocode}
+\DeclareBoolOption[true]{chemcompounds}
+\DeclareComplementaryOption{bpchem}{chemcompounds}
+\DeclareBoolOption[true]{floatrow}
+%    \end{macrocode}
+%\end{macro}
 %\end{macro}
-%\begin{macro}{\c@bibnote}
-% The business-end of the work is only carried out if the \opt{notes}
-% option is set to \opt{true} or \opt{auto}.  The check above means
-% that a reference section is also defined.  First, some checking for
-% the \opt{auto} option occurs; the counter used by \pkg{notes2bib}
-% needs to be defined even if the package is not loaded.
+%
+%\begin{macro}{\cst@opt@bpchem}
+%\begin{macro}{\cst@opt@chemcompounds}
+%\begin{macro}{\cst@opt@ref@error}
+% The \opt{tracking} option has two possible values.
 %    \begin{macrocode}
-\ifcst@autonotes
-  \AtBeginDocument{
-    \@ifpackageloaded{notes2bib}{}
-      {\newcounter{bibnote}}}
-\fi
+\define@key{cst}{tracking}[chemcompounds]{%
+  \edef\KVO@param{#1}%
+  \@onelevel@sanitize\KVO@param
+  \ifx\KVO@param\cst@opt@bpchem
+    \expandafter\cst@chemcompoundsfalse
+  \else
+    \ifx\KVO@param\cst@opt@chemcompounds
+      \expandafter\expandafter\expandafter\cst@chemcompoundstrue
+    \else
+      \expandafter\expandafter\expandafter\cst@opt@ref@error
+    \fi
+  \fi
+}
+\newcommand*\cst@opt@bpchem{bpchem}
+\newcommand*\cst@opt@chemcompounds{chemcompounds}
+\newcommand*\cst@opt@ref@error{%
+  \PackageWarning{chemscheme}{%
+    Value `\KVO@param' is not supported by\MessageBreak
+    option `tracking'%
+  }%
+}
 %    \end{macrocode}
 %\end{macro}
-%\begin{macro}{\cst@refname}
-%\changes{v1.2}{2008/03/07}{New macro}
-%\begin{macro}{\cst@ref@name}
-%\changes{v1.2}{2008/03/07}{New macro}
-%\begin{macro}{\cst@ref@name@}
-%\changes{v1.2}{2008/03/07}{New macro}
-% The internal macros to actually display the reference section name
-% deals with the various options.  The \cs{expandafter}s are for
-% caution here: nothing \emph{should} go wrong with the nested
-% \cs{if} statements.
+%\end{macro}
+%\end{macro}
+%
+%\begin{macro}{\ifcst@memoir}
+%\begin{macro}{\cst@opt@float}
+%\begin{macro}{\cst@opt@floatrow}
+%\begin{macro}{\cst@opt@memoir}
+%\begin{macro}{\cst@opt@floats@error}
+% For \opt{floats}, the number of choices is slightly higher.
 %    \begin{macrocode}
-\newcommand*{\cst@refname}{%
-  \ifcst@notes
-    \ifcst@autonotes
-      \ifnum\the\value{bibnote}>\z@
+\newif\ifcst@memoir
+\define@key{cst}{floats}{%
+  \edef\KVO@param{#1}%
+  \cst@floatrowtrue
+  \cst@memoirfalse
+  \ifx\KVO@param\cst@opt@float
+    \expandafter\cst@floatrowfalse
+  \else
+    \ifx\KVO@param\cst@opt@floatrow\else
+      \ifx\KVO@param\cst@opt@memoir
         \expandafter\expandafter\expandafter\expandafter
-          \expandafter\expandafter\expandafter\cst@ref@name
-      \else
+        \expandafter\expandafter\expandafter\cst@memoirtrue
+      \else        
         \expandafter\expandafter\expandafter\expandafter
-          \expandafter\expandafter\expandafter\cst@ref@name@
+        \expandafter\expandafter\expandafter\cst@opt@floats@error
       \fi
-    \else
-      \expandafter\expandafter\expandafter\cst@ref@name
     \fi
+  \fi
+}
+\newcommand*\cst@opt@float{float}
+\newcommand*\cst@opt@floatrow{floatrow}
+\newcommand*\cst@opt@memoir{memoir}
+\newcommand*\cst@opt@floats@error{%
+  \PackageWarning{chemscheme}{%
+    Value `\KVO@param' is not supported by\MessageBreak
+    option `floats'%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%
+%\begin{environment}{scheme}
+%\begin{macro}{\cst@float@pkg}
+%\begin{macro}{\cst@float@execute}
+%\begin{macro}{\cst@float@load}
+%\begin{macro}{\cst@float@load@float}
+%\begin{macro}{\cst@float@load@floatrow}
+% With options processed, the appropriate packages can be loaded as
+% necessary. The are some checks so that only one package is tried. 
+%    \begin{macrocode}
+\newcommand*\cst@float@pkg{}
+\newcommand*\cst@float@execute{}
+\newcommand*\cst@float@load{%
+  \IfFileExists{floatrow.sty}{}{%
+    \ifcst@floatrow
+      \expandafter\cst@floatrowfalse
+    \fi
+  }%
+  \ifcst@floatrow
+    \expandafter\cst@float@load@floatrow
   \else
-    \expandafter\cst@ref@name@%
-  \fi}
-\newcommand*{\cst@ref@name}[3]{%
-  \ifcst@notesbefore
-    #3\space#2\space#1%
-  \else
-    #1\space#2\space#3%
-  \fi}
-\newcommand*{\cst@ref@name@}[3]{#1}
+    \expandafter\cst@float@load@float
+  \fi
+}
+\newcommand*\cst@float@load@float{%
+  \RequirePackage{float}
+  \def\cst@float@pkg{float}
+  \def\cst@float@execute{\AtBeginDocument}
+}
+\newcommand*\cst@float@load@floatrow{%
+  \RequirePackage{floatrow}
+  \def\cst@float@pkg{floatrow}
+  \def\cst@float@execute{\@firstofone}
+}
 %    \end{macrocode}
 %\end{macro}
 %\end{macro}
 %\end{macro}
-%\begin{macro}{\cst@setrefname}
-%\changes{v1.2}{2008/03/07}{New macro}
-% Setting up the section name is a tricky affair.  If no section is
-% defined, then the whole process is skipped.  Otherwise, the first
-% check made s if the default language matches the definition given.
-% If so, the heading is changed now.
+%\end{macro}
+%\end{macro}
+%
+%\begin{macro}{\cst@float@chapter}
+%\begin{macro}{\cst@float@chapter@hook}
+% A method to add to the \cs{@chapter} macro is needed.  This is
+% not compatible with \cs{g@addto@macro} directly, so a more
+% complex method is used by providing a suitable hook.
 %    \begin{macrocode}
-\@ifundefined{cst@refsec}
-  {\let\cst@setrefname\@gobblefour}
-  {\newcommand*{\cst@setrefname}[4]{
-     \edef\cst@tempa{#1}%
-     \ifx\cst@tempa\cst@language
-       \expandafter\renewcommand\expandafter*\expandafter{%
-         \cst@refsec}
-         {\cst@refname{#2}{#3}{#4}}
-     \fi
+\newcommand*\cst@float@chapter@hook{}
+\newcommand*\cst@float@chapter{}
+\ifx\@chapter\@undefined\else
+  \let\cst@float@chapter\@chapter
+  \def\@chapter{%
+    \cst@float@chapter@hook
+    \cst@float@chapter
+  }
+\fi
 %    \end{macrocode}
-%\begin{macro}{cst@tempa}
-% At the beginning of the document, a check needs to be made for
-% \pkg{babel} and \pkg{biblatex}.  For the later, a low-level hack is
-% made to attach to the mechanism.  For \pkg{babel} the appropriate
-% commands are added to the \cs{captions\ldots} macro.
+%\end{macro}
+%\end{macro}
+%
+%\begin{macro}{\cst@float@chapter@fix}
+% So that floats inside chapters work correctly.
 %    \begin{macrocode}
-     \AtBeginDocument{
-       \@ifpackageloaded{biblatex}
-         {\def\cst@tempa{\csgappto{bib@strings@#1}}
-          \expandafter\cst@tempa\expandafter{\expandafter
-            \renewcommand\expandafter*\expandafter{%
-              \cst@refsec}{%
-                \cst@refname{#2}{#3}{#4}}}}
-         {\@ifpackageloaded{babel}
-           {\def\cst@tempa{\expandafter\addto\expandafter{%
-              \csname captions#1\endcsname}}
-            \expandafter\cst@tempa\expandafter
-              {\expandafter\renewcommand\expandafter*%
-                \expandafter{\cst@refsec}{%
-                  \cst@refname{#2}{#3}{#4}}}
+\newcommand*\cst@float@chapter@fix{%
+  \g@addto@macro{\cst@float@chapter@hook}{%
+    \addtocontents{los}{\protect\addvspace{10\p@}}%
+  }%
+  \begingroup\expandafter\expandafter\expandafter\endgroup
+  \expandafter\ifx\csname KOMAScriptVersion\endcsname\relax
+    \@namedef{thescheme}{%
+      \ifnum\c@chapter>\z@\relax
+        \thechapter.%
+      \fi 
+      \arabic{scheme}%
+    }%
+  \fi
+}
 %    \end{macrocode}
 %\end{macro}
-% To make sure the changes are applied \emph{now}, the current
-% language is re-selected.
+%
+%\begin{macro}{\cst@float@make@float}
+% When using \pkg{float}, definition depends on the existence of
+% chapters. The name and ``list of'' macros are then created separately.
 %    \begin{macrocode}
-            \expandafter\selectlanguage\expandafter{%
-              \languagename}}
-           {}}}}}
+\newcommand*\cst@float@make@float{%
+  \begingroup\expandafter\expandafter\expandafter\endgroup
+  \expandafter\ifx\csname chapter\endcsname\relax
+    \newfloat{scheme}{tbp}{los}%
+  \else
+    \newfloat{scheme}{tbp}{los}[chapter]%
+    \expandafter\cst@float@chapter@fix
+  \fi
+  \floatname{scheme}{\schemename}%
+  \newcommand*\listofschemes{%
+    \listof{scheme}{\listschemename}%
+  }%
+}
 %    \end{macrocode}
 %\end{macro}
-% Default names are loaded for a range of languages.  Most
-% journals stick to the same words, with only the order changing.
-%\changes{v1.1c}{2007/09/23}{Added \texttt{german} alias for
-%  \texttt{ngerman}}
-%\changes{v1.1c}{2007/09/23}{Added \texttt{frenchb} alias for
-%  \texttt{french}}
+%\begin{macro}{\cst@float@make@floatrow}
+% For \pkg{floatrow}, the interface to everything is rather simple.
 %    \begin{macrocode}
-\cst@setrefname{english}{References}{and}{Notes}
-\cst@setrefname{UKenglish}{References}{and}{Notes}
-\cst@setrefname{ngerman}{Literatur}{und}{Notizen}
-\cst@setrefname{german}{Literatur}{und}{Notizen}
-\cst@setrefname{french}{R\'ef\'erences}{et}{Notes}
-\cst@setrefname{frenchb}{R\'ef\'erences}{et}{Notes}
+\newcommand*\cst@float@make@floatrow{%
+  \begingroup\expandafter\expandafter\expandafter\endgroup
+  \expandafter\ifx\csname chapter\endcsname\relax
+    \DeclareNewFloatType{scheme}{%
+      fileext   = los,
+      placement = tbp,
+      name      = Scheme
+    }%
+  \else
+    \DeclareNewFloatType{scheme}{%
+      fileext   = los,
+      placement = tbp,
+      name      = Scheme, 
+      within    = chapter
+    }%
+    \cst@float@chapter@fix
+  \fi
+  \newcommand*\listofschemes{%
+    \listof{scheme}{\listschemename}%
+  }%
+}
 %    \end{macrocode}
+%\end{macro}
 %
-% \iffalse
-%</package>
-% \fi
-%
-% \section{Configuration files}
+%\begin{macro}{\cst@float@make@memoir}
+% \pkg{memoir} has a lot of things to set up for a float. This list is
+% essentially the same as the \pkg{memoir} kernel uses.
+%    \begin{macrocode}
+\newcommand*\cst@float@make@memoir{%
+  \newfloat[chapter]{scheme}{los}{\schemename}%
+  \newlistof{listofschemes}{los}{\listschemename}%
+  \addtodef{\@smemfront}{}{\counterwithout{scheme}{chapter}}%
+  \addtodef{\@smemmain}{}{%
+    \ifartopt\else
+      \counterwithin{scheme}{chapter}%
+    \fi
+  }%
+  \addtodef{\backmatter}{}{%
+    \ifartopt\else
+      \counterwithout{scheme}{chapter}%
+      \setcounter{scheme}{0}%
+    \fi
+  }%
+  \newlistentry[chapter]{scheme}{los}{0}%
+  \cftsetindents{scheme}{0em}{2.3em}%
+  \addtodef{\insertchapterspace}{}{%
+    \addtocontents{los}{\protect\addvspace{10pt}}%
+  }%
+  \ifartopt
+    \counterwithout{scheme}{chapter}%
+  \fi
+}
+%    \end{macrocode}
+%\end{macro}
 %
-% 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.
+% Options are set.
+%    \begin{macrocode}
+\ProcessKeyvalOptions{cst}
+%    \end{macrocode}
+%    
+% Everything is set up, and so the support can finally be loaded.
+%    \begin{macrocode}
+\@ifpackageloaded{floatrow}{%
+  \def\cst@float@pkg{floatrow}
+  \def\cst@float@execute{\@firstofone}
+}{%
+  \@ifpackageloaded{float}{%
+    \def\cst@float@pkg{float}
+    \def\cst@float@execute{\AtBeginDocument}
+  }{%
+    \@ifclassloaded{memoir}{%
+      \def\cst@float@pkg{memoir}
+      \def\cst@float@execute{\AtBeginDocument}
+    }{%
+      \@ifpackageloaded{chemstyle}{}{%
+        \cst@float@load
+      }%
+    }%
+  }%
+}
+\ifx\cst@float@pkg\cst@opt@memoir\else
+  \let\newfloat\@undefined
+\fi
+\@ifpackageloaded{chemstyle}{}{%
+  \cst@float@execute{\@nameuse{cst@float@make@\cst@float@pkg}}
+}
+%    \end{macrocode}
+%\end{environment}
+%    
+%\subsubsection{Supporting \pkg{babel} for schemes}
 %
-% \iffalse
-%<*rsc>
-% \fi
+%\begin{macro}{\schemename}
+%\begin{macro}{\listschemename}
+% To start, the names in English.
+%    \begin{macrocode}
+\@ifpackageloaded{floatrow}{}{%
+  \newcommand*\schemename{Scheme}
+}
+\newcommand*\listschemename{List of Schemes}
+%    \end{macrocode}
+%\end{macro}
+%\end{macro}
 %
-% \subsection{RSC style}
-%\changes{v1.0b}{2007/09/04}{Sorted a problem with \texttt{babel}
-% and figure name format}
-%\changes{v1.0b}{2007/09/04}{Fixed formatting of alkyls}
-%\changes{v1.1}{2007/09/17}{Fixed (another) error in alkyl formatting}
+% Some simple label changes.
 %    \begin{macrocode}
-\ProvidesFile{rsc.jdf}
-  [\cst@ver RSC journal style]
 \AtBeginDocument{%
-  \renewcommand{\figurename}{Fig.}}
-\captionsetup{labelsep=quad,labelfont=bf}
-\setkeys[cst]{opt}{
-  radprefix=true,
-  rademph=true,
-  radsuper=false,
-  radhyphen=true,
-  abbremph=true,
-  abbrcomma=false}
+  \@ifpackageloaded{babel}{%
+    \addto{\captionsfrench}{%
+      \def\listschemename{Table des sch\`emes}%
+      \def\schemename{{\scshape Sch\`eme}}%
+    }%
+    \addto{\captionsgerman}{%
+      \def\listschemename{Schemenverzeichnis}%
+      \def\schemename{Schema}%
+    }%
+    \expandafter\selectlanguage\expandafter{\languagename}%
+  }{}%
+}
 %    \end{macrocode}
-% \iffalse
-%</rsc>
-%<*angew>
-% \fi
+%    
+%\subsubsection{Positioning float contents}
+%
+%\begin{macro}{\floatcontentscentre}
+%\begin{macro}{\floatcontentscenter}
+%\begin{macro}{\floatcontentsleft}
+%\begin{macro}{\floatcontentsright}
+% When using \pkg{floatrow}, centring all floats is easy.  This is
+% not the case for other methods, and so some macros are provided.
+% The definitions depend on whether \pkg{floatrow} is in use.
+%    \begin{macrocode}
+\@ifpackageloaded{floatrow}{%
+  \newcommand*\floatcontentscentre{%
+    \floatsetup{objectset=centering}%
+  }
+  \newcommand*\floatcontentscenter{%
+    \floatsetup{objectset=centering}%
+  }
+  \newcommand*\floatcontentsright{%
+    \floatsetup{objectset=raggedleft}%
+  }
+  \newcommand*\floatcontentsleft{%
+    \floatsetup{objectset=raggedright}%
+  }
+}{%
+%    \end{macrocode}
+%\begin{macro}{\cst@floatboxreset}
+%\begin{macro}{\@floatboxreset}
+%\begin{macro}{\cst@everyfloat}
+% When \pkg{floatrow} is not in use, then a low-level hack of
+% \cs{@floatboxtreset} is used.
+%    \begin{macrocode}
+  \newcommand*\cst@floatboxreset{}
+  \newcommand*\cst@everyfloat{}
+  \let\cst@floatboxreset\@floatboxreset
+  \def\@floatboxreset{%
+    \cst@everyfloat
+    \cst@floatboxreset
+  }
+  \newcommand*{\floatcontentscentre}{%
+    \let\cst@everyfloat\centering
+  }
+  \newcommand*{\floatcontentscenter}{%
+    \let\cst@everyfloat\centering
+  }
+  \newcommand*{\floatcontentsleft}{%
+    \let\cst@everyfloat\relax
+  }
+  \newcommand*{\floatcontentsright}{%
+    \let\cst@everyfloat\raggedleft
+  }
+}
+\floatcontentsleft
+%    \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%\end{macro}
+%
+%\subsubsection{Reference numbers in graphics}
 %
-%\subsection{\emph{Angew.~Chem.}~style}
-%\changes{v1.0a}{2007/08/23}{Fixed incorrect Latin formatting for
-%  \texttt{angew} option}
+%\begin{macro}{\schemerefmarker}
+%\begin{macro}{\schemerefformat}
+% The two macros \cs{schemerefmarker} and \cs{schemerefformat}
+% are used to allow customisation of the behaviour of the package.
+% Here defaults are provided.
 %    \begin{macrocode}
-\ProvidesFile{angew.def}
-  [\cst@ver Angew. Chem. journal style]
-\captionsetup{labelsep=period,labelfont={bf,it},font=sf,
-  singlelinecheck=off}
-\captionsetup[table]{labelsep=colon}
-\setkeys[cst]{opt}{
-  radprefix=true,
-  rademph=true,
-  radsuper=false,
-  radhyphen=false,
-  abbremph=false,
-  abbrcomma=false}
+\newcommand*\schemerefmarker{TMP}
+\newcommand*\schemerefformat{\textsf}
 %    \end{macrocode}
-% \iffalse
-%</angew>
-%<*jomc>
-% \fi
+%\end{macro}
+%\end{macro}
 %
-%\subsection{\emph{J.~Organomet.~Chem.}~style}
-%\changes{v1.1g}{2007/10/19}{Added \texttt{jomc} style}
+%\begin{macro}{\cst@ref@count}
+% The automatic numbering system needs a counter.
 %    \begin{macrocode}
-\ProvidesFile{jomc.def}
-  [\cst@ver J. Organomet. Chem. journal style]
-\captionsetup{labelsep=period}
-\captionsetup[table]{labelsep=newline,singlelinecheck=off}
-\AtBeginDocument{%
-  \renewcommand{\figurename}{Fig.}}
-\setkeys[cst]{opt}{
-  radprefix=true,
-  rademph=true,
-  radsuper=true,
-  radhyphen=false,
-  abbremph=false,
-  abbrcomma=false,
-  notesbefore=true}
+\newcount\cst@ref@count
 %    \end{macrocode}
-% \iffalse
-%</jomc>
-%<*tetlett>
-% \fi
+%\end{macro}
 %
-%\subsection{\emph{Tetrahedron Lett.}~style}
-%\changes{v1.1h}{2007/10/31}{Added \texttt{tetlett} style}
+%\begin{macro}{\cst@ref@label}
+%\begin{macro}{\cst@ref@load}
+% The loading of support packages is set up as a macro, so that it can
+% be delayed when \pkg{chemstyle} is in use.
 %    \begin{macrocode}
-\ProvidesFile{tetlett.def}
-  [\cst@ver Tetrahedron Lett. journal style]
-\captionsetup{labelsep=period,singlelinecheck=off,labelfont=bf}
-\setkeys[cst]{opt}{
-  radprefix=true,
-  rademph=true,
-  radsuper=false,
-  radhyphen=true,
-  abbremph=false,
-  abbrcomma=true,
-  notesbefore=true}
+\newcommand*\cst@ref@label{}
+\newcommand*\cst@ref@load{%
+  \ifcst@chemcompounds
+    \RequirePackage{chemcompounds}
+    \let\cst@ref@label\compound
+  \else
+    \RequirePackage{bpchem}
+    \let\cst@ref@label\CNlabel
+  \fi
+}
+\@ifpackageloaded{chemstyle}{}{%
+  \cst@ref@load
+}
 %    \end{macrocode}
-% \iffalse
-%</tetlett>
-%<*jacs>
-% \fi
+%\end{macro}
+%\end{macro}
 %
-%\subsection{\emph{J.~Am.~Chem.~Soc.}~style}
+%\begin{macro}{\schemeref}
+%\begin{macro}{\chemschemeref}
+% The main function is quite simple: just set up the substitution then
+% hand over to \pkg{psfrag}. There is also some back-compatibility code
+% for early versions of the package.
 %    \begin{macrocode}
-\ProvidesFile{jacs.jdf}
-  [\cst@ver J. Am. Chem. Soc. journal style]
-\DeclareCaptionLabelSeparator{perquad}{.\quad}
-\captionsetup{labelfont={bf,it,sf},textfont=sf,
-  labelsep=perquad}
-\captionsetup[figure]{textfont=rm}
-\captionsetup{singlelinecheck=off}
-\setkeys[cst]{opt}{
-  radprefix=true,
-  rademph=true,
-  radsuper=true,
-  radhyphen=false,
-  abbremph=false,
-  abbrcomma=true,
-  notesbefore=true}
-\floatstyle{plaintop}
-\restylefloat{scheme}
-\floatstyle{plain}
-\cst@notesbeforefalse
+\DeclareRobustCommand*\schemeref[2]
+  [\schemerefmarker\the\cst@ref@count]{%
+  \advance\cst@ref@count\@ne\relax
+  \psfrag{#1}[b][b]{%
+    \schemerefformat{\cst@ref@label{#2}}%
+  }%
+}
+\DeclareRobustCommand*\chemschemeref[1]{%
+  \schemeref[#1]%
+}
 %    \end{macrocode}
-% \iffalse
-%</jacs>
-%<*ic>
-% \fi
+%\end{macro}
+%\end{macro}
 %
-%\subsection{\emph{Inorg.~Chem.}~style}
-% Almost exactly the same as for \emph{J.~Am.~Chem.~Soc.}, so most of
-% the work is left to \file{jacs.jdf}.
+%\begin{macro}{\schemerefsub}
+%\begin{macro}{\chemschemerefsub}
+%\begin{macro}{\cst@ref@check@sub}
+% Sub-referencing is only available with \pkg{bpchem}: other than that,
+% very similar to above.
 %    \begin{macrocode}
-\ProvidesFile{ic.jdf}
-  [\cst@ver Inorg. Chem. journal style]
-\input {jacs.jdf}
-\captionsetup{textfont=rm}
+\DeclareRobustCommand*\schemerefsub[3]
+  [\schemerefmarker\the\cst@ref@count]{%
+  \advance\cst@ref@count\@ne\relax
+  \psfrag{#1}[b][b]{%
+    \schemerefformat{\CNlabelsub{#2}{#3}}%
+  }%
+}
+\DeclareRobustCommand*\chemschemerefsub[1]{%
+  \schemerefsub[#1]%
+}
+\newcommand*\cst@ref@check@sub{%
+  \@ifpackageloaded{bpchem}{}{%
+    \def\schemerefsub[3][]{%
+      \PackageWarning{chemscheme}{%
+        \string\schemerefsub\space not available unless bpchem
+        \MessageBreak package is loaded
+      }%
+    }%
+  }%
+}
+\AtBeginDocument{\cst@ref@check@sub}
 %    \end{macrocode}
-%\iffalse
-%</ic>
-%<*jpc>
-%\fi
+%\end{macro}
+%\end{macro}
+%\end{macro}
 %
-%\subsection{\emph{J.~Phys.~Chem.}~style}
-%\changes{v1.0a}{2007/08/23}{Added \emph{J.~Phys.~Chem.}~style}
+% That ends the \pkg{chemscheme} package.
 %    \begin{macrocode}
-\ProvidesFile{jpc.jdf}
-  [\cst@ver J. Phys. Chem. journal style]
-\DeclareCaptionFormat{labelcaps}{\MakeUppercase{#1}#2#3}
-\captionsetup{font=bf,labelsep=colon,format=labelcaps}
-\captionsetup[figure]{format=plain,textfont=md,labelsep=period}
-\captionsetup{singlelinecheck=off}
-\setkeys[cst]{opt}{
-  radprefix=true,
-  rademph=true,
-  radsuper=false,
-  radhyphen=false,
-  abbremph=false,
-  abbrcomma=true,
-  notesbefore=true}
-\floatstyle{plaintop}
-\restylefloat{scheme}
-\floatstyle{plain}
-\cst@notesbeforefalse
+%</chemscheme>
 %    \end{macrocode}
-%\iffalse
-%</jpc>
-%<*orglett>
-% \fi
+%    
+%\subsection{Journal definition files}
+%
+% The journal files are all rather similar. They set a series of keys
+% and perhaps make other changes.
+% 
+%\subsubsection{\emph{Angew.\ Chem.}\ style}
 %
-%\subsection{\emph{Org.~Lett.}~style}
-%\changes{v1.0a}{2007/08/23}{Added \emph{Org.~Lett.}~style}
 %    \begin{macrocode}
-\ProvidesFile{orglett.jdf}
-  [\cst@ver Org. Lett. journal style]
-\RequirePackage{xcolor}
+%<*angew>    
+\ProvidesFile{angew.chemstyle.cfg}
+  [2009/06/06 v2.0 Angew. Chem. journal style]
+\setkeys{cst}{
+  abbremph  = false,
+  radhyphen = false
+}
+\captionsetup{
+  font            = sf,
+  labelfont       = {bf,it},
+  labelsep        = period,
+  singlelinecheck = off
+}
+\captionsetup[table]{
+  labelsep = colon
+}
+%</angew>
 %    \end{macrocode}
-% Currently, this style only works with \pkg{float}.
+%    
+%\subsubsection{\emph{Inorg.\ Chem.}\ style}
+%
 %    \begin{macrocode}
-\@ifpackageloaded{floatrow}
-  {\PackageError{chemstyle}
-    {Org. Lett. style only works with float}
-    {Load chemstyle with the floatrow=false option
-      to\MessageBreak use the orglett style}}
-  {}
+%<*ic>    
+\ProvidesFile{ic.chemstyle.cfg}
+  [2009/06/06 v2.0 Inorg. Chem. journal style]
+\DeclareCaptionLabelSeparator{perquad}{.\quad}
+\captionsetup{
+  labelfont       = {bf,it,sf},
+  labelsep        = perquad,
+  singlelinecheck = off
+  textfont        = rm
+}
+\captionsetup[figure]{
+  textfont = rm
+}
+\setkeys{cst}{
+  abbrcomma   = true,
+  abbremph    = false,
+  notesbefore = false,
+  radhyphen   = false,
+  radsuper    = true
+}
+\@ifpackageloaded{floatrow}{%
+  \floatsetup[scheme]{style=plaintop}
+}{%
+  \floatstyle{plaintype}
+  \restylefloat{scheme}
+  \floatstyle{plain}
+}
+%</ic>
 %    \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.
+%    
+%\subsubsection{\emph{J.~Am.\ Chem.\ Soc.}\ style}
+%
 %    \begin{macrocode}
-\newcommand*{\OrgLettColour}{purple}
+%<*jacs>    
+\ProvidesFile{jacs.chemstyle.cfg}
+  [2009/06/06 v2.0 J. Am. Chem. Soc. journal style]
+\DeclareCaptionLabelSeparator{perquad}{.\quad}
+\captionsetup{
+  labelfont       = {bf,it,sf},
+  labelsep        = perquad,
+  singlelinecheck = off
+  textfont        = sf
+}
+\captionsetup[figure]{
+  textfont = rm
+}
+\setkeys{cst}{
+  abbrcomma   = true,
+  abbremph    = false,
+  notesbefore = false,
+  radhyphen   = false,
+  radsuper    = true
+}
+\@ifpackageloaded{floatrow}{%
+  \floatsetup[scheme]{style=plaintop}
+}{%
+  \floatstyle{plaintype}
+  \restylefloat{scheme}
+  \floatstyle{plain}
+}
+%</jacs>
 %    \end{macrocode}
-%\end{macro}
-%\begin{macro}{\fs@orglett}
-% 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 \texttt{ruled} style from the \pkg{float} package.
+%    
+%\subsubsection{\emph{J.~Organomet.\ Chem.}\ style}
+%
 %    \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}%
+%<*jomc>    
+\ProvidesFile{jomc.chemstyle.cfg}
+  [2009/06/06 v2.0 J. Organomet. Chem. journal style]
+\setkeys{cst}{
+  abbremph  = false,
+  radhyphen = true,
+  radsuper  = true,
+}
+\captionsetup{
+  labelsep        = period,
+}
+\captionsetup[table]{
+  labelsep        = newline,
+  singlelinecheck = off
+}
+\AtBeginDocument{%
+  \def\figurename{Fig.}%
+}
+%</jomc>
+%    \end{macrocode}
+%    
+%\subsubsection{\emph{J.~Phys.\ Chem.}\ style}
+%
+%    \begin{macrocode}
+%<*jpc>    
+\ProvidesFile{jpc.chemstyle.cfg}
+  [2009/06/06 v2.0 J. Phys. Chem. journal style]
+\DeclareCaptionFormat{labelcaps}{\MakeUppercase{#1}#2#3}
+\captionsetup{
+  font            = bf,
+  format          = labelcaps,
+  labelsep        = colon,
+  singlelinecheck = off
+}
+\captionsetup[figure]{
+  format   = plain,
+  labelsep = period,
+  textfont = md
+}
+\setkeys{cst}{
+  abbrcomma   = true,
+  abbremph    = false,
+  notesbefore = false,
+  radhyphen   = false
+}
+\@ifpackageloaded{floatrow}{%
+  \floatsetup[scheme]{style=plaintop}
+}{%
+  \floatstyle{plaintype}
+  \restylefloat{scheme}
+  \floatstyle{plain}
+}
+%</jpc>
 %    \end{macrocode}
-% This is the same \cs{@fs@mid} as is used in the \pkg{float} package
-% for \texttt{plaintop} floats.
+%  
+%\subsection{\emph{Org.\ Lett.}\ style}  
+%
 %    \begin{macrocode}
-  \def\@fs@mid{\vspace\belowcaptionskip\relax}%
-  \def\@fs@post{\begingroup\color{\OrgLettColour}\kern2pt
-    \hrule height1.5pt depth0pt\endgroup}%
-  \let\@fs@iftopcapt\iftrue}
+%<*orglett>    
+\ProvidesFile{orglett.chemstyle.cfg}
+  [2009/06/06 v2.0 Org. Lett. journal style]
+\DeclareCaptionLabelSeparator{perquad}{.\quad}
+\captionsetup{
+  labelfont       = bf,
+  labelsep        = perquad
+}
+\setkeys{cst}{
+  abbrcomma   = true,
+  abbremph    = false,
+  notesbefore = false,
+  radhyphen   = false,
+  radsuper    = true
+}
 %    \end{macrocode}
-%\end{macro}
+% The \emph{Org.\ Lett.}\ style is a it more complicated than all of
+% the others as the float formatting is much more complicated. First,
+% colour support is needed.
+%    \begin{macrocode}
+\RequirePackage{xcolor}
+%    \end{macrocode}
+%\begin{macro}{\fs@orglett}
 %\begin{macro}{\fs@orglettfig}
-% Figures need to be slightly different, so an almost identical
-% command is needed.
+% For \pkg{float}, some new styles based on the supplied \texttt{ruled}
+% one.
 %    \begin{macrocode}
-\newcommand*{\fs@orglettfig}{%
+\newcommand*\fs@orglett{%
+  \def\@fs@cfont{\bfseries}%
+  \let\@fs@capt\floatc@ruled
+  \def\@fs@pre{%
+    \begingroup
+      \color{purple}%                     
+      \hrule height 12pt depth 0pt\relax 
+      \kern 2pt\relax
+    \endgroup
+  }%
+  \def\@fs@mid{%
+    \vspace\belowcaptionskip\relax      
+  }%
+  \def\@fs@post{%
+    \begingroup
+      \color{purple}%
+      \kern 2pt\relax                     
+      \hrule height 1.5pt depth 0pt\relax 
+    \endgroup
+  }%
+  \let\@fs@iftopcapt\iftrue
+}
+\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}
+  \def\@fs@pre{%
+    \begingroup
+      \color{purple}%
+      \hrule height 12pt depth 0pt\relax
+      \kern 2pt\relax
+    \endgroup
+  }%
+  \def\@fs@mid{%
+    \vspace\abovecaptionskip\relax
+  }%
+  \def\@fs@post{%
+    \begingroup
+      \color{purple}%
+      \kern 2pt\relax
+      \hrule height1.5pt depth 0pt\relax
+  \endgroup
+  }%
+  \let\@fs@iftopcapt\iffalse
+}
 %    \end{macrocode}
-%\end{macro}
-% The new style is now applied.  Users can change back to normal
-% floats by changing back to the \texttt{plain} style.
+%\end{macro}  
+%\end{macro} 
+%
 %    \begin{macrocode}
-\floatstyle{orglettfig}
-\restylefloat{figure}
-\floatstyle{orglett}
-\restylefloat{scheme}
-\restylefloat{table}
+\DeclareFloatVCode{orglettthickrule}{%
+  \par
+  \begingroup
+    \color{purple}%
+    \hrule height 12pt depth 0pt\relax
+    \vskip 2pt\relax
+  \endgroup
+  \par
+}
+\DeclareFloatVCode{orglettlowrule}{%
+  \par
+  \begingroup
+    \vskip 2pt\relax
+    \hrule height 1.5pt depth 0pt\relax
+  \endgroup
+  \par
+}
 %    \end{macrocode}
-% The more usual style commands now occur.
+% With that done, things can be applied. 
 %    \begin{macrocode}
-\DeclareCaptionLabelSeparator{perquad}{.\quad}
-\captionsetup{labelfont=bf,labelsep=perquad}
-\setkeys[cst]{opt}{
-  radprefix=true,
-  rademph=true,
-  radsuper=true,
-  radhyphen=false,
-  abbremph=false,
-  abbrcomma=true,
-  notesbefore=true}
-\cst@notesbeforefalse
-%    \end{macrocode}
-% \iffalse
+\@ifpackageloaded{floatrow}{%
+  \floatsetup{
+    capposition  = top,
+    heightadjust = all,
+    postcode     = orglettlowrule,
+    precode      = orglettthickrule,
+    midcode      = rule,
+  }
+  \floatsetup[figure]{
+    capposition  = bottom,
+    heightadjust = all,
+    postcode     = orglettlowrule,
+    precode      = orglettthickrule,
+    midcode      = rule,
+  }
+}{%
+  \floatstyle{orglettfig}
+  \restylefloat{figure}
+  \floatstyle{orglett}
+  \restylefloat{scheme}
+  \restylefloat{table}
+}
 %</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 very little changes compared to the \LaTeX\ kernel.
-% This requires undoing the defaults provided above.  For commands
-% where a default is needed (\eg the \cs{latin} command) the style
-% of the RSC is followed.  As the \pkg{float} package has been loaded,
-% notice that captions will be placed below floats even if the
-% \cs{caption} command appears above the contents of the floating
-% environment.
+%    \end{macrocode}
+%
+%\subsubsection{Royal Society of Chemistry style}
+%
 %    \begin{macrocode}
-\ProvidesFile{none.jdf}
-  [\cst@ver Empty journal style]
-\floatstyle{plain}
-\restylefloat{table}
-\labelformat{figure}{#1}
-\labelformat{table}{#1}
-\floatplacement{table}{tbp}
-\floatplacement{figure}{tbp}
-\AtBeginDocument{
-  \floatplacement{scheme}{tbp}
-  \labelformat{scheme}{#1}}
+%<*rsc>    
+\ProvidesFile{rsc.chemstyle.cfg}
+  [2009/06/06 v2.0 RSC journal style]
+\captionsetup{
+  labelsep  = quad,
+  labelfont = bf
+}
+\AtBeginDocument{%
+  \def\figurename{Fig.}%
+}
+%</rsc>
 %    \end{macrocode}
-% \iffalse
-%</none>
-% \fi
-% \PrintChanges
-% \PrintIndex
-% \Finale
+%    
+%\subsubsection{\emph{Tetrahedron Lett.}\ style}
+%
+%    \begin{macrocode}
+%<*tetlett>    
+\ProvidesFile{tetlett.chemstyle.cfg}
+  [2009/06/06 v2.0 Tetrahedron Lett. journal style]
+\captionsetup{
+  labelsep        = period,
+  labelfont       = bf,
+  singlelinecheck = off
+}
+\setkeys{cst}{
+  abbrcomma = true,
+  abbremph  = false,
+}
+%</tetlett>
+%    \end{macrocode}
+% 
+%\Finale
+%
 %\iffalse
-%<*jawltxdoc>
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{jawltxdoc}
-\usepackage[T1]{fontenc}
-\usepackage{lmodern}
-\usepackage[final]{listings,graphicx,microtype}
-\usepackage[scaled=0.95]{helvet}
-\usepackage[version=3]{mhchem}
-\usepackage[osf]{mathpazo}
-\usepackage{booktabs,array,url,courier,xspace,varioref}
-\usepackage{upgreek,ifpdf,float,caption,longtable,babel}
-\begingroup
-  \@ifundefined{eTeXversion}
-    {\aftergroup\@gobble}
-    {\aftergroup\@firstofone}
-\endgroup
-{\usepackage{etoolbox}}
-\floatstyle{plaintop}
-\restylefloat{table}
-\labelformat{figure}{\figurename~#1}
-\labelformat{table}{\tablename~#1}
-\ifpdf
-  \usepackage{embedfile}
-  \embedfile[%
-    stringmethod=escape,%
-    mimetype=plain/text,%
-    desc={LaTeX docstrip source archive for package `\jobname'}%
-    ]{\jobname.dtx}
-\fi
-\IfFileExists{\jobname.sty}
-  {\usepackage{\jobname}}{}
-\usepackage[numbered]{hypdoc}
-\setcounter{IndexColumns}{2}
-\newlength\LaTeXwidth
-\newlength\LaTeXoutdent
-\newlength\LaTeXgap
-\setlength\LaTeXgap{1em}
-\setlength\LaTeXoutdent{-0.15\textwidth}
-\newbox\lst@samplebox
-\edef\LaTeXexamplefile{\jobname.tmp}
-\lst@RequireAspects{writefile}
-\lstnewenvironment{LaTeXexample}[1][example]{%
-  \global\let\lst@intname\@empty
-  \ifcsname LaTeXcode#1\endcsname
-    \expandafter\let\expandafter\LaTeXcode
-      \csname LaTeXcode#1\endcsname
-    \expandafter\let\expandafter\LaTeXcodeend
-      \csname LaTeXcode#1end\endcsname
-  \else
-    \PackageError{jawltxdoc}
-      {Undefined example type `#1'}
-      \@ehd
-    \let\LaTeXcode\relax
-    \let\LaTeXcodeend\relax
-  \fi
-  \LaTeXcode}
-  {\lst@EndWriteFile
-   \LaTeXcodeend}
-\newcommand*{\LaTeXcodeexample}{%
-  \setbox\lst@samplebox=\hbox\bgroup
-  \LaTeXcodefloat}
-\let\LaTeXcoderesultonly\LaTeXcodeexample
-\newcommand*{\LaTeXcodeexampleend}{%
-  \egroup
-  \setlength\LaTeXwidth{\wd\lst@samplebox}%
-  \begin{list}{}{%
-    \setlength\itemindent{0pt}
-    \setlength\leftmargin\LaTeXoutdent
-    \setlength\rightmargin{0pt}}%
-    \item
-      \setlength\LaTeXoutdent{-0.15\textwidth}
-      \begin{minipage}[c]{%
-        \textwidth-\LaTeXwidth-\LaTeXoutdent-\LaTeXgap}
-        \LaTeXcodefloatend
-      \end{minipage}%
-      \hfill
-      \begin{minipage}[c]{\LaTeXwidth}%
-        \hbox to\linewidth{\box\lst@samplebox\hss}%
-      \end{minipage}%
-  \end{list}}
-\newcommand*{\LaTeXcodefloat}{%
-  \setkeys{lst}{tabsize=4,gobble=3,breakindent=0pt,
-    basicstyle=\small\ttfamily,basewidth=0.51em,
-    keywordstyle=\color{blue}}%
-  \lst@BeginAlsoWriteFile{\LaTeXexamplefile}}
-\let\LaTeXcodenoexample\LaTeXcodefloat
-\let\LaTeXcodenoexampleend\@empty
-\newcommand*{\LaTeXcodefloatend}{%
-  \MakePercentComment\catcode`\^^M=10\relax
-  \small
-  {\setkeys{lst}{SelectCharTable=\lst@ReplaceInput{\^\^I}%
-    {\lst@ProcessTabulator}}%
-    \leavevmode \input{\LaTeXexamplefile}}%
-  \MakePercentIgnore}
-\newcommand*{\LaTeXcoderesultonlyend}{\egroup\LaTeXcodefloatend}
-\lstnewenvironment{BibTeXexample}{%
-  \global\let\lst@intname\@empty
-  \setbox\lst@samplebox=\hbox\bgroup
-  \setkeys{lst}{tabsize=4,gobble=3,breakindent=0pt,
-    basicstyle=\small\ttfamily,basewidth=0.51em,
-    keywordstyle=\color{black}}
-  \lst@BeginAlsoWriteFile{\LaTeXexamplefile}}
- {\lst@EndWriteFile
-   \LaTeXcodeexampleend}
-\newcommand*{\DescribeOption}{%
-  \leavevmode\@bsphack\begingroup\MakePrivateLetters
-  \Describe@Option}
-\newcommand*{\Describe@Option}[1]{\endgroup
-              \marginpar{\raggedleft\PrintDescribeEnv{#1}}%
-              \SpecialOptionIndex{#1}\@esphack\ignorespaces}
-\newcommand*{\SpecialOptionIndex}[1]{\@bsphack
-    \index{#1\actualchar{\protect\ttfamily#1}
-           (option)\encapchar usage}%
-    \index{options:\levelchar#1\actualchar{\protect\ttfamily#1}%
-      \encapchar usage}\@esphack}
-\newcommand*{\indexopt}[1]{\DescribeOption{#1}\opt{#1}}
-\newcommand*{\DescribeOptionInfo}[2]{%
-  \DescribeOption{#1}%
-  \opt{#1=\meta{#2}}\xspace}
-\newcommand*{\ofixarg}[1]{%
-  {\ttfamily[}%
-  \ifmmode \expandafter \nfss@text \fi
-  {%
-    \meta@font@select
-    \edef\meta@hyphen@restore{%
-      \hyphenchar\the\font\the\hyphenchar\font}%
-    \hyphenchar\font\m@ne
-    \language\l@nohyphenation
-    #1\/%
-    \meta@hyphen@restore
-    }%
-    {\ttfamily]}}
-\newcommand*{\pkg}[1]{\textsf{#1}}
-\newcommand*{\currpkg}{\pkg{\jobname}\xspace}
-\newcommand*{\opt}[1]{\texttt{#1}}
-\newcommand*{\defaultopt}[1]{\opt{\textbf{#1}}}
-\newcommand*{\file}[1]{\texttt{#1}}
-\newcommand*{\ext}[1]{\file{.#1}}
-\newcommand*{\latin}[1]{\emph{#1}}
-\newcommand*{\etc}{%
-  \@ifnextchar.
-    {\latin{etc}}
-    {\latin{etc}.\xspace}}
-\newcommand*{\eg}{%
-  \@ifnextchar.
-    {\latin{e.g}}
-    {\latin{e.g}.\xspace}}
-\newcommand*{\ie}{%
-  \@ifnextchar.
-    {\latin{i.e}}
-    {\latin{i.e}.\xspace}}
-\newcommand*{\etal}{%
-  \@ifnextchar.
-    {\latin{et~al.}}
-    {\latin{et~al}.\xspace}}
-\newcommand*{\AMS}{{\protect\usefont{OMS}{cmsy}{m}{n}%
-  A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}
-\providecommand*{\eTeX}{\ensuremath{\varepsilon}-\TeX}
-\DeclareRobustCommand*{\XeTeX}
-  {X\kern-.125em\lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\TeX}
-\providecommand*{\CTAN}{\textsc{ctan}}
-\@ifpackageloaded{etoolbox}
-  {\patchcmd{\@addmarginpar}
-    {\@latex@warning@no@line {Marginpar on page \thepage\space moved}}
-    {\relax}{}{}}
-  {}
-\newcounter{argument}
-\g@addto@macro\endmacro{\setcounter{argument}{0}}
-\newcommand*\darg[1]{%
-  \stepcounter{argument}%
-  {\ttfamily\char`\#\theargument~:~}#1\par\noindent\ignorespaces}
-\newcommand*\doarg[1]{%
-  \stepcounter{argument}%
-  {\ttfamily\makebox[0pt][r]{[}%
-   \char`\#\theargument]:~}#1\par\noindent\ignorespaces}
-%</jawltxdoc>
-%\fi
+%<*demo>
+%</demo>
+%<*scheme>
+%!PS-Adobe-2.0 EPSF-1.2
+%%Creator: ChemDraw Std(tm) 10.0
+%<!labels>%%Title: scheme-one.eps
+%<labels>%%Title: scheme-two.eps
+%%CreationDate: 21/07/2007 12:00
+%%DocumentSuppliedProcSets: chemdict30 24 13
+%%DocumentFonts: Helvetica Helvetica-Oblique
+%%BoundingBox: 30 78 288 144
+%%EndComments
+%%BeginProcSet: chemdict30 24 13
+% ChemDraw Laser Prep
+% Copyright © 1985-2005 CambridgeSoft Corp., All Rights Reserved
+userdict/chemdict30 210 dict put
+chemdict30 begin/version 24 def/sv 13 def
+/b{bind def}bind def/L{load def}b/R{null def}b/d/def L/a/add L/al/aload L
+/as/astore L/at/atan L/cp/closepath L/cv/curveto L/cw/currentlinewidth L
+/cpt/currentpoint L/dv/div L/D/dup L/e/exch L/F/false L/f/fill L/fa/forall L
+/g/get L/gi/getinterval L/gr/grestore L/gs/gsave L/ie/ifelse L/ix/index L
+/l/lineto L/mt/matrix L/M/moveto L/m/mul L/n/neg L/np/newpath L/pb/pathbbox L
+/P/pop L/r/roll L/rl/rlineto L/rm/rmoveto L/ro/rotate L/rp/repeat L
+/ru/round L/sc/scale L/sl/setlinewidth L/sm/setmatrix L/st/stroke L
+/sp/strokepath L/sq/sqrt L/s/sub L/T/true L/tr/transform L/xl/translate L
+/xc/exec L/A R/N R/St R/X R/Y R/aL R/bL R/bS R/bd R/bs R/cX R/cY R/ch R/co R
+/fB R/fI R/fS R/fZ R/fl R/ft R/iX R/iY R/idx R/lh R/llx R/lly R/lp R/nH R
+/nSq R/newdict R/ps R/rad R/rev R/sL R/sba R/sbl R/sbs R/sn R/spa R/tB R
+/typ R/urx R/ury R/w R/wF R/xX R/xY R/rBg R/gBg R/bBg R/gry R/rDst R/gDst R
+/bDst R/cpd R/Aeq R/Ath R/Aos R/Ach R/ed R/sf 20 d/cW 20 d/lW 20 d/bW 75 d
+/wF 1.5 d/aF 11.875 d/aR 0.263 d/aA 50 d/hS 54 d/pA 32 d/sh F d/S{sf m}b
+/dL{[hS] 0 setdash}b/o{1 ix}b/rot{3 -1 r}b/x{e d}b/CMT mt d/TM mt d
+/SM{CMT sm}b/XY{X D m Y D m a sq}b/s1 1 string d/fp{T charpath flattenpath}b
+/p{tr ru 0.25 a e ru 0.25 a e itransform}b/Wd{65536. dv}b
+/C{Wd rot Wd rot Wd rot setrgbcolor}b
+/setcmykcolor where{P/sk/setcmykcolor L}{/sk{4 1 r 3{3 ix a D 0 lt{P 0}if D 1\
+ gt{P 1}if 1 e s 3 1 r}rp setrgbcolor P}b}ie/sg{D currenthsbcolor P rot seths\
+bcolor currenthsbcolor e P e P o s D m .001 gt{setgray}{P}ie}b
+/sBg{65535 dv/bBg x 65535 dv/gBg x 65535 dv/rBg
+x}b
+/sRmp{currentrgbcolor bBg e s/bDst x gBg e s/gDst x rBg e s/rDst x}b
+/dD{np 2 1 r 4 2 r xl 2 dv D sc -1 0 M 0 -1 l 1 0 l 0 1 l cp SM 0 ne{f}{lW 0.\
+8 m sl st}ie}b
+/dM{gs np 3 1 r xl D sc 0 4 M 0 -8 rl 3.5 2 rm -7 4 rl 0 -4 rm 7 4 rl SM st g\
+r}b/dQ{gs np 0 360 arc 0.5 sg f gr}b
+/dR{lW 0.8 m sl 2 ix s/Y x 2 ix s/X x xl Rr SM st}b
+/dT{fp pb 3 1 r s 3 2 r s 2 1 r rm f}b/N 0 d/db{array/bs x/N 0 d}b
+/B{bs N rot put/N N 1 a d}b
+/SpA{gs np o o xl rot s e rot s o 0 ne o 0 ne or{at ro}{P P}ie
+aR aL m n D aL a 0 M 0 o n aA n aA arc cp f gr}b
+/SpH{gs np o o xl rot s e rot s o 0 ne o 0 ne or{at ro}{P P}ie
+0 cw 2 dv xl
+aR aL m n D aL a 0 M 0 o n aA n 0 arc cp f gr}b/Sp{/St x 0.316/aR x gs
+aF lW m 0.8 m St 4 and 0 ne{bW m lW dv bW sl}if/aL x
+St 8 and 0 ne{8 ix 8 ix 3 ix 3 ix SpA}if
+St 16 and 0 ne{2 ix 6 m 1 a D ix e D ix e D ix e D ix e P SpA}if
+St 32 and 0 ne{8 ix 8 ix 3 ix 3 ix SpH}if
+St 64 and 0 ne{2 ix 6 m 1 a D ix e D ix e D ix e D ix e P SpH}if
+St 2 and 0 ne{St 4 and 0 ne{[hS bW m lW dv] 0 setdash}{dL}ie}if
+np M{cv}rp St 128 and 0 ne{f}{st}ie gr}b/Ha{gs np 3 1 r
+xl D sc -.7 1.4 M 0.7 1.4 l -.7 2.4 M 0.7 2.4 l SM st gr}b
+/OP{3 ix 3 ix xl 3 -1 r s 3 1 r
+e s o o at ro D m e D m a sq}b
+/OB{/bS x OP D bS dv D lW 2 m lt{P lW 2 m}if/bd x}b
+/DA{np 0 0 M aL 0 aR aL m 180 aA s 180 aA a arc cp f}b
+/OA{np 0 cw -2 dv M aL 0 aR aL m 180 aA s
+180 arc 0 cw -2 dv rl cp f}b
+/Ast{SM cw 0.8 m sl st}b/SA{aF m lW m/aL x 0.263/aR x aL 1 aR s m np 0 M
+ rad 0 l gs Ast gr}b
+/CA{aF lW m 0.8 m/aL x 0.316/aR x aL 1 aR s m 2 dv rad D m o D m s D 0 le{P
+P P}{sq at 2
+m np rad 0 rad 180 6 -1 r s 180 6 -1 r s arc gs Ast gr cpt
+e at ro}ie}b/AA{np rad 0 rad 180 180 6 -1 r a arc gs SM st gr}b
+/RA{lW m/w x np rad w M w .7 dv w l rad w n M w .7 dv w n l w
+ .35 dv w 2 m M 0 0
+l w .35 dv w -2 m l st}b
+/HA{lW m/w x np 0 0 M w 2 m D l w 2 m w l rad w l rad w n l w 2 m
+w n l w 2 m D n l cp st}b
+/Ar1{gs 5 1 r OP/rad x{{2.25 SA DA}{1.5 SA DA}{1 SA DA}{lW 4 m sl 4.5 SA DA}
+{lW 4 m sl 3 SA DA}{lW 4 m sl 2 SA
+DA}{270 CA DA}{180 CA DA}{120 CA DA}{90 CA DA}{2.5 RA}{2.5
+HA}{1 -1 sc 270 CA DA}{1 -1 sc 180 CA DA}{1 -1 sc 120 CA DA}{1 -1 sc 90 CA
+DA}{5 RA}{5 HA}{dL 2.25 SA DA}{dL 1.5 SA DA}{dL 1 SA DA}{2.25 SA OA}{1.5 SA
+OA}{1 SA OA}{1 -1 sc 2.25 SA OA}{1 -1 sc 1.5 SA OA}
+{1 -1 sc 1 SA OA}{270 CA OA}{180 CA OA}{120 CA OA}{90 CA OA}{1 -1 sc 270 CA
+OA}{1 -1 sc 180 CA OA}{1 -1 sc 120 CA OA}{1 -1 sc 90 CA OA}{1 -1 sc 270
+AA}{1 -1 sc 180 AA}{1 -1 sc 120 AA}{1 -1 sc 90 AA}}e g xc
+gr}b/ac{arcto 4{P}rp}b/rO{4 cw m}b/Cr{0 0 1 0 360 arc}b/Ac{XY D sc Cr SM}b
+/OrA{Y X at ro XY D rev{neg}if sc}b/Ov{OrA 1 0.4 sc Cr SM}b
+/Asc{OrA 1 27 dv D sc}b/LB{9 -6 M
+21 -10 27 -8 27 0 cv
+27 8 21 10 9 6 cv
+-3 2 -3 -2 9 -6 cv
+cp}b/DLB{0 0 M
+0 0 -9.51 9.65 -9.51 18.02 cv
+-9.51 23.22 -6.75 27 0 27 cv
+6.75 27 9.51 23.22 9.51 18.02 cv
+9.51 9.65 0 0 0 0 cv
+cp}b/ZLB{LB}b
+/dt{gs np M SM cpt np rot 4.5 dv 0 360 arc f gr}b
+/whf{gs 1 setgray f gr SM st}b/blf{gs f gr SM st}b/Rr{0 rO M
+0 Y X Y rO ac
+X Y X 0 rO ac
+X 0 0 0 rO ac
+0 0 0 Y rO ac
+cp}b/Rc{0 0 M
+0 Y l
+X Y l
+X 0 l
+cp}b/grf{gs 0.5 sg f gr SM st}b/gG{D 32 dv D m 1 e s/gry x
+currentrgbcolor bDst gry m a 3 1 r gDst gry m a 3 1 r rDst gry m a 3 1 r
+setrgbcolor}b/gS{dtransform CMT idtransform
+m D 0 lt{n}if sq n D
+CMT dtransform idtransform
+e 2 m e
+xl
+7 m 32 a 256 dv D sc}b/gLB{sh{sRmp
+32 -0.5 0.5{gs
+gG
+13.5 0 xl
+D 32 s 64 dv 13.5 m D 7 m 24 dv
+gS
+-13.5 0 xl
+LB f
+gr}for
+LB SM st}{LB grf}ie}b/gOv{sh{sRmp
+32 -0.5 0.5{gs
+gG
+D 32 s 64 dv 0.65 m D
+gS
+Cr f
+gr}for
+Cr SM st}{Cr grf}ie}b/gAc{sh{sRmp
+32 -0.5 0.5{gs
+gG
+D 32 s 64 dv D
+gS
+Cr f
+gr}for
+Cr SM st}{Cr grf}ie}b
+/gDLB{sh{sRmp
+32 -0.5 0.5{gs
+gG
+0 13.5 xl
+D 32 s 64 dv 13.5 m D 7 m 24 dv e
+gS
+0 -13.5 xl
+DLB f
+gr}for
+DLB SM st}{DLB grf}ie}b/gRr{sh{sRmp
+32 -0.5 0.5{gs
+gG
+X 2 dv Y 2 dv xl
+D 32 s 64 dv X Y lt{X}{Y}ie m 0.25 m D
+gS
+X -2 dv Y -2 dv xl
+Rr f
+gr}for
+Rr SM st}{Rr grf}ie}b/gRc{sh{sRmp
+32 -0.5 0.5{gs
+gG
+X 2 dv Y 2 dv xl
+D 32 s 64 dv X Y lt{X}{Y}ie m 0.25 m D
+gS
+X -2 dv Y -2 dv xl
+Rc f
+gr}for
+Rc SM st}{Rc grf}ie}b/gZLB{gLB}b/Ath{Y X at ro XY 2 dv/rad x gs D SA DA gr
+ rad 2 m 0 xl 180 ro SA DA}b/Aeq{Y X at ro XY/rad x
+rev{1 -1 sc}if
+gs
+0 lW 2 m xl
+D SA OA
+gr
+rad 0 xl
+180 ro
+0 lW 2 m xl
+SA OA}b/Aos{X Y M SM cpt xl XY e dv lW 1.667 m o o lt{e}if P D sc}b/Ach{5 Aos
+gs/Helvetica findfont[1 0 0 -1 0 0]makefont 5.5 scalefont setfont
+D stringwidth P 2 dv D 1 a/rad x
+n 0 M show gr
+rad 2 s -5 M
+rad n -5 rad n 1 2 ac
+rad n 1 rad 1 2 ac
+rad 1 rad -5 2 ac
+rad -5 rad n -5 2 ac
+cp Ast}b/Ar{D 39 lt{Ar1}
+{gs 5 1 r o o xl 3 -1 r e s 3 1 r s e
+o 0 lt o 0 lt ne/rev x
+D 0 lt{1 -1 sc neg}if/Y x D 0 lt{-1 1 sc neg}
+if/X x np{{Y 16 div D 2 S lt{P 2 S}if/lp x
+lp 0 M 0 0 l 0 Y l lp Y l
+X lp s 0 M X 0 l X Y l X lp s Y l SM st}{Y 16 div D 2 S lt{P 2 S}if/lp x
+lp 0 M
+0 0 0 Y lp ac
+0 Y 2 dv lp neg o lp ac
+0 Y 2 dv 0 Y lp ac
+0 Y lp Y lp ac
+X lp s 0 M
+X 0 X Y lp ac
+X Y 2 dv X lp a o lp ac
+X Y 2 dv X Y lp ac
+X Y X lp s Y lp ac SM st}{Y D 2 dv Y 180 pA s 180 pA a arc st
+np X Y s Y 2 dv
+Y pA D neg arcn st}{Rc SM st}{X lW 2 dv a lW -2 dv M
+rO D rl
+X lW 2 dv a rO a Y lW 2 dv a rO a l
+rO lW -2 dv a Y lW 2 dv a rO a l
+lW -2 dv Y lW 2 dv a l
+0 Y l X Y l X 0 l cp f
+0 0 M
+0 Y l
+X Y l
+X 0 l cp
+SM st}{Rr SM st}{rO Y M rO rO xl
+0 Y X Y rO ac
+X Y X 0 rO ac
+X 0 0 0 rO ac
+rO neg D xl X Y 0 Y rO ac
+cp f
+Rr st}{Ac st}{OrA gAc}{Ov st}{OrA 1 .4 sc gOv}{Asc LB whf}{Asc gLB}
+{Asc gs gLB gr
+-1 -1 sc LB whf}{Asc gs gLB gr
+-0.4 -0.4 sc LB whf}{Asc LB gs whf gr
+np -0.4 -0.4 sc gLB}{Asc DLB -1 -1 sc DLB gs whf gr
+np 90 ro gs gDLB gr -1 -1 sc gDLB}{Asc gs -1 -1 sc ZLB whf gr
+gs 3.6 12 sc gOv gr
+ZLB whf}{Asc gs -1 -1 sc gZLB gr
+gs 3.6 12 sc Cr whf gr
+gZLB}{0 0 M X Y l SM st}{bW sl 0 0 M X Y l SM st}
+{dL 0 0 M X Y l SM st}{OrA 1 16 dv D sc
+0 -1 M
+0 0 1 0 1 ac
+8 0 8 1 1 ac
+8 0 16 0 1 ac
+16 0 16 -1 1 ac
+SM st}{XY D 0 0 dt X Y dt}{XY 2 dv X Y dt}{XY D X Y dt 0 0 M SM cpt xl
+2 dv D sc
+1 0 M -1 0 l
+0 1 M 0 -1 l
+Ast}{XY D X Y dt 0 0 M SM cpt xl
+2 dv D sc
+1 0 M -1 0 l
+Ast}{4.5 Aos
+1 0 M -1 0 l
+0 1 M 0 -1 l
+2 0 M 0 0 2 0 360 arc
+Ast}{4.5 Aos
+1 0 M -1 0 l
+2 0 M 0 0 2 0 360 arc
+Ast}{2.25 Ath}{1.5 Ath}{1 Ath}{2.25 Aeq}{1.5 Aeq}{1 Aeq}{OrA 1 16 dv D sc
+0 -1 M 0 0 l 16 0 l 16 -1 l SM st}{5 Aos
+1 -1 M -1 -1 l
+0 2 M 0 -2 l
+Ast}{5 Aos
+1 -1 M -1 -1 l
+1 1 M -1 1 l
+0 2 M 0 -2 l
+Ast}{4.5 Aos
+1 0 M -1 0 l
+0 1 M 0 -1 l
+Ast}{4.5 Aos
+1 0 M -1 0 l
+Ast}{gRc}{gRr}{Rc blf}{Rr blf}{Ac blf}{Ov blf}{Asc DLB -1 -1 sc DLB gs whf gr
+np 90 ro DLB -1 -1 sc DLB blf}{Asc gs -1 -1 sc ZLB blf gr
+gs 3.6 12 sc Cr whf gr
+ZLB blf}{Asc gs -1 -1 sc ZLB whf gr
+gs 3.6 12 sc Cr blf gr
+ZLB whf}{Asc LB gs whf gr
+np -0.4 -0.4 sc LB blf}{Asc LB gs f gr gs SM st gr
+np -0.4 -0.4 sc LB whf}{Asc LB blf}{Asc LB gs f gr gs SM st gr
+np -1 -1 sc LB whf}{Ac whf}{OrA gAc}{Ac blf}{Ov whf}
+{OrA 1 .4 sc gOv}{Ov blf}{(Rac)Ach}{(Abs)Ach}{(Rel)Ach}
+}e 39 s g xc gr}ie}b/DS{np M l st}b
+/DD{gs dL DS gr}b/DB{gs 12 OB bW sl np 0 0 M 0 l st gr}b/ap{e 3 ix a
+e 2 ix a}b/PT{D 2 4 gi al P OP D 1 sc
+o length 6 gt{P 6 g}{e P 8 dv}ie
+D lW 2 m lt{P lW 2 m}if
+0 e
+0 0
+3 -1 r s 3 1 r e s e
+0 0 M 1 0 l
+0 0 ap M 1 0 ap l
+e n e n
+0 0 ap M 1 0 ap l
+P P}b/DT{gs np PT SM st gr}b
+/NH{lW s D hS dv ru
+cvi D 0 eq{P 1}if/nH x
+D hS nH m s
+D 0 lt{P .1 s nH dv}{nH 2 a dv D 0 xl 2 m s nH dv}ie}b
+/Bd{D type/arraytype ne{bs e g}if{{P}{{{DS}{DD}{gs 12 OB np
+bW 2 dv/bd x
+lW 2 dv e D NH e{D bd M bd n l}for
+st gr}{gs 12 OB np
+lW 2 dv 0 xl NH 1 sc
+bW 2 dv wF m nH 1 a dv/bd x
+0 1 nH
+{D 1 a bd m o o M n l}for SM st gr}{P}{DB}{gs 12 OB
+np 0 lW 2 dv o o n M l bW 2 dv
+wF m o o l n l
+cp f gr}{P}{gs 12 OB/bL x
+bW 2 dv D lW lt{P lW}if/bd x np 0 0 M
+bL bd 4 m dv ru 2 o o lt{e}if P cvi/nSq x
+bL nSq 2 m dv D sc
+nSq{.135  .667 .865  .667 1 0 rcurveto
+.135 -.667 .865 -.667 1 0 rcurveto}rp SM st gr}{gs 12 OB
+np 0 lW 2 dv o o n M l bW 2 dv
+wF m o o l n l
+cp SM lW 0.8 m sl st gr}{P}{4 2 r gs OP/rad x 1 SA DA gr}{P}
+}o 1 g 1 s g e 2 4 gi al P
+5 -1 r xc}{al P 8 ix 1 eq{DD}{DS}ie 5 -1 r 2 eq{DB}{DS}ie P}{DT}}o 0 g g xc}b
+/ed{gs cpt np cw 2 dv 0 360 arc f gr}b
+/SPe{gs 0 e xl 1 1 S dv D n sc CMT currentmatrix P lW sl 4.0 setmiterlimit
+np}b/ws{Wd 0 32 4 -1 roll widthshow}b/blank/Times-Roman findfont/CharStrings
+g/space g d/mv 256 array d/NUL/SOH/STX/ETX/EOT/ENQ/ACK/BEL/BS/HT/LF/VT
+/FF/CR/SO/SI
+/DLE/DC1/DC2/DC3/DC4/NAK/SYN/ETB/CAN/EM/SUB/ESC/FS/GS/RS/US
+mv 0 32 gi as P
+mv 32/Times-Roman findfont/Encoding get
+32 96 gi putinterval
+mv 39/quotesingle put
+mv 96/grave put/unknown/unknown/quotesinglbase/florin/quotedblbase/ellipsis
+/dagger/daggerdbl
+/circumflex/perthousand/Scaron/guilsinglleft/OE/unknown/unknown/unknown
+/unknown/quoteleft/quoteright/quotedblleft/quotedblright/bullet/endash
+/emdash
+/tilde/trademark/scaron/guilsinglright/oe/unknown/unknown/Ydieresis
+/blank/exclamdown/cent/sterling/currency/yen/brokenbar/section
+/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered
+/macron
+/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph
+/periodcentered
+/cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf
+/threequarters/questiondown
+/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla
+/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis
+/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply
+/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls
+/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
+/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
+/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide
+/oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis
+mv 128 128 gi as P/fSt 50 string d(ChemDraw)fSt copy P/fD{D/Symbol eq{
+findfont[1 0 0 -1 0 0]makefont}{D {findfont}stopped{/Helvetica findfont}if
+D length dict/newdict x{
+1 index/FID ne{1 index/FontMatrix eq{[1 0 0 -1 0 0]matrix concatmatrix}if
+newdict 3 1 r put}{P P}ie}forall
+newdict/Encoding mv put
+fSt 8 fSt length 8 sub gi cvs length 8 add
+fSt 0 rot gi cvn newdict definefont}ie}b/ts{gs xl ro 0 0 M}b
+/nl{0 e xl 0 0 M}b/tx{ft e g e sf m rot D 96 and 0 ne{
+64 and 0 ne{-0.5}{0.25}ie e 0.75 m}{P 0 e}ie
+D 4 -1 r e scalefont setfont m cpt P e M}b
+end
+%%EndProcSet
+%%EndProlog
+
+chemdict30 begin
+/cW 24 def
+/bW 48 def
+/lW 12 def
+/hS 32 def
+/sh true def
+222 SPe[
+/Helvetica
+fD
+/Helvetica-Oblique
+fD]/ft x
+600 1560 M
+5760 1560 l
+5760 2880 l
+600 2880 l
+cp clip np
+65535 65535
+65535 sBg
+0 1640 2178 ts
+0.0000 0.0000 0.0000 1.0000 sk
+0 10 0 tx
+(N)show
+gr
+0 1182 2178 ts
+0.0000 0.0000 0.0000 1.0000 sk
+0 10 0 tx
+(N)show
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+1619 2364 M
+1627 2376 l
+1335 2376 l
+1344 2364 l
+cp
+f
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+1598 2330 M
+1598 2342 l
+1364 2342 l
+1364 2330 l
+cp
+f
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+1669 2208 M
+1681 2212 l
+1627 2376 l
+1619 2364 l
+cp
+f
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+1481 1941 M
+1481 1926 l
+1629 2034 l
+1622 2043 l
+cp
+f
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+1343 2041 M
+1336 2032 l
+1481 1926 l
+1481 1941 l
+cp
+f
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+1363 2069 M
+1356 2059 l
+1478 1971 l
+1485 1981 l
+cp
+f
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+1344 2364 M
+1335 2376 l
+1282 2212 l
+1293 2209 l
+cp
+f
+gr
+0 1033 2091 ts
+0.0000 0.0000 0.0000 1.0000 sk
+-377
+0 M
+0 10 0 tx
+(Mes)show
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+1055 2043 M
+1059 2031
+l
+1167 2066 l
+1163 2078 l
+cp
+f
+gr
+0 1897 2091 ts
+0.0000 0.0000 0.0000 1.0000 sk
+0 10 0 tx
+(Mes)show
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+1878 2040 M
+1882 2051
+l
+1802 2077 l
+1798 2066 l
+cp
+f
+gr
+gs
+12 D sl/lW x
+24 /cW x
+48 /bW x
+32 /hS x
+0.0000 0.0000 0.0000 1.0000 sk
+10 D sl/lW x
+1228 1973 M
+1295
+1973 l st
+1261 1940 M
+1261 2006 l st
+gr
+0 2085 2400 ts
+0.0000 0.0000 0.0000 1.0000 sk
+0 10 0 tx
+(Br)show
+64 10 0 tx
+(\226)show
+gr
+0 5084 2247 ts
+0.0000 0.0000 0.0000 1.0000 sk
+0 10 0 tx
+(N)show
+gr
+0 4625 2247 ts
+0.0000 0.0000 0.0000 1.0000 sk
+0 10 0 tx
+(N)show
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+5062 2433 M
+5071 2445 l
+4778 2445 l
+4787 2433 l
+cp
+f
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+5042 2399 M
+5042 2411 l
+4808 2411 l
+4808 2399 l
+cp
+f
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+5113 2277 M
+5124 2281 l
+5071 2445 l
+5062 2433 l
+cp
+f
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+4925 2010 M
+4925 1995 l
+5072 2102 l
+5065 2112 l
+cp
+f
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+4787 2110 M
+4779 2101 l
+4925 1995 l
+4925 2010 l
+cp
+f
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+4787 2433 M
+4778 2445 l
+4725 2281 l
+4737 2278 l
+cp
+f
+gr
+0 4476 2160 ts
+0.0000 0.0000 0.0000 1.0000 sk
+-377 0 M
+0 10 0 tx
+(Mes)show
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+4498 2112 M
+4502 2100
+l
+4610 2135 l
+4606 2147 l
+cp
+f
+gr
+0 5340 2160 ts
+0.0000 0.0000 0.0000 1.0000 sk
+0 10 0 tx
+(Mes)show
+gr
+gs
+0.0000 0.0000 0.0000 1.0000 sk
+np
+5321 2109 M
+5325 2120
+l
+5246 2146 l
+5243 2134 l
+cp
+f
+gr
+gs
+12 D sl/lW x
+24 /cW x
+48 /bW x
+32 /hS x
+0.0000 0.0000 0.0000 1.0000 sk
+np
+4962 1946 17 0 360 arc
+cp
+f
+np
+4887 1946 17 0 360 arc
+cp
+f
+gr
+0 3236 1785 ts
+0.0000 0.0000 0.0000 1.0000 sk
+-364.5 0 M
+0 10 0 tx
+(KO-)show
+2 10 1 tx
+(t)show
+0 10 0 tx
+(-Bu)show
+201 nl
+-114.5 0 M
+0 10 0 tx
+(thf)show
+gr
+gs
+12 D sl/lW x
+24 /cW x
+48 /bW x
+32 /hS x
+0.0000 0.0000 0.0000 1.0000 sk
+10 D sl/lW x
+3597 2130 M
+2771 2130 l st
+gs
+3581 2161 3701 2130 3701 2130 3596 2143 3581 2161 3581 2161 3581 2098
+3596 2116 3596 2130 3701 2130 3581 2098 3581 2098 4 3701 2130 0 Sp
+gr
+gr
+0
+1215 2805 ts
+0.0000 0.0000 0.0000 1.0000 sk
+0 10 0 tx
+%<labels>(TMP1)show
+gr
+0 4642 2805 ts
+0.0000 0.0000 0.0000 1.0000 sk
+0 10 0 tx
+%<labels>(TMP2)show
+gr
+gr end
+%%Trailer
+showpage
+%</scheme>
+
+%\fi
\ No newline at end of file
-- 
cgit v1.2.3

