diff options
author | Karl Berry <karl@freefriends.org> | 2008-03-08 23:20:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-03-08 23:20:46 +0000 |
commit | 0f2ded353988b19236ea87f6f135ab63045a5672 (patch) | |
tree | d22639a74e947e25f9f033993e3872b42dda8e4c /Master/texmf-dist/source/latex | |
parent | d6767c07e4b1da71175894668d79303343af63f2 (diff) |
chemstyle 1.2 (8mar08)
git-svn-id: svn://tug.org/texlive/trunk@6903 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/chemstyle/chemstyle.dtx | 1799 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/chemstyle/chemstyle.ins | 11 |
2 files changed, 1021 insertions, 789 deletions
diff --git a/Master/texmf-dist/source/latex/chemstyle/chemstyle.dtx b/Master/texmf-dist/source/latex/chemstyle/chemstyle.dtx index f78c0fc6f74..49b5bff4d60 100644 --- a/Master/texmf-dist/source/latex/chemstyle/chemstyle.dtx +++ b/Master/texmf-dist/source/latex/chemstyle/chemstyle.dtx @@ -1,15 +1,15 @@ % \iffalse meta-comment % -% Copyright (C) 2007 by +% 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.3 of this license or (at your option) any later +% 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.3 or later is part of all distributions of -% LaTeX version 2003/12/01 or later. +% 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.'' % @@ -19,6 +19,7 @@ % and the derived files chemstyle.ins, % chemstyle.sty, % chemstyle.pdf, +% chemstyle.ltx, % rsc.jdf, % angew.jdf, % tetlett.jdf, @@ -79,17 +80,17 @@ The chemstyle package --- Writing chemistry with style 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 ---------------------------------------------------------------- \endpreamble \Msg{Generating chemstyle files:} -\usedir{tex/latex/contib/chemstyle} +\usedir{tex/latex/chemstyle} \generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}} \file{\jobname.sty}{\from{\jobname.dtx}{package}} - \file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}} } +\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}} @@ -101,6 +102,9 @@ } \generate{\file{none.jdf}{\from{chemstyle.dtx}{none}} } +\usedir{doc/latex/chemstyle} +\generate{\file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}} +} \endbatchfile %</install> %<*ignore> @@ -115,17 +119,24 @@ \EnableCrossrefs \CodelineIndex \RecordChanges +\usepackage[journal=none,xspace=true]{chemstyle} %\OnlyDescription % The various formatting commands used in this file are collected -% together in |jawltxdoc|. +% together in jawltxdoc. \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} \end{document} %</driver> % \fi % -%\CheckSum{658} +%\CheckSum{0} % % \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 @@ -146,58 +157,75 @@ % \GetFileInfo{\jobname.sty} % %\changes{v1.0}{2006/08/06}{Initial release of package} -%\changes{v1.0b}{2007/09/04}{Added |microtype| and |notes2bib| to -% template} -%\changes{v1.1}{2007/09/17}{License changed from GPL to LPPL} +%\changes{v1.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} +% under \LaTeX} %\changes{v1.1c}{2007/09/23}{Fixed problems with capitalisation -% of \texttt{SIunits}} +% 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} +% +%\setkeys{lst}{language=[LaTeX]{TeX},moretexcs={mmHg,Molar,% +% molar,cmc,Hz,unit,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,\@ifclassloaded,\@ifnextchar,\@ifpackageloaded} -%\DoNotIndex{\@undefined,\abovecaptionskip,\addto,\AtBeginDocument} -%\DoNotIndex{\begin,\begingroup,\belowcaptionskip,\bfseries,\bibname} -%\DoNotIndex{\captionsetup,\cm,\color,\csname,\CurrentOption} +%\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{\DeclareOption,\DeclareRobustCommand,\def} -%\DoNotIndex{\documentclass,\edef,\else,\emph,\end,\endcsname} -%\DoNotIndex{\endgroup,\ensuremath,\ExecuteOptions,\expandafter} -%\DoNotIndex{\femtogram,\fg,\fi,\figurename,\floatc@plain} +%\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,\hertz,\hrule,\iffalse,\iftrue,\ifx,\input} -%\DoNotIndex{\InputIfFileExists,\kern,\labelformat,\languagename} -%\DoNotIndex{\let,\MakeUppercase,\MessageBreak,\NeedsTeXFormat} -%\DoNotIndex{\newcommand,\newfloat,\newif,\newunit,\PackageInfo} -%\DoNotIndex{\PackageWarning,\PassOptionsToPackage,\ProcessOptions} -%\DoNotIndex{\providecommand,\ProvidesFile,\ProvidesPackage,\quad} -%\DoNotIndex{\refname,\relax\renewcommand,\RequirePackage} -%\DoNotIndex{\restylefloat,\rotatebox,\selectlanguage,\space} -%\DoNotIndex{\tablename,\textsc,\textsuperscript,\unitsep} -%\DoNotIndex{\unitsuperscript,\usepackage,\varnothing,\vspace} -%\DoNotIndex{\xspace,\@tempa,\@tempb,\centi,\cubed,\deci} -%\DoNotIndex{\DeclareMathSymbol,\DeclareSymbolFont,\dm} -%\DoNotIndex{\mathord,\metre,\milli,\mole,\relax,\spacefactor} -%\DoNotIndex{\usk,\futurelet,\@ifundefined} -% -% \title{\texttt{chemstyle} --- Writing chemistry with style% +%\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{\si@requirecfgs,\space,\spacefactor,\tablename,\textsc} +%\DoNotIndex{\textsuperscript,\the,\unitsep,\unitsuperscript,\usk} +%\DoNotIndex{\value,\vspace,\xspace,\z@} +% +% \title{\currpkg\ --- Writing chemistry with style^^A % \thanks{This file describes version \fileversion, last revised % \filedate.}} -% \author{Joseph Wright% +% \author{Joseph Wright^^A % \thanks{E-mail: joseph.wright@morningstar2.co.uk}} % \date{Released \filedate} % % \maketitle % %\begin{abstract} -% The |chemstyle| package provides a ``one-stop shop'' for setting up -% formatting of LaTeX documents following the editorial policies of +% 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. @@ -208,36 +236,36 @@ %\end{multicols} % %\section{Introduction} -% The aim of |chemstyle| is to provide a quick method to set up -% various document parameters (such as caption formatting), simply by +% 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. |chemstyle| has grown out of the |rsc| package, which had +% 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 |chemstyle| package is also designed with the -% use of |biblatex| in mind: the |rsc| package is closely bound to -% traditional BibTeX use. +% 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 |rsc| package, |chemstyle| provides a range +% 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 |rsc|. Everything that can -% be done using the |rsc| LaTeX package is therefore possible using -% the |chemstyle| package. -% -% The formatting system provided by |chemstyle| are intended for -% writing a variety of documents. Thus the stylistic changes made by -% the package do not seek to reproduce the appearance of printed -% journal articles. The package aims to be suitable for use in -% preparing drafts of papers, but also for writing reports, theses -% and so on. -% -%\section{Style options for \texttt{chemstyle}} -% |chemstyle| should be loaded with a package option specifying which -% journal style to follow. Currently, |chemstyle| is aware of a the +% 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} +%\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 Table~\ref{styles}. New styles can be developed % by creating a new file modelled on the existing definitions; -% |chemstyle| will automatically search for correctly-named styles. +% \currpkg will automatically search for correctly-named styles. %\begin{table} % \begin{tabular}{ll} % \toprule @@ -256,112 +284,131 @@ % tetlett & \emph{Tetrahedron}, \emph{Tetrahedron Lett.} \\ % \bottomrule % \end{tabular} -% \caption{Styles provided by \texttt{chemstyle}}\label{styles} +% \caption{Styles provided by \currpkg}\label{styles} %\end{table} -% The style files provided with |chemstyle| have been derived from +% 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 |none| style is notable as it is not based on a journal. +% 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 |none| option, for example. +% implicity using the \opt{none} option, for example. % %\subsection{Creating styles} -% The process of creating a new styles for |chemstyle| is intended to -% be relatively easy. New styles should be saved as files with the -% extension |.jdf| (standing for for Journal Definition File), and +% 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 MikTeX -% users, this can be done graphically or by typing \texttt{mpm -% --update-db} at the command line; for TeXLive, run +% \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 +% new styles. Arbitrary \TeX\ commands can be included, if they are % necessary for a particular style. For example, other packages can -% be loaded in \cmd{\usepackage}. +% be loaded in \cs{usepackage}. % -% The maintainer of |chemstyle| is happy to add new styles to the +% 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. +% sufficient time!). If you have a new style to add (or corrections +% to an existing one), please contact the package author. % %\subsection{Package options} -% As well as the various journal styles provided with the package, a -% number of options are recognised to alter compatibility with other -% packages and to give the desired output. |chemstyle| will also pass -% options through to the |chemscheme| package, which is used to -% provide support for schemes. Users should consult the |chemscheme| -% documentation for the options applicable. -% -% Currently, |chemstyle| has options |nonotes|, |nophrases|, -% |SIunits| and |xspace|. These are explained at the appropriate -% places within this document. All are hopefully relatively clearly -% named. +%\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} +% \currpkg loads the \pkg{chemscheme} package, and therefore will +% pass through the opt{chemcompounds} option. % %\section{Naming of the references section} -% |chemstyle| alters the naming of the references section of a -% document. By default, |chemstyle| alters the value of -% \cmd{\bibname} or \cmd{\refname} (as appropriate) to the form of -% words chosen by the target journal for the ``\refname'' section. +% \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 +% target journal for the ``References'' section. % % The ``\refname'' naming commands are language-aware, \emph{via} the -% |babel| interface. Currently, |chemstyle| includes appropriate -% labels for babel languages |english|, |UKenglish|, |ngerman| and -% |french|.\footnote{The \texttt{french} option for \texttt{babel} -% causes a clash with \texttt{unitsdef} concerning the command -% \texttt{\textbackslash fg}. \texttt{babel} uses this for -% \emph{guillemets}, while \texttt{unitsdef} uses it as an -% abbreviation for \texttt{\textbackslash femtogram}. The -% \texttt{chemstyle} package prevents the clash, and leaves the -% \texttt{babel} definition intact.} Other languages can be added if -% appropriate wordings are provided to the author. -% -% The |chemstyle| packages recognises the |nonotes| option, which -% affects how the \refname section is headed. With the |nonotes| -% option, the ``Notes'' part of the section name is omitted, and only -% the ``\refname'' phrase is output. +% \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}. +% +%\DescribeOption{notes} +%\DescribeOption{nonotes} +% 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 +% enable or disable the addition of ``Notes and'' to the +% ``References'' of the section title. The \opt{auto} option works +% in conjunction with the \pkg{notes2bib} package. If notes are +% 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} -% Both the |unitsdef| and |SIunits| packages provide a great number -% of easy to use unit commands, and handles spacing between numbers -% and units very well. However, a few useful units seem to be -% missing, and are provided here. By default, |chemstyle| uses the -% |unitsdef| package to achieve this, but using the |SIunits| option -% will use that package instead. %\DescribeMacro{\Hz} %\DescribeMacro{\mmHg} %\DescribeMacro{\molar} %\DescribeMacro{\Molar} %\DescribeMacro{\cmc} -% The most obvious of these is \cmd{\Hz}, which simply gives \Hz. The -% command \cmd{\mmHg} has a non-breaking thin space, leading to -% \mmHg. Two related commands are given for concentration: -% \cmd{\molar} gives \molar, whilst \cmd{\Molar} gives \Molar. -% Finally, the command \cmd{\cmc} is provided for generating \cmc. -% When using |unitsdef|, all of the new macros space correctly with -% numbers, so inputting |10\cmc| gives 10\cmc, with a non-breaking -% space. Users of |SIunits| will be familiar with the approach used -% by that package. +% 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. The package therefore provides +% these, using \pkg{SIunits} by default.\footnote{This is a change in +% v1.2: previous versions used \pkg{unitsdef}.} The definitions +% follow the pattern of the appropriate package. +%\begin{LaTeXexample} +% \unit{10}{\Hz}\\ +% \unit{20}{\mmHg}\\ +% \unit{30}{\molar}\\ +% \unit{40}{\Molar}\\ +% \unit{50}{\cmc} +%\end{LaTeXexample} +% +% The \pkg{si} package is currently under development as a +% replacement for \pkg{SIunits} and \pkg{unitsdef}.\footnote{By the +% maintainer of \currpkg.} \pkg{si} includes definitions for the +% above units, and so if it is loaded the definitions are taken from +% there, rather than provided by \currpkg. Looking to the future, +% once \pkg{si} reaches version 1.0, it will become the default +% support package for \currpkg. % %\subsection{The standard state symbol} %\DescribeMacro{\standardstate} % Related to the above, but not exactly a unit is the -% \cmd{\standardstate} command.\footnote{The \texttt{\textbackslash -% standardstate} macro is only defined if the user does not have -% their own version.} This generates the tricky \standardstate\ -% symbol: |$\Delta S\standardstate$| generates $\Delta -% S\standardstate$. Note that this is safe in either text or maths -% mode. +% \cmd{\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. +%\begin{LaTeXexample} +% \emph{H}\standardstate\\ +% $\Delta S\standardstate$ +%\end{LaTeXexample} % %\subsection{Alkyl radicals} -%\DescribeMacro{\iPr} +%\DescribeMacro{\nPr} %\DescribeMacro{\iPr} %\DescribeMacro{\nBu} %\DescribeMacro{\iBu} @@ -369,16 +416,37 @@ %\DescribeMacro{\tBu} % There are a few alkyl radicals that come up all of the time. No % one seems to have put these into a package, so they are provided -% here. As you would expect, \cmd{\iPr} gives \iPr, \cmd{\iBu} gives -% \iBu\ and \cmd{\tBu} gives \tBu, and so on. The style of the -% output depends on the journal style specified; most journals seem -% to favour one version of the abbreviation. When |chemstyle| is -% loaded using the |xspace| option, the |xspace| package is -% automatically used to add space after the command names, so that -% |\iPr group| will result in ``\iPr\ group'' being -% typeset.\footnote{Reader of the source of this document will see -% that this document has been compiled \emph{without} the |xspace| -% option!} +% 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} +% +%\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} % %\subsection{Latin phrases} %\DescribeMacro{\latin} @@ -389,385 +457,427 @@ %\DescribeMacro{\invacuo} % The various Latin phrases commonly used in chemistry are made % available as the obvious commands. By altering the definition of -% \cmd{\latin}, this allows ready switching from italic to Roman -% typesetting. Notice that \cmd{\etc}, \cmd{\ie} and \cmd{\eg} are -% aware of trailing periods, and so doubling-up should not occur. -% Once again, these macros use |xspace| when given as a package -% option to handle automatic addition of spaces after these phrases. -% For American journals, where it is obligatory to follow ``\eg'' -% and ``\ie'' with a comma, the package provides a mechanism for -% handling this automatically. Thus, when using an appropriate -% journal style, |\eg|, |\eg.| and |\eg,| will all result in -% typesetting ``\eg,''. -% -% The \cmd{\etc} and \cmd{\etal} commands are set up on the +% \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. +% +%\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}\\ +% \cstsetup{abbremph=false} +% \ie equals \eg perhaps \etc +%\end{LaTeXexample} +% +%\DescribeOption{abbrcomma} +% For American journals, where it is obligatory to follow ``\eg'' and +% ``\ie'' with a comma, the package provides a mechanism for handling +% this automatically. Thus, when using an appropriate journal style, +% |\eg|, |\eg.| and |\eg,| will all result in typesetting ``\eg,''. +% The Boolean package option \opt{abbrcomma} controls this. +%\begin{LaTeXexample} +% \eg this\\ +% \cstsetup{abbrcomma=true} +% \ie that +%\end{LaTeXexample} +% +% 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 -% |\etc\ more text|, |\etc~more text|, \etc. If this is a big issue, -% the package author may look at it again. +%\begin{LaTeXexample} +% \etc\ more text \\ +% \etal\~have shown +%\end{LaTeXexample} % +%\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 \cmd{\latin} macro, it will be used even if you load -% |chemstyle|. If you encounter any problems, try loading the package -% with the |nophrases| option; this option prevents the package even +% own \cs{latin} macro, it will be used even if you load \currpkg. 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. % %\DescribeMacro{\latinemphon} %\DescribeMacro{\latinemphoff} -% The formatting of Latin phrases can be altered using the two macros -% \cmd{\latinemphon} and \cmd{\latinemphoff}, which switch the use of -% \cmd{\emph} for Latin phrases on and off. These macros are mainly -% intended for the use in journal style files, but may be more -% generally useful. +% 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. % %\section{Additional information} -%\subsection{Advice for users of \texttt{rsc} and \texttt{achemso}} -% The |chemstyle| package is intended as a replacement for the |rsc| -% package. As such, it covers almost everything the the |rsc| LaTeX -% package does, and more. Users of |rsc| are strongly encouraged to -% update to using |chemstyle|. The bibliography styles provided by -% |achemso| and |rsc| will continue to be required, of course. -% Migration of these styles to |biblatex| is an on-going project. +%\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 |chemstyle| package has been designed to avoid, as far as +% The \currpkg package has been designed to avoid, as far as % possible, clashes with other packages. The package requires the -% presence of the standard |graphicx| and |varioref| packages. If -% these packages need to be loaded with explicit options, this should -% be done \emph{before} loading |chemstyle|. The |chemscheme| package -% is also needed, as it provides the floating |scheme| environment -% essential in synthetic chemistry documents. +% 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. % %\subsection{Captions above floats} -% The |scheme| float type is generated using the |float| package. -% This has the side-effect that the placement of captions for floats -% does not depended on where the \cmd{\caption} command comes inside -% the floating environment.\footnote{Normally this is a good thing.} -% If you wish to alter the placement of captions, the mechanism of -% the underlying |float| package will be needed. This requires the -% use of \cmd{\floatstyle} to load the desired settings, followed by -% \cmd{\restylefloat} to apply the settings. This is most usually -% done with tables. +% The \texttt{scheme} float type is generated using the \pkg{float} +% package. This has the side-effect that the placement of captions +% for floats does not depended on where the \cs{caption} command +% comes inside the floating environment.\footnote{Normally this is a +% good thing.} If you wish to alter the placement of captions, the +% mechanism of the underlying \pkg{float} package will be needed. +% This requires the use of \cs{floatstyle} to load the desired +% settings, followed by \cs{restylefloat} to apply the settings. +% This is most usually done with tables. %\begin{LaTeXexample}[\typesetfloatexample] -% \begin{table}[h] -% \caption{A caption above the float contents} -% The float contents -% \end{table} -% \floatstyle{plaintop} -% \restylefloat{table} -% \begin{table}[h] -% \caption{A second caption above the float contents} -% The second float contents -% \end{table} +% \begin{table}[h] +% \caption{A caption above the float contents} +% The float contents +% \end{table} +% \floatstyle{plaintop} +% \restylefloat{table} +% \begin{table}[h] +% \caption{A second caption above the float contents} +% The second float contents +% \end{table} %\end{LaTeXexample} % -% \iffalse -%<*template> -% \fi -% \section{A template for chemical articles} +%\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. +% 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. The file \file{chemstyle.ltx} will be generated by +% compiling this documentation, and contains the example ``ready to +% run''. +%\edef\LaTeXexamplefile{chemstyle.ltx} +%\begin{LaTeXexample}[\typesetcodeonly] +% \documentclass[fontsize=10pt,paper=a4]{scrreprt} +% \usepackage[english,UKenglish]{babel} +% \usepackage{geometry,upgreek,booktabs} +% \usepackage[journal=rsc,xspace=true]{chemstyle} +% \usepackage[version=3]{mhchem} +% \usepackage[footnotes]{notes2bib} +% \usepackage[final]{microtype} +% \usepackage[colorlinks]{hyperref} +% \begin{document} +% Document contents go here +% \end{document} +%\end{LaTeXexample} +%\edef\LaTeXexamplefile{\jobname.tmp} % -% The versatile \textsc{koma-script} bundle provides more advanced +% The versatile \textsc{koma}-script bundle provides more advanced % versions of the standard document classes. If you want paragraphs % separated out, with no indents (a common style for theses), add the -% |parskip| option to the font and paper size ones given here. -% \begin{macrocode} -\documentclass[fontsize=10pt,paper=a4]{scrreprt} -% \end{macrocode} -% The |geometry| package allows the users to alter page layout -% with ease; much better than trying to hack the raw LaTeX system. -% \begin{macrocode} -\usepackage{geometry} -% \end{macrocode} -% The |babel| system is loaded to sort out hyphenation and so on, +% \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. -% \begin{macrocode} -\usepackage[english,UKenglish]{babel} -% \end{macrocode} -% Load |chemstyle| (of course) to give not only some easy formatting, +% +% \pkg{geometry}e 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 |chemscheme| package. This also loads either -% |chemcompounds| or (optionally) |bpchem| to track compound numbers. -% Using the |xspace| option automatically adds space after the -% various abbreviations. -% \begin{macrocode} -\usepackage[rsc,xspace]{chemstyle} -% \end{macrocode} -% The |mhchem| package provides the \cmd{\ce} command for rapidly +% 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}. -% \begin{macrocode} -\usepackage[version=3]{mhchem} -% \end{macrocode} -% Greek letters should be italic if used for variables, but upright -% (Roman) if used otherwise. So the standard LaTeX |$\delta$| is -% fine for typesetting an NMR shift (\eg\ $\delta = \dots$ ppm.), -% but not for a $\upsigma$-bond or a $\uppi$-complex. The |upgreek| -% package provides commands such as |$\upsigma$| and |$\uppi$| which -% are ideal for this. -% \begin{macrocode} -\usepackage{upgreek} -% \end{macrocode} -% The default LaTeX table formatting is not very good. The -% |booktabs| package does things properly, and has good -% advice in the manual. A highly-recommended package for -% those interested in formatting (\ie\ all (La)TeX users!). -% \begin{macrocode} -\usepackage{booktabs} -% \end{macrocode} -% The |microtype| package improves formatting when used with the -% pdfTeX engine. By giving the |final| option, it is active even -% when using |draft| as a global option. -% \begin{macrocode} -\usepackage[final]{microtype} -% \end{macrocode} -% Using |notes2bib| allows the user to automatically add notes to the -% bibliography from within the document body. So you can put +% +% 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 |footnotes| +% References section without any further effort. The \opt{footnotes} % option means that footnotes do the same. -% \begin{macrocode} -\usepackage[footnotes]{notes2bib} -% \end{macrocode} -% Finally, the |hyperref| package makes headings, citations and so on into -% hyperlinks. -% \begin{macrocode} -\usepackage[colorlinks]{hyperref} -% \end{macrocode} -% The bulk of the document can then start. -% \begin{macrocode} -\begin{document} -\end{document} -% \end{macrocode} -% \iffalse -%</template> -% \fi % -% \StopEventually{} +% Finally, the \pkg{hyperref} package makes headings, citations and +% so on into hyperlinks. % -% \iffalse +%\StopEventually{} +% +%\iffalse %<*package> -% \fi +%\fi %\section{The package code} -% %\subsection{Setup code} % First of all, the package identifies itself and loads other -% packages needed to function. Loading |chemscheme| is deferred +% packages needed to function. Loading \pkg{chemscheme} is deferred % until later, to allow processing of options at the correct point. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{chemstyle} - [2007/10/31 v1.1h Writing chemistry with style] + [2008/03/08 v1.2 Writing chemistry with style] % \end{macrocode} %\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} % Packages that are needed under all circumstances are loaded here. +% There are some limitations on the age of \pkg{xkeyval}. % \begin{macrocode} -\RequirePackage{graphicx,varioref,caption} +\RequirePackage{xkeyval} +\@ifpackagelater{xkeyval}{2005/05/07} + {} + {\PackageError{chemstyle} + {xkeyval >= 2.5 required} + {chemstyle requires the `xkeyval' package, version 2.5 + or later.\MessageBreak The version loaded is: + `\@nameuse{ver@xkeyval.sty}'.\MessageBreak + This is a fatal error: loading will abort.} + \endinput} +\RequirePackage{graphicx,varioref,caption,xspace} % \end{macrocode} -% -%\subsection{Alkyl radicals} -%\begin{macro}{\cst@emph} -%\begin{macro}{\cst@hyph} -%\begin{macro}{\cst@super} -% Alkyl radical abbreviations are produced using the macro -% \cmd{\cst@radical}. This uses a series of formatting commands, -% which have default values provided here. The names are hopefully -% pretty self-explanatory. +%\begin{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} -\let\cst@emph\relax -\def\cst@hyph{} -\let\cst@super\relax -\newif \ifcst@prefix \cst@prefixtrue +\newcommand*{\cst@tempa}{} +\newcommand*{\cst@tempb}{} % \end{macrocode} %\end{macro} %\end{macro} -%\end{macro} -%\begin{macro}{\cst@radical} -% The \cmd{\cst@radical} macro does the hard work of declaring -% each abbreviation. To ensure there is no unexpected clash of -% names, \cmd{\newcommand} is used first to check for any problems. -% The commands are made robust so they can (hopefully) be used -% anywhere. +% +%\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. % \begin{macrocode} -\def\cst@radical#1#2{% - \expandafter\newcommand\expandafter{\csname #1#2\endcsname}{}% - \expandafter\DeclareRobustCommand\expandafter{% - \csname #1#2\endcsname}{% - \ifcst@prefix - \cst@super{\cst@emph{#1}}\cst@hyph#2% - \else - #2\cst@hyph\cst@super{\cst@emph{#1}}% - \fi% - \cst@xspace - } -} +\newcommand*{\cst@boolkey}[1]{ + \define@boolkey[cst]{opt}[cst@]{#1}[true]{}} % \end{macrocode} %\end{macro} -% With a mechanism in place, the abbreviations are declared. The -% format of the resulting output will depend upon the configuration -% file used. +%\begin{macro}{\ifcst@chemcompounds} +%\begin{macro}{\ifcst@xspace} +%\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{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@boolkey{chemcompounds} +\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} % \end{macrocode} -% -% \subsection{Option handling} -% Firstly, the ``pass through'' options are handled, as these will be -% sent through to |chemscheme|. The package options for |chemstyle| -% are also handled here. -%\changes{v1.1}{2007/09/17}{Added \texttt{phrases} option} -%\changes{v1.1}{2007/09/17}{Added \texttt{siunits} option} -%\changes{v1.1}{2007/09/17}{Added \texttt{xspace} option} -%\changes{v1.1c}{2007/09/23}{Added \texttt{SIunits} option} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\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{macrocode} -\newif \ifcst@notes \cst@notestrue -\newif \ifcst@phrases \cst@phrasestrue -\newif \ifcst@si \cst@sifalse -\newif \ifcst@xspace \cst@xspacefalse -\DeclareOption{ch}{\ExecuteOptions{chapter}} -\DeclareOption{chapter}% - {\PassOptionsToPackage{chapter}{chemscheme}} -\DeclareOption{chemcompounds}% - {\PassOptionsToPackage{chemcompounds}{chemscheme}} -\DeclareOption{nonotes}{\cst@notesfalse} -\DeclareOption{nophrases}{\cst@phrasesfalse} -\DeclareOption{siunits}{\cst@sitrue} -\DeclareOption{SIunits}{\cst@sitrue} -\DeclareOption{xspace}{\cst@xspacetrue} +\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} % \end{macrocode} -% In order to handle the loading of style definitions correctly, a -% bit of care is needed. The package options need to be loaded -% \emph{before} |chemscheme|, but the style definitions need to -% be loaded after |chemscheme|. This is achieved by saving the -% options and looking at them again once the package loading is done. -% Notice that only one style definition can be used, so this is -% taken care of with a warning if needed. +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +% Some old options are no longer needed at all. % \begin{macrocode} -\let\cst@option\relax -\DeclareOption*{% - \ifx\cst@option\relax\else - \PackageWarning{chemstyle} - {Extra option \cst@option\space ignored} - \fi - \edef\cst@option{\CurrentOption} -} +\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} -% If |SIunits| is already loaded, then the option has to be set. +%\begin{macro}{\cst@journal} +%\begin{macro}{\cst@language} +% The \opt{journal} option can be given with or without +% \opt{journal=}. % \begin{macrocode} -\@ifpackageloaded{SIunits} - {\ExecuteOptions{siunits}} - {\@ifpackageloaded{siunits} - {\ExecuteOptions{siunits}} - {}} -\ProcessOptions* -\ifcst@si - \@ifpackageloaded{unitsdef} - {\PackageWarning{chemstyle}{% - You have set the SIunits option,\MessageBreak - but have already loaded unitsdef!\MessageBreak - unitsdef will be used for extra unit macros} - \cst@sifalse} - {\AtBeginDocument{% - \@ifpackageloaded{siunits}% - {} - {\RequirePackage{SIunits}}% - } - } -\else +\define@cmdkeys[cst]{opt}[cst@]{journal,language} +\DeclareOptionX*{\edef\cst@journal{\CurrentOption}} % \end{macrocode} -% The \cmd{\fg} macro is defined in French as a \emph{guillemet} sign, -% and so to avoid a clash a bit of patching is needed. A check to see -% if |babel| has already defined \cmd{\fg}\@. If it has, the definition -% is saved and deleted. +%\end{macro} +%\end{macro} +% The default options are executed, and the user options are +% processed. % \begin{macrocode} - \ifx\fg\@undefined - \else - \ifx\fg\relax - \else - \let\cst@fg\fg - \let\fg\@undefined - \fi - \fi - \RequirePackage{unitsdef} +\setkeys[cst]{opt}{ + notes=true, + phrases=true, + chemcompounds=true, + xspace=true, + journal=none, + radprefix=true, + rademph=true, + radsuper=false, + radhyphen=true, + abbremph=true, + abbrcomma=false, + language=english, + notesbefore=true} +\ProcessOptionsX[cst]<opt> % \end{macrocode} -% If \cmd{\cst@fg} exists, it is restored here, otherwise \cmd{\fg} -% is undefined. At the beginning of the document, \cmd{\fg} is -% defined as an abbreviation for a femtogram if it is not being used -% by |babel|. This way there is not a problem if |babel| is loaded -% after |chemstyle|. +% With the options processed, those to be passed to \pkg{chemscheme} +% are sorted out. % \begin{macrocode} - \ifx\cst@fg\@undefined - \let\fg\@undefined - \else - \let\fg\cst@fg - \fi - \AtBeginDocument{% - \ifx\fg\@undefined - \newcommand{\fg}{\femtogram} - \fi - } +\ifcst@chemcompounds + \PassOptionsToPackage{chemcompounds}{chemscheme} \fi \RequirePackage{chemscheme} % \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{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. +% \begin{macrocode} +\newcommand*{\cstsetup}[1]{% + \iffalse{\fi\ifnum0=`}\fi + \setkeys[cst]{opt}{#1}% + \ifnum0=`{\fi\iffalse}\fi} +% \end{macrocode} +%\end{macro} % -%\subsection{Extra units and related commands} -% -%\begin{macro}{\cubiccentimeter} +%\subsection{Extra units} +%\changes{v1.2}{2008/03/06}{Re-write of units section} +% The upcoming \pkg{si} package\footnote{An improved replacement for +% all of the existing unit packages.} will include the extra +% chemistry units as a loadable modules (\opt{alsoload=synchem}). A +% series of checks are therefore made before any definitions are +% given. If \pkg{si} is loaded, the necessary part of that package is +% loaded; the \cs{si@requirecfgs} macro from that package is used. +% The \cs{makeatletter} macro is needed here as otherwise the +% configuration file is loaded with the wrong category codes. +% \begin{macrocode} +\AtBeginDocument{ + \@ifpackageloaded{si} + {\makeatletter + \si@requirecfgs{synchem} + \makeatother} +% \end{macrocode} %\begin{macro}{\cmc} %\begin{macro}{\Hz} +% Neither \pkg{unitsdef} nor \pkg{SIunits} define these two macros. +% \begin{macrocode} + {\newcommand*{\cmc}{\cubiccentimeter} + \newcommand*{\Hz}{\hertz} +% \end{macrocode} +%\end{macro} +%\end{macro} +%\begin{macro}{\cubiccentimeter} %\begin{macro}{\Molar} %\begin{macro}{\molar} %\begin{macro}{\mmHg} %\begin{macro}{\mol} -%\changes{v1.0b}{2007/09/04}{New macro} -% A few additional unit types are provides, which |unitsdef| and -% |SIunits| do not provide. Most of these require different set up -% for the two supported packages. +% A check is for the \pkg{unitsdef} package, so that the +% package-dependant definitions can be given. % \begin{macrocode} -\ifcst@si - \newcommand{\cubiccentimeter}{\centi\metre\cubed} - \newcommand{\Molar}{\textsc{m}} - \newcommand{\molar}{\mole\usk\deci\metre\rpcubed} - \newcommand{\mmHg}{\milli\metre~Hg} - \newcommand{\mol}{\mole} -\else - \newunit{\cubiccentimeter}{\cm\unitsuperscript{3}} - \newunit{\Molar}{\textsc{m}} - \newunit{\molar}{\mole\unitsep\dm\unitsuperscript{--3}} - \newunit{\mmHg}{mm\unitsep{}Hg} - \newunit{\mol}{\mole} -\fi -\newcommand{\cmc}{\cubiccentimeter} -\newcommand{\Hz}{\hertz} + \@ifpackageloaded{unitsdef} + {\newunit{\cubiccentimeter}{\cm\unitsuperscript{3}} + \newunit{\Molar}{\textsc{m}} + \newunit{\molar}{\mole\unitsep\dm\unitsuperscript{--3}} + \newunit{\mmHg}{mmHg} + \newunit{\mol}{\mole}} +% \end{macrocode} +% Two checks are made for \pkg{SIunits} to allow for odd +% capitalisation. If it is not found, then the package is +% loaded.\footnote{This will change when \pkg{si} reaches version +% 1.0.} +% \begin{macrocode} + {\@ifpackageloaded{SIunits}{} + {\@ifpackageloaded{siunits}{} + {\RequirePackage{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}}}} % \end{macrocode} %\end{macro} %\end{macro} %\end{macro} %\end{macro} %\end{macro} -%\end{macro} -%\end{macro} +% +%\subsection{Standard state symbol} %\begin{macro}{\cst@varnothing} %\changes{v1.1}{2007/09/17}{New macro} %\begin{macro}{\standardstate} -% In a very similar vein, the ``standard state'' symbol is handy. -% This is produced by rotating the ``varnothing'' symbol from the -% \textsc{ams} set. Note that the rotation angle here has been -% carefully checked, but is set by eye. The symbol is loaded directly -% here, rather than using the |amssymb| package, to avoid any -% clashes. +% The ``standard state'' symbol is handy. This is produced by +% rotating the ``varnothing'' symbol from the \textsc{ams} set. Note +% that the rotation angle here has been carefully checked, but is set +% by eye. The symbol is loaded directly here, rather than using the +% \pkg{amssymb} package, to avoid any clashes. %\changes{v1.1c}{2007/09/23}{Definition only occurs if user does not % have own version} %\changes{v1.1c}{2007/09/23}{Altered angle of rotation for better @@ -782,17 +892,99 @@ %\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. +% \begin{macrocode} +\newcommand*{\cst@radical}[2]{% + \expandafter\DeclareRobustCommand\expandafter*\expandafter{% + \csname #1#2\endcsname}{% +% \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 +% \end{macrocode} +%\end{macro} +%\end{macro} +%\end{macro} +% The final check is for a prefix, which is easiest to do here. +% \begin{macrocode} + \ifcst@radprefix + \cst@super{\cst@emph{#1}}\cst@hyphen#2% + \else + #2\cst@hyphen\cst@super{\cst@emph{#1}}% + \fi + \cst@xspace}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\cst@xspace} +%\changes{v1.2}{2008/03/07}{New definition} +% A re-useable \cs{xspace}-based macro. +% \begin{macrocode} +\newcommand*{\cst@xspace}{% + \ifcst@xspace + \expandafter\xspace% + \fi} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\nPr} +%\begin{macro}{\iPr} +%\begin{macro}{\nBu} +%\begin{macro}{\iBu} +%\begin{macro}{\sBu} +%\begin{macro}{\tBu} +% With a mechanism in place, the abbreviations are declared. The +% format of the resulting output will depend upon the configuration +% file used. +% \begin{macrocode} +\cst@radical{n}{Pr}% +\cst@radical{i}{Pr}% +\cst@radical{n}{Bu}% +\cst@radical{i}{Bu}% +\cst@radical{s}{Bu}% +\cst@radical{t}{Bu}% +% \end{macrocode} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +% %\subsection{Float formatting} % The next step is to format the floats correctly. Unfortunately, -% |memoir| does not provide all of the commands needed to achieve -% this. Thus the |float| package is needed; in order to load it, the -% \cmd{\newfloat} command in |memoir| is killed off. The -% |chemscheme| package does not load |float| when |memoir| is being -% used, because creating a new float type is catered for directly -% by |memoir|. Unfortunately, the |memoir| system isn't flexible -% enough for what is needed by |chemstyle|, so the hard work of -% |chemscheme| is undone here! For other document classes, |float| -% will already have been loaded by |chemscheme|. +% \pkg{memoir} does not provide all of the commands needed to achieve +% this. Thus the \pkg{float} package is needed; in order to load it, +% the \cs{newfloat} command in \pkg{memoir} is killed off. The +% \pkg{chemscheme} package does not load \pkg{float} when +% \pkg{memoir} is being used, because creating a new float type is +% catered for directly by \pkg{memoir}. Unfortunately, the +% \pkg{memoir} system isn't flexible enough for what is needed by +% \currpkg, so the hard work of \pkg{chemscheme} is undone here! For +% other document classes, \pkg{float} will already have been loaded +% by \pkg{chemscheme}. % \begin{macrocode} \@ifclassloaded{memoir} {\let\newfloat\@undefined @@ -814,179 +1006,96 @@ \floatplacement{figure}{htbp} % \end{macrocode} % The contents of floats are centred by default, using the hook -% from the |chemstyle| package. +% from the \pkg{chemscheme} package. % \begin{macrocode} \floatcontentscentre % \end{macrocode} % %\subsection{Cross-references} %\changes{v1.1g}{2007/10/19}{Fixed problem with cross-referencing -% when \texttt{babel} is not loaded} +% when \pkg{babel} is not loaded} % The naming for cross-references is sorted out properly using the -% |varioref| package. +% \pkg{varioref} package. % \begin{macrocode} -\AtBeginDocument{% - \labelformat{scheme}{\schemename~#1}} +\labelformat{scheme}{\schemename~#1} \labelformat{figure}{\figurename~#1} \labelformat{table}{\tablename~#1} % \end{macrocode} % -% \subsection{Latin words} -% +% \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 \cmd{\latin} command \emph{only} -% if the user does not have their own version. This is achieved -% here, with precautions taken to ensure the user can define -% their own \cmd{\latin} command \emph{after} loading |chemstyle| -% and still have everything work properly. -% \begin{macrocode} -\let\latinemphon\relax -\let\latinemphoff\relax -\let\cst@latin\relax -\ifcst@phrases - \newcommand{\latinemphon}{\let\cst@latin\emph} - \newcommand{\latinemphoff}{\let\cst@latin\relax} - \AtBeginDocument{% - \providecommand\latin{\cst@latin} - } -\fi -\latinemphon -% \end{macrocode} -%\end{macro} -%\end{macro} -%\end{macro} -%\end{macro} -% -% In ACS journals, the abbreviations ``\eg'' and ``\ie'' are always -% followed by a comma. In order to provide an automated way to do -% this, a series of macros are needed to test the punctuation -% trailing the macro names. Firstly, a switch is provided for the -% journal style files. -% \begin{macrocode} -\newif \ifcst@comma \cst@commafalse -% \end{macrocode} -% The implementation of the testing code is delayed until the -% beginning of the document to allow the switching to occur. First -% the case where a comma is needed is handled. -% \begin{macrocode} -\AtBeginDocument{% - \ifcst@comma -% \end{macrocode} -%\begin{macro}{\cst@punct} -% The \cmd{\cst@punct} macro holds the comma-containing punctuation -% to be added. -% \begin{macrocode} - \def\cst@punct{.,\cst@xspace} -% \end{macrocode} -%\end{macro} -%\begin{macro}{\cst@addpunct} -%\changes{v1.1}{2007/09/17}{New macro} -%\changes{v1.1f}{2007/10/14}{No longer used when comma not required} -%\begin{macro}{\cst@add@punct} -%\changes{v1.1}{2007/09/17}{New macro} -%\begin{macro}{\cst@add@punct@} -%\changes{v1.1}{2007/09/17}{New macro} -% The following macros are very closely based on those in the |cite| -% package used for moving citations after punctuation. The first -% macro is used as an initial hook. Notice that \cmd{\relax} is -% essential here, as it provides an argument for \cmd{\cst@add@punct} -% in the first round of checking. -% \begin{macrocode} - \def\cst@addpunct{% - \cst@add@punct\relax% - } -% \end{macrocode} -% Here, a plain TeX \cmd{\futurelet} is used to test the next -% character. Notice that this macro takes a single argument, which is -% used to recursively gobble up punctuation. -% \begin{macrocode} - \def\cst@add@punct#1{% - \futurelet\@tempa\cst@add@punct@% - } -% \end{macrocode} -% The checking occurs here. If a match is made, then the process is -% repeated to allow the punctuation to be gobbled. -% \begin{macrocode} - \def\cst@add@punct@{% - \ifx\@tempa.% - \let\@tempb\cst@add@punct% - \else - \ifx\@tempa,% - \let\@tempb\cst@add@punct% -% \end{macrocode} -% No match, and so new punctuation is to be added and the loop ended. +% 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{macrocode} - \else - \let\@tempb\cst@punct% - \fi - \fi - \@tempb% - } - \fi -} +\newcommand*{\cst@latin}{% + \ifcst@abbremph + \expandafter\emph% + \fi} +\newcommand*{\latinemphon}{\cstsetup{abbremph=true}} +\newcommand*{\latinemphoff}{\cstsetup{abbremph=false}} +\AtBeginDocument{\providecommand*\latin{\cst@latin}} % \end{macrocode} %\end{macro} %\end{macro} %\end{macro} -% -%\begin{macro}{\cst@xspace} -% The use of |xspace| is optional; this is handled using a package -% option and the internal macro \cmd{\cst@xspace}. -% \begin{macrocode} -\ifcst@xspace - \RequirePackage{xspace} - \let\cst@xspace\xspace -\else - \let\cst@xspace\relax -\fi -% \end{macrocode} %\end{macro} -% %\begin{macro}{\etc} %\begin{macro}{\invacuo} %\begin{macro}{\etal} %\changes{v1.1f}{2007/10/14}{Fixed problem with full stop spacing} %\begin{macro}{\eg} -%\changes{v1.1}{2007/09/17}{Adds comma for ACS journals} +%\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 ACS journals} +%\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 \cmd{\xspace} command deals with any problems of spacing. +% 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 \cmd{\providecommand} +% are performed. All of these functions use \cs{providecommand} % to avoid standing on the user's own versions, if they exist. % \begin{macrocode} \ifcst@phrases \AtBeginDocument{ - \providecommand{\etc}% + \providecommand*{\etc} {\@ifnextchar.{\cst@etc}{\cst@etc.\cst@xspace}} - \providecommand{\invacuo}% + \providecommand*{\invacuo} {\latin{in vacuo}\cst@xspace} - \providecommand{\etal}% + \providecommand*{\etal} {\@ifnextchar.{\cst@etal}{\cst@etal.\cst@xspace}} - \ifcst@comma - \providecommand{\eg}% - {\cst@eg\cst@addpunct} - \providecommand{\ie}% - {\cst@ie\cst@addpunct} - \else - \providecommand{\eg}% - {\@ifnextchar.{\cst@eg}{\cst@eg.\cst@xspace}} - \providecommand{\ie}% - {\@ifnextchar.{\cst@ie}{\cst@ie.\cst@xspace}} - \fi - } -\fi + \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}}} % \end{macrocode} % \end{macro} % \end{macro} @@ -1006,158 +1115,251 @@ % cannot come at the end of a sentence, they are designed to give % only an inter-word space. % \begin{macrocode} -\def\cst@etal{\latin{et~al}} -\def\cst@etc{\latin{etc}} -\def\cst@ie{\latin{i.e\spacefactor999\relax}} -\def\cst@eg{\latin{e.g\spacefactor999\relax}} +\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} -% -% \subsection{Handling section naming} -% -% First, a new if is needed to differentiate between ``Notes and -% References'' and ``References and Notes.'' +%\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{macrocode} -\newif \ifcst@notesbefore \cst@notesbeforetrue +\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}} % \end{macrocode} -% \begin{macro}{\cst@name@refs} -% To keep life simple in the main macro, and to save on redundant -% code, the ordering of ``Notes,'' ``and'' and ``References'' is -% handled here. +%\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} -\def\cst@name@refs#1#2#3{% - \ifcst@notesbefore - #3\space#2\space#1% +\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{macrocode} +\newcommand*{\cst@add@punct}[1]{% + \futurelet\cst@tempa\cst@add@punct@} +% \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. +% \begin{macrocode} +\newcommand*{\cst@add@punct@}{% + \ifx.\cst@tempa + \let\cst@tempb\cst@add@punct \else - #1\space#2\space#3% + \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 \fi -} + \cst@tempb} % \end{macrocode} -% \end{macro} -% \begin{macro}{\cst@language} -% The default language of the document is probably English. However, -% this is alterable if needed, as it is not set in stone. -% Anyone needing to mess with this is probably happy using -% \cmd{\makeatletter}, so the command is kept out of user space. +%\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. % \begin{macrocode} -\def\cst@language{english} +\newcommand*{\cst@commapunct}{.,\cst@xspace} % \end{macrocode} -% \end{macro} -% \begin{macro}{\cst@refsection} -%\changes{v1.1g}{2007/10/19}{Changed to use \cs{@ifundefined}} -% The existence of a suitable reference section name command is -% checked here. Some document classes (\eg\ minimal) may not define -% a suitable command. Assuming that is not the case, -% \cmd{\cst@refsection} is used to store the name of the macro -% holding the references section. +%\end{macro} +% +%\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} % \begin{macrocode} -\@ifundefined{refname}{% - \@ifundefined{bibname}{% - \PackageWarning{chemstyle}% - {No bibliography name command defined in document class}% - \def\cst@namerefs#1#2#3#4{}% - }{% - \def\cst@refsection{\bibname}% - } -}{% - \def\cst@refsection{\refname}% -} +\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}}} % \end{macrocode} -% \end{macro} -% \begin{macro}{\cst@namerefs} -%\changes{v1.1g}{2007/10/19}{Changed to use \cs{@ifundefined}} -% \begin{macro}{\cst@language@check} -% The main macro of the heading-altering section takes four -% arguments, \marg{language}, \marg{references}, \marg{and} -% and \marg{notes}. The first is the |babel| label for the language -% that the words are four, and the other three parameters and the -% words ``References'', ``and'' and ``Notes'', respectively. +% +% \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). % \begin{macrocode} -\@ifundefined{cst@namerefs}{% - \def\cst@namerefs#1#2#3#4{% - \ifcst@notes% +\begingroup + \@ifundefined{chapter} + {\@ifundefined{refname} + {\PackageInfo{chemstyle} + {No bibliography name command found} + \cstsetup{notes=false}} + {\gdef\cst@refsec{\refname}}} + {\gdef\cst@refsec{\bibname}} +\endgroup % \end{macrocode} -% The non-|babel| version of the function only does anything if the -% language passed in |#1| is the default document language (probably -% English). The check for this needs the macro -% \cmd{\cst@language@check} to get |\ifx| to behave as desired. +%\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{macrocode} - \def\cst@language@check{#1} - \ifx\cst@language\cst@language@check - \expandafter\renewcommand\expandafter{\cst@refsection}% - {\cst@name@refs{#2}{#3}{#4}}% - \fi +\ifcst@autonotes + \AtBeginDocument{ + \@ifpackageloaded{notes2bib}{} + {\newcounter{bibnote}}} +\fi % \end{macrocode} -% To ensure that things work whether |babel| is loaded or not, a few -% hoops have to be jumped through. Altering the |babel| strings is -% delayed until the start of the document, in case |babel| is loaded -% after |chemstyle|. There is also a complication that MikTeX -% defines \cmd{\languagename} even if |babel| is not loaded. This -% may contain an undesired value, and so the presence of |babel| -% needs to be tested for to avoid strange errors. +%\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. % \begin{macrocode} - \AtBeginDocument{% - \@ifpackageloaded{babel}{% - \expandafter\addto\expandafter{\csname captions#1\endcsname}% - {\expandafter\renewcommand\expandafter{\cst@refsection}% - {\cst@name@refs{#2}{#3}{#4}}}% - \expandafter\selectlanguage\expandafter{\languagename}} - {}} - \else% - \ifx#1\cst@language - \expandafter\renewcommand\expandafter{\cst@refsection}{#2}% +\newcommand*{\cst@refname}{% + \ifcst@notes + \ifcst@autonotes + \ifnum\the\value{bibnote}>\z@ + \expandafter\expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\cst@ref@name% + \else + \expandafter\expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\cst@ref@name@% \fi - \AtBeginDocument{% - \@ifpackageloaded{babel}{% - \expandafter\addto\expandafter{\csname captions#1\endcsname}% - {\expandafter\renewcommand\expandafter{\cst@refsection}{#2}}% - \expandafter\selectlanguage\expandafter{\languagename}}% - {}} - \fi% - } -}{} + \else + \expandafter\expandafter\expandafter\cst@ref@name% + \fi + \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} % \end{macrocode} -% \end{macro} -% \end{macro} -% Finally, default names are loaded for a range of languages. Most +%\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. +% \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 +% \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. +% \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}}} +% \end{macrocode} +%\end{macro} +% To make sure the changes are applied \emph{now}, the current +% language is re-selected. +% \begin{macrocode} + \expandafter\selectlanguage\expandafter{\languagename}} + {}}}}} +% \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{macrocode} -\cst@namerefs{english}{References}{and}{Notes} -\cst@namerefs{UKenglish}{References}{and}{Notes} -\cst@namerefs{ngerman}{Literatur}{und}{Notizen} -\cst@namerefs{german}{Literatur}{und}{Notizen} -\cst@namerefs{french}{R\'ef\'erences}{et}{Notes} -\cst@namerefs{frenchb}{R\'ef\'erences}{et}{Notes} +\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} % \end{macrocode} % -% \subsection{Loading the style definition} -% -% The style definition is loaded here, once else everything is in -% place. A style must be loaded, so a default is provided to be on -% the safe side. The journal style file must have extension -% |.jdf|. -%\changes{v1.1b}{2007/09/19}{Load \texttt{caption} even when -% journal style does not exist} -% \begin{macrocode} -\ifx\cst@option\relax - \PackageWarning{chemstyle} - {You didn't say which style to use \MessageBreak - Defaulting to the ``no change'' style: none} - \def\cst@option{none} -\fi -\InputIfFileExists{\cst@option.jdf} - {\PackageInfo{chemstyle} - {Loaded \cst@option.jdf}} - {\PackageWarning{chemstyle} - {Required style \cst@option\space does not exist}} -% \end{macrocode} % \iffalse %</package> % \fi @@ -1183,12 +1385,13 @@ \AtBeginDocument{% \renewcommand{\figurename}{Fig.}} \captionsetup{labelsep=quad,labelfont=bf} -\let\cst@emph\emph -\def\cst@hyph{-} -\let\cst@super\relax -\cst@prefixtrue -\latinemphon -\cst@commafalse +\setkeys[cst]{opt}{ + radprefix=true, + rademph=true, + radsuper=false, + radhyphen=true, + abbremph=true, + abbrcomma=false} % \end{macrocode} % \iffalse %</rsc> @@ -1202,12 +1405,13 @@ \ProvidesFile{angew.def}[2007/10/31 v1.1h] \captionsetup{labelsep=period,labelfont={bf,it},font=sf,singlelinecheck=off} \captionsetup[table]{labelsep=colon} -\let\cst@emph\emph -\def\cst@hyph{} -\let\cst@super\relax -\cst@prefixtrue -\latinemphoff -\cst@commafalse +\setkeys[cst]{opt}{ + radprefix=true, + rademph=true, + radsuper=false, + radhyphen=false, + abbremph=false, + abbrcomma=false} % \end{macrocode} % \iffalse %</angew> @@ -1222,12 +1426,14 @@ \captionsetup[table]{labelsep=newline,singlelinecheck=off} \AtBeginDocument{% \renewcommand{\figurename}{Fig.}} -\let\cst@emph\emph -\def\cst@hyph{} -\let\cst@super\textsuperscript -\cst@prefixtrue -\latinemphoff -\cst@commafalse +\setkeys[cst]{opt}{ + radprefix=true, + rademph=true, + radsuper=true, + radhyphen=false, + abbremph=false, + abbrcomma=false, + notesbefore=true} % \end{macrocode} % \iffalse %</jomc> @@ -1239,12 +1445,14 @@ % \begin{macrocode} \ProvidesFile{tetlett.def}[2007/10/31 v1.1h] \captionsetup{labelsep=period,singlelinecheck=off,labelfont=bf} -\let\cst@emph\emph -\def\cst@hyph{-} -\let\cst@super\relax -\cst@prefixtrue -\latinemphoff -\cst@commatrue +\setkeys[cst]{opt}{ + radprefix=true, + rademph=true, + radsuper=false, + radhyphen=true, + abbremph=false, + abbrcomma=true, + notesbefore=true} % \end{macrocode} % \iffalse %</tetlett> @@ -1258,16 +1466,18 @@ \captionsetup{labelfont={bf,it,sf},textfont=sf,labelsep=perquad} \captionsetup[figure]{textfont=rm} \captionsetup{singlelinecheck=off} -\let\cst@emph\emph -\def\cst@hyph{} -\let\cst@super\textsuperscript -\cst@prefixtrue +\setkeys[cst]{opt}{ + radprefix=true, + rademph=true, + radsuper=true, + radhyphen=false, + abbremph=false, + abbrcomma=true, + notesbefore=true} \floatstyle{plaintop} \restylefloat{scheme} \floatstyle{plain} -\latinemphoff \cst@notesbeforefalse -\cst@commatrue % \end{macrocode} % \iffalse %</jacs> @@ -1295,16 +1505,18 @@ \captionsetup{font=bf,labelsep=colon,format=labelcaps} \captionsetup[figure]{format=plain,textfont=md,labelsep=period} \captionsetup{singlelinecheck=off} -\let\cst@emph\emph -\def\cst@hyph{} -\let\cst@super\textsuperscript -\cst@prefixtrue +\setkeys[cst]{opt}{ + radprefix=true, + rademph=true, + radsuper=false, + radhyphen=false, + abbremph=false, + abbrcomma=true, + notesbefore=true} \floatstyle{plaintop} \restylefloat{scheme} \floatstyle{plain} -\latinemphoff \cst@notesbeforefalse -\cst@commatrue % \end{macrocode} %\iffalse %</jpc> @@ -1319,44 +1531,50 @@ % \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 +% style, an additional macro is provided. The purple colour looks % about right for matching the printed journal, but if anyone has a % better suggestion please let the package author know. % \begin{macrocode} \newcommand*{\OrgLettColour}{purple} % \end{macrocode} %\end{macro} +%\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 |ruled| style from the |float| package. +% on the \texttt{ruled} style from the \pkg{float} package. % \begin{macrocode} -\newcommand\fs@orglett{\def\@fs@cfont{\bfseries} +\newcommand*{\fs@orglett}{% + \def\@fs@cfont{\bfseries}% \let\@fs@capt\floatc@ruled \def\@fs@pre{\begingroup\color{\OrgLettColour} \hrule height12pt depth0pt \kern2pt\endgroup}% % \end{macrocode} -% This is the same \cmd{\@fs@mid} as is used in the |float| package -% for |plaintop| floats. +% This is the same \cs{@fs@mid} as is used in the \pkg{float} package +% for \texttt{plaintop} floats. % \begin{macrocode} \def\@fs@mid{\vspace\belowcaptionskip\relax}% \def\@fs@post{\begingroup\color{\OrgLettColour}\kern2pt \hrule height1.5pt depth0pt\endgroup}% \let\@fs@iftopcapt\iftrue} % \end{macrocode} +%\end{macro} +%\begin{macro}{\fs@orglettfig} % Figures need to be slightly different, so an almost identical % command is needed. % \begin{macrocode} -\newcommand\fs@orglettfig{\def\@fs@cfont{\bfseries} +\newcommand*{\fs@orglettfig}{% + \def\@fs@cfont{\bfseries}% \let\@fs@capt\floatc@plain - \def\@fs@pre{\begingroup\color{\OrgLettColour} + \def\@fs@pre{\begingroup\color{\OrgLettColour}% \hrule height12pt depth0pt \kern2pt\endgroup}% \def\@fs@mid{\vspace\abovecaptionskip\relax}% \def\@fs@post{\begingroup\color{\OrgLettColour}\kern2pt \hrule height1.5pt depth0pt\endgroup}% \let\@fs@iftopcapt\iffalse} % \end{macrocode} +%\end{macro} % The new style is now applied. Users can change back to normal -% floats by changing back to the |plain| style. +% floats by changing back to the \texttt{plain} style. % \begin{macrocode} \floatstyle{orglettfig} \restylefloat{figure} @@ -1368,19 +1586,20 @@ % \begin{macrocode} \DeclareCaptionLabelSeparator{perquad}{.\quad} \captionsetup{labelfont=bf,labelsep=perquad} -\let\cst@emph\emph -\def\cst@hyph{} -\let\cst@super\textsuperscript -\cst@prefixtrue -\latinemphoff +\setkeys[cst]{opt}{ + radprefix=true, + rademph=true, + radsuper=true, + radhyphen=false, + abbremph=false, + abbrcomma=true, + notesbefore=true} \cst@notesbeforefalse -\cst@commatrue % \end{macrocode} % \iffalse %</orglett> %<*none> %\fi -% %\subsection{The empty style --- none} % To allow the user to load the extra macros provided here without % any style changes, a ``do nothing'' style is provided. It simply @@ -1391,7 +1610,6 @@ % notice that captions will be placed below floats even if the % \cmd{\caption} command appears above the contents of the floating % environment. -% % \begin{macrocode} \ProvidesFile{none.jdf}[2007/10/31 v1.1h] \floatstyle{plain} @@ -1411,29 +1629,18 @@ % \Finale %\iffalse %<*jawltxdoc> -% The following is convenient method for collecting together package -% loading, formatting commands and new macros used to format |dtx| -% files written by the current author. It is based on the similar -% files provided by Will Robertson in his packages and Heiko Oberdiek -% as a stand-alone package. Notice that it is not intended for other -% users: there is no error checking! However, it is covered by the -% LPPL in the same way as the rest of this package. -% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{jawltxdoc} - [2007/10/14 v1.0b] -% First of all, a number of support packages are loaded. \usepackage[T1]{fontenc} \usepackage[english,UKenglish]{babel} \usepackage[scaled=0.95]{helvet} \usepackage[version=3]{mhchem} \usepackage[final]{microtype} \usepackage[osf]{mathpazo} -\usepackage{booktabs,array,url,graphicx,courier,unitsdef} -\usepackage{upgreek,ifpdf,listings} -% If using PDFLaTeX, the source will be attached to the PDF. This -% is basically the system used by Heiko Oberdiek, but with a check -% that PDF mode is enabled. +\usepackage{booktabs,array,url,graphicx,courier,xspace} +\usepackage{upgreek,ifpdf,listings,float,caption,longtable} +\floatstyle{plaintop} +\restylefloat{table} \ifpdf \usepackage{embedfile} \embedfile[% @@ -1442,19 +1649,15 @@ desc={LaTeX docstrip source archive for package `\jobname'}% ]{\jobname.dtx} \fi -\usepackage{\jobname} +\IfFileExists{\jobname.sty} + {\usepackage{\jobname}}{} \usepackage[numbered]{hypdoc} -% -% To typeset examples, a new environment is needed. The code below -% is based on that in used by |listings|, but is modified to get -% better formatting for this context. The formatting of the output -% is basically that in Will Robertson's |dtx-style| file. \newlength\LaTeXwidth \newlength\LaTeXoutdent \newlength\LaTeXgap \setlength\LaTeXgap{1em} \setlength\LaTeXoutdent{-0.15\textwidth} -\def\typesetexampleandcode{% +\newcommand*{\typesetexampleandcode}{% \begin{list}{}{% \setlength\itemindent{0pt} \setlength\leftmargin\LaTeXoutdent @@ -1471,7 +1674,7 @@ \end{minipage}% \end{list} } -\def\typesetcodeandexample{% +\newcommand*{\typesetcodeandexample}{% \begin{list}{}{% \setlength\itemindent{0pt} \setlength\leftmargin{0pt} @@ -1484,7 +1687,7 @@ \lst@sampleInput \end{list} } -\def\typesetfloatexample{% +\newcommand*{\typesetfloatexample}{% \begin{list}{}{% \setlength\itemindent{0pt} \setlength\leftmargin{0pt} @@ -1497,7 +1700,7 @@ \end{minipage}% \end{list} } -\def\typesetcodeonly{% +\newcommand*{\typesetcodeonly}{% \begin{list}{}{% \setlength\itemindent{0pt} \setlength\leftmargin{0pt} @@ -1516,25 +1719,16 @@ \let\typesetexample#1 \global\let\lst@intname\@empty \setbox\lst@samplebox=\hbox\bgroup - \setkeys{lst}{language=[LaTeX]{TeX},tabsize=4,gobble=2,% - breakindent=0pt,basicstyle=\small\ttfamily,basewidth=0.51em,% - keywordstyle=\color{blue},% -% Notice that new keywords should be added here. The list is simply -% macro names needed to typeset documentation of the package -% author. - morekeywords={bibnote,citenote,bibnotetext,bibnotemark,% - thebibnote,bibnotename,includegraphics,schemeref,% - floatcontentsleft,floatcontentsright,floatcontentscentre,% - schemerefmarker,compound,schemerefformat,color,% - startchemical,stopchemical,chemical,setupchemical,bottext,% - listofschemes}} + \setkeys{lst}{tabsize=4,gobble=3,breakindent=0pt,% + basicstyle=\small\ttfamily,basewidth=0.51em,% + keywordstyle=\color{blue}} \lst@BeginAlsoWriteFile{\LaTeXexamplefile} }{% \lst@EndWriteFile\egroup \setlength\LaTeXwidth{\wd\lst@samplebox} \typesetexample% } -\def\lst@sampleInput{% +\newcommand*{\lst@sampleInput}{% \MakePercentComment\catcode`\^^M=10\relax \small% {\setkeys{lst}{SelectCharTable=\lst@ReplaceInput{\^\^I}% @@ -1542,6 +1736,41 @@ \leavevmode \input{\LaTeXexamplefile}}% \MakePercentIgnore% } -\hyphenation{PDF-LaTeX} +\def\DescribeOption{\leavevmode\@bsphack\begingroup\MakePrivateLetters + \Describe@Option} +\def\Describe@Option#1{\endgroup + \marginpar{\raggedleft\PrintDescribeEnv{#1}}% + \SpecialOptionIndex{#1}\@esphack\ignorespaces} +\def\SpecialOptionIndex#1{\@bsphack + \index{#1\actualchar{\protect\ttfamily#1} + (option)\encapchar usage}% + \index{options:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar + usage}\@esphack} +\newcommand*{\pkg}[1]{\textsf{#1}} +\newcommand*{\currpkg}{\pkg{\jobname}\xspace} +\newcommand*{\opt}[1]{\texttt{#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*{\AMS}{{\protect\usefont{OMS}{cmsy}{m}{n}% + A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}} +\providecommand*{\eTeX}{\ensuremath{\varepsilon}-\TeX} +\newcommand*{\XeTeX} + {X\kern-.125em\lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\TeX} %</jawltxdoc> %\fi diff --git a/Master/texmf-dist/source/latex/chemstyle/chemstyle.ins b/Master/texmf-dist/source/latex/chemstyle/chemstyle.ins index 6e2a49e598c..49063a4b317 100644 --- a/Master/texmf-dist/source/latex/chemstyle/chemstyle.ins +++ b/Master/texmf-dist/source/latex/chemstyle/chemstyle.ins @@ -9,7 +9,7 @@ %% The chemstyle package --- Writing chemistry with style %% 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 %% ---------------------------------------------------------------- %% @@ -21,17 +21,17 @@ The chemstyle package --- Writing chemistry with style 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 ---------------------------------------------------------------- \endpreamble \Msg{Generating chemstyle files:} -\usedir{tex/latex/contib/chemstyle} +\usedir{tex/latex/chemstyle} \generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}} \file{\jobname.sty}{\from{\jobname.dtx}{package}} - \file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}} } +\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}} @@ -43,6 +43,9 @@ } \generate{\file{none.jdf}{\from{chemstyle.dtx}{none}} } +\usedir{doc/latex/chemstyle} +\generate{\file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}} +} \endbatchfile \endinput %% |