summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/chem-ini.mkiv
blob: d18ba47a10a3b550ac99c1f9fff0b61d4c5a0d60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
%D \module
%D   [       file=chem-ini,
%D        version=2008.03.06,
%D       subtitle=Chemistry,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

% todo: \mathscriptsmode

\writestatus{loading}{ConTeXt Chemistry Macros / Initialization} % might become Inline

\registerctxluafile{chem-ini}{1.001}

\unprotect

% todo: use \mathscriptsmode if needed

%D \macros
%D   {molecule}
%D
%D Quick and dirty:
%D
%D \starttyping
%D \unexpanded\def\molecule#1%
%D   {$\enablesupersub\tf#1$}
%D \stoptyping
%D
%D Using \LUA:
%D
%D \startbuffer
%D \molecule{H_2SO_4^-2}
%D \molecule{H_2SO_4^{-2}}
%D \molecule{H_2SO_4^{-2{x}}}
%D \stopbuffer
%D
%D \typebuffer \getbuffer

\unexpanded\def\molecule#1%
  {\clf_molecule{#1}}

%D For old times sake:

\unexpanded\def\chem#1#2#3%
  {\dontleavehmode\begingroup#1\lohi{#2}{#3}\endgroup}

\protect \endinput