summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/tex/texmath.h
blob: 23fc5a0e42e1b3eb98810c7928376f4703340c16 (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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
/* texmath.h

   Copyright 1996-2006 Han The Thanh <thanh@pdftex.org>
   Copyright 2006-2009 Taco Hoekwater <taco@luatex.org>

   This file is part of LuaTeX.

   LuaTeX is free software; you can redistribute it and/or modify it under
   the terms of the GNU General Public License as published by the Free
   Software Foundation; either version 2 of the License, or (at your
   option) any later version.

   LuaTeX is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
   License for more details.

   You should have received a copy of the GNU General Public License along
   with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */


#ifndef TEXMATH_H
#  define TEXMATH_H 1

#  define empty 0

extern pointer new_noad(void);

extern void show_math_node(halfword);
extern void flush_math(void);
extern void math_left_brace(void);
extern void finish_display_alignment(halfword, halfword, halfword);
extern halfword new_sub_box(halfword);

#  define math_reset(p) do { if (p!=null) flush_node(p); p = null; } while (0)

#  define scripts_allowed(A) ((type((A))>=simple_noad)&&(type((A))<fence_noad))

#  define default_code 010000000000     /* denotes |default_rule_thickness| */

extern void initialize_math(void);
extern void initialize_math_spacing(void);
extern halfword math_vcenter_group(halfword);
extern void build_choices(void);
extern void close_math_group(halfword);
extern void init_math(void);
extern void start_eq_no(void);
extern void set_math_char(mathcodeval);
extern void math_char_in_text(mathcodeval);
extern void math_math_comp(void);
extern void math_limit_switch(void);
extern void math_radical(void);
extern void math_ac(void);
extern pointer new_style(small_number);
extern void append_choices(void);
extern void sub_sup(void);
extern void no_sub_sup(void);
extern void math_fraction(void);
extern void math_left_right(void);
extern void after_math(void);

extern void scan_extdef_del_code(int level, int extcode);
extern void scan_extdef_math_code(int level, int extcode);

extern int fam_fnt(int fam_id, int size_id);
extern void def_fam_fnt(int fam_id, int size_id, int f, int lvl);
extern void dump_math_data(void);
extern void undump_math_data(void);
void unsave_math_data(int lvl);

/*
  @ We also need to compute the change in style between mlists and their
  subsidiaries. The following macros define the subsidiary style for
  an overlined nucleus (|cramped_style|), for a subscript or a superscript
  (|sub_style| or |sup_style|), or for a numerator or denominator (|num_style|
  or |denom_style|).
*/

extern const char *math_style_names[];

#  define cramped 1             /* add this to an uncramped style if you want to cramp it */

#  define cramped_style(A) 2*((A)/2)+cramped    /* cramp the style */
#  define sub_style(A) 2*((A)/4)+script_style+cramped   /* smaller and cramped */
#  define sup_style(A) 2*((A)/4)+script_style+((A)%2)   /* smaller */
#  define num_style(A) (A)+2-2*((A)/6)  /* smaller unless already script-script */
#  define denom_style(A) 2*((A)/2)+cramped+2-2*((A)/6)  /* smaller, cramped */
#  define sup_sup_style(A) sup_style(sup_style((A)))    /* smaller */

void setup_math_style(void);
void print_math_style(void);

#  define text_size 0
#  define script_size 1
#  define script_script_size 2

#  define dir_math_save cur_list.math_field
#  define m_style cur_list.math_style_field
#  define init_math_fields() do {               \
        dir_math_save=false;                    \
        m_style=-1;                             \
    } while (0)


#  define null_font 0
#  define min_quarterword 0

#  define undefined_math_parameter max_dimen

typedef enum {
    math_param_quad,
    math_param_axis,
    math_param_operator_size,
    math_param_overbar_kern,
    math_param_overbar_rule,
    math_param_overbar_vgap,
    math_param_underbar_kern,
    math_param_underbar_rule,
    math_param_underbar_vgap,
    math_param_radical_kern,
    math_param_radical_rule,
    math_param_radical_vgap,
    math_param_radical_degree_before,
    math_param_radical_degree_after,
    math_param_radical_degree_raise,
    math_param_stack_vgap,
    math_param_stack_num_up,
    math_param_stack_denom_down,
    math_param_fraction_rule,
    math_param_fraction_num_vgap,
    math_param_fraction_num_up,
    math_param_fraction_denom_vgap,
    math_param_fraction_denom_down,
    math_param_fraction_del_size,
    math_param_skewed_fraction_hgap,
    math_param_skewed_fraction_vgap,
    math_param_limit_above_vgap,
    math_param_limit_above_bgap,
    math_param_limit_above_kern,
    math_param_limit_below_vgap,
    math_param_limit_below_bgap,
    math_param_limit_below_kern,
    math_param_nolimit_sub_factor, /* bonus */
    math_param_nolimit_sup_factor, /* bonus */
    math_param_under_delimiter_vgap,
    math_param_under_delimiter_bgap,
    math_param_over_delimiter_vgap,
    math_param_over_delimiter_bgap,
    math_param_sub_shift_drop,
    math_param_sup_shift_drop,
    math_param_sub_shift_down,
    math_param_sub_sup_shift_down,
    math_param_sub_top_max,
    math_param_sup_shift_up,
    math_param_sup_bottom_min,
    math_param_sup_sub_bottom_max,
    math_param_subsup_vgap,
    math_param_space_after_script,
    math_param_connector_overlap_min,
    math_param_ord_ord_spacing,
    math_param_ord_op_spacing,
    math_param_ord_bin_spacing,
    math_param_ord_rel_spacing,
    math_param_ord_open_spacing,
    math_param_ord_close_spacing,
    math_param_ord_punct_spacing,
    math_param_ord_inner_spacing,
    math_param_op_ord_spacing,
    math_param_op_op_spacing,
    math_param_op_bin_spacing,
    math_param_op_rel_spacing,
    math_param_op_open_spacing,
    math_param_op_close_spacing,
    math_param_op_punct_spacing,
    math_param_op_inner_spacing,
    math_param_bin_ord_spacing,
    math_param_bin_op_spacing,
    math_param_bin_bin_spacing,
    math_param_bin_rel_spacing,
    math_param_bin_open_spacing,
    math_param_bin_close_spacing,
    math_param_bin_punct_spacing,
    math_param_bin_inner_spacing,
    math_param_rel_ord_spacing,
    math_param_rel_op_spacing,
    math_param_rel_bin_spacing,
    math_param_rel_rel_spacing,
    math_param_rel_open_spacing,
    math_param_rel_close_spacing,
    math_param_rel_punct_spacing,
    math_param_rel_inner_spacing,
    math_param_open_ord_spacing,
    math_param_open_op_spacing,
    math_param_open_bin_spacing,
    math_param_open_rel_spacing,
    math_param_open_open_spacing,
    math_param_open_close_spacing,
    math_param_open_punct_spacing,
    math_param_open_inner_spacing,
    math_param_close_ord_spacing,
    math_param_close_op_spacing,
    math_param_close_bin_spacing,
    math_param_close_rel_spacing,
    math_param_close_open_spacing,
    math_param_close_close_spacing,
    math_param_close_punct_spacing,
    math_param_close_inner_spacing,
    math_param_punct_ord_spacing,
    math_param_punct_op_spacing,
    math_param_punct_bin_spacing,
    math_param_punct_rel_spacing,
    math_param_punct_open_spacing,
    math_param_punct_close_spacing,
    math_param_punct_punct_spacing,
    math_param_punct_inner_spacing,
    math_param_inner_ord_spacing,
    math_param_inner_op_spacing,
    math_param_inner_bin_spacing,
    math_param_inner_rel_spacing,
    math_param_inner_open_spacing,
    math_param_inner_close_spacing,
    math_param_inner_punct_spacing,
    math_param_inner_inner_spacing,
    math_param_last
} math_parameters;

extern const char *math_param_names[];

#  define math_param_first_mu_glue math_param_ord_ord_spacing

extern void def_math_param(int param_code, int style_code, scaled value,
                           int lvl);
extern scaled get_math_param(int param_code, int style_code);


typedef enum {
    ScriptPercentScaleDown = 1,
    ScriptScriptPercentScaleDown,
    DelimitedSubFormulaMinHeight,
    DisplayOperatorMinHeight,
    MathLeading,
    AxisHeight,
    AccentBaseHeight,
    FlattenedAccentBaseHeight,
    SubscriptShiftDown,
    SubscriptTopMax,
    SubscriptBaselineDropMin,
    SuperscriptShiftUp,
    SuperscriptShiftUpCramped,
    SuperscriptBottomMin,
    SuperscriptBaselineDropMax,
    SubSuperscriptGapMin,
    SuperscriptBottomMaxWithSubscript,
    SpaceAfterScript,
    UpperLimitGapMin,
    UpperLimitBaselineRiseMin,
    LowerLimitGapMin,
    LowerLimitBaselineDropMin,
    StackTopShiftUp,
    StackTopDisplayStyleShiftUp,
    StackBottomShiftDown,
    StackBottomDisplayStyleShiftDown,
    StackGapMin,
    StackDisplayStyleGapMin,
    StretchStackTopShiftUp,
    StretchStackBottomShiftDown,
    StretchStackGapAboveMin,
    StretchStackGapBelowMin,
    FractionNumeratorShiftUp,
    FractionNumeratorDisplayStyleShiftUp,
    FractionDenominatorShiftDown,
    FractionDenominatorDisplayStyleShiftDown,
    FractionNumeratorGapMin,
    FractionNumeratorDisplayStyleGapMin,
    FractionRuleThickness,
    FractionDenominatorGapMin,
    FractionDenominatorDisplayStyleGapMin,
    SkewedFractionHorizontalGap,
    SkewedFractionVerticalGap,
    OverbarVerticalGap,
    OverbarRuleThickness,
    OverbarExtraAscender,
    UnderbarVerticalGap,
    UnderbarRuleThickness,
    UnderbarExtraDescender,
    RadicalVerticalGap,
    RadicalDisplayStyleVerticalGap,
    RadicalRuleThickness,
    RadicalExtraAscender,
    RadicalKernBeforeDegree,
    RadicalKernAfterDegree,
    RadicalDegreeBottomRaisePercent,
    MinConnectorOverlap,
    SubscriptShiftDownWithSuperscript,
    FractionDelimiterSize,
    FractionDelimiterDisplayStyleSize,
    NoLimitSubFactor,
    NoLimitSupFactor,
    MATH_param_last,
} MATH_param_codes;

#  define MATH_param_max MATH_param_last

extern const char *MATH_param_names[];

#endif