% -------------------------------------------------------------------------- % the CHEMGREEK package % % interface for upright greek letters for use in chemistry % % -------------------------------------------------------------------------- % Clemens Niederberger % -------------------------------------------------------------------------- % https://github.org/cgnieder/chemgreek/ % contact@mychemistry.eu % -------------------------------------------------------------------------- % 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. % -------------------------------------------------------------------------- \RequirePackage{expl3,xparse} \def\chemgreek@version{0.5} \def\chemgreek@date{2014/08/07} \ProvidesExplPackage{chemgreek}{\chemgreek@date}{\chemgreek@version} {interface for upright greek letters for use in chemistry (CN)} % ---------------------------------------------------------------------------- % temporary variables: \seq_new:N \l__chemgreek_tmpa_seq \tl_new:N \l__chemgreek_tmpa_tl \tl_new:N \l__chemgreek_tmpb_tl \int_new:N \l__chemgreek_tmpa_int \int_new:N \g__chemgreek_tmpa_int % ---------------------------------------------------------------------------- % an l3 conditional that can test 2e's conditionals that go like % \iffoo ... \else ... \fi % see http://tex.stackexchange.com/a/119806/5049 \prg_new_conditional:Npnn \chemgreek_latex_if:n #1 {p,T,F,TF} { \use:c { if #1 } \prg_return_true: \else: \prg_return_false: \fi: } % let's see if we can test if a package has been loaded after begin document: \prg_new_conditional:Npnn \chemgreek_if_package_loaded:n #1 {p,T,F,TF} { \cs_if_exist:cTF { ver@#1.sty } { \prg_return_true: } { \prg_return_false: } } \cs_generate_variant:Nn \chemgreek_if_package_loaded:nF { V } \prg_new_protected_conditional:Npnn \chemgreek_if_package_with:nn #1#2 {T,F,TF} { \cs_if_exist:cTF {opt@#1.sty} { \clist_if_in:cnTF {opt@#1.sty} {#2} { \prg_return_true: } { \prg_return_false: } } { \prg_return_false: } } % ---------------------------------------------------------------------------- % messages \msg_new:nnnn { chemgreek } { mapping-not-defined } { The~ mapping~ `#1'~ does~ not~ exist~ \msg_line_context: } { You~ chose~ the~ mapping~ `#1'~ \msg_line_context: \c_space_tl which~ has~ apparently~ not~ been~ defined,~ yet.~ If~ this~ is~ due~ to~ a~ miss-spelling~ you~ need~ to~ declare~ it~ first~ via~ \token_to_str:N \newchemgreekmapping \c_space_tl or~ \token_to_str:N \declarechemgreekmapping . } \msg_new:nnnn { chemgreek } { mapping-already-defined } { The~ mapping~ `#1'~ does~ already~ exist~ \msg_line_context: } { It~ seems~ you're~ trying~ to~ define~ the~ mapping~ `#1'~ \msg_line_context: .~ However,~ this~ mapping~ does~ already~ exist.~ If~ this~ is~ not~ due~ to~ a~ miss-spelling~ you~ need~ to~ redefine~ it~ via~ \token_to_str:N \renewchemgreekmapping . } \msg_new:nnnn { chemgreek } { mapping-active } { The~ mapping~ `#1'~ already~ is~ active~ \msg_line_context: .~ I'm~ doing~ nothing. } { The~ mapping~ `#1'~ already~ is~ active~ \msg_line_context: .~ I'm~ doing~ nothing. } \msg_new:nnnn { chemgreek } { package-missing } { You've~ activated~ mapping~ `#1'~ which~ needs~ package~ `#2'~ loaded.~ However, package~ `#2'~ does~ not~ seem~ to~ be~ loaded~ \msg_line_context: .~ If~ I'm~ mistaken~ then~ ignore~ this~ warning. } { You've~ activated~ mapping~ `#1'~ which~ needs~ package~ `#2'~ loaded.~ However,~ package~ `#2'~ does~ not~ seem~ to~ be~ loaded~ \msg_line_context: .~ Using~ the~ letter~ macros~ will~ probably~ not~ work.~ If~ I'm~ mistaken~ then~ ignore~ this~ warning. } \msg_new:nnnn { chemgreek } { command-deprecated } { The~ command~ \token_to_str:N #1 is~ deprecated.~ Use~ \token_to_str:N #2 instead~ \msg_line_context: .~ \token_to_str:N #1 may~ be~ dropped~ in~ the~ future~ without~ further~ warning. } { The~ command~ \token_to_str:N #1 is~ deprecated.~ Use~ \token_to_str:N #2 instead~ \msg_line_context: .~ \token_to_str:N #1 may~ be~ dropped~ in~ the~ future~ without~ further~ warning. } % ---------------------------------------------------------------------------- % define a deprecated command with hints to the corresponding new one: \cs_new_protected:Npn \chemgreek_define_deprecated:NN #1#2 { \cs_new_protected:Npn #1 { \msg_warning:nnnn { chemgreek } { command-deprecated } { #1 } { #2 } #2 } } \cs_generate_variant:Nn \chemgreek_define_deprecated:NN { cc } % ---------------------------------------------------------------------------- % a tokenlist constant that will be used to build the mapping property lists % both for uppercase and lowercase and also for setting the output macros \tl_const:Nn \c__chemgreek_alphabet_tl { { alpha } % 1 { beta } % 2 { gamma } % 3 { delta } % 4 { epsilon } % 5 { zeta } % 6 { eta } % 7 { theta } % 8 { iota } % 9 { kappa } % 10 { lambda } % 11 { mu } % 12 { nu } % 13 { xi } % 14 { omikron } % 15 { pi } % 16 { rho } % 17 { sigma } % 18 { tau } % 19 { upsilon } % 20 { phi } % 21 { psi } % 22 { chi } % 23 { omega } % 24 } % ---------------------------------------------------------------------------- % variants of kernel functions: \cs_generate_variant:Nn \prop_put:Nnn { cxV } \cs_generate_variant:Nn \tl_if_eq:nnTF { V } % ---------------------------------------------------------------------------- % helper function to retrieve upper- and lowercase entries while the mapping % happens: \cs_new_protected:Npn \__chemgreek_get_upper_lower:w #1 / #2 \q_stop { \tl_set:Nn \l__chemgreek_tmpa_tl { #1 } \tl_set:Nn \l__chemgreek_tmpb_tl { #2 } } % ---------------------------------------------------------------------------- % a conditional for testing if a mapping exists: \prg_new_conditional:Npnn \chemgreek_if_mapping_exists:n #1 {p,T,F,TF} { \bool_if:nTF { \prop_if_exist_p:c { l__chemgreek_uppercase_mapping_#1_prop } && \prop_if_exist_p:c { l__chemgreek_lowercase_mapping_#1_prop } } { \prg_return_true: } { \prg_return_false: } } % a conditional for testing if a mapping is active: \tl_new:N \l__chemgreek_active_mapping_tl \prg_new_conditional:Npnn \chemgreek_if_mapping_active:n #1 {p,T,F,TF} { \tl_if_eq:NcTF \l__chemgreek_active_mapping_tl { c__chemgreek_mapping_#1_tl } { \prg_return_true: } { \prg_return_false: } } % ---------------------------------------------------------------------------- % a property lists that holds the needed package names for a mapping \prop_new:N \l__chemgreek_packages_prop % ---------------------------------------------------------------------------- % the main mapping function: % #1: mapping-name % #2: package name % #3: mapping-entries \cs_new_protected:Npn \chemgreek_new_mapping:nnn #1#2#3 { \chemgreek_if_mapping_exists:nTF { #1 } { \msg_error:nnn { chemgreek } { mapping-already-defined } { #1 } } { \prop_new:c { l__chemgreek_uppercase_mapping_#1_prop } \prop_new:c { l__chemgreek_lowercase_mapping_#1_prop } \tl_const:cn { c__chemgreek_mapping_#1_tl } { #1 } \prop_put:Nnn \l__chemgreek_packages_prop { #1 } { #2 } \__chemgreek_set_mapping:nn { #1 } { #3 } } } \cs_new_protected:Npn \chemgreek_renew_mapping:nnn #1#2#3 { \chemgreek_if_mapping_exists:nTF { #1 } { \prop_put:Nnn \l__chemgreek_packages_prop { #1 } { #2 } \__chemgreek_set_mapping:nn { #1 } { #3 } } { \msg_error:nnn { chemgreek } { mapping-not-defined } { #1 } } } \cs_new_protected:Npn \chemgreek_declare_mapping:nnn #1#2#3 { \chemgreek_if_mapping_exists:nF { #1 } { \prop_new:c { l__chemgreek_uppercase_mapping_#1_prop } \prop_new:c { l__chemgreek_lowercase_mapping_#1_prop } \tl_const:cn { c__chemgreek_mapping_#1_tl } { #1 } } \prop_put:Nnn \l__chemgreek_packages_prop { #1 } { #2 } \__chemgreek_set_mapping:nn { #1 } { #3 } } \cs_new_protected:Npn \__chemgreek_set_mapping:nn #1#2 { \prop_clear:c { l__chemgreek_lowercase_mapping_#1_prop } \prop_clear:c { l__chemgreek_uppercase_mapping_#1_prop } \int_zero:N \l__chemgreek_tmpa_int \clist_map_inline:nn { #2 } { \int_incr:N \l__chemgreek_tmpa_int \__chemgreek_get_upper_lower:w ##1 \q_stop \prop_put:cxV { l__chemgreek_lowercase_mapping_#1_prop } { \tl_item:Nn \c__chemgreek_alphabet_tl { \l__chemgreek_tmpa_int } } \l__chemgreek_tmpa_tl \prop_put:cxV { l__chemgreek_uppercase_mapping_#1_prop } { \tl_item:Nn \c__chemgreek_alphabet_tl { \l__chemgreek_tmpa_int } } \l__chemgreek_tmpb_tl } } % the user commands: \NewDocumentCommand \newchemgreekmapping { O{}mm } { \chemgreek_new_mapping:nn { #2 } { #1 } { #3 } } \NewDocumentCommand \renewchemgreekmapping { O{}mm } { \chemgreek_renew_mapping:nnn { #2 } { #1 } { #3 } } \NewDocumentCommand \declarechemgreekmapping { O{}mm } { \chemgreek_declare_mapping:nnn { #2 } { #1 } { #3 } } % ---------------------------------------------------------------------------- % a function to selectively change specific entries in a mapping: % this will hold all changed mappings until they've been (re-)activated % logically a sequence or clist would make more sense; however, % \prop_if_in:Nn(TF) is expandable \prop_new:N \l__chemgreek_changed_mappings_prop % #1: mapping-name % #2: upper / lower % #3: entry-name % #4: entry \cs_new_protected:Npn \chemgreek_change:nnnn #1#2#3#4 { \chemgreek_if_mapping_exists:nTF { #1 } { \prop_put:cnn { l__chemgreek_#2 case_mapping_#1_prop } { #3 } { #4 } \prop_put:Nnn \l__chemgreek_changed_mappings_prop { #1 } { #1 } } { \msg_error:nnn { chemgreek } { mapping-not-defined } { #1 } } } % the user command: \NewDocumentCommand \changechemgreeksymbol { mmmm } { \chemgreek_change:nnnn { #1 } { #2 } { #3 } { #4 } } % ---------------------------------------------------------------------------- % a function to activate a mapping: % #1: mapping-name % TODO: error if needed package has not been loaded \cs_new_protected:Npn \chemgreek_activate_mapping:n #1 { \chemgreek_if_mapping_exists:nTF { #1 } { \bool_if:nTF { ( \chemgreek_if_mapping_active_p:n { #1 } ) && !( \prop_if_in_p:Nn \l__chemgreek_changed_mappings_prop { #1 } ) } { \msg_info:nnn { chemgreek } { mapping-active } { #1 } } { \tl_set:Nn \l__chemgreek_active_mapping_tl { #1 } \prop_get:NnN \l__chemgreek_packages_prop { #1 } \l__chemgreek_tmpa_tl \tl_if_blank:VF \l__chemgreek_tmpa_tl { \chemgreek_if_package_loaded:VF \l__chemgreek_tmpa_tl { \msg_warning:nnxx { chemgreek } { package-missing } { #1 } { \l__chemgreek_tmpa_tl } } } \tl_map_inline:Nn \c__chemgreek_alphabet_tl { \cs_set_protected:cpx { chem \tl_expandable_uppercase:n ##1 } { \prop_get:cn { l__chemgreek_uppercase_mapping_#1_prop } { ##1 } } \cs_set_protected:cpx { chem ##1 } { \prop_get:cn { l__chemgreek_lowercase_mapping_#1_prop } { ##1 } } } \prop_get:NnNT \l__chemgreek_changed_mappings_prop { #1 } \l__chemgreek_tmpa_tl { \prop_remove:Nn \l__chemgreek_changed_mappings_prop { #1 } } } } { \msg_error:nnn { chemgreek } { mapping-not-defined } { #1 } } } % user command that also loads the needed package: % #1: load package % #2: mapping-name \NewDocumentCommand \activatechemgreekmapping { sm } { \IfBooleanT { #1 } { \prop_get:NnN \l__chemgreek_packages_prop { #2 } \l__chemgreek_tmpa_tl \tl_if_blank:VF \l__chemgreek_tmpa_tl { \exp_args:No \RequirePackage { \l__chemgreek_tmpa_tl } } } \chemgreek_activate_mapping:n { #2 } } \@onlypreamble\activatechemgreekmapping % user command that activates a new mapping without loading the package: \NewDocumentCommand \selectchemgreekmapping { m } { \chemgreek_activate_mapping:n { #1 } } % ---------------------------------------------------------------------------- % debugging commands: \cs_new_protected:Npn \chemgreek_print_mapping:n #1 { \int_gzero:N \g__chemgreek_tmpa_int \begin { tabular } { llcc } pos & name & lower & upper \\ \tl_map_inline:Nn \c__chemgreek_alphabet_tl { \int_gincr:N \g__chemgreek_tmpa_int \int_use:N \g__chemgreek_tmpa_int . & ##1 & \prop_get:cn { l__chemgreek_lowercase_mapping_#1_prop } { ##1 } & \prop_get:cn { l__chemgreek_uppercase_mapping_#1_prop } { ##1 } \\ } \end{tabular} } \cs_new_eq:NN \printchemgreekmapping \chemgreek_print_mapping:n \cs_new_protected:Npn \chemgreek_show_mapping:n #1 { \int_gzero:N \g__chemgreek_tmpa_int \iow_log:n { ................................................. } \iow_log:n { . ~ chemgreek~ mapping~ `#1': } \tl_map_inline:Nn \c__chemgreek_alphabet_tl { \int_gincr:N \g__chemgreek_tmpa_int \iow_log:x { . ~ \int_use:N \g__chemgreek_tmpa_int . } \iow_log:x { . \c_space_tl \c_space_tl \c_space_tl \c_space_tl \c_space_tl ##1 ~ => ~ \prop_get:cn { l__chemgreek_lowercase_mapping_#1_prop } { ##1 } } \iow_log:x { . \c_space_tl \c_space_tl \c_space_tl \c_space_tl \c_space_tl \tl_expandable_uppercase:n ##1 ~ => ~ \prop_get:cn { l__chemgreek_uppercase_mapping_#1_prop } { ##1 } } } \iow_log:n { ................................................. } } \cs_new_eq:NN \showchemgreekmapping \chemgreek_show_mapping:n \cs_new_protected:Npn \chemgreek_print_alphabet: { \tl_map_inline:Nn \c__chemgreek_alphabet_tl { \use:c { chem ##1 } \use:c { chem \tl_expandable_uppercase:n ##1 } \c_space_tl } \tex_unskip:D } \cs_new_eq:NN \printchemgreekalphabet \chemgreek_print_alphabet: % ---------------------------------------------------------------------------- % deprecate old macro names that started with an uppercase C: \cs_new_protected:Npn \chemgreek_deprecate_symbol:n #1 { \chemgreek_define_deprecated:cc { Chem#1 } { chem#1 } } \cs_new_protected:Npn \chemgreek_deprecate_symbols: { \tl_map_inline:Nn \c__chemgreek_alphabet_tl { \chemgreek_deprecate_symbol:n { ##1 } \chemgreek_deprecate_symbol:n { \tl_expandable_uppercase:n ##1 } } } \chemgreek_deprecate_symbols: % ---------------------------------------------------------------------------- % functions to format integers with greek letters; these are basically copies % of \int_to_alph:n \cs_new:Npn \chemgreek_int_to_greek:n #1 { \int_to_symbols:nnn { #1 } { 24 } { { 1 } { \chemalpha } { 2 } { \chembeta } { 3 } { \chemgamma } { 4 } { \chemdelta } { 5 } { \chemepsilon } { 6 } { \chemzeta } { 7 } { \chemeta } { 8 } { \chemiota } { 9 } { \chemtheta } { 10 } { \chemkappa } { 11 } { \chemlambda } { 12 } { \chemmu } { 13 } { \chemnu } { 14 } { \chemxi } { 15 } { \chemomikron } { 16 } { \chempi } { 17 } { \chemrho } { 18 } { \chemsigma } { 19 } { \chemtau } { 20 } { \chemupsilon } { 21 } { \chemphi } { 22 } { \chempsi } { 23 } { \chemchi } { 24 } { \chemomega } } } \cs_new:Npn \chemgreek_int_to_Greek:n #1 { \int_to_symbols:nnn { #1 } { 24 } { { 1 } { \chemAlpha } { 2 } { \chemBeta } { 3 } { \chemGamma } { 4 } { \chemDelta } { 5 } { \chemEpsilon } { 6 } { \chemZeta } { 7 } { \chemEta } { 8 } { \chemIota } { 9 } { \chemTheta } { 10 } { \chemKappa } { 11 } { \chemLambda } { 12 } { \chemMu } { 13 } { \chemNu } { 14 } { \chemXi } { 15 } { \chemOmikron } { 16 } { \chemPi } { 17 } { \chemRho } { 18 } { \chemSigma } { 19 } { \chemTau } { 20 } { \chemUpsilon } { 21 } { \chemPhi } { 22 } { \chemPsi } { 23 } { \chemChi } { 24 } { \chemOmega } } } % ---------------------------------------------------------------------------- % predefine some mappings % default: \chemgreek_new_mapping:nnn { default } { } { \ensuremath{\alpha} / \ensuremath{\mathrm{A}} , % 1 \ensuremath{\beta} / \ensuremath{\mathrm{B}} , % 2 \ensuremath{\gamma} / \ensuremath{\Gamma} , % 3 \ensuremath{\delta} / \ensuremath{\Delta} , % 4 \ensuremath{\epsilon} / \ensuremath{\mathrm{E}} , % 5 \ensuremath{\zeta} / \ensuremath{\mathrm{Z}} , % 6 \ensuremath{\eta} / \ensuremath{\mathrm{H}} , % 7 \ensuremath{\theta} / \ensuremath{\Theta} , % 8 \ensuremath{\iota} / \ensuremath{\mathrm{I}} , % 9 \ensuremath{\kappa} / \ensuremath{\mathrm{K}} , % 10 \ensuremath{\lambda} / \ensuremath{\Lambda} , % 11 \ensuremath{\mu} / \ensuremath{\mathrm{M}} , % 12 \ensuremath{\nu} / \ensuremath{\mathrm{N}} , % 13 \ensuremath{\xi} / \ensuremath{\Xi} , % 14 \ensuremath{o} / \ensuremath{\mathrm{O}} , % 15 \ensuremath{\pi} / \ensuremath{\Pi} , % 16 \ensuremath{\rho} / \ensuremath{\mathrm{P}} , % 17 \ensuremath{\sigma} / \ensuremath{\Sigma} , % 18 \ensuremath{\tau} / \ensuremath{\mathrm{T}} , % 19 \ensuremath{\upsilon} / \ensuremath{\Upsilon} , % 20 \ensuremath{\phi} / \ensuremath{\Phi} , % 21 \ensuremath{\psi} / \ensuremath{\Psi} , % 22 \ensuremath{\chi} / \ensuremath{\mathrm{X}} , % 23 \ensuremath{\omega} / \ensuremath{\Omega} % 24 } % default-variant: \chemgreek_new_mapping:nnn { var-default } { } { \ensuremath{\alpha} / \ensuremath{\mathrm{A}} , % 1 \ensuremath{\beta} / \ensuremath{\mathrm{B}} , % 2 \ensuremath{\gamma} / \ensuremath{\Gamma} , % 3 \ensuremath{\delta} / \ensuremath{\Delta} , % 4 \ensuremath{\varepsilon} / \ensuremath{\mathrm{E}} , % 5 \ensuremath{\zeta} / \ensuremath{\mathrm{Z}} , % 6 \ensuremath{\eta} / \ensuremath{\mathrm{H}} , % 7 \ensuremath{\theta} / \ensuremath{\Theta} , % 8 \ensuremath{\iota} / \ensuremath{\mathrm{I}} , % 9 \ensuremath{\kappa} / \ensuremath{\mathrm{K}} , % 10 \ensuremath{\lambda} / \ensuremath{\Lambda} , % 11 \ensuremath{\mu} / \ensuremath{\mathrm{M}} , % 12 \ensuremath{\nu} / \ensuremath{\mathrm{N}} , % 13 \ensuremath{\xi} / \ensuremath{\Xi} , % 14 \ensuremath{o} / \ensuremath{\mathrm{O}} , % 15 \ensuremath{\pi} / \ensuremath{\Pi} , % 16 \ensuremath{\varrho} / \ensuremath{\mathrm{P}} , % 17 \ensuremath{\sigma} / \ensuremath{\Sigma} , % 18 \ensuremath{\tau} / \ensuremath{\mathrm{T}} , % 19 \ensuremath{\upsilon} / \ensuremath{\Upsilon} , % 20 \ensuremath{\phi} / \ensuremath{\Phi} , % 21 \ensuremath{\psi} / \ensuremath{\Psi} , % 22 \ensuremath{\chi} / \ensuremath{\mathrm{X}} , % 23 \ensuremath{\omega} / \ensuremath{\Omega} % 24 } % mathdesign: \chemgreek_new_mapping:nnn { mathdesign } { mathdesign } { \ensuremath{\alphaup} / \ensuremath{\mathrm{A}} , % 1 \ensuremath{\betaup} / \ensuremath{\mathrm{B}} , % 2 \ensuremath{\gammaup} / \ensuremath{\Gammaup} , % 3 \ensuremath{\deltaup} / \ensuremath{\Deltaup} , % 4 \ensuremath{\epsilonup} / \ensuremath{\mathrm{E}} , % 5 \ensuremath{\zetaup} / \ensuremath{\mathrm{Z}} , % 6 \ensuremath{\etaup} / \ensuremath{\mathrm{H}} , % 7 \ensuremath{\thetaup} / \ensuremath{\Thetaup} , % 8 \ensuremath{\iotaup} / \ensuremath{\mathrm{I}} , % 9 \ensuremath{\kappaup} / \ensuremath{\mathrm{K}} , % 10 \ensuremath{\lambdaup} / \ensuremath{\Lambdaup} , % 11 \ensuremath{\muup} / \ensuremath{\mathrm{M}} , % 12 \ensuremath{\nuup} / \ensuremath{\mathrm{N}} , % 13 \ensuremath{\xiup} / \ensuremath{\Xiup} , % 14 \ensuremath{\mathrm{o}} / \ensuremath{\mathrm{O}} , % 15 \ensuremath{\piup} / \ensuremath{\Piup} , % 16 \ensuremath{\rhoup} / \ensuremath{\mathrm{R}} , % 17 \ensuremath{\sigmaup} / \ensuremath{\Sigmaup} , % 18 \ensuremath{\tauup} / \ensuremath{\mathrm{T}} , % 19 \ensuremath{\upsilonup} / \ensuremath{\Upsilonup} , % 20 \ensuremath{\phiup} / \ensuremath{\Phiup} , % 21 \ensuremath{\psiup} / \ensuremath{\Psiup} , % 22 \ensuremath{\chiup} / \ensuremath{\mathrm{X}} , % 23 \ensuremath{\omegaup} / \ensuremath{\Omegaup} % 24 } % textgreek: \chemgreek_new_mapping:nnn { textgreek } { textgreek } { \mbox{\textalpha} / \mbox{\textAlpha} , % 1 \mbox{\textbeta} / \mbox{\textBeta} , % 2 \mbox{\textgamma} / \mbox{\textGamma} , % 3 \mbox{\textdelta} / \mbox{\textDelta} , % 4 \mbox{\textepsilon} / \mbox{\textEpsilon} , % 5 \mbox{\textzeta} / \mbox{\textZeta} , % 6 \mbox{\texteta} / \mbox{\textEta} , % 7 \mbox{\texttheta} / \mbox{\textTheta} , % 8 \mbox{\textiota} / \mbox{\textIota} , % 9 \mbox{\textkappa} / \mbox{\textKappa} , % 10 \mbox{\textlambda} / \mbox{\textLambda} , % 11 \mbox{\textmugreek} / \mbox{\textMu} , % 12 \mbox{\textnu} / \mbox{\textNu} , % 13 \mbox{\textxi} / \mbox{\textXi} , % 14 \mbox{\textomikron} / \mbox{\textOmikron} , % 15 \mbox{\textpi} / \mbox{\textPi} , % 16 \mbox{\textrho} / \mbox{\textRho} , % 17 \mbox{\textsigma} / \mbox{\textSigma} , % 18 \mbox{\texttau} / \mbox{\textTau} , % 19 \mbox{\textupsilon} / \mbox{\textUpsilon} , % 20 \mbox{\textphi} / \mbox{\textPhi} , % 21 \mbox{\textpsi} / \mbox{\textPsi} , % 22 \mbox{\textchi} / \mbox{\textChi} , % 23 \mbox{\textomega} / \mbox{\textOmega} % 24 } % upgreek: \chemgreek_new_mapping:nnn { upgreek } { upgreek } { \ensuremath{\upalpha} / \ensuremath{\mathrm{A}} , % 1 \ensuremath{\upbeta} / \ensuremath{\mathrm{B}} , % 2 \ensuremath{\upgamma} / \ensuremath{\Upgamma} , % 3 \ensuremath{\updelta} / \ensuremath{\Updelta} , % 4 \ensuremath{\upepsilon} / \ensuremath{\mathrm{E}} , % 5 \ensuremath{\upzeta} / \ensuremath{\mathrm{Z}} , % 6 \ensuremath{\upeta} / \ensuremath{\mathrm{H}} , % 7 \ensuremath{\uptheta} / \ensuremath{\Uptheta} , % 8 \ensuremath{\upiota} / \ensuremath{\mathrm{I}} , % 9 \ensuremath{\upkappa} / \ensuremath{\mathrm{K}} , % 10 \ensuremath{\uplambda} / \ensuremath{\Uplambda} , % 11 \ensuremath{\upmu} / \ensuremath{\mathrm{M}} , % 12 \ensuremath{\upnu} / \ensuremath{\mathrm{N}} , % 13 \ensuremath{\upxi} / \ensuremath{\Upxi} , % 14 \ensuremath{\mathrm{o}} / \ensuremath{\mathrm{O}} , % 15 \ensuremath{\uppi} / \ensuremath{\Uppi} , % 16 \ensuremath{\uprho} / \ensuremath{\mathrm{R}} , % 17 \ensuremath{\upsigma} / \ensuremath{\Upsigma} , % 18 \ensuremath{\uptau} / \ensuremath{\mathrm{T}} , % 19 \ensuremath{\upupsilon} / \ensuremath{\Upupsilon} , % 20 \ensuremath{\upphi} / \ensuremath{\Upphi} , % 21 \ensuremath{\uppsi} / \ensuremath{\Uppsi} , % 22 \ensuremath{\upchi} / \ensuremath{\mathrm{X}} , % 23 \ensuremath{\upomega} / \ensuremath{\Upomega} % 24 } % kpfonts: \chemgreek_new_mapping:nnn { kpfonts } { kpfonts } { \ensuremath{\alphaup} / \ensuremath{\mathrm{A}} , % 1 \ensuremath{\betaup} / \ensuremath{\mathrm{B}} , % 2 \ensuremath{\gammaup} / \ensuremath{\Gammaup} , % 3 \ensuremath{\deltaup} / \ensuremath{\Deltaup} , % 4 \ensuremath{\epsilonup} / \ensuremath{\mathrm{E}} , % 5 \ensuremath{\zetaup} / \ensuremath{\mathrm{Z}} , % 6 \ensuremath{\etaup} / \ensuremath{\mathrm{H}} , % 7 \ensuremath{\thetaup} / \ensuremath{\Thetaup} , % 8 \ensuremath{\iotaup} / \ensuremath{\mathrm{I}} , % 9 \ensuremath{\kappaup} / \ensuremath{\mathrm{K}} , % 10 \ensuremath{\lambdaup} / \ensuremath{\Lambdaup} , % 11 \ensuremath{\muup} / \ensuremath{\mathrm{M}} , % 12 \ensuremath{\nuup} / \ensuremath{\mathrm{N}} , % 13 \ensuremath{\xiup} / \ensuremath{\Xiup} , % 14 \ensuremath{\mathrm{o}} / \ensuremath{\mathrm{O}} , % 15 \ensuremath{\piup} / \ensuremath{\Piup} , % 16 \ensuremath{\rhoup} / \ensuremath{\mathrm{R}} , % 17 \ensuremath{\sigmaup} / \ensuremath{\Sigmaup} , % 18 \ensuremath{\tauup} / \ensuremath{\mathrm{T}} , % 19 \ensuremath{\upsilonup} / \ensuremath{\Upsilonup} , % 20 \ensuremath{\phiup} / \ensuremath{\Phiup} , % 21 \ensuremath{\psiup} / \ensuremath{\Psiup} , % 22 \ensuremath{\chiup} / \ensuremath{\mathrm{X}} , % 23 \ensuremath{\omegaup} / \ensuremath{\Omegaup} % 24 } % newtx: \chemgreek_new_mapping:nnn { newtx } { newtxmath } { \ensuremath{\upalpha} / \ensuremath{\mathrm{A}} , % 1 \ensuremath{\upbeta} / \ensuremath{\mathrm{B}} , % 2 \ensuremath{\upgamma} / \ensuremath{\upGamma} , % 3 \ensuremath{\updelta} / \ensuremath{\upDelta} , % 4 \ensuremath{\upepsilon} / \ensuremath{\mathrm{E}} , % 5 \ensuremath{\upzeta} / \ensuremath{\mathrm{Z}} , % 6 \ensuremath{\upeta} / \ensuremath{\mathrm{H}} , % 7 \ensuremath{\uptheta} / \ensuremath{\upTheta} , % 8 \ensuremath{\upiota} / \ensuremath{\mathrm{I}} , % 9 \ensuremath{\upkappa} / \ensuremath{\mathrm{K}} , % 10 \ensuremath{\uplambda} / \ensuremath{\upLambda} , % 11 \ensuremath{\upmu} / \ensuremath{\mathrm{M}} , % 12 \ensuremath{\upnu} / \ensuremath{\mathrm{N}} , % 13 \ensuremath{\upxi} / \ensuremath{\upXi} , % 14 \ensuremath{\mathrm{o}} / \ensuremath{\mathrm{O}} , % 15 \ensuremath{\uppi} / \ensuremath{\upPi} , % 16 \ensuremath{\uprho} / \ensuremath{\mathrm{R}} , % 17 \ensuremath{\upsigma} / \ensuremath{\upSigma} , % 18 \ensuremath{\uptau} / \ensuremath{\mathrm{T}} , % 19 \ensuremath{\upupsilon} / \ensuremath{\upUpsilon} , % 20 \ensuremath{\upphi} / \ensuremath{\upPhi} , % 21 \ensuremath{\uppsi} / \ensuremath{\upPsi} , % 22 \ensuremath{\upchi} / \ensuremath{\mathrm{X}} , % 23 \ensuremath{\upomega} / \ensuremath{\upOmega} % 24 } % fourier: \cs_new:Npn \__chemgreek_lfourier:n #1 { \chemgreek_latex_if:nTF { sloped } { \ensuremath { \use:c { other #1 } } } { \ensuremath { \use:c { #1 } } } } \cs_new:Npn \__chemgreek_ufourier:n #1 { \chemgreek_latex_if:nTF { sloped } { \ensuremath { \use:c { #1 } } } { \ensuremath { \use:c { other #1 } } } } \chemgreek_new_mapping:nnn { fourier } { fourier } { \__chemgreek_lfourier:n {alpha} / \ensuremath{\mathrm{A}} , % 1 \__chemgreek_lfourier:n {beta} / \ensuremath{\mathrm{B}} , % 2 \__chemgreek_lfourier:n {gamma} / \__chemgreek_ufourier:n {Gamma} , % 3 \__chemgreek_lfourier:n {delta} / \__chemgreek_ufourier:n {Delta} , % 4 \__chemgreek_lfourier:n {epsilon} / \ensuremath{\mathrm{E}} , % 5 \__chemgreek_lfourier:n {zeta} / \ensuremath{\mathrm{Z}} , % 6 \__chemgreek_lfourier:n {eta} / \ensuremath{\mathrm{H}} , % 7 \__chemgreek_lfourier:n {theta} / \__chemgreek_ufourier:n {Theta} , % 8 \__chemgreek_lfourier:n {iota} / \ensuremath{\mathrm{I}} , % 9 \__chemgreek_lfourier:n {kappa} / \ensuremath{\mathrm{K}} , % 10 \__chemgreek_lfourier:n {lambda} / \__chemgreek_ufourier:n {Lambda} , % 11 \__chemgreek_lfourier:n {mu} / \ensuremath{\mathrm{M}} , % 12 \__chemgreek_lfourier:n {nu} / \ensuremath{\mathrm{N}} , % 13 \__chemgreek_lfourier:n {xi} / \__chemgreek_ufourier:n {Xi} , % 14 \ensuremath {\mathrm{o}} / \ensuremath{\mathrm{O}} , % 15 \__chemgreek_lfourier:n {pi} / \__chemgreek_ufourier:n {Pi} , % 16 \__chemgreek_lfourier:n {rho} / \ensuremath{\mathrm{R}} , % 17 \__chemgreek_lfourier:n {sigma} / \__chemgreek_ufourier:n {Sigma} , % 18 \__chemgreek_lfourier:n {tau} / \ensuremath{\mathrm{T}} , % 19 \__chemgreek_lfourier:n {upsilon} / \__chemgreek_ufourier:n {Upsilon} , % 20 \__chemgreek_lfourier:n {phi} / \__chemgreek_ufourier:n {Phi} , % 21 \__chemgreek_lfourier:n {psi} / \__chemgreek_ufourier:n {Psi} , % 22 \__chemgreek_lfourier:n {chi} / \ensuremath{\mathrm{X}} , % 23 \__chemgreek_lfourier:n {omega} / \__chemgreek_ufourier:n {Omega} % 24 } % textalpha: \chemgreek_new_mapping:nnn { textalpha } { textalpha } { \mbox{\textalpha} / \mbox{\textAlpha} , % 1 \mbox{\textbeta} / \mbox{\textBeta} , % 2 \mbox{\textgamma} / \mbox{\textGamma} , % 3 \mbox{\textdelta} / \mbox{\textDelta} , % 4 \mbox{\textepsilon} / \mbox{\textEpsilon} , % 5 \mbox{\textzeta} / \mbox{\textZeta} , % 6 \mbox{\texteta} / \mbox{\textEta} , % 7 \mbox{\texttheta} / \mbox{\textTheta} , % 8 \mbox{\textiota} / \mbox{\textIota} , % 9 \mbox{\textkappa} / \mbox{\textKappa} , % 10 \mbox{\textlambda} / \mbox{\textLambda} , % 11 \mbox{\textmu} / \mbox{\textMu} , % 12 \mbox{\textnu} / \mbox{\textNu} , % 13 \mbox{\textxi} / \mbox{\textXi} , % 14 \mbox{\textomicron} / \mbox{\textOmicron} , % 15 \mbox{\textpi} / \mbox{\textPi} , % 16 \mbox{\textrho} / \mbox{\textRho} , % 17 \mbox{\textsigma} / \mbox{\textSigma} , % 18 \mbox{\texttau} / \mbox{\textTau} , % 19 \mbox{\textupsilon} / \mbox{\textUpsilon} , % 20 \mbox{\textphi} / \mbox{\textPhi} , % 21 \mbox{\textpsi} / \mbox{\textPsi} , % 22 \mbox{\textchi} / \mbox{\textChi} , % 23 \mbox{\textomega} / \mbox{\textOmega} % 24 } % textgreek: \chemgreek_new_mapping:nnn { fontspec } { fontspec } { \mbox{\textalpha} / \mbox{\textAlpha} , % 1 \mbox{\textbeta} / \mbox{\textBeta} , % 2 \mbox{\textgamma} / \mbox{\textGamma} , % 3 \mbox{\textdelta} / \mbox{\textDelta} , % 4 \mbox{\textepsilon} / \mbox{\textEpsilon} , % 5 \mbox{\textzeta} / \mbox{\textZeta} , % 6 \mbox{\texteta} / \mbox{\textEta} , % 7 \mbox{\texttheta} / \mbox{\textTheta} , % 8 \mbox{\textiota} / \mbox{\textIota} , % 9 \mbox{\textkappa} / \mbox{\textKappa} , % 10 \mbox{\textlambda} / \mbox{\textLambda} , % 11 \mbox{\textmu} / \mbox{\textMu} , % 12 \mbox{\textnu} / \mbox{\textNu} , % 13 \mbox{\textxi} / \mbox{\textXi} , % 14 \mbox{o} / \mbox{O} , % 15 \mbox{\textpi} / \mbox{\textPi} , % 16 \mbox{\textrho} / \mbox{\textRho} , % 17 \mbox{\textsigma} / \mbox{\textSigma} , % 18 \mbox{\texttau} / \mbox{\textTau} , % 19 \mbox{\textupsilon} / \mbox{\textUpsilon} , % 20 \mbox{\textphi} / \mbox{\textPhi} , % 21 \mbox{\textpsi} / \mbox{\textPsi} , % 22 \mbox{\textchi} / \mbox{\textChi} , % 23 \mbox{\textomega} / \mbox{\textOmega} % 24 } % activate default mapping \chemgreek_activate_mapping:n { default } \AtBeginDocument { \chemgreek_if_package_with:nnT {hyperref} {unicode} { \chemgreek_if_package_loaded:nT {textalpha} { \pdfstringdefDisableCommands { \tl_map_inline:Nn \c__chemgreek_alphabet_tl { \cs_set_eq:cc { chem \tl_expandable_uppercase:n #1 } { text \tl_expandable_uppercase:n #1 } \cs_set_eq:cc { chem #1 } { text #1 } } } } } } \tex_endinput:D HISTORY: 2013/06/26 - v0.1 - first working version to be bundled with chemmacros 2013/07/06 - v0.1a - fixed stupid bug in `upgreek' mapping - added error messages and added \renewchemgreekmapping and \declarechemgreekmapping 2013/08/24 - v0.2 - new mappings `mathdesign', `fourier' - new functions: \chemgreek_int_to_greek:n and \chemgreek_int_to_Greek:n 2013/11/20 - v0.2a - fixed typos in `fourier' mapping - added missing \prop_clear: to \__chemgreek_set_mapping:nn - added missing argument to message calls 2014/01/24 - v0.3 - rename \Chem \chem, the old names will issue warnings but still work - new mappings `textalpha' (cf the package with the same name, part of `greek-fontenc') - \chemgreek_new_mapping:nnn redefined so that package name must be given if needed; \chemgreek_activate_mapping:n now issues a warning if the needed package hasn't been loaded - if hyperref has been loaded with package option `unicode' and `textalpha' package has been loaded, too, we can use greek letters in PDF bookmarks - new command \printchemgreekmapping - \showchemgreekmapping now writes information to the log 2014/01/29 - v0.4 - add mapping `fontspec' - new command \printchemgreekalphabet 2014/08/07 - v0.5 - split from `chemmacros' bundle as independent package TODO: