From f92b5dd10f840cfa7f2d1d57a12fc7c8eb1983e1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 17 Jul 2008 22:54:25 +0000 Subject: chemstyle 1.3 (17jul08) git-svn-id: svn://tug.org/texlive/trunk@9643 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/chemstyle/chemstyle.dtx | 584 ++++++++++++--------- 1 file changed, 330 insertions(+), 254 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 e4f5ee549dd..2fc5a3c8253 100644 --- a/Master/texmf-dist/source/latex/chemstyle/chemstyle.dtx +++ b/Master/texmf-dist/source/latex/chemstyle/chemstyle.dtx @@ -11,7 +11,7 @@ % 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.'' +% This work has the LPPL maintenance status `maintained.' % % The current maintainer of this work is Joseph Wright. % @@ -19,7 +19,8 @@ % and the derived files chemstyle.ins, % chemstyle.sty, % chemstyle.pdf, -% chemstyle.ltx, +% chemstyle-manual.pdf, +% chemstyle-demo.ltx, % rsc.jdf, % angew.jdf, % tetlett.jdf, @@ -27,8 +28,21 @@ % jacs.jdf, % ic.jdf, % jpc.jdf, -% orglett.jdf and -% none.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 @@ -43,8 +57,6 @@ % makeindex -s gind.ist chemstyle.idx % makeindex -s gglo.ist -o chemstyle.gls chemstyle.glo % pdflatex chemstyle.dtx -% makeindex -s gind.ist chemstyle.idx -% makeindex -s gglo.ist -o chemstyle.gls chemstyle.glo % pdflatex chemstyle.dtx % (b) With write18 enabled: % pdflatex chemstyle.dtx @@ -52,14 +64,15 @@ % 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, mpm --update-db, +% 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. +% 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 @@ -77,7 +90,7 @@ \askforoverwritefalse \preamble ---------------------------------------------------------------- - The chemstyle package --- Writing chemistry with style + 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 @@ -86,9 +99,14 @@ \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}} - \file{\jobname.sty}{\from{\jobname.dtx}{package}} } \usedir{tex/latex/chemstyle/config} \generate{\file{rsc.jdf}{\from{chemstyle.dtx}{rsc}} @@ -102,11 +120,39 @@ } \generate{\file{none.jdf}{\from{chemstyle.dtx}{none}} } +\nopreamble\nopostamble \usedir{doc/latex/chemstyle} -\generate{\file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}} +\generate{\file{chemstyle-demo.ltx}{\from{\jobname.dtx}{demo}} + \file{README.txt}{\from{\jobname.dtx}{readme}} } \endbatchfile % +%<*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 +See http://www.latex-project.org/lppl.txt +---------------------------------------------------------------- + +The chemstyle bundle provides two packages: chemstyle and +chemscheme. Both are intended to help chemists create floating +graphics and match published styles. + +The 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 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. +% %<*ignore> \fi % Will Robertson's trick @@ -115,13 +161,12 @@ % %<*driver> \PassOptionsToClass{a4paper}{article} -\documentclass[englih,UKenglish]{ltxdoc} +\documentclass[german,english,UKenglish]{ltxdoc} \EnableCrossrefs \CodelineIndex \RecordChanges %\OnlyDescription -% The various formatting commands used in this file are collected -% together in jawltxdoc. +\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 @@ -136,7 +181,7 @@ % % \fi % -%\CheckSum{0} +%\CheckSum{636} % % \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 @@ -181,9 +226,9 @@ %\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,unit,standardstate,iPr,nPr,nBu,sBu,tBu,iBu,% -% cstsetup,latin,eg,ie,etc,invacuo,etal,floatstyle,restylefloat,% +%\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} @@ -212,10 +257,12 @@ %\DoNotIndex{\ProvidesFile,\ProvidesPackage,\quad,\refname,\relax} %\DoNotIndex{\renewcommand,\RequirePackage,\restylefloat,\rotatebox} %\DoNotIndex{\rpcubed,\schemename,\selectlanguage,\setkeys} -%\DoNotIndex{\si@requirecfgs,\space,\spacefactor,\tablename,\textsc} +%\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.}} @@ -335,8 +382,13 @@ % 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. +% 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}. % %\section{Naming of the references section} % \currpkg alters the naming of the references section of a document. @@ -378,26 +430,19 @@ %\DescribeMacro{\cmc} % 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. +% 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} -% \unit{10}{\Hz}\\ -% \unit{20}{\mmHg}\\ -% \unit{30}{\molar}\\ -% \unit{40}{\Molar}\\ -% \unit{50}{\cmc} +% \SI{10}{\Hz}\\ +% \SI{20}{\mmHg}\\ +% \SI{30}{\molar}\\ +% \SI{40}{\Molar}\\ +% \SI{50}{\cmc} %\end{LaTeXexample} % -% The \pkg{siunitx} package is currently under development as a -% replacement for \pkg{SIunits} and \pkg{unitsdef}.\footnote{By the -% maintainer of \currpkg.} \pkg{siunitx} 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{siunitx} 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 @@ -532,23 +577,27 @@ % chemistry documents. % %\subsection{Captions above floats} -% 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] +% 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 +% 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 +% 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 +% following code is appropriate. +% +%\begin{LaTeXexample}[float] +% \begin{table}[ht] % The float contents % \caption{A caption below the float contents in the source} % \end{table} -% \floatstyle{plain} -% \restylefloat{table} -% \begin{table}[h] +% \floatsetup[table]{style=plain} % When using floatrow +% % \floatstyle{plain} +% % \restylefloat{table} When using float +% \begin{table}[ht] % The second float contents, which should be above the caption % \caption{A second caption below the float contents % in the source} @@ -562,24 +611,27 @@ % 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. 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,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[colorlinks]{hyperref} -% \begin{document} -% Document contents go here -% \end{document} -%\end{LaTeXexample} -%\edef\LaTeXexamplefile{\jobname.tmp} +% follows. +%\iffalse +%<*demo> +%\fi +% \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[extrarun=on]{auto-pst-pdf} +\usepackage[colorlinks]{hyperref} +\begin{document} + Document contents go here +\end{document} +% \end{macrocode} +%\iffalse +% +%\fi % % The versatile \textsc{koma}-script bundle provides more advanced % versions of the standard document classes. If you want paragraphs @@ -630,14 +682,21 @@ %\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. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} +\def\cst@id$#1: #2.#3 #4 #5-#6-#7 #8 #9${% + \def\cst@ver{#5/#6/#7\space v1.3\space}} +\cst@id $Id: chemstyle.dtx 36 2008-07-17 07:39:53Z joseph $ \ProvidesPackage{chemstyle} - [2008/04/14 v1.2b Writing chemistry with style] + [\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} @@ -645,16 +704,7 @@ % Packages that are needed under all circumstances are loaded here. % There are some limitations on the age of \pkg{xkeyval}. % \begin{macrocode} -\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{xkeyval}[2005/05/07] \RequirePackage{graphicx,varioref,caption,xspace} % \end{macrocode} %\begin{macro}{\cst@tempa} @@ -679,6 +729,7 @@ % \end{macrocode} %\end{macro} %\begin{macro}{\ifcst@chemcompounds} +%\begin{macro}{\ifcst@floatrow} %\begin{macro}{\ifcst@xspace} %\begin{macro}{\ifcst@phrases} %\begin{macro}{\ifcst@radprefix} @@ -691,6 +742,7 @@ % The Boolean keys are now defined. % \begin{macrocode} \cst@boolkey{chemcompounds} +\cst@boolkey{floatrow} \cst@boolkey{xspace} \cst@boolkey{phrases} \cst@boolkey{radprefix} @@ -711,6 +763,7 @@ %\end{macro} %\end{macro} %\end{macro} +%\end{macro} %\begin{macro}{\ifcst@notes} %\begin{macro}{\ifcst@autonotes} %\begin{macro}{\cst@tempa} @@ -767,6 +820,7 @@ phrases=true, chemcompounds=true, xspace=true, + floatrow=true, journal=none, radprefix=true, rademph=true, @@ -784,7 +838,11 @@ \ifcst@chemcompounds \PassOptionsToPackage{chemcompounds}{chemscheme} \fi -\RequirePackage{chemscheme} +\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 @@ -794,6 +852,7 @@ \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} @@ -817,64 +876,52 @@ %\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}} -% The upcoming \pkg{siunitx} 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{siunitx} 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{siunitx} - {\makeatletter - \si@requirecfgs{synchem} - \makeatother} -% \end{macrocode} +%\changes{v1.2c}{2008/06/10}{Altered call to \pkg{siunitx} +% function} +%\changes{v1.4}{2008/06/24}{Default to loading \pkg{siunitx}} %\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} -% A check is for the \pkg{unitsdef} package, so that the -% package-dependant definitions can be given. +% 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. % \begin{macrocode} - \@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{siunitx} reaches -% version 1.0.} -% \begin{macrocode} - {\@ifpackageloaded{SIunits}{} - {\@ifpackageloaded{siunits}{} - {\RequirePackage{SIunits}}} - \newcommand*{\cubiccentimeter}{\centi\metre\cubed} +\AtBeginDocument{ + \@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*{\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}}}}} % \end{macrocode} %\end{macro} %\end{macro} %\end{macro} %\end{macro} %\end{macro} +%\end{macro} +%\end{macro} % %\subsection{Standard state symbol} %\begin{macro}{\cst@varnothing} @@ -981,27 +1028,11 @@ %\end{macro} % %\subsection{Float formatting} -% The next step is to format the floats correctly. Unfortunately, -% \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 - \RequirePackage{float}} - {} -% \end{macrocode} -% The standard float types are now restyled to place the captions -% correctly (for most journals). Normally in chemical documents -% the author expects the float to be ``here'' if possible; this is -% therefore set as the default. +% 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{macrocode} \floatstyle{plaintop} \restylefloat{table} @@ -1010,7 +1041,7 @@ \floatplacement{table}{htbp} \floatplacement{figure}{htbp} % \end{macrocode} -% Work with |schemes| needs to be done after \pkg{hyperref} might be +% Work with |scheme|s needs to be done after \pkg{hyperref} might be % loaded. % \begin{macrocode} \AtBeginDocument{ @@ -1227,8 +1258,9 @@ \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}}} + found\MessageBreak This is a core part of + chemstyle\MessageBreak Something is wrong with + the installation}}} % \end{macrocode} % % \subsection{Handling reference section naming} @@ -1290,14 +1322,14 @@ \ifcst@notes \ifcst@autonotes \ifnum\the\value{bibnote}>\z@ - \expandafter\expandafter\expandafter\expandafter\expandafter - \expandafter\expandafter\cst@ref@name% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\cst@ref@name \else - \expandafter\expandafter\expandafter\expandafter\expandafter - \expandafter\expandafter\cst@ref@name@% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\cst@ref@name@ \fi \else - \expandafter\expandafter\expandafter\cst@ref@name% + \expandafter\expandafter\expandafter\cst@ref@name \fi \else \expandafter\cst@ref@name@% @@ -1339,21 +1371,24 @@ \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}}}} + \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}}} + {\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}} + \expandafter\selectlanguage\expandafter{% + \languagename}} {}}}}} % \end{macrocode} %\end{macro} @@ -1394,7 +1429,7 @@ %\changes{v1.1}{2007/09/17}{Fixed (another) error in alkyl formatting} % \begin{macrocode} \ProvidesFile{rsc.jdf} - [2008/04/14 v1.2b RSC journal style] + [\cst@ver RSC journal style] \AtBeginDocument{% \renewcommand{\figurename}{Fig.}} \captionsetup{labelsep=quad,labelfont=bf} @@ -1416,8 +1451,9 @@ % \texttt{angew} option} % \begin{macrocode} \ProvidesFile{angew.def} - [2008/04/14 v1.2b Angew. Chem. journal style] -\captionsetup{labelsep=period,labelfont={bf,it},font=sf,singlelinecheck=off} + [\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, @@ -1436,7 +1472,7 @@ %\changes{v1.1g}{2007/10/19}{Added \texttt{jomc} style} % \begin{macrocode} \ProvidesFile{jomc.def} - [2008/04/14 v1.2b J. Organomet. Chem. journal style] + [\cst@ver J. Organomet. Chem. journal style] \captionsetup{labelsep=period} \captionsetup[table]{labelsep=newline,singlelinecheck=off} \AtBeginDocument{% @@ -1459,7 +1495,7 @@ %\changes{v1.1h}{2007/10/31}{Added \texttt{tetlett} style} % \begin{macrocode} \ProvidesFile{tetlett.def} - [2008/04/14 v1.2b Tetrahedron Lett. journal style] + [\cst@ver Tetrahedron Lett. journal style] \captionsetup{labelsep=period,singlelinecheck=off,labelfont=bf} \setkeys[cst]{opt}{ radprefix=true, @@ -1478,9 +1514,10 @@ %\subsection{\emph{J.~Am.~Chem.~Soc.}~style} % \begin{macrocode} \ProvidesFile{jacs.jdf} - [2008/04/14 v1.2b J. Am. Chem. Soc. journal style] + [\cst@ver J. Am. Chem. Soc. journal style] \DeclareCaptionLabelSeparator{perquad}{.\quad} -\captionsetup{labelfont={bf,it,sf},textfont=sf,labelsep=perquad} +\captionsetup{labelfont={bf,it,sf},textfont=sf, + labelsep=perquad} \captionsetup[figure]{textfont=rm} \captionsetup{singlelinecheck=off} \setkeys[cst]{opt}{ @@ -1506,7 +1543,7 @@ % the work is left to \file{jacs.jdf}. % \begin{macrocode} \ProvidesFile{ic.jdf} - [2008/04/14 v1.2b Inorg. Chem. journal style] + [\cst@ver Inorg. Chem. journal style] \input {jacs.jdf} \captionsetup{textfont=rm} % \end{macrocode} @@ -1519,7 +1556,7 @@ %\changes{v1.0a}{2007/08/23}{Added \emph{J.~Phys.~Chem.}~style} % \begin{macrocode} \ProvidesFile{jpc.jdf} - [2008/04/14 v1.2b J. Phys. Chem. journal style] + [\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} @@ -1546,9 +1583,18 @@ %\changes{v1.0a}{2007/08/23}{Added \emph{Org.~Lett.}~style} % \begin{macrocode} \ProvidesFile{orglett.jdf} - [2008/04/14 v1.2b Org. Lett. journal style] + [\cst@ver Org. Lett. journal style] \RequirePackage{xcolor} % \end{macrocode} +% Currently, this style only works with \pkg{float}. +% \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}} + {} +% \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 @@ -1632,7 +1678,7 @@ % environment. % \begin{macrocode} \ProvidesFile{none.jdf} - [2008/04/14 v1.2b Empty journal style] + [\cst@ver Empty journal style] \floatstyle{plain} \restylefloat{table} \labelformat{figure}{#1} @@ -1654,14 +1700,17 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{jawltxdoc} \usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage[final]{listings,graphicx,microtype} \usepackage[scaled=0.95]{helvet} \usepackage[version=3]{mhchem} -\usepackage[final]{microtype} \usepackage[osf]{mathpazo} -\usepackage{booktabs,array,url,graphicx,courier,xspace,ifmtarg} -\usepackage{upgreek,ifpdf,listings,float,caption,longtable,babel} +\usepackage{booktabs,array,url,courier,xspace,etoolbox,varioref} +\usepackage{upgreek,ifpdf,float,caption,longtable,babel} \floatstyle{plaintop} \restylefloat{table} +\labelformat{figure}{\figurename~#1} +\labelformat{table}{\tablename~#1} \ifpdf \usepackage{embedfile} \embedfile[% @@ -1673,104 +1722,117 @@ \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} -\newcommand*{\typesetexampleandcode}{% +\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} - \lst@sampleInput - \end{minipage}% - \hfill% - \begin{minipage}[c]{\LaTeXwidth}% - \hbox to\linewidth{\box\lst@samplebox\hss}% - \end{minipage}% - \end{list} -} -\newcommand*{\typesetcodeandexample}{% - \begin{list}{}{% - \setlength\itemindent{0pt} - \setlength\leftmargin{0pt} - \setlength\rightmargin{0pt} - } - \item - \begin{minipage}[c]{\LaTeXwidth}% - \hbox to\linewidth{\box\lst@samplebox\hss}% - \end{minipage}% - \lst@sampleInput - \end{list} -} -\newcommand*{\typesetfloatexample}{% + \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}} +\let\LaTeXcodenoexample\LaTeXcodeexample +\newcommand*{\LaTeXcodenoexampleend}{% + \egroup + \setlength\LaTeXwidth{\wd\lst@samplebox}% \begin{list}{}{% \setlength\itemindent{0pt} \setlength\leftmargin{0pt} - \setlength\rightmargin{0pt} - } - \item - \lst@sampleInput - \begin{minipage}[c]{\LaTeXwidth}% - \hbox to\linewidth{\box\lst@samplebox\hss}% - \end{minipage}% - \end{list} -} -\newcommand*{\typesetcodeonly}{% - \begin{list}{}{% - \setlength\itemindent{0pt} - \setlength\leftmargin{0pt} - \setlength\rightmargin{0pt} - } - \item - \begin{minipage}[c]{\LaTeXwidth}% - \hbox to\linewidth{\box\lst@samplebox\hss}% - \end{minipage}% - \end{list} -} -\edef\LaTeXexamplefile{\jobname.tmp} -\lst@RequireAspects{writefile} -\newbox\lst@samplebox -\lstnewenvironment{LaTeXexample}[1][\typesetexampleandcode]{% - \let\typesetexample#1 - \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{blue}} - \lst@BeginAlsoWriteFile{\LaTeXexamplefile} -}{% - \lst@EndWriteFile\egroup - \setlength\LaTeXwidth{\wd\lst@samplebox} - \typesetexample% -} -\newcommand*{\lst@sampleInput}{% + \setlength\rightmargin{0pt}}% + \item + \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}} +\newcommand*{\LaTeXcodefloatend}{% \MakePercentComment\catcode`\^^M=10\relax - \small% + \small {\setkeys{lst}{SelectCharTable=\lst@ReplaceInput{\^\^I}% {\lst@ProcessTabulator}}% \leavevmode \input{\LaTeXexamplefile}}% - \MakePercentIgnore% -} -\def\DescribeOption{\leavevmode\@bsphack\begingroup\MakePrivateLetters + \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} -\def\Describe@Option#1{\endgroup +\newcommand*{\Describe@Option}[1]{\endgroup \marginpar{\raggedleft\PrintDescribeEnv{#1}}% \SpecialOptionIndex{#1}\@esphack\ignorespaces} -\def\SpecialOptionIndex#1{\@bsphack +\newcommand*{\SpecialOptionIndex}[1]{\@bsphack \index{#1\actualchar{\protect\ttfamily#1} (option)\encapchar usage}% - \index{options:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar - usage}\@esphack} + \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}} @@ -1781,22 +1843,36 @@ \newcommand*{\etc}{% \@ifnextchar. {\latin{etc}} - {\latin{etc.}} - \xspace} + {\latin{etc}.\xspace}} \newcommand*{\eg}{% \@ifnextchar. {\latin{e.g}} - {\latin{e.g.}} - \xspace} + {\latin{e.g}.\xspace}} \newcommand*{\ie}{% \@ifnextchar. {\latin{i.e}} - {\latin{i.e.}} - \xspace} + {\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} -\newcommand*{\XeTeX} +\DeclareRobustCommand*{\XeTeX} {X\kern-.125em\lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\TeX} +\providecommand*{\CTAN}{\textsc{ctan}} +\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} % %\fi -- cgit v1.2.3