Skip to content

Commit

Permalink
version 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
cgnieder committed Oct 15, 2015
1 parent 8a45c2e commit c7cf030
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 22 deletions.
36 changes: 28 additions & 8 deletions chemmacros.module.reactions.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
\ChemModule{reactions}{2015/09/15 reaction environments}
\ChemModule{reactions}{2015/10/14 reaction environments}

\chemmacros_load_module:n {chemformula}

Expand Down Expand Up @@ -87,21 +87,40 @@
\tl_new:N \reactionlistname
\tl_new:N \l__chemmacros_reaction_heading_tl

\cs_if_exist:NTF \chapter
{ \tl_set:Nn \l__chemmacros_reaction_heading_tl { \chapter* } }
{ \tl_set:Nn \l__chemmacros_reaction_heading_tl { \section* } }
\cs_new:Npn \__chemmacros_reaction_heading:n #1
{ \l__chemmacros_reaction_heading_tl { #1 } }
\cs_generate_variant:Nn \__chemmacros_reaction_heading:n { V }

\tl_set:Nn \l__chemmacros_reaction_lorname_tl { \chemmacros_translate:n {reaction} }
\tl_set:Nn \reactionlistname { \chemmacros_translate:n {list-of-reactions} }

\cs_new:Npn \__chemmacros_reaction_heading:n #1
{ \l__chemmacros_reaction_heading_tl { #1 } }
\cs_generate_variant:Nn \__chemmacros_reaction_heading:n { V }
\keys_define:nn {chemmacros/reactions}
{
list-name .tl_set:N = \reactionlistname ,
list-entry .tl_set:N = \l__chemmacros_reaction_lorname_tl ,
}
\ChemCompatibilityFrom{5.2}
\keys_define:nn {chemmacros/reactions}
{
list-heading-cmd .code:n =
\cs_set_protected:Npn \__chemmacros_reaction_heading:n ##1 {#1}
}
\EndChemCompatibility

\cs_if_exist:NTF \chapter
{
\keys_set:nn {chemmacros/reactions}
{ list-heading-cmd = \chapter* {#1} }
}
{
\keys_set:nn {chemmacros/reactions}
{ list-heading-cmd = \section* {#1} }
}

\cs_new_protected:Npn \listofreactions
{
\__chemmacros_reaction_heading:V \reactionlistname
\@starttoc { lor }
\@starttoc {lor}
}

\cs_new_protected:Npn \l@reaction #1#2
Expand Down Expand Up @@ -187,3 +206,4 @@

2015/09/15 - adapt to `method' option => do not use chemformula's macros
directly
2015/10/14 - new option `list-heading-cmd'
Binary file modified chemmacros_en.pdf
Binary file not shown.
53 changes: 39 additions & 14 deletions chemmacros_en.tex
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@
formula = chemformula ,
chemformula/format = \libertineLF
}
% \setchemformula{format = \libertineLF}

\usepackage{siunitx}

Expand Down Expand Up @@ -409,6 +408,8 @@
}
\ExplSyntaxOff

\AtBeginDocument{\renewcommand*\reftextfaraway[1]{from page~\pageref{#1}}}

\begin{document}

\part{Preliminaries}
Expand Down Expand Up @@ -979,13 +980,13 @@ \subsubsection{The \cs*{iupac} Command}
\end{example}

The spaces inserted by \sym{-} and \sym{\textbar} can be
customized.\changedversion{5.2}
customized.
\begin{options}
\keyval{hyphen-pre-space}{skip}\Module{nomenclature}\Default{.01em}
\keyval{hyphen-pre-space}{dim}\Module{nomenclature}\Default{.01em}
Set the space that is inserted before the hyphen set with \sym{-}.
\keyval{hyphen-post-space}{skip}\Module{nomenclature}\Default{-.03em}
\keyval{hyphen-post-space}{dim}\Module{nomenclature}\Default{-.03em}
Set the space that is inserted after the hyphen set with \sym{-}.
\keyval{break-space}{skip}\Module{nomenclature}\Default{.01em}
\keyval{break-space}{dim}\Module{nomenclature}\Default{.01em}
Set the space inserted by \sym{\textbar}.
\end{options}

Expand Down Expand Up @@ -2091,22 +2092,32 @@ \subsubsection{Predefined Environments}
\begin{environments}
\environment{reaction}
A single reaction where \chemformula\ code is placed directly in the
environment body. A wrapper around the \env*{equation} environment.
environment body. A wrapper around the \env*{equation} environment. The
environment body is parsed with \cs{ch} or \cs{ce} depending on the value
of the \option{formula} option, see
section~\vref{sec:chemformula-module}.
\environment{reactions}
Several aligned reactions. A wrapper around \pkg{amsmath}'s \env*{align}
environment.
environment. The environment body is parsed with \cs{ch} or \cs{ce}
depending on the value of the \option{formula} option, see
section~\vref{sec:chemformula-module}.
\end{environments}

\ldots and their starred versions for unnumbered reactions.
\begin{environments}
\environment{reaction*}
A wrapper around the \env*{equation*} environment.
A wrapper around the \env*{equation*} environment. The environment body
is parsed with \cs{ch} or \cs{ce} depending on the value of the
\option{formula} option, see section~\vref{sec:chemformula-module}.
\environment{reactions*}
A wrapper around \pkg{amsmath}'s \env*{align*} environment.
A wrapper around \pkg{amsmath}'s \env*{align*} environment. The
environment body is parsed with \cs{ch} or \cs{ce} depending on the value
of the \option{formula} option, see
section~\vref{sec:chemformula-module}.
\end{environments}

With them you can create (un)numbered reaction equations similar to
mathematical equations.
With those environments you can create (un)numbered reaction equations similar
to mathematical equations.

Theses environments use the \env*{equation}/\env*{equation*} environments or
the \env*{align}/\env*{align*} environments, respectively, to display the
Expand Down Expand Up @@ -2231,13 +2242,19 @@ \subsubsection{List of Reactions}

The output of this list can be modified by two options:
\begin{options}
\keyval{list-name}{name of the list}\Module{reaction}\Default{List of
reactions}
\keyval{list-name}{name of the
list}\Module{reactions}\Default{\cs*{ChemTranslate}\Marg{{list-of-reactions}}}
Let's you set the name of the list manually. The default name is language
dependent, see section~\vref{sec:lang-module}.
\keyval{list-entry}{prefix to each entry}\Module{reaction}\Default{Reaction}
\keyval{list-entry}{prefix to each
entry}\Module{reactions}\Default{\cs*{ChemTranslate}\Marg{reaction}}
Let's you set a prefix to each list entry. The default name is language
dependent, see section~\vref{sec:lang-module}.
\keyval{list-heading-cmd}{code}\Module{reactions}\Default{\cs*{section}\sarg\Marg{\#1}}
The\sinceversion{5.2} macro that is called at the beginning of the list.
Inside of \meta{code} \code{\#1} refers to the actual heading of the list.
The default setting is not entirely true: if a macro \cs*{chapter} is
defined \code{\cs*{chapter}\sarg\Marg{\#1}} is used.
\end{options}
Instead of using the option \option{list-name} you also could redefine
\cs{reactionlistname}.
Expand Down Expand Up @@ -3283,6 +3300,14 @@ \subsection{How To}
\end{sourcecode}
In both variants \code{@} has category code~11 (letter).

Since new modules very likely might rely on code provided first in a certain
version of \chemmacros\ you might want to make sure that your module only is
loaded when the compatibility mode is high enough to provide the features you
want:
\begin{sourcecode}
\ChemModule{foo}{2015/10/14 description of foo}[5.2]
\end{sourcecode}

You should be aware that your module \emph{will not be loaded} with
\verbcode+\usechemmodule{all}+! The pseudo-module \chemmodule{all} contains a
manually maintained list of the modules that are loaded by it.
Expand Down

0 comments on commit c7cf030

Please sign in to comment.