Skip to content

Commit

Permalink
v6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
cgnieder committed Mar 5, 2022
1 parent a504042 commit 8f1b26a
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 49 deletions.
3 changes: 2 additions & 1 deletion HISTORY
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ Version history
which is why \ChemStyle is introduced
- add load-time option `stop' which can prevent
modules and styles from being loaded
2022/??/?? - version 6?? - enable giving translation keys per language
2022/03/05 - version 6.2 - enable giving translation keys per language
(lang)
- re-write translations module giving keys per
language rather than vice versa
- fix issue with phases/sub=true (issue #49)
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--------------------------------------------------------------------------
the CHEMMACROS package v6.1 2022/02/13
the CHEMMACROS package v6.2 2022/03/05

comprehensive support for typesetting chemistry documents

Expand Down
2 changes: 1 addition & 1 deletion chemmacros.intro.statement
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
% --------------------------------------------------------------------------
% the CHEMMACROS package v6.1 2022/02/13
% the CHEMMACROS package v6.2 2022/03/05
%
% comprehensive support for typesetting chemistry documents
%
Expand Down
12 changes: 5 additions & 7 deletions code/chemmacros.isotopes.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{ \tl_set:Nx #2 { \use:c { @elements@atom@name@num@ \str_lowercase:n {#1} } } }
}
}
\cs_generate_variant:Nn \chemmacros_get_atom_number:nN { V }
\cs_generate_variant:Nn \chemmacros_get_atom_number:nN {V}

% #1: atomic number|element symbol|element name
% #2: tl to store the result in
Expand Down Expand Up @@ -64,7 +64,7 @@
{ \prg_return_true: }
{ \prg_return_false: }
}
\cs_generate_variant:Nn \chemmacros_check_isotope:nnF { V }
\cs_generate_variant:Nn \chemmacros_check_isotope:nnF {V}

% #1: atomic number|element symbol|element name
% #2: tl to store the result in
Expand All @@ -81,7 +81,7 @@
{ \seq_map_break: }
}
}
\cs_generate_variant:Nn \chemmacros_get_main_isotope:nN { V }
\cs_generate_variant:Nn \chemmacros_get_main_isotope:nN {V}

% #1: atomic number|element symbol|element name
% #2: seq to store the results in
Expand Down Expand Up @@ -198,11 +198,9 @@
#1
}
}
\cs_generate_variant:Nn \chemmacros_isotope_write:nnn { VnV , VVV , nnV , nVV }
\cs_generate_variant:Nn \chemmacros_isotope_write:nnn {VnV,VVV,nnV,nVV}

% TODO: option for the layout of the written isotope: ^{12}_6C vs C-12

\NewDocumentCommand \isotope { sm }
\NewDocumentCommand \isotope {sm}
{ \chemmacros_isotope:nn {#1} {#2} }

% --------------------------------------------------------------------------
Expand Down
16 changes: 13 additions & 3 deletions code/chemmacros.lang.code.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\ChemModule{lang}{2022/02/24 language settings for chemmacros}
\ChemModule{lang}{2022/03/05 language settings for chemmacros}

\RequirePackage{translations}

Expand Down Expand Up @@ -120,18 +120,28 @@
{#2}
}

% #1: key
% #2: lang
% #3: translation
\NewDocumentCommand \DeclareChemTranslations {mm}
{ \chemmacros_declare_translations:nn {#1} {#2} }
\@onlypreamble \DeclareChemTranslations


% #1: key
% #2: csv list: { <lang1> = <translation1> , <lang2> = <translation2> }
\NewDocumentCommand \DeclareChemTranslation {mmm}
{ \chemmacros_declare_translation:nnn {#1} {#2} {#3} }
\@onlypreamble \DeclareChemTranslation

% #1: lang
% #2: csv list: { <key1> = <translation1> , <key2> = <translation2> }
\NewDocumentCommand \AddChemTranslations {mm}
{ \chemmacros_add_translations:nn {#1} {#2} }
\@onlypreamble \AddChemTranslations


% #1: lang
% #2: key
% #3: translation
\NewDocumentCommand \AddChemTranslation {mmm}
{ \chemmacros_add_translation:nnn {#1} {#2} {#3} }
\@onlypreamble \AddChemTranslation
Expand Down
4 changes: 2 additions & 2 deletions code/chemmacros.newman.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
{ #2 } ;
\group_end:
}
\cs_generate_variant:Nn \chemmacros_newman_back_node:nn { nf }
\cs_generate_variant:Nn \chemmacros_newman_back_node:nn {nf}

% place front nodes:
\cs_new_protected:Npn \chemmacros_newman_front_node:nn #1#2
Expand Down Expand Up @@ -175,7 +175,7 @@
)
{ #2 } ;
}
\cs_generate_variant:Nn \chemmacros_newman_front_node:nn { nf }
\cs_generate_variant:Nn \chemmacros_newman_front_node:nn {nf}

% --------------------------------------------------------------------------
\ChemModuleEnd
2 changes: 1 addition & 1 deletion code/chemmacros.phases.code.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\ChemModule{phases}{2020/11/29 phase descriptors}
\ChemModule{phases}{2022/03/03 phase descriptors}

\bool_new:N \l__chemmacros_phases_sub_bool
\dim_new:N \l__chemmacros_phases_space_dim
Expand Down
2 changes: 1 addition & 1 deletion code/chemmacros.reactions.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
#3
\end{#1}
}
\cs_generate_variant:Nn \__chemmacros_reaction_write:nnn { nnV }
\cs_generate_variant:Nn \__chemmacros_reaction_write:nnn {nnV}

\chemmacros_define_keys:nn {reactions}
{
Expand Down
4 changes: 2 additions & 2 deletions code/chemmacros.spectroscopy.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
\tl_gclear:N \g__chemmacros_nmr_element_coupled_tl
}
}
\cs_generate_variant:Nn \__chemmacros_nmr_nucleus:nn { VV }
\cs_generate_variant:Nn \__chemmacros_nmr_nucleus:nn {VV}

\cs_new_protected:Npn \__chemmacros_nmr_nucleus:w #1,#2 \q_stop
{
Expand Down Expand Up @@ -120,7 +120,7 @@
\group_end:
}

\cs_generate_variant:Nn \__chemmacros_nmr_base:nn { VV }
\cs_generate_variant:Nn \__chemmacros_nmr_base:nn {VV}

\cs_new_protected:Npn \__chemmacros_nmr_frequency:n #1
{
Expand Down
4 changes: 2 additions & 2 deletions code/chemmacros.start.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

% --------------------------------------------------------------------------
% package information:
\tl_const:Nn \c_chemmacros_date_tl {2022/02/13}
\tl_const:Nn \c_chemmacros_date_tl {2022/03/05}
\tl_const:Nn \c_chemmacros_version_major_number_tl {6}
\tl_const:Nn \c_chemmacros_version_minor_number_tl {1}
\tl_const:Nn \c_chemmacros_version_minor_number_tl {2}
\tl_const:Nn \c_chemmacros_version_subrelease_tl {}
\tl_const:Nx \c_chemmacros_version_number_tl
{
Expand Down
48 changes: 28 additions & 20 deletions code/chemmacros.sty
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
% --------------------------------------------------------------------------
% the CHEMMACROS package v6.1 2022/02/13
% the CHEMMACROS package v6.2 2022/03/05
%
% comprehensive support for typesetting chemistry documents
%
Expand Down Expand Up @@ -34,9 +34,9 @@

% --------------------------------------------------------------------------
% package information:
\tl_const:Nn \c_chemmacros_date_tl {2022/02/13}
\tl_const:Nn \c_chemmacros_date_tl {2022/03/05}
\tl_const:Nn \c_chemmacros_version_major_number_tl {6}
\tl_const:Nn \c_chemmacros_version_minor_number_tl {1}
\tl_const:Nn \c_chemmacros_version_minor_number_tl {2}
\tl_const:Nn \c_chemmacros_version_subrelease_tl {}
\tl_const:Nx \c_chemmacros_version_number_tl
{
Expand Down Expand Up @@ -1038,7 +1038,7 @@
% --------------------------------------------------------------------------

\ChemModuleEnd
\ChemModule{lang}{2022/02/24 language settings for chemmacros}
\ChemModule{lang}{2022/03/05 language settings for chemmacros}

\RequirePackage{translations}

Expand Down Expand Up @@ -1160,18 +1160,28 @@
{#2}
}

% #1: key
% #2: lang
% #3: translation
\NewDocumentCommand \DeclareChemTranslations {mm}
{ \chemmacros_declare_translations:nn {#1} {#2} }
\@onlypreamble \DeclareChemTranslations


% #1: key
% #2: csv list: { <lang1> = <translation1> , <lang2> = <translation2> }
\NewDocumentCommand \DeclareChemTranslation {mmm}
{ \chemmacros_declare_translation:nnn {#1} {#2} {#3} }
\@onlypreamble \DeclareChemTranslation

% #1: lang
% #2: csv list: { <key1> = <translation1> , <key2> = <translation2> }
\NewDocumentCommand \AddChemTranslations {mm}
{ \chemmacros_add_translations:nn {#1} {#2} }
\@onlypreamble \AddChemTranslations


% #1: lang
% #2: key
% #3: translation
\NewDocumentCommand \AddChemTranslation {mmm}
{ \chemmacros_add_translation:nnn {#1} {#2} {#3} }
\@onlypreamble \AddChemTranslation
Expand Down Expand Up @@ -1819,7 +1829,7 @@

% --------------------------------------------------------------------------
\ChemModuleEnd
\ChemModule{phases}{2020/11/29 phase descriptors}
\ChemModule{phases}{2022/03/03 phase descriptors}

\bool_new:N \l__chemmacros_phases_sub_bool
\dim_new:N \l__chemmacros_phases_space_dim
Expand Down Expand Up @@ -2767,7 +2777,7 @@
{ \tl_set:Nx #2 { \use:c { @elements@atom@name@num@ \str_lowercase:n {#1} } } }
}
}
\cs_generate_variant:Nn \chemmacros_get_atom_number:nN { V }
\cs_generate_variant:Nn \chemmacros_get_atom_number:nN {V}

% #1: atomic number|element symbol|element name
% #2: tl to store the result in
Expand Down Expand Up @@ -2808,7 +2818,7 @@
{ \prg_return_true: }
{ \prg_return_false: }
}
\cs_generate_variant:Nn \chemmacros_check_isotope:nnF { V }
\cs_generate_variant:Nn \chemmacros_check_isotope:nnF {V}

% #1: atomic number|element symbol|element name
% #2: tl to store the result in
Expand All @@ -2825,7 +2835,7 @@
{ \seq_map_break: }
}
}
\cs_generate_variant:Nn \chemmacros_get_main_isotope:nN { V }
\cs_generate_variant:Nn \chemmacros_get_main_isotope:nN {V}

% #1: atomic number|element symbol|element name
% #2: seq to store the results in
Expand Down Expand Up @@ -2942,11 +2952,9 @@
#1
}
}
\cs_generate_variant:Nn \chemmacros_isotope_write:nnn { VnV , VVV , nnV , nVV }

% TODO: option for the layout of the written isotope: ^{12}_6C vs C-12
\cs_generate_variant:Nn \chemmacros_isotope_write:nnn {VnV,VVV,nnV,nVV}

\NewDocumentCommand \isotope { sm }
\NewDocumentCommand \isotope {sm}
{ \chemmacros_isotope:nn {#1} {#2} }

% --------------------------------------------------------------------------
Expand Down Expand Up @@ -3236,7 +3244,7 @@
{ #2 } ;
\group_end:
}
\cs_generate_variant:Nn \chemmacros_newman_back_node:nn { nf }
\cs_generate_variant:Nn \chemmacros_newman_back_node:nn {nf}

% place front nodes:
\cs_new_protected:Npn \chemmacros_newman_front_node:nn #1#2
Expand Down Expand Up @@ -3267,7 +3275,7 @@
)
{ #2 } ;
}
\cs_generate_variant:Nn \chemmacros_newman_front_node:nn { nf }
\cs_generate_variant:Nn \chemmacros_newman_front_node:nn {nf}

% --------------------------------------------------------------------------
\ChemModuleEnd
Expand Down Expand Up @@ -4199,7 +4207,7 @@
#3
\end{#1}
}
\cs_generate_variant:Nn \__chemmacros_reaction_write:nnn { nnV }
\cs_generate_variant:Nn \__chemmacros_reaction_write:nnn {nnV}

\chemmacros_define_keys:nn {reactions}
{
Expand Down Expand Up @@ -5086,7 +5094,7 @@
\tl_gclear:N \g__chemmacros_nmr_element_coupled_tl
}
}
\cs_generate_variant:Nn \__chemmacros_nmr_nucleus:nn { VV }
\cs_generate_variant:Nn \__chemmacros_nmr_nucleus:nn {VV}

\cs_new_protected:Npn \__chemmacros_nmr_nucleus:w #1,#2 \q_stop
{
Expand Down Expand Up @@ -5138,7 +5146,7 @@
\group_end:
}

\cs_generate_variant:Nn \__chemmacros_nmr_base:nn { VV }
\cs_generate_variant:Nn \__chemmacros_nmr_base:nn {VV}

\cs_new_protected:Npn \__chemmacros_nmr_frequency:n #1
{
Expand Down Expand Up @@ -5535,7 +5543,7 @@
}
\group_end:
}
\cs_generate_variant:Nn \chemmacros_state:nnnnnn { nVVVVV }
\cs_generate_variant:Nn \chemmacros_state:nnnnnn {nVVVVV}

\exp_args:NNe
\NewDocumentCommand \state { O{}e{\char_generate:nn {`_}{8}^}me{\char_generate:nn {`_}{8}^} }
Expand Down
2 changes: 1 addition & 1 deletion code/chemmacros.thermodynamics.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
}
\group_end:
}
\cs_generate_variant:Nn \chemmacros_state:nnnnnn { nVVVVV }
\cs_generate_variant:Nn \chemmacros_state:nnnnnn {nVVVVV}

\exp_args:NNe
\NewDocumentCommand \state { O{}e{\char_generate:nn {`_}{8}^}me{\char_generate:nn {`_}{8}^} }
Expand Down
Binary file modified doc/chemmacros-manual.pdf
Binary file not shown.
3 changes: 2 additions & 1 deletion doc/chemmacros.manual.cls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\ProvidesClass{chemmacros-manual}[2022/02/13]
\ProvidesClass{chemmacros-manual}[2022/03/05]

\LoadClass[load-preamble,add-index]{cnltx-doc}
\RequirePackage{imakeidx}
Expand Down Expand Up @@ -533,5 +533,6 @@
\chemmacros@add@version{2022-01-16}{6.0}
\chemmacros@add@version{2022-01-18}{6.0a}
\chemmacros@add@version{2022-02-13}{6.1}
\chemmacros@add@version{2022-03-05}{6.2}

\endinput
16 changes: 10 additions & 6 deletions doc/chemmacros.manual.tex
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ \subsection{Upgrading from version $5.x$}
\option{minimal} allows to load \chemmacros\ with smallest subset
necessary. Then additional modules can be added with the
\option{modules}.
\item A new module \module{reactants} has been added, thanks to \leandriis.
\item A new module \module{reactants} has been added, thanks to \leandriis!
\end{itemize}

\part{Main Modules}\label{part:main-modules}
Expand Down Expand Up @@ -3323,11 +3323,6 @@ \subsection{Available Translation Keys}\label{sec:avail-transl-keys}
find that a translation for your language is missing you can provide it in the
preamble:
\begin{commands}
% \command{DeclareTranslation}[\marg{language}\marg{key}\marg{translation}]
% Defines a translation of key \meta{key} for the language \meta{language}.
% No error will be raised if a translation of \meta{key} already exists.
% This command can only be used in the preamble and is defined by the
% \pkg{translations} package.
\command{DeclareChemTranslation}[\marg{key}\marg{language}\marg{translation}]
\sinceversion{5.6}A command which makes an abstraction from the
\pkg{translations} package. It should be used in documents for adding
Expand All @@ -3339,6 +3334,15 @@ \subsection{Available Translation Keys}\label{sec:avail-transl-keys}
used by document authors as well, of course. It gets a csv list of
key\slash value pairs of translations. This command can only be used in
the preamble.
\command{AddChemTranslation}[\marg{language}\marg{key}\marg{translation}]
\sinceversion{6.2}Basically the same as \cs{DeclareChemTranslation} but
with focus on the language instead of the key and thus has a different
argument order. This command can only be used in the preamble.
\command{AddChemTranslations}[\marg{languagen}\Marg{\meta{key} = \meta{translation}}]
\sinceversion{6.2}Basically the same as \cs{DeclareChemTranslations} but
with focus on the language instead of the key. It lets you define the
translations of several keys for one language in one go. This command can
only be used in the preamble.
\end{commands}
If you send me an email (see section~\vref{sec:sugg-bug-reports}) with the
translations for your language I'll gladly add them to the next release of
Expand Down

0 comments on commit 8f1b26a

Please sign in to comment.