summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-09-12 21:23:52 +0000
committerKarl Berry <karl@freefriends.org>2015-09-12 21:23:52 +0000
commitaf6faae1a8553e2c55f7980152d84d8cf4ac5a96 (patch)
treec0e8e756f5e5118331df38ec867e51d67a8d0f5d /Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex
parentb8a8a5629c2e03bdf95ebe04a220c4568a1dad14 (diff)
chemmacros (12sep15)
git-svn-id: svn://tug.org/texlive/trunk@38359 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex')
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex84
1 files changed, 84 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex
new file mode 100644
index 00000000000..cbc6fe23039
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex
@@ -0,0 +1,84 @@
+% --------------------------------------------------------------------------
+%
+% the CHEMMACROS package -- module: `phases'
+%
+% --------------------------------------------------------------------------
+% Clemens Niederberger
+% --------------------------------------------------------------------------
+% 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.
+% --------------------------------------------------------------------------
+% Copyright 2011-2015 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.
+% --------------------------------------------------------------------------
+\ChemModule{phases}{2015/06/09 phase descriptors}
+
+\chemmacros_load_module:n {chemformula}
+
+\bool_new:N \l__chemmacros_phases_sub_bool
+\dim_new:N \l__chemmacros_phases_space_dim
+\dim_set:Nn \l__chemmacros_phases_space_dim { .1333 em }
+
+\keys_define:nn {chemmacros/phases}
+ {
+ pos .choice: ,
+ pos / sub .code:n = \bool_set_true:N \l__chemmacros_phases_sub_bool ,
+ pos / side .code:n = \bool_set_false:N \l__chemmacros_phases_sub_bool ,
+ space .dim_set:N = \l__chemmacros_phases_space_dim
+ }
+
+\chemmacros_new_macroset:nnn {Phase} {mm} { \chemmacros_define_phase:Nn #1 {#2} }
+
+\cs_new_protected:Npn \chemmacros_define_phase:Nn #1#2
+ {
+ \tl_set:Nx \l__chemmacros_tmpa_tl { phase-\chemmacros_remove_backslash:N #1 }
+ \exp_args:NV \@trnslt@declare@translation
+ \l__chemmacros_tmpa_tl
+ {fallback}
+ {#2}
+ \__chemmacros_define_phase:Nx #1
+ { \exp_not:N \chemmacros_translate:n { \exp_not:V \l__chemmacros_tmpa_tl } }
+ }
+
+\cs_new_protected:Npn \__chemmacros_define_phase:Nn #1#2
+ {
+ \cs_if_exist:NF #1 { \cs_new:Npn #1 {} }
+ \DeclareDocumentCommand #1 {o}
+ { \chemmacros_phase:n { #2 \IfNoValueF {##1} {,~##1} } }
+ }
+\cs_generate_variant:Nn \__chemmacros_define_phase:Nn { Nx }
+
+\cs_new_protected:Npn \chemmacros_phase:n #1
+ {
+ \chemmacros_leave_vmode:
+ \bool_if:NTF \l__chemmacros_phases_sub_bool
+ { \chemformula_subscript:n { (#1) } }
+ {
+ \skip_horizontal:N \l__chemmacros_phases_space_dim
+ \chemmacros_text:n { (#1) }
+ }
+ }
+
+% --------------------------------------------------------------------------
+\NewDocumentCommand \phase {m} { \chemmacros_phase:n {#1} }
+
+\NewChemPhase \sld {s}
+\NewChemPhase \lqd {l}
+\NewChemPhase \gas {g}
+\NewChemPhase \aq {aq}
+
+% --------------------------------------------------------------------------