summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemmacros/chemgreek.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-08-24 22:39:08 +0000
committerKarl Berry <karl@freefriends.org>2013-08-24 22:39:08 +0000
commitc85fa36270547458332b4c790354729c2f3f3c9a (patch)
treecf1202280b0358de3a3b820b5782f1f4f7197511 /Master/texmf-dist/tex/latex/chemmacros/chemgreek.sty
parent8f202738ce363c80b55b8a2a9496340292a4b200 (diff)
chemmacros (24aug13)
git-svn-id: svn://tug.org/texlive/trunk@31513 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemmacros/chemgreek.sty')
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemgreek.sty151
1 files changed, 149 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemgreek.sty b/Master/texmf-dist/tex/latex/chemmacros/chemgreek.sty
index dc072de4205..9bb67b76e9f 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/chemgreek.sty
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemgreek.sty
@@ -26,8 +26,8 @@
% - The Current Maintainer of this work is Clemens Niederberger.
% ----------------------------------------------------------------------------
\RequirePackage{expl3,xparse}
-\def\chemgreek@version{0.1a}
-\def\chemgreek@date{2013/07/06}
+\def\chemgreek@version{0.2}
+\def\chemgreek@date{2013/08/24}
\ProvidesExplPackage{chemgreek}{\chemgreek@date}{\chemgreek@version}
{interface for upright greek letters for use in chemistry (CN)}
@@ -41,6 +41,13 @@
\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: }
+
+% ----------------------------------------------------------------------------
% messages
\msg_new:nnnn { chemgreek } { mapping-not-defined }
{ The~ mapping~ `#1'~ does~ not~ exist~ \msg_line_context: }
@@ -256,6 +263,71 @@
\cs_new_eq:NN \showchemgreekmapping \chemgreek_show_mapping:n
% ----------------------------------------------------------------------------
+% 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:nn { default }
@@ -315,6 +387,35 @@
\ensuremath{\omega} / \ensuremath{\Omega} % 24
}
+% mathdesign:
+\chemgreek_new_mapping:nn { 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:nn { textgreek }
{
@@ -431,6 +532,49 @@
\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:nn { fourier }
+ {
+ \__chemgreek_lfourier:n {alpha} / \ensuremath{\mathrm{A}} , % 1
+ \__chemgreek_lfourier:n {beta} / \ensuremath{\mathrm{B}} , % 2
+ \__chemgreek_lfourier:n {gamma} / \__chemgreek_upper_fourier:n {Gamma} , % 3
+ \__chemgreek_lfourier:n {delta} / \__chemgreek_upper_fourier: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_upper_fourier:n {Theta} , % 8
+ \__chemgreek_lfourier:n {iota} / \ensuremath{\mathrm{I}} , % 9
+ \__chemgreek_lfourier:n {kappa} / \ensuremath{\mathrm{K}} , % 10
+ \__chemgreek_lfourier:n {lambda} / \__chemgreek_upper_fourier:n {Lambda} , % 11
+ \__chemgreek_lfourier:n {mu} / \ensuremath{\mathrm{M}} , % 12
+ \__chemgreek_lfourier:n {nu} / \ensuremath{\mathrm{N}} , % 13
+ \__chemgreek_lfourier:n {xi} / \__chemgreek_upper_fourier:n {Xi} , % 14
+ \ensuremath {\mathrm{o}} / \ensuremath{\mathrm{O}} , % 15
+ \__chemgreek_lfourier:n {pi} / \__chemgreek_upper_fourier:n {Pi} , % 16
+ \__chemgreek_lfourier:n {rho} / \ensuremath{\mathrm{R}} , % 17
+ \__chemgreek_lfourier:n {sigma} / \__chemgreek_upper_fourier:n {Sigma} , % 18
+ \__chemgreek_lfourier:n {tau} / \ensuremath{\mathrm{T}} , % 19
+ \__chemgreek_lfourier:n {upsilon} / \__chemgreek_upper_fourier:n {Upsilon} , % 20
+ \__chemgreek_lfourier:n {phi} / \__chemgreek_upper_fourier:n {Phi} , % 21
+ \__chemgreek_lfourier:n {psi} / \__chemgreek_upper_fourier:n {Psi} , % 22
+ \__chemgreek_lfourier:n {chi} / \ensuremath{\mathrm{X}} , % 23
+ \__chemgreek_lfourier:n {omega} / \__chemgreek_ufourier:n {Omega} % 24
+ }
+
% activate default mapping
\chemgreek_activate_mapping:n { default }
@@ -441,3 +585,6 @@ HISTORY:
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