diff options
author | Karl Berry <karl@freefriends.org> | 2019-10-02 21:15:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-10-02 21:15:52 +0000 |
commit | 5924d3d19a3cfd0f81b96b17199dff811f75027e (patch) | |
tree | b15e143b3b75afb2b1d5f097a66d949b8b67e40e /Master/texmf-dist | |
parent | 5d3ec7070ee3e23edf7cde4ee7f335539c36393b (diff) |
chemnum (2oct19)
git-svn-id: svn://tug.org/texlive/trunk@52256 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/chemnum/README | 10 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/chemnum/chemnum_en.pdf | bin | 550888 -> 588398 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/chemnum/chemnum_en.tex | 238 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/chemnum/chemnum.sty | 348 |
4 files changed, 341 insertions, 255 deletions
diff --git a/Master/texmf-dist/doc/latex/chemnum/README b/Master/texmf-dist/doc/latex/chemnum/README index ddfa8b2331e..fd5fdfcd173 100644 --- a/Master/texmf-dist/doc/latex/chemnum/README +++ b/Master/texmf-dist/doc/latex/chemnum/README @@ -1,16 +1,14 @@ -------------------------------------------------------------------------- -chemnum v1.2 2016/04/14 +chemnum v1.2c 2019/10/02 a comprehensive approach for the numbering of chemical compounds -------------------------------------------------------------------------- Clemens Niederberger -Web: - v0.* https://bitbucket.org/cgnieder/chemnum/ - v1.* https://github.com/cgnieder/chemnum +Web: https://github.com/cgnieder/chemnum E-Mail: contact@mychemistry.eu -------------------------------------------------------------------------- -Copyright 2011-2016 Clemens Niederberger +Copyright 2011--2019 Clemens Niederberger This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 @@ -32,5 +30,3 @@ This work consists of the files - chemnum_en.tex, chemnum_en.pdf - README -------------------------------------------------------------------------- -Version 1 is a complete re-write from scratch of the `chemnum' package. --------------------------------------------------------------------------- diff --git a/Master/texmf-dist/doc/latex/chemnum/chemnum_en.pdf b/Master/texmf-dist/doc/latex/chemnum/chemnum_en.pdf Binary files differindex 4f6a1d26e58..9254c029c57 100644 --- a/Master/texmf-dist/doc/latex/chemnum/chemnum_en.pdf +++ b/Master/texmf-dist/doc/latex/chemnum/chemnum_en.pdf diff --git a/Master/texmf-dist/doc/latex/chemnum/chemnum_en.tex b/Master/texmf-dist/doc/latex/chemnum/chemnum_en.tex index a5abd7365da..f6da470d1df 100644 --- a/Master/texmf-dist/doc/latex/chemnum/chemnum_en.tex +++ b/Master/texmf-dist/doc/latex/chemnum/chemnum_en.tex @@ -1,8 +1,36 @@ -% arara: pdflatex: { shell: on } -%! arara: pdflatex: { shell: on } -% arara: biber -% arara: pdflatex -% arara: pdflatex +% -------------------------------------------------------------------------- +% the CHEMNUM package +% +% a comprehensive approach for the numbering of chemical compounds +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% -------------------------------------------------------------------------- +% https://github.org/cgnieder/chemnum/ +% contact@mychemistry.eu +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +% Copyright 2011--2019 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% !arara: pdflatex: { shell: on , interaction: nonstopmode } +% !arara: pdflatex: { shell: on , interaction: nonstopmode } +% !arara: biber +% arara: pdflatex: { interaction: nonstopmode } +% arara: pdflatex: { interaction: nonstopmode } \documentclass[load-preamble+,ngerman,british,american]{cnltx-doc} \usepackage[utf8]{inputenc} \usepackage{chemnum} @@ -47,7 +75,7 @@ keyis, marginnote, midrule, NewDocumentCommand, - schemestart,schemestop,setatomsep, + schemestart,schemestop,setchemfig, theffbibliography, toprule } , index-setup = { othercode=\footnotesize,level=\addsec }, @@ -60,11 +88,13 @@ \usepackage{chemformula} \setchemformula{format=\libertineLF} \usepackage{chemfig,relsize} -\setatomsep{1.78500 em} -\setbondstyle{line width = 0.06642 em} +\setchemfig{ + atom sep = 1.78500 em , + bond style = {line width = 0.06642 em} +} \renewcommand*\printatom[1]{\textsmaller{\ensuremath{\mathsf{#1}}}} -\usepackage{array,booktabs} +\usepackage{array,booktabs,csquotes} \usepackage{graphicx} @@ -112,57 +142,6 @@ \pkg{chemgreek}~\cite{pkg:chemgreek} and the \pkg{psfrag}~\cite{pkg:psfrag} package. -\section{News}\label{sec:news} -The \chemnum\ package has been my first attempt to create a comprehensive -labeling package for chemical compounds. However, it had and has more than -one weakness and its code was -- to be frank -- a mess. Version~1 is now a -complete re-write of \chemnum\ where I tried to achieve several points: -\begin{itemize} - \item A cleaner code internally. - \item A cleaner user interface, \ie, more user macros for different tasks, a - unified naming of the commands and a less redundant naming of the - options. - \item Extended functionality such as sorting and compressing of sublabel - lists and sorting and merging of main label lists. -\end{itemize} - -Although the syntax seems more or less the same at first sight quite a number -of changes have been made that make version~1 incompatible with version~0. -While I thought a while about maintaining backwards compatibility version~0 -was known to be in an experimental stage where everything was allowed to be -changed at any time. So users \emph{could} know there was a risk. I have a -feeling that many users nevertheless didn't realize this and may be bothered -by this incompatibility. So I am well aware that the update will -inconvenience some users. However, since version~0 won't be updated any more -it made more sense to make a breaking update once. - -The same is not true for version~1. The syntax and commands described in this -manual will not be changed as easily and from this version on I will take care -of backwards compatibility. - -For those people wanting to keep older versions: they are are still available -from websites such as \website{ctanhg.scharrer-online.de} or -\securewebsite{bitbucket.org/cgnieder/chemnum}. You can also email me for an -older version. - -Many commands have got a new name! The most important ones are: -\begin{itemize} - \item \cs*{cmpdref}; this is now called \cs{replacecmpd}. - \item \cs*{cmpdinit}; this is now called \cs{initcmpd}. - \item \cs*{cmpdreset}; this is now called \cs{resetcmpd}. - \item \cs*{cmpdsetup}; this is now called \cs{setchemnum}. -\end{itemize} -However, there are many more changes. Basically all options have new names -and often do their thing slightly different from the way things have been -before. - -Please note that this overall change does not mean that version~1 is version~0 -declared stable. It is very likely that version~1 will now have quite a -number of bugs to be fixed and probably missing features, too. So I'd be very -glad to receive feedback either on \chemnum's homepage -\securewebsite{github.com/cgnieder/chemnum} or via email to -\email{contact@mychemistry.eu}. - \section{Overview over the Available Commands}\label{sec:overv-over-avail} This section lists all available commands with a brief description. Commands @@ -198,7 +177,7 @@ Most of the commands will be explained in a later section in more detail. section~\ref{sec:deta-comp-labels}. \command{replacecmpd}[\code{+}\oarg{options}\marg{\ac{id}}] A command for replacing tags in \ac{eps} files, see - section~\ref{sec:replacing-tags-aceps} for details. + section~\ref{sec:replacing-tags-eps-ps} for details. \command{initcmpd}[\oarg{options}\marg{list of \acp{id}}] Initiate compound labels. This command can only be used in the preamble. It is desribed in section~\ref{sec:deta-comp-labels}. @@ -329,7 +308,7 @@ see section~\ref{sec:chang-input-mark} for details. More than one label can be put inside \cs{cmpd}, separated by commas. Then a list like \cmpd{a, b, c, e, g.two} is printed. \end{example} -The Harvard comma (see section~\ref{sec:lang-depend-sett}) in \code{, and} +The Harvard comma (see section~\ref{sec:lang-depend-sett}) in \enquote{\code{, and}} between \cmpd{e} and \cmpd{g.two} suggests that there are options to customize the list, see section~\ref{sec:formatting-labels} for more on this. @@ -608,10 +587,14 @@ command. They are marked with \module{replace}. \keybool{merge}\Module{both (l)}\Default{false} If set to true a list of labels is merged, \ie, ``\cmpd{q.five,a,q.two}'' becomes ``\cmpd[merge=true]{q.five,a,q.two}''. - \keyval{pre-label-code}{code}\Module{cmpd (g)}\Default + \keyval{pre-label-code}{code}\Module{both (g)}\Default Code to be inserted before a label. - \keyval{post-label-code}{code}\Module{cmpd (g)}\Default + \keyval{post-label-code}{code}\Module{both (g)}\Default Code to be inserted after a label. + \keyval{pre-main-label-code}{code}\Module{both (g)}\Default + \sinceversion{1.2a}Code to be inserted before a main label. + \keyval{post-main-label-code}{code}\Module{both (g)}\Default + \sinceversion{1.2a}Code to be inserted after a main label. \keyval{main-sub-sep}{code}\Module{both (l)}\Default{.} The separator symbol that is used in \cs{cmpd} to separate the \meta{main \ac{id}} from a \meta{sub \ac{id}}. @@ -855,9 +838,9 @@ explicitly will overwrite the language sensitivity. If you only want to adapt the separators to your language have a look at section~\ref{sec:lang-depend-sett}. -\section{Replacing Tags in \ac{eps} or \ac{ps} Files}\label{sec:replacing-tags-aceps} +\section{Replacing Tags in \ac{eps} or \ac{ps} Files}\label{sec:replacing-tags-eps-ps} -Although it is quite possible to create rection schemes within \LaTeX\ +Although it is quite possible to create reaction schemes within \LaTeX\ directly -- for example with the \pkg{chemfig} package~\cite{pkg:chemfig} -- many people prefer to use a program such as \textsc{ChemDraw} for it. In order to be able to use the labels with such schemes as well the following @@ -865,11 +848,18 @@ method is usually used: \begin{itemize} \item Create the scheme and place temporary tags like \code{TMP1}, \code{TMP2} and so on where you want the compound labels to be. - \item Export the scheme as \ac{eps} or \ac{ps} figure where you make sure - that the tags are embedded as text strings. + \item Export the scheme as \ac{eps} or \ac{ps} figure \emph{where you make + sure that the tags are embedded as text strings}. If the tags are not + present as text strings they cannot be replaced. This is a common source + of user problems. \item Include the \ac{eps} with \cs*{includegraphics}. Right before that use \cs{replacecmpd} once for every temporary tag. \end{itemize} +\emph{For the actual replacement please make sure that you compile with + \code{shell-escape} enabled. If you compile with \code{pdflatex} you + probably also need \pkg{auto-pst-pdf}~\cite{pkg:auto-pst-pdf} loaded. In + subsequent runs load it with option \code{off} when you turned off + \code{shell-escape}.} \begin{commands} \command{replacecmpd}[\code{+}\oarg{options}\marg{\ac{id}}] @@ -894,7 +884,7 @@ The tags now can be replaced with labels. The result is shown in figure~\ref{fig:scheme-tmp-tags-replaced}. \begin{example}[compile,exe-with={--shell-escape},runs=1,float=htbp,caption={A scheme with temporary tags replaced with labels.\label{fig:scheme-tmp-tags-replaced}}] - % code for figure 2 + % code for figure 2 -- compiled with shell-escape enabled \documentclass{standalone} \usepackage{graphicx,auto-pst-pdf,chemnum} \begin{document} @@ -971,7 +961,7 @@ respect to the \ac{ps} box that is replaced. This is described in \begin{example}[compile,exe-with={--shell-escape},runs=1,float=htbp,caption={A scheme with arbitrary tags replaced with labels.\label{fig:scheme-bla-tags-replaced}}] - % code for figure 4 + % code for figure 4 -- compiled with shell-escape enabled \documentclass{standalone} \usepackage{graphicx,auto-pst-pdf,chemnum} \begin{document} @@ -1025,6 +1015,11 @@ wrong please write me an email and I'll add your language or fix the wrong translation. \begin{table}[htbp] + \newcommand*\showlanguageentry[1]{% + #1 + & \visualizespaces{\GetTranslationFor{#1}{chemnum-sep-two}} + & \visualizespaces{\GetTranslationFor{#1}{chemnum-sep-last-two}} + } \centering \caption{Available languages} \label{tab:languages} @@ -1034,45 +1029,19 @@ translation. \bfseries chemnum-sep-two & \bfseries chemnum-sep-last-two \\ \midrule - English - & \visualizespaces{\GetTranslationFor{English}{chemnum-sep-two}} - & \visualizespaces{\GetTranslationFor{English}{chemnum-sep-last-two}} \\ - American - & \visualizespaces{\GetTranslationFor{American}{chemnum-sep-two}} - & \visualizespaces{\GetTranslationFor{American}{chemnum-sep-last-two}} \\ - German - & \visualizespaces{\GetTranslationFor{German}{chemnum-sep-two}} - & \visualizespaces{\GetTranslationFor{German}{chemnum-sep-last-two}} \\ - French - & \visualizespaces{\GetTranslationFor{French}{chemnum-sep-two}} - & \visualizespaces{\GetTranslationFor{French}{chemnum-sep-last-two}} \\ - Spanish - & \visualizespaces{\GetTranslationFor{Spanish}{chemnum-sep-two}} - & \visualizespaces{\GetTranslationFor{Spanish}{chemnum-sep-last-two}} \\ - Italian - & \visualizespaces{\GetTranslationFor{Italian}{chemnum-sep-two}} - & \visualizespaces{\GetTranslationFor{Italian}{chemnum-sep-last-two}} \\ - Catalan - & \visualizespaces{\GetTranslationFor{Catalan}{chemnum-sep-two}} - & \visualizespaces{\GetTranslationFor{Catalan}{chemnum-sep-last-two}} \\ - Portuguese - & \visualizespaces{\GetTranslationFor{Portuguese}{chemnum-sep-two}} - & \visualizespaces{\GetTranslationFor{Portuguese}{chemnum-sep-last-two}} \\ - Dutch - & \visualizespaces{\GetTranslationFor{Dutch}{chemnum-sep-two}} - & \visualizespaces{\GetTranslationFor{Dutch}{chemnum-sep-last-two}} \\ - Danish - & \visualizespaces{\GetTranslationFor{Danish}{chemnum-sep-two}} - & \visualizespaces{\GetTranslationFor{Danish}{chemnum-sep-last-two}} \\ - Swedish - & \visualizespaces{\GetTranslationFor{Swedish}{chemnum-sep-two}} - & \visualizespaces{\GetTranslationFor{Swedish}{chemnum-sep-last-two}} \\ - Finnish - & \visualizespaces{\GetTranslationFor{Finnish}{chemnum-sep-two}} - & \visualizespaces{\GetTranslationFor{Finnish}{chemnum-sep-last-two}} \\ - Norwegian - & \visualizespaces{\GetTranslationFor{Norwegian}{chemnum-sep-two}} - & \visualizespaces{\GetTranslationFor{Norwegian}{chemnum-sep-last-two}} \\ + \showlanguageentry{English} \\ + \showlanguageentry{American} \\ + \showlanguageentry{German} \\ + \showlanguageentry{French} \\ + \showlanguageentry{Spanish} \\ + \showlanguageentry{Italian} \\ + \showlanguageentry{Catalan} \\ + \showlanguageentry{Portuguese} \\ + \showlanguageentry{Dutch} \\ + \showlanguageentry{Danish} \\ + \showlanguageentry{Swedish} \\ + \showlanguageentry{Finnish} \\ + \showlanguageentry{Norwegian} \\ \bottomrule \end{tabular} \end{table} @@ -1173,6 +1142,55 @@ above commands are defined in terms of them: \NewDocumentCommand\subcmpdshowref{mm}{\chemnumshowref{#2}} \end{sourcecode} -\end{document} +\section{From Version~0 to Version~1}\label{sec:news} +The \chemnum\ package has been my first attempt to create a comprehensive +labeling package for chemical compounds. However, it had and has more than +one weakness and its code was -- to be frank -- a mess. Version~1 is now a +complete re-write of \chemnum\ where I tried to achieve several points: +\begin{itemize} + \item A cleaner code internally. + \item A cleaner user interface, \ie, more user macros for different tasks, a + unified naming of the commands and a less redundant naming of the + options. + \item Extended functionality such as sorting and compressing of sublabel + lists and sorting and merging of main label lists. +\end{itemize} +Although the syntax seems more or less the same at first sight quite a number +of changes have been made that make version~1 incompatible with version~0. +While I thought a while about maintaining backwards compatibility version~0 +was known to be in an experimental stage where everything was allowed to be +changed at any time. So users \emph{could} know there was a risk. I have a +feeling that many users nevertheless didn't realize this and may be bothered +by this incompatibility. So I am well aware that the update will +inconvenience some users. However, since version~0 won't be updated any more +it made more sense to make a breaking update once. +The same is not true for version~1. The syntax and commands described in this +manual will not be changed as easily and from this version on I will take care +of backwards compatibility. + +For those people wanting to keep older versions: they are are still available +from websites such as \website{ctanhg.scharrer-online.de} or +\securewebsite{bitbucket.org/cgnieder/chemnum}. You can also email me for an +older version. + +Many commands have got a new name! The most important ones are: +\begin{itemize} + \item \cs*{cmpdref}; this is now called \cs{replacecmpd}. + \item \cs*{cmpdinit}; this is now called \cs{initcmpd}. + \item \cs*{cmpdreset}; this is now called \cs{resetcmpd}. + \item \cs*{cmpdsetup}; this is now called \cs{setchemnum}. +\end{itemize} +However, there are many more changes. Basically all options have new names +and often do their thing slightly different from the way things have been +before. + +Please note that this overall change does not mean that version~1 is version~0 +declared stable. It is very likely that version~1 will now have quite a +number of bugs to be fixed and probably missing features, too. So I'd be very +glad to receive feedback either on \chemnum's homepage +\securewebsite{github.com/cgnieder/chemnum} or via email to +\email{contact@mychemistry.eu}. + +\end{document} diff --git a/Master/texmf-dist/tex/latex/chemnum/chemnum.sty b/Master/texmf-dist/tex/latex/chemnum/chemnum.sty index 659378bf72a..b7d1277df49 100644 --- a/Master/texmf-dist/tex/latex/chemnum/chemnum.sty +++ b/Master/texmf-dist/tex/latex/chemnum/chemnum.sty @@ -12,7 +12,7 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -% Copyright 2011-2016 Clemens Niederberger +% Copyright 2011--2019 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -26,32 +26,41 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\def\chemnumdate{2016/04/14} -\def\chemnumversion{1.2} -\def\chemnuminfo{a comprehensive approach for the numbering of chemical compounds} +\RequirePackage{expl3,xparse,l3keys2e} -\RequirePackage{expl3}[2016/03/28] -\RequirePackage{xparse,l3keys2e} +\ExplSyntaxOn +\tl_const:Nn \c_chemnum_date_tl {2019/10/02} +\tl_const:Nn \c_chemnum_version_number_tl {1.2} +\tl_const:Nn \c_chemnum_version_suffix_tl {c} +\tl_const:Nx \c_chemnum_version_tl + { \c_chemnum_version_number_tl \c_chemnum_version_suffix_tl } +\tl_const:Nn \c_chemnum_info_tl + {a~ comprehensive~ approach~ for~ the~ numbering~ of~ chemical~ compounds} % ---------------------------------------------------------------------------- % provide the package: -\ProvidesExplPackage{chemnum} - {\chemnumdate} - {\chemnumversion} - {\chemnuminfo\space (CN)} +\ProvidesExplPackage + {chemnum} + {\c_chemnum_date_tl} + {\c_chemnum_version_tl} + {\c_chemnum_info_tl \c_space_tl (CN)} % ---------------------------------------------------------------------------- % required packages: % language support: -\RequirePackage{translations}[2015/11/07] +\RequirePackage{translations} + % greek alphabet for the labels matching to chemmacros' selection: -\RequirePackage{chemgreek}[2016/02/10] +\RequirePackage{chemgreek} \RequirePackage{psfrag} % ---------------------------------------------------------------------------- % messages: \msg_new:nnn {chemnum} {missing-label} - { The~ key~ `#1'~ has~ no~ label~ associated~ \msg_line_context: } + { + The~ key~ `#1' \tl_if_blank:nF {#2} {~ of~`#2'} ~ has~ no~ label~ + associated~ \msg_line_context: + } \msg_new:nnn {chemnum} {erroneous-argument-combination} { @@ -210,6 +219,8 @@ \int_new:N \l__chemnum_tmpb_int \int_new:N \l__chemnum_tmpc_int +\str_new:N \l__chemnum_tmpa_str + % ---------------------------------------------------------------------------- % variables: \prop_new:N \l__chemnum_label_formats_prop @@ -227,6 +238,7 @@ \seq_new:N \g__chemnum_defined_compounds_seq \seq_new:N \g__chemnum_compound_defined_subcompounds_seq +\tl_const:Nn \c_chemnum_nothing_here_tl {??} \tl_new:N \l__chemnum_label_format_tl \tl_set:Nn \l__chemnum_label_format_tl {\bfseries} \tl_new:N \l__chemnum_local_label_format_tl @@ -367,13 +379,13 @@ sub-counter-format .groups:n = {compound,general} , % label: pre-label-code .tl_set:N = \l__chemnum_pre_label_default_tl , - pre-label-code .groups:n = {compound} , + pre-label-code .groups:n = {compound,general} , post-label-code .tl_set:N = \l__chemnum_post_label_default_tl , - post-label-code .groups:n = {compound} , + post-label-code .groups:n = {compound,general} , pre-main-label-code .tl_set:N = \l__chemnum_pre_main_label_default_tl , - pre-main-label-code .groups:n = {compound} , + pre-main-label-code .groups:n = {compound,general} , post-main-label-code .tl_set:N = \l__chemnum_post_main_label_default_tl , - post-main-label-code .groups:n = {compound} , + post-main-label-code .groups:n = {compound,general} , main-sub-sep .tl_set:N = \l__chemnum_compound_separator_tl , main-sub-sep .groups:n = {general,list} , list-label-sep .tl_set:N = \l__chemnum_main_separator_tl , @@ -512,14 +524,15 @@ % if the `chemnum' package is removed from the preamble \AtBeginDocument { - \if@filesw - \iow_now:Nn \@auxout - { - \providecommand\chemnum@cmpd[8]{} ^^J - \providecommand\chemnum@subcmpd[4]{} ^^J - \providecommand\chemnum@check{} - } - \fi + \legacy_if:nT {@filesw} + { + \iow_now:Nn \@auxout + { + \providecommand\chemnum@cmpd[8]{} ^^J + \providecommand\chemnum@subcmpd[4]{} ^^J + \providecommand\chemnum@check{} + } + } } % we use this one to trigger a LaTeX rerun warning -- to be precise the @@ -528,7 +541,11 @@ { \AtEndDocument { \def \chemnum@check { \@tempswatrue } } } % add the rerun check at the end: -\AtEndDocument { \if@filesw \iow_now:Nn \@auxout { \chemnum@check } \fi } +\AtEndDocument + { + \legacy_if:nT {@filesw} + { \iow_now:Nn \@auxout { \chemnum@check } } + } % ---------------------------------------------------------------------------- % initiating new compounds @@ -624,8 +641,8 @@ \int_gincr:N \g__chemnum_main_int \stepcounter{cmpdmain} } - \seq_if_exist:cF { g__chemnum_#1_initiated_subcompounds_seq } - { \seq_new:c { g__chemnum_#1_initiated_subcompounds_seq } } + \seq_if_exist:cF {g__chemnum_#1_initiated_subcompounds_seq} + { \seq_new:c {g__chemnum_#1_initiated_subcompounds_seq} } } % #1: main ID @@ -643,11 +660,11 @@ \chemnum_subcompound_set_property:nnnn {#1} {#2} {ID} {#2} \chemnum_subcompound_set_property:nnnn {#1} {#2} {main-compound} {#1} \chemnum_subcompound_set_property:nnnx {#1} {#2} {number} - { \int_use:c { g__chemnum_compound_#1_subcompound_int } } + { \int_use:c {g__chemnum_compound_#1_subcompound_int} } \chemnum_subcompound_set_property:nnnx {#1} {#2} {counter-representation} { \__chemnum_label_format:cV - { g__chemnum_compound_#1_subcompound_int } + {g__chemnum_compound_#1_subcompound_int} \l__chemnum_default_subcounter_representation_tl } } @@ -661,26 +678,41 @@ \cs_new_protected:Npn \chemnum_initialize_subcompound:nn #1#2 { - \int_if_exist:cF { g__chemnum_compound_#1_subcompound_int } - { \int_new:c { g__chemnum_compound_#1_subcompound_int } } - \int_gincr:c { g__chemnum_compound_#1_subcompound_int } - \seq_if_exist:cF { g__chemnum_compound_#1_subcompounds_seq } - { \seq_new:c { g__chemnum_compound_#1_subcompounds_seq } } - \prop_if_exist:cF { g__chemnum_compound_#1_subcompounds_prop } - { \prop_new:c { g__chemnum_compound_#1_subcompounds_prop } } - \seq_if_in:cnF { g__chemnum_compound_#1_subcompounds_seq } {#2} - { \seq_gput_right:cn { g__chemnum_compound_#1_subcompounds_seq } {#2} } + \int_if_exist:cF {g__chemnum_compound_#1_subcompound_int} + { \int_new:c {g__chemnum_compound_#1_subcompound_int} } + \int_gincr:c {g__chemnum_compound_#1_subcompound_int} + \seq_if_exist:cF {g__chemnum_compound_#1_subcompounds_seq} + { \seq_new:c {g__chemnum_compound_#1_subcompounds_seq} } + \prop_if_exist:cF {g__chemnum_compound_#1_subcompounds_prop} + { \prop_new:c {g__chemnum_compound_#1_subcompounds_prop} } + \seq_if_in:cnF {g__chemnum_compound_#1_subcompounds_seq} {#2} + { \seq_gput_right:cn {g__chemnum_compound_#1_subcompounds_seq} {#2} } \seq_gput_right:Nn \g__chemnum_compound_defined_subcompounds_seq {#1#2} - \prop_gput:cnx { g__chemnum_compound_#1_subcompounds_prop } {#2} + \prop_gput:cnx {g__chemnum_compound_#1_subcompounds_prop} {#2} { - \int_use:c { g__chemnum_compound_#1_subcompound_int } : + \int_use:c {g__chemnum_compound_#1_subcompound_int} : \__chemnum_label_format:cV - { g__chemnum_compound_#1_subcompound_int } + {g__chemnum_compound_#1_subcompound_int} \l__chemnum_default_subcounter_representation_tl } } % ---------------------------------------------------------------------------- + +\cs_new:Npn \__chemnum_nothing_here:n #1 + { + \c_chemnum_nothing_here_tl + \msg_warning:nnn {chemnum} {missing-label} {#1} + } + +\cs_new:Npn \__chemnum_nothing_here:nn #1#2 + { + \c_chemnum_nothing_here_tl + \msg_warning:nnnn {chemnum} {missing-label} {#1} {#2} + } +\cs_generate_variant:Nn \__chemnum_nothing_here:nn {x} + +% ---------------------------------------------------------------------------- \cs_new_protected:Npn \chemnum_log_main:n #1 { \bool_if:NT \l__chemnum_log_bool @@ -716,7 +748,7 @@ \prg_new_protected_conditional:Npnn \chemnum_subcompound_if_initiated:nn #1#2 { T,F,TF } { - \seq_if_in:cnTF { g__chemnum_#1_initiated_subcompounds_seq } {#2} + \seq_if_in:cnTF {g__chemnum_#1_initiated_subcompounds_seq} {#2} { \prg_return_true: } { \prg_return_false: } } @@ -745,12 +777,12 @@ % #2: property to be defined \cs_new_protected:Npn \chemnum_compound_declare_property:nn #1#2 { - \seq_if_exist:cF { g__chemnum_compound_#1_properties_seq } - { \seq_new:c { g__chemnum_compound_#1_properties_seq } } - \prop_if_exist:cF { g__chemnum_compound_#1_prop } - { \prop_new:c { g__chemnum_compound_#1_prop } } - \seq_if_in:cnF { g__chemnum_compound_#1_properties_seq } {#2} - { \seq_gput_right:cn { g__chemnum_compound_#1_properties_seq } {#2} } + \seq_if_exist:cF {g__chemnum_compound_#1_properties_seq } + { \seq_new:c {g__chemnum_compound_#1_properties_seq} } + \prop_if_exist:cF {g__chemnum_compound_#1_prop} + { \prop_new:c {g__chemnum_compound_#1_prop} } + \seq_if_in:cnF {g__chemnum_compound_#1_properties_seq} {#2} + { \seq_gput_right:cn {g__chemnum_compound_#1_properties_seq} {#2} } } % #1: ID @@ -766,8 +798,8 @@ % #3: value of property \cs_new_protected:Npn \chemnum_compound_set_property:nnn #1#2#3 { - \seq_if_in:cnTF { g__chemnum_compound_#1_properties_seq } {#2} - { \prop_gput:cnn { g__chemnum_compound_#1_prop } {#2} {#3} } + \seq_if_in:cnTF {g__chemnum_compound_#1_properties_seq} {#2} + { \prop_gput:cnn {g__chemnum_compound_#1_prop} {#2} {#3} } { \msg_error:nnn {chemnum} {property-undefined} {#1} {#2} } } \cs_generate_variant:Nn \chemnum_compound_set_property:nnn { nnV , nnx } @@ -776,15 +808,15 @@ % #2: property to be updated \cs_new_protected:Npn \chemnum_compound_update_property:nn #1#2 { - \seq_if_in:cnTF { g__chemnum_compound_#1_properties_seq } {#2} + \seq_if_in:cnTF {g__chemnum_compound_#1_properties_seq} {#2} { - \prop_get:cnN { g__chemnum_compound_#1_prop } {previous-#2} + \prop_get:cnN {g__chemnum_compound_#1_prop} {previous-#2} \l__chemnum_tmpa_tl - \prop_get:cnN { g__chemnum_compound_#1_prop } {#2} + \prop_get:cnN {g__chemnum_compound_#1_prop} {#2} \l__chemnum_tmpb_tl \tl_if_eq:NNF \l__chemnum_tmpb_tl \l__chemnum_tmpa_tl { - \prop_gput:cnV { g__chemnum_compound_#1_prop } + \prop_gput:cnV {g__chemnum_compound_#1_prop} {previous-#2} \l__chemnum_tmpb_tl } @@ -795,7 +827,7 @@ % #1: ID \cs_new_protected:Npn \chemnum_compound_update_properties:n #1 { - \seq_map_inline:cn { g__chemnum_compound_#1_properties_seq } + \seq_map_inline:cn {g__chemnum_compound_#1_properties_seq} { \chemnum_compound_update_property:nn {#1} {##1} } } @@ -804,8 +836,8 @@ % #3: property to be defined \cs_new_protected:Npn \chemnum_subcompound_declare_property:nnn #1#2#3 { - \seq_if_in:cnF { g__chemnum_compound_#1_#2_properties_seq } {#3} - { \seq_gput_right:cn { g__chemnum_compound_#1_#2_properties_seq } {#3} } + \seq_if_in:cnF {g__chemnum_compound_#1_#2_properties_seq} {#3} + { \seq_gput_right:cn {g__chemnum_compound_#1_#2_properties_seq} {#3} } } % #1: main ID @@ -813,11 +845,11 @@ % #3: properties to be defined \cs_new_protected:Npn \chemnum_subcompound_declare_properties:nnn #1#2#3 { - \seq_if_exist:cF { g__chemnum_compound_#1_#2_properties_seq } - { \seq_new:c { g__chemnum_compound_#1_#2_properties_seq } } - \prop_if_exist:cF { g__chemnum_compound_#1_#2_properties_prop } - { \prop_new:c { g__chemnum_compound_#1_#2_properties_prop } } - \clist_map_inline:nn { #3 } + \seq_if_exist:cF {g__chemnum_compound_#1_#2_properties_seq} + { \seq_new:c {g__chemnum_compound_#1_#2_properties_seq} } + \prop_if_exist:cF {g__chemnum_compound_#1_#2_properties_prop} + { \prop_new:c {g__chemnum_compound_#1_#2_properties_prop} } + \clist_map_inline:nn {#3} { \chemnum_subcompound_declare_property:nnn {#1} {#2} {##1} } } @@ -827,8 +859,8 @@ % #4: value of property \cs_new_protected:Npn \chemnum_subcompound_set_property:nnnn #1#2#3#4 { - \seq_if_in:cnTF { g__chemnum_compound_#1_#2_properties_seq } {#3} - { \prop_gput:cnn { g__chemnum_compound_#1_#2_properties_prop } {#3} {#4} } + \seq_if_in:cnTF {g__chemnum_compound_#1_#2_properties_seq} {#3} + { \prop_gput:cnn {g__chemnum_compound_#1_#2_properties_prop} {#3} {#4} } { \msg_error:nnn {chemnum} {property-undefined} {#1.#2} {#3} } } \cs_generate_variant:Nn \chemnum_subcompound_set_property:nnnn { nnnV , nnnx } @@ -838,15 +870,15 @@ % #3: property to be updated \cs_new_protected:Npn \chemnum_subcompound_update_property:nnn #1#2#3 { - \seq_if_in:cnTF { g__chemnum_compound_#1_#2_properties_seq } + \seq_if_in:cnTF {g__chemnum_compound_#1_#2_properties_seq} { - \prop_get:cnN { g__chemnum_compound_#1_#2_properties_prop } {previous-#3} + \prop_get:cnN {g__chemnum_compound_#1_#2_properties_prop} {previous-#3} \l__chemnum_tmpa_tl - \prop_get:cnN { g__chemnum_compound_#1_#2_properties_prop } {#3} + \prop_get:cnN {g__chemnum_compound_#1_#2_properties_prop} {#3} \l__chemnum_tmpb_tl \tl_if_eq:NNF \l__chemnum_tmpb_tl \l__chemnum_tmpa_tl { - \prop_gput:cnV { g__chemnum_compound_#1_#2_properties_prop } + \prop_gput:cnV {g__chemnum_compound_#1_#2_properties_prop} {previous-#3} \l__chemnum_tmpb_tl } @@ -858,7 +890,7 @@ % #2: sub ID \cs_new_protected:Npn \chemnum_subcompound_update_properties:nn #1#2 { - \seq_map_inline:cn { g__chemnum_compound_#1_#2_properties_seq } + \seq_map_inline:cn {g__chemnum_compound_#1_#2_properties_seq} { \chemnum_subcompound_update_property:nnn {#1} {#2} {##1} } } @@ -869,14 +901,14 @@ \cs_new_protected:Npn \chemnum_get_compound_property_or:nnn #1#2#3 { - \prop_get:cnNTF { g__chemnum_compound_#1_prop } {#2} + \prop_get:cnNTF {g__chemnum_compound_#1_prop} {#2} \l__chemnum_tmpa_tl { \tl_use:N \l__chemnum_tmpa_tl } {#3} } \cs_new:Npn \chemnum_expandable_get_compound_property:nn #1#2 - { \prop_item:cn { g__chemnum_compound_#1_prop } {#2} } + { \prop_item:cn {g__chemnum_compound_#1_prop} {#2} } \cs_generate_variant:Nn \chemnum_expandable_get_compound_property:nn { V } % #1: main ID @@ -887,14 +919,14 @@ \cs_new_protected:Npn \chemnum_get_subcompound_property_or:nnnn #1#2#3#4 { - \prop_get:cnNTF { g__chemnum_compound_#1_#2_properties_prop } {#3} + \prop_get:cnNTF {g__chemnum_compound_#1_#2_properties_prop} {#3} \l__chemnum_tmpa_tl { \tl_use:N \l__chemnum_tmpa_tl } {#4} } \cs_new:Npn \chemnum_expandable_get_subcompound_property:nnn #1#2#3 - { \prop_item:cn { g__chemnum_compound_#1_#2_properties_prop } {#3} } + { \prop_item:cn {g__chemnum_compound_#1_#2_properties_prop} {#3} } % ---------------------------------------------------------------------------- \DeclareExpandableDocumentCommand \cmpdproperty { mm } @@ -911,7 +943,7 @@ \cs_new_protected:Npn \chemnum_initiate_subcompound:nn #1#2 { \chemnum_subcompound_if_initiated:nnF {#1} {#2} - { \seq_gput_right:cn { g__chemnum_#1_initiated_subcompounds_seq } {#2} } + { \seq_gput_right:cn {g__chemnum_#1_initiated_subcompounds_seq} {#2} } } % ---------------------------------------------------------------------------- @@ -927,13 +959,11 @@ % #8: label format \cs_new_protected:Npn \__chemnum_write_compound_to_auxfile_x:nnnnnnnn #1#2#3#4#5#6#7#8 { - \if@filesw - \token_if_eq_meaning:NNT \@nodocument \relax - { - \iow_now:Nx \@auxout - { \exp_not:N \chemnum@cmpd {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8} } - } - \fi + \legacy_if:nT {@filesw} + { + \iow_now:Nx \@auxout + { \exp_not:N \chemnum@cmpd {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8} } + } } \cs_generate_variant:Nn \__chemnum_write_compound_to_auxfile_x:nnnnnnnn { nnnVVVVV } @@ -955,13 +985,11 @@ % #3: counter representation \cs_new_protected:Npn \__chemnum_write_subcompound_to_auxfile_x:nnnn #1#2#3#4 { - \if@filesw - \token_if_eq_meaning:NNT \@nodocument \relax - { - \iow_now:Nx \@auxout - { \exp_not:N \chemnum@subcmpd {#1}{#2}{#3}{#4} } - } - \fi + \legacy_if:nT {@filesw} + { + \iow_now:Nx \@auxout + { \exp_not:N \chemnum@subcmpd {#1}{#2}{#3}{#4} } + } } \cs_new_protected:Npn \chemnum_save_subcompound_to_auxfile:nn #1#2 @@ -989,21 +1017,21 @@ \cs_new_protected:Npn \chemnum@cmpd #1#2#3#4#5#6#7#8 { % \chemnum_initialize_compound:n {#1} - \prop_if_exist:cF { g__chemnum_compound_#1_prop } - { \prop_new:c { g__chemnum_compound_#1_prop } } - \prop_gput:cnn { g__chemnum_compound_#1_prop } + \prop_if_exist:cF {g__chemnum_compound_#1_prop} + { \prop_new:c {g__chemnum_compound_#1_prop} } + \prop_gput:cnn {g__chemnum_compound_#1_prop} {previous-number} {#2} - \prop_gput:cnn { g__chemnum_compound_#1_prop } + \prop_gput:cnn {g__chemnum_compound_#1_prop} {previous-counter-representation} {#3} - \prop_gput:cnn { g__chemnum_compound_#1_prop } + \prop_gput:cnn {g__chemnum_compound_#1_prop} {previous-pre-label-code} {#4} - \prop_gput:cnn { g__chemnum_compound_#1_prop } + \prop_gput:cnn {g__chemnum_compound_#1_prop} {previous-post-label-code} {#5} - \prop_gput:cnn { g__chemnum_compound_#1_prop } + \prop_gput:cnn {g__chemnum_compound_#1_prop} {previous-pre-main-label-code} {#6} - \prop_gput:cnn { g__chemnum_compound_#1_prop } + \prop_gput:cnn {g__chemnum_compound_#1_prop} {previous-post-main-label-code} {#7} - \prop_gput:cnn { g__chemnum_compound_#1_prop } + \prop_gput:cnn {g__chemnum_compound_#1_prop} {previous-label-format} {#8} } @@ -1013,15 +1041,15 @@ % #4: counter representation \cs_new_protected:Npn \chemnum@subcmpd #1#2#3#4 { - \prop_if_exist:cF { g__chemnum_compound_#1_#2_properties_prop } - { \prop_new:c { g__chemnum_compound_#1_#2_properties_prop } } - \seq_if_exist:cF { g__chemnum_compound_#1_subcompounds_seq } - { \seq_new:c { g__chemnum_compound_#1_subcompounds_seq } } - \seq_if_in:cnF { g__chemnum_compound_#1_subcompounds_seq } {#2} - { \seq_gput_right:cn { g__chemnum_compound_#1_subcompounds_seq } {#2} } - \prop_gput:cnn { g__chemnum_compound_#1_#2_properties_prop } + \prop_if_exist:cF {g__chemnum_compound_#1_#2_properties_prop} + { \prop_new:c {g__chemnum_compound_#1_#2_properties_prop} } + \seq_if_exist:cF {g__chemnum_compound_#1_subcompounds_seq} + { \seq_new:c {g__chemnum_compound_#1_subcompounds_seq} } + \seq_if_in:cnF {g__chemnum_compound_#1_subcompounds_seq} {#2} + { \seq_gput_right:cn {g__chemnum_compound_#1_subcompounds_seq} {#2} } + \prop_gput:cnn {g__chemnum_compound_#1_#2_properties_prop} {previous-number} {#3} - \prop_gput:cnn { g__chemnum_compound_#1_#2_properties_prop } + \prop_gput:cnn {g__chemnum_compound_#1_#2_properties_prop} {previous-counter-representation} {#4} } @@ -1060,7 +1088,6 @@ % #3: sub ID \cs_new_protected:Npn \chemnum_declare_subcompound:nnn #1#2#3 { - % \keys_set:nn {chemnum} {#1} \chemnum_subcompound_if_initiated:nnF {#2} {#3} { \bool_if:NT \g__chemnum_initiate_sub_bool @@ -1170,8 +1197,11 @@ \chemnum_get_compound_property:nn {#1} {previous-label-format} { \chemnum_get_compound_property_or:nnn {#1} - { previous-counter-representation } - { ?? \__chemnum_rerun: } + {previous-counter-representation} + { + \__chemnum_nothing_here:n {#1} + \__chemnum_rerun: + } } \group_end: \chemnum_get_compound_property:nn {#1} {previous-post-main-label-code} @@ -1189,7 +1219,10 @@ { \chemnum_get_subcompound_property_or:nnnn {#1} {#2} {previous-counter-representation} - { ?? \__chemnum_rerun: } + { + \__chemnum_nothing_here:nn {#2} {#1} + \__chemnum_rerun: + } } \group_end: } @@ -1265,7 +1298,7 @@ { \tl_clear:N \l__chemnum_tmpa_tl \tl_set:Nx \l__chemnum_tmpa_tl - { \seq_use:cn { g__chemnum_compound_##4_subcompounds_seq } { , } } + { \seq_use:cn {g__chemnum_compound_##4_subcompounds_seq} {,} } \tl_if_blank:VF \l__chemnum_tmpa_tl { \chemnum_write_sublist:NNnnV ##1 ##2 {##3} {##4} @@ -1294,8 +1327,8 @@ { \bool_if:NTF #2 { - \chemnum_hyper_link:nn {#4} - { \chemnum_compound_read:n {#4} } + \bool_if:NF \l__chemnum_sub_only_bool + { \chemnum_hyper_link:nn {#4} { \chemnum_compound_read:n {#4} } } \bool_if:NT #1 { \msg_error:nn {chemnum} {erroneous-argument-combination} } } @@ -1353,10 +1386,18 @@ } % ---------------------------------------------------------------------------- -\cs_set_protected:Npn \chemnum_show_key_def:n #1 - { \marginpar { \fbox { \normalfont \ttfamily #1 } } } +\cs_new_protected:Npn \chemnum_print_label_id:n #1 + { + \group_begin: + \str_set:Nn \l__chemnum_tmpa_str {#1} + \str_use:N \l__chemnum_tmpa_str + \group_end: + } + +\cs_new_protected:Npn \chemnum_show_label_margin:n #1 + { \marginpar { \fbox {#1} } } -\cs_set_protected:Npn \chemnum_show_key_ref:n #1 +\cs_new_protected:Npn \chemnum_show_label_inline:n #1 { \group_begin: \hbox_unpack:N \c_empty_box % this is \leavevmode @@ -1366,18 +1407,38 @@ \hbox_overlap_right:n { \tex_vrule:D \tex_raise:D .75em - \hbox:n - { \underbar { \normalfont \footnotesize \ttfamily #1 } } + \hbox:n { \underbar {#1} } } } \group_end: } -% ---------------------------------------------------------------------------- +\NewDocumentCommand \cmpdprintlabelid {m} + { \chemnum_print_label_id:n {#1} } + +\NewDocumentCommand \cmpdshowlabelmargin {m} + { \chemnum_show_label_margin:n {#1} } + +\NewDocumentCommand \cmpdshowlabelinline {m} + { \chemnum_show_label_inline:n {#1} } + \NewDocumentCommand \chemnumshowdef {m} - { \chemnum_show_key_def:n {#1} } + { + \cmpdshowlabelmargin + { + \normalfont \ttfamily + \cmpdprintlabelid {#1} + } + } + \NewDocumentCommand \chemnumshowref {m} - { \chemnum_show_key_ref:n {#1} } + { + \cmpdshowlabelinline + { + \normalfont \ttfamily \footnotesize + \cmpdprintlabelid {#1} + } + } \NewDocumentCommand \cmpdshowdef {m} { \chemnumshowdef {#1} } \NewDocumentCommand \cmpdshowref {m} { \chemnumshowref {#1} } @@ -1396,7 +1457,7 @@ \l__chemnum_tmpc_seq \l__chemnum_sub_separator_tl {#5} - \seq_remove_duplicates:N \l__chemnum_tmpc_seq + \seq_remove_duplicates:N \l__chemnum_tmpc_seq \seq_map_inline:Nn \l__chemnum_tmpc_seq { \bool_if:NF #2 @@ -1467,29 +1528,34 @@ \seq_clear:N #7 \bool_if:NF #1 { - \seq_map_inline:cn { g__chemnum_compound_#5_subcompounds_seq } + \seq_if_exist:cTF {g__chemnum_compound_#5_subcompounds_seq} { - \seq_if_in:NnT #3 {##1} + \seq_map_inline:Nn #3 { - \seq_put_right:Nn #6 - { \chemnum_write_subcompound:NNnnn #1 #2 {#4} {#5} {##1} } - \bool_if:NTF #2 + \seq_if_in:cnTF {g__chemnum_compound_#5_subcompounds_seq} {##1} { - \seq_put_right:Nx #7 + \seq_put_right:Nn #6 + { \chemnum_write_subcompound:NNnnn #1 #2 {#4} {#5} {##1} } + \bool_if:NTF #2 { - \chemnum_expandable_get_subcompound_property:nnn - {#5} {##1} {previous-number} + \seq_put_right:Nx #7 + { + \chemnum_expandable_get_subcompound_property:nnn + {#5} {##1} {previous-number} + } } - } - { - \seq_put_right:Nx #7 { - \chemnum_expandable_get_subcompound_property:nnn - {#5} {##1} {number} + \seq_put_right:Nx #7 + { + \chemnum_expandable_get_subcompound_property:nnn + {#5} {##1} {number} + } } } + { \__chemnum_nothing_here:nn {##1} {#5} } } } + { \__chemnum_nothing_here:xn { \seq_use:Nnnn #3 {,~} {,~} {,~} } {#5} } } } @@ -1917,8 +1983,8 @@ } \NewDocumentCommand \initcmpd {O{}m} - { \chemnum_init:nn {#1} {#2} } -\@onlypreamble\cmpdinit + { \AtBeginDocument { \chemnum_init:nn {#1} {#2} } } +\@onlypreamble\initcmpd % ---------------------------------------------------------------------------- % resetting compound numbering @@ -2008,4 +2074,10 @@ HISTORY: \prop_item:Nn) 2016/04/14 v1.2 - changes to how compounds are saved to auxfile - hyperref support: backlinks to first appearance of label - +2016/05/11 v1.2a - pre- and post-label options now belong both to the + `compound' and the `general' groups +2016/10/22 v1.2b - enable label keys to be printed (with `show-keys') if they + contain underscores or similar tokens + - easier customization possibilities of the `show-keys' + functions +2019/10/02 v1.2c - fix issues #5, #7 |