summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-08-10 22:26:33 +0000
committerKarl Berry <karl@freefriends.org>2014-08-10 22:26:33 +0000
commit42bcd08cc7a71e0192916020b1ace6838c3c21cb (patch)
treefcfe4de6272df848a5a89e00052a7a525c3b88a9 /Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
parent118ad5fd40d58a85598d9e7227466ebf8ad1a946 (diff)
chemmacros (9aug14)
git-svn-id: svn://tug.org/texlive/trunk@34897 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty')
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty254
1 files changed, 140 insertions, 114 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
index 3075128b12a..c1a37af5dcd 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
@@ -1,33 +1,34 @@
% --------------------------------------------------------------------------
-% - the CHEMMACROS bundle
-% - chemmacros.sty
-% - loads of little helpers for chemists
+% the CHEMMACROS package
+%
+% loads of little helpers for chemists
+%
% --------------------------------------------------------------------------
-% - Clemens Niederberger
+% Clemens Niederberger
% --------------------------------------------------------------------------
-% - https://bitbucket.org/cgnieder/chemmacros/
-% - contact@mychemistry.eu
+% https://github.org/cgnieder/chemmacros/
+% contact@mychemistry.eu
% --------------------------------------------------------------------------
-% - If you have any ideas, questions, suggestions or bugs to report, please
-% - feel free to contact me.
+% If you have any ideas, questions, suggestions or bugs to report, please
+% feel free to contact me.
% --------------------------------------------------------------------------
-% - Copyright 2011-2014 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.
+% Copyright 2011-2014 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.
% --------------------------------------------------------------------------
\RequirePackage{ expl3 , xparse , l3keys2e }
-\def\chemmacros@version{4.5a}
-\def\chemmacros@date{2014/06/30}
+\def\chemmacros@version{4.6}
+\def\chemmacros@date{2014/08/08}
\ProvidesExplPackage
{chemmacros}
@@ -92,7 +93,7 @@
\bool_new:N \l__chemmacros_varioref_bool
\bool_new:N \l__chemmacros_chemfig_bool
\bool_new:N \l__chemmacros_ghsystem_bool
-\bool_set_true:N \l__chemmacros_ghsystem_bool
+% \bool_set_true:N \l__chemmacros_ghsystem_bool
\bool_new:N \l__chemmacros_iupac_restricted_bool
\bool_new:N \l__chemmacros_iupac_strict_bool
@@ -335,7 +336,7 @@
% define a deprecated command with hints to the corresponding new one:
\cs_new_protected:Npn \chemmacros_define_deprecated:NN #1#2
{
- \cs_new_protected:Npn #1
+ \cs_set_protected:Npn #1
{
\msg_warning:nnxx { chemmacros } { command-deprecated }
{ #1 } { #2 }
@@ -349,7 +350,7 @@
% define a command as dropped!
\cs_new_protected:Npn \chemmacros_define_dropped:N #1
{
- \cs_new_protected:Npn #1
+ \cs_set_protected:Npn #1
{ \msg_error:nnn { chemmacros } { command-dropped } { #1 } }
}
@@ -764,8 +765,6 @@
\NewChemParticle \prt { p+ }
\NewChemParticle \ntr { n^0 }
-\DeclareChemDropped \Rad
-
% --------------------------------------------------------------------------
% charges
% circled charge signs: they are defined in the `chemformula' module:
@@ -1151,9 +1150,6 @@
\NewChemIUPAC \tert { \textit { tert } }
% Fischer
-\DeclareChemDropped \Dfi
-\DeclareChemDropped \Lfi
-
\NewChemIUPAC \dexter { \textsc { d } }
\NewChemIUPAC \laevus { \textsc { l } }
@@ -1286,7 +1282,7 @@
\chemmacros_allow_hyphens:
}
-\cs_new_protected:Nn \chemmacros_break_point:
+\cs_new_protected:Npn \chemmacros_break_point:
{
\chemmacros_nobreak:
\tex_discretionary:D { - } { }
@@ -1294,20 +1290,46 @@
\chemmacros_allow_hyphens:
}
+\cs_new_protected:Npn \chemmacros_superscript:
+ { \mode_if_math:TF { \sb } { \textsuperscript } }
+
\bool_new:N \l__chemmacros_inside_iupac_bool
-\cs_new_protected:Nn \chemmacros_iupac:n
+\group_begin:
+\char_set_catcode_active:N \~
+\char_set_lccode:nn {`~} {`|}
+\tl_to_lowercase:n { \group_end: \cs_set_eq:NN ~ } \chemmacros_break_point:
+
+\group_begin:
+\char_set_catcode_active:N \~
+\char_set_lccode:nn {`~} {`^}
+\tl_to_lowercase:n { \group_end: \cs_set_protected:Npn ~ }
+ { \chemmacros_superscript: }
+
+\group_begin:
+\char_set_catcode_active:N \|
+\char_set_catcode_active:N \^
+
+\cs_new_protected:Npn \chemmacros_iupac:n
{
\group_begin:
\bool_set_true:N \l__chemmacros_inside_iupac_bool
\chemmacros_make_iupac:
\chemmacros_ignore_spaces:
\cs_set_eq:NN \- \chemmacros_break_point_hyphen:
- \cs_set_eq:NN \| \chemmacros_break_point:
- \cs_set_eq:NN \^ \textsuperscript
+ \char_set_catcode_active:N \|
+ \char_set_catcode_active:N \^
+ \chemmacros_define_deprecated:NN \| |
+ \chemmacros_define_deprecated:NN \^ ^
+ \chemmacros_iupac_aux:n
+ }
+
+\cs_new_protected:Npn \chemmacros_iupac_aux:n #1
+ {
#1
\group_end:
}
+\group_end:
% Thanks to Joseph Wright and Enrico Gregorio for the help on the curious
% redefinition of \- and the end of the compilation
@@ -1316,8 +1338,8 @@
\cs_set_protected:Npx \- { \exp_not:o { \- } }
\cs_set_eq:NN \@dischyph \-
-\NewDocumentCommand \iupac { m }
- { \chemmacros_iupac:n { #1 } }
+\NewDocumentCommand \iupac { }
+ { \chemmacros_iupac:n }
% --------------------------------------------------------------------------
% latin phrases
@@ -2146,7 +2168,7 @@
\tl_put_right:Nn \g__chemmacros_nmr_element_coupled_tl { \} }
}
\tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl { #2 }
- \iupac { \^ { #1 } }
+ \iupac { \chemmacros_superscript: { #1 } }
\bool_if:NTF \l__chemmacros_nmr_parse_bool
{ \chemformula_ch:nV {} \g__chemmacros_nmr_element_coupled_tl }
{ \chemmacros_atom:V \g__chemmacros_nmr_element_coupled_tl }
@@ -3916,88 +3938,88 @@
% full tip for pairs
\pgfarrowsdeclare { el } { el }
-{
- \dim_set:Nn \l__chemmacros_el_length_dim
- { 2.5pt + 2.5\pgflinewidth }
- \pgfarrowsleftextend { -\l__chemmacros_el_length_dim }
- \pgfarrowsrightextend { .5\pgflinewidth }
-}
-{
- \dim_set:Nn \l__chemmacros_el_length_dim
- { 2.5pt + 2.5\pgflinewidth }
- \pgfsetdash {} { 0pt }
- \pgfsetroundjoin
- \pgfsetroundcap
- \pgfpathmoveto { \pgfpoint { 0pt } { 0pt } }
- \pgfpathlineto
- {
- \pgfpoint
- { -\l__chemmacros_el_length_dim }
- { .3\l__chemmacros_el_length_dim }
- }
- \pgfpathlineto
- { \pgfpoint { -.5\l__chemmacros_el_length_dim } { 0pt } }
- \pgfpathlineto
- {
- \pgfpoint
- { -\l__chemmacros_el_length_dim }
- { -.3\l__chemmacros_el_length_dim }
- }
- \pgfpathlineto { \pgfpoint { 0pt } { 0pt } }
- \pgfusepathqfillstroke
-}
+ {
+ \dim_set:Nn \l__chemmacros_el_length_dim
+ { 2.5pt + 2.5\pgflinewidth }
+ \pgfarrowsleftextend { -\l__chemmacros_el_length_dim }
+ \pgfarrowsrightextend { .5\pgflinewidth }
+ }
+ {
+ \dim_set:Nn \l__chemmacros_el_length_dim
+ { 2.5pt + 2.5\pgflinewidth }
+ \pgfsetdash {} { 0pt }
+ \pgfsetroundjoin
+ \pgfsetroundcap
+ \pgfpathmoveto { \pgfpoint { 0pt } { 0pt } }
+ \pgfpathlineto
+ {
+ \pgfpoint
+ { -\l__chemmacros_el_length_dim }
+ { .3\l__chemmacros_el_length_dim }
+ }
+ \pgfpathlineto
+ { \pgfpoint { -.5\l__chemmacros_el_length_dim } { 0pt } }
+ \pgfpathlineto
+ {
+ \pgfpoint
+ { -\l__chemmacros_el_length_dim }
+ { -.3\l__chemmacros_el_length_dim }
+ }
+ \pgfpathlineto { \pgfpoint { 0pt } { 0pt } }
+ \pgfusepathqfillstroke
+ }
% half tip on the left
\pgfarrowsdeclare { left~el } { left~el }
-{
- \dim_set:Nn \l__chemmacros_el_length_dim
- { 2.5pt + 2.5\pgflinewidth }
- \pgfarrowsleftextend { -\l__chemmacros_el_length_dim }
- \pgfarrowsrightextend { .5\pgflinewidth }
-}
-{
- \dim_set:Nn \l__chemmacros_el_length_dim
- { 2.5pt + 2.5\pgflinewidth }
- \pgfsetdash {} { 0pt }
- \pgfsetroundjoin
- \pgfsetroundcap
- \pgfpathmoveto { \pgfpoint { 0pt } { 0pt } }
- \pgfpathlineto
- {
- \pgfpoint
- { -\l__chemmacros_el_length_dim }
- { .3\l__chemmacros_el_length_dim }
- }
- \pgfpathlineto { \pgfpoint { -.5\l__chemmacros_el_length_dim } { 0pt } }
- \pgfpathlineto { \pgfpoint { 0pt } { 0pt } }
- \pgfusepathqfillstroke
-}
+ {
+ \dim_set:Nn \l__chemmacros_el_length_dim
+ { 2.5pt + 2.5\pgflinewidth }
+ \pgfarrowsleftextend { -\l__chemmacros_el_length_dim }
+ \pgfarrowsrightextend { .5\pgflinewidth }
+ }
+ {
+ \dim_set:Nn \l__chemmacros_el_length_dim
+ { 2.5pt + 2.5\pgflinewidth }
+ \pgfsetdash {} { 0pt }
+ \pgfsetroundjoin
+ \pgfsetroundcap
+ \pgfpathmoveto { \pgfpoint { 0pt } { 0pt } }
+ \pgfpathlineto
+ {
+ \pgfpoint
+ { -\l__chemmacros_el_length_dim }
+ { .3\l__chemmacros_el_length_dim }
+ }
+ \pgfpathlineto { \pgfpoint { -.5\l__chemmacros_el_length_dim } { 0pt } }
+ \pgfpathlineto { \pgfpoint { 0pt } { 0pt } }
+ \pgfusepathqfillstroke
+ }
% half tip in the right
\pgfarrowsdeclare { right~el } { right~el }
-{
- \dim_set:Nn \l__chemmacros_el_length_dim
- { 2.5pt + 2.5\pgflinewidth }
- \pgfarrowsleftextend { -\l__chemmacros_el_length_dim }
- \pgfarrowsrightextend { .5\pgflinewidth }
-}
-{
- \dim_set:Nn \l__chemmacros_el_length_dim
- { 2.5pt + 2.5\pgflinewidth }
- \pgfsetdash {} { 0pt }
- \pgfsetroundjoin
- \pgfsetroundcap
- \pgfpathmoveto { \pgfpoint { 0pt } { 0pt } }
- \pgfpathlineto
- {
- \pgfpoint
- { -\l__chemmacros_el_length_dim }
- { -.3\l__chemmacros_el_length_dim }
- }
- \pgfpathlineto { \pgfpoint { -.5\l__chemmacros_el_length_dim } { 0pt } }
- \pgfpathlineto { \pgfpoint { 0pt } { 0pt } }
- \pgfusepathqfillstroke
-}
+ {
+ \dim_set:Nn \l__chemmacros_el_length_dim
+ { 2.5pt + 2.5\pgflinewidth }
+ \pgfarrowsleftextend { -\l__chemmacros_el_length_dim }
+ \pgfarrowsrightextend { .5\pgflinewidth }
+ }
+ {
+ \dim_set:Nn \l__chemmacros_el_length_dim
+ { 2.5pt + 2.5\pgflinewidth }
+ \pgfsetdash {} { 0pt }
+ \pgfsetroundjoin
+ \pgfsetroundcap
+ \pgfpathmoveto { \pgfpoint { 0pt } { 0pt } }
+ \pgfpathlineto
+ {
+ \pgfpoint
+ { -\l__chemmacros_el_length_dim }
+ { -.3\l__chemmacros_el_length_dim }
+ }
+ \pgfpathlineto { \pgfpoint { -.5\l__chemmacros_el_length_dim } { 0pt } }
+ \pgfpathlineto { \pgfpoint { 0pt } { 0pt } }
+ \pgfusepathqfillstroke
+ }
% --------------------------------------------------------------------------
% setup
@@ -4327,9 +4349,13 @@ Version history
2014/04/08 - version 4.5 - new option `acid-base/subscript'
- added Dutch translations
2014/06/30 - version 4.5a - adapt to deprecated expl3 functions
+2014/08/08 - version 4.6 - from bundle to packages: packages `chemformula',
+ `ghsystem' and `chemgreek' no longer belong to the
+ bundle but now are packages of their own.
% --------------------------------------------------------------------------- %
% TODO:
- add d-orbitals
- make electron movement arrow tips (`el', `left el' and `right el') public
+- make | and ^ active inside \iupac and use them instead of \| and \^