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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
% --------------------------------------------------------------------------
%
% the CHEMMACROS package -- module: `xfrac'
%
% --------------------------------------------------------------------------
% 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{xfrac}{2015/07/22 use xfrac package with chemmacros}
\RequirePackage{xfrac}
% --------------------------------------------------------------------------
% #1: type
% #2: numerator
% #3: denominator
\cs_new_protected:Npn \chemmacros_frac:nnn #1#2#3
{
\IfInstanceExistTF {xfrac} {chemmacros-frac-\f@family-#1}
{ \sfrac [chemmacros-frac-\f@family-#1] {#2} {#3} }
{ \sfrac [chemmacros-frac-default-#1]{#2} {#3} }
}
\NewDocumentCommand \chemfrac {O{text}mm}
{ \chemmacros_frac:nnn {#1} {#2} {#3} }
% --------------------------------------------------------------------------
% default:
\DeclareInstance {xfrac} {chemmacros-frac-cmr-superscript} {text}
{
numerator-top-sep = -.1ex ,
slash-left-kern = -.2em ,
slash-right-kern = -.2em ,
slash-symbol-font = cmr
}
\DeclareInstance {xfrac} {chemmacros-frac-cmr-text} {text}
{
numerator-top-sep = 0ex ,
slash-left-kern = -.2em ,
slash-right-kern = -.2em ,
slash-symbol-font = cmr
}
% computer modern (same as default):
\DeclareInstance {xfrac} {chemmacros-frac-cmr-superscript} {text}
{
numerator-top-sep = -.1ex ,
slash-left-kern = -.2em ,
slash-right-kern = -.2em ,
slash-symbol-font = cmr
}
\DeclareInstance {xfrac} {chemmacros-frac-cmr-text} {text}
{
numerator-top-sep = 0ex ,
slash-left-kern = -.2em ,
slash-right-kern = -.2em ,
slash-symbol-font = cmr
}
% Linux Libertine T lining:
\DeclareInstance {xfrac} {chemmacros-frac-LinuxLibertineT-TLF-text} {text}
{
numerator-top-sep = 0ex ,
slash-left-kern = 0em ,
slash-right-kern = .05em ,
slash-symbol-font = LinuxLibertineT-TLF
}
\DeclareInstance {xfrac} {chemmacros-frac-LinuxLibertineT-TLF-superscript} {text}
{
scale-factor = 1.2 ,
denominator-bot-sep = -.1ex ,
numerator-top-sep = -.1ex ,
slash-left-kern = .1em ,
slash-right-kern = .1em ,
slash-symbol-font = LinuxLibertineT-TLF
}
% Linux Libertine T oldstyle:
\DeclareInstance {xfrac} {chemmacros-frac-LinuxLibertineT-TOsF-text} {text}
{
denominator-bot-sep = .1ex ,
numerator-top-sep = -.2ex ,
slash-left-kern = 0em ,
slash-right-kern = 0em ,
slash-symbol-font = LinuxLibertineT-TOsF
}
\DeclareInstance {xfrac} {chemmacros-frac-LinuxLibertineT-TOsF-superscript} {text}
{
scale-factor = 1.2 ,
denominator-bot-sep = -.1ex ,
numerator-top-sep = -.2ex ,
slash-left-kern = 0em ,
slash-right-kern = .1em ,
slash-symbol-font = LinuxLibertineT-TOsF
}
% lmodern:
\DeclareInstance {xfrac} {chemmacros-frac-lmr-superscript} {text}
{
slash-left-kern = -.2em ,
slash-right-kern = -.2em ,
slash-symbol-font = lmr
}
\DeclareInstance {xfrac} {chemmacros-frac-lmr-text} {text}
{
slash-left-kern = -.2em ,
slash-right-kern = -.2em ,
slash-symbol-font = lmr
}
% --------------------------------------------------------------------------
|