sync with experimental
[luatex.git] / source / texk / web2c / luatexdir / tex / texmath.h
blobe5ad6798257d991760c2e139b896e9fdec92d898
1 /* texmath.h
3 Copyright 1996-2006 Han The Thanh <thanh@pdftex.org>
4 Copyright 2006-2009 Taco Hoekwater <taco@luatex.org>
6 This file is part of LuaTeX.
8 LuaTeX is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2 of the License, or (at your
11 option) any later version.
13 LuaTeX is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 License for more details.
18 You should have received a copy of the GNU General Public License along
19 with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
22 #ifndef TEXMATH_H
23 # define TEXMATH_H 1
25 # define empty 0
27 extern pointer new_noad(void);
29 extern void show_math_node(halfword);
30 extern void flush_math(void);
31 extern void math_left_brace(void);
32 extern void finish_display_alignment(halfword, halfword, halfword);
33 extern halfword new_sub_box(halfword);
35 # define math_reset(p) do { if (p!=null) flush_node(p); p = null; } while (0)
37 # define scripts_allowed(A) ((type((A))>=simple_noad)&&(type((A))<fence_noad))
39 # define default_code 010000000000 /* denotes |default_rule_thickness| */
41 typedef enum {
42 ord_noad_type = 0,
43 op_noad_type_normal,
44 op_noad_type_limits,
45 op_noad_type_no_limits,
46 bin_noad_type,
47 rel_noad_type,
48 open_noad_type,
49 close_noad_type,
50 punct_noad_type,
51 inner_noad_type,
52 under_noad_type,
53 over_noad_type,
54 vcenter_noad_type,
55 } noad_types;
57 extern void initialize_math(void);
58 extern void initialize_math_spacing(void);
59 extern halfword math_vcenter_group(halfword);
60 extern void build_choices(void);
61 extern void close_math_group(halfword);
62 extern void init_math(void);
63 extern void start_eq_no(void);
64 extern void set_math_char(mathcodeval);
65 extern void math_char_in_text(mathcodeval);
66 extern void math_math_comp(void);
67 extern void math_limit_switch(void);
68 extern void math_radical(void);
69 extern void math_ac(void);
70 extern pointer new_style(small_number);
71 extern void append_choices(void);
72 extern void sub_sup(void);
73 extern void math_fraction(void);
74 extern void math_left_right(void);
75 extern void after_math(void);
77 extern void scan_extdef_del_code(int level, int extcode);
78 extern void scan_extdef_math_code(int level, int extcode);
80 extern int fam_fnt(int fam_id, int size_id);
81 extern void def_fam_fnt(int fam_id, int size_id, int f, int lvl);
82 extern void dump_math_data(void);
83 extern void undump_math_data(void);
84 void unsave_math_data(int lvl);
87 @ We also need to compute the change in style between mlists and their
88 subsidiaries. The following macros define the subsidiary style for
89 an overlined nucleus (|cramped_style|), for a subscript or a superscript
90 (|sub_style| or |sup_style|), or for a numerator or denominator (|num_style|
91 or |denom_style|).
94 extern const char *math_style_names[];
96 # define cramped 1 /* add this to an uncramped style if you want to cramp it */
98 # define cramped_style(A) 2*((A)/2)+cramped /* cramp the style */
99 # define sub_style(A) 2*((A)/4)+script_style+cramped /* smaller and cramped */
100 # define sup_style(A) 2*((A)/4)+script_style+((A)%2) /* smaller */
101 # define num_style(A) (A)+2-2*((A)/6) /* smaller unless already script-script */
102 # define denom_style(A) 2*((A)/2)+cramped+2-2*((A)/6) /* smaller, cramped */
103 # define sup_sup_style(A) sup_style(sup_style((A))) /* smaller */
105 void setup_math_style(void);
106 void print_math_style(void);
108 # define text_size 0
109 # define script_size 1
110 # define script_script_size 2
112 # define dir_math_save cur_list.math_field
113 # define m_style cur_list.math_style_field
114 # define init_math_fields() do { \
115 dir_math_save=false; \
116 m_style=-1; \
117 } while (0)
120 # define null_font 0
121 # define min_quarterword 0
123 # define undefined_math_parameter max_dimen
125 typedef enum {
126 math_param_quad,
127 math_param_axis,
128 math_param_operator_size,
129 math_param_overbar_kern,
130 math_param_overbar_rule,
131 math_param_overbar_vgap,
132 math_param_underbar_kern,
133 math_param_underbar_rule,
134 math_param_underbar_vgap,
135 math_param_radical_kern,
136 math_param_radical_rule,
137 math_param_radical_vgap,
138 math_param_radical_degree_before,
139 math_param_radical_degree_after,
140 math_param_radical_degree_raise,
141 math_param_stack_vgap,
142 math_param_stack_num_up,
143 math_param_stack_denom_down,
144 math_param_fraction_rule,
145 math_param_fraction_num_vgap,
146 math_param_fraction_num_up,
147 math_param_fraction_denom_vgap,
148 math_param_fraction_denom_down,
149 math_param_fraction_del_size,
150 math_param_skewed_fraction_hgap,
151 math_param_skewed_fraction_vgap,
152 math_param_limit_above_vgap,
153 math_param_limit_above_bgap,
154 math_param_limit_above_kern,
155 math_param_limit_below_vgap,
156 math_param_limit_below_bgap,
157 math_param_limit_below_kern,
158 math_param_nolimit_sub_factor, /* bonus */
159 math_param_nolimit_sup_factor, /* bonus */
160 math_param_under_delimiter_vgap,
161 math_param_under_delimiter_bgap,
162 math_param_over_delimiter_vgap,
163 math_param_over_delimiter_bgap,
164 math_param_sub_shift_drop,
165 math_param_sup_shift_drop,
166 math_param_sub_shift_down,
167 math_param_sub_sup_shift_down,
168 math_param_sub_top_max,
169 math_param_sup_shift_up,
170 math_param_sup_bottom_min,
171 math_param_sup_sub_bottom_max,
172 math_param_subsup_vgap,
173 math_param_space_after_script,
174 math_param_connector_overlap_min,
175 math_param_ord_ord_spacing,
176 math_param_ord_op_spacing,
177 math_param_ord_bin_spacing,
178 math_param_ord_rel_spacing,
179 math_param_ord_open_spacing,
180 math_param_ord_close_spacing,
181 math_param_ord_punct_spacing,
182 math_param_ord_inner_spacing,
183 math_param_op_ord_spacing,
184 math_param_op_op_spacing,
185 math_param_op_bin_spacing,
186 math_param_op_rel_spacing,
187 math_param_op_open_spacing,
188 math_param_op_close_spacing,
189 math_param_op_punct_spacing,
190 math_param_op_inner_spacing,
191 math_param_bin_ord_spacing,
192 math_param_bin_op_spacing,
193 math_param_bin_bin_spacing,
194 math_param_bin_rel_spacing,
195 math_param_bin_open_spacing,
196 math_param_bin_close_spacing,
197 math_param_bin_punct_spacing,
198 math_param_bin_inner_spacing,
199 math_param_rel_ord_spacing,
200 math_param_rel_op_spacing,
201 math_param_rel_bin_spacing,
202 math_param_rel_rel_spacing,
203 math_param_rel_open_spacing,
204 math_param_rel_close_spacing,
205 math_param_rel_punct_spacing,
206 math_param_rel_inner_spacing,
207 math_param_open_ord_spacing,
208 math_param_open_op_spacing,
209 math_param_open_bin_spacing,
210 math_param_open_rel_spacing,
211 math_param_open_open_spacing,
212 math_param_open_close_spacing,
213 math_param_open_punct_spacing,
214 math_param_open_inner_spacing,
215 math_param_close_ord_spacing,
216 math_param_close_op_spacing,
217 math_param_close_bin_spacing,
218 math_param_close_rel_spacing,
219 math_param_close_open_spacing,
220 math_param_close_close_spacing,
221 math_param_close_punct_spacing,
222 math_param_close_inner_spacing,
223 math_param_punct_ord_spacing,
224 math_param_punct_op_spacing,
225 math_param_punct_bin_spacing,
226 math_param_punct_rel_spacing,
227 math_param_punct_open_spacing,
228 math_param_punct_close_spacing,
229 math_param_punct_punct_spacing,
230 math_param_punct_inner_spacing,
231 math_param_inner_ord_spacing,
232 math_param_inner_op_spacing,
233 math_param_inner_bin_spacing,
234 math_param_inner_rel_spacing,
235 math_param_inner_open_spacing,
236 math_param_inner_close_spacing,
237 math_param_inner_punct_spacing,
238 math_param_inner_inner_spacing,
239 math_param_last
240 } math_parameters;
242 extern const char *math_param_names[];
244 # define math_param_first_mu_glue math_param_ord_ord_spacing
246 extern void def_math_param(int param_code, int style_code, scaled value,
247 int lvl);
248 extern scaled get_math_param(int param_code, int style_code);
251 typedef enum {
252 ScriptPercentScaleDown = 1,
253 ScriptScriptPercentScaleDown,
254 DelimitedSubFormulaMinHeight,
255 DisplayOperatorMinHeight,
256 MathLeading,
257 AxisHeight,
258 AccentBaseHeight,
259 FlattenedAccentBaseHeight,
260 SubscriptShiftDown,
261 SubscriptTopMax,
262 SubscriptBaselineDropMin,
263 SuperscriptShiftUp,
264 SuperscriptShiftUpCramped,
265 SuperscriptBottomMin,
266 SuperscriptBaselineDropMax,
267 SubSuperscriptGapMin,
268 SuperscriptBottomMaxWithSubscript,
269 SpaceAfterScript,
270 UpperLimitGapMin,
271 UpperLimitBaselineRiseMin,
272 LowerLimitGapMin,
273 LowerLimitBaselineDropMin,
274 StackTopShiftUp,
275 StackTopDisplayStyleShiftUp,
276 StackBottomShiftDown,
277 StackBottomDisplayStyleShiftDown,
278 StackGapMin,
279 StackDisplayStyleGapMin,
280 StretchStackTopShiftUp,
281 StretchStackBottomShiftDown,
282 StretchStackGapAboveMin,
283 StretchStackGapBelowMin,
284 FractionNumeratorShiftUp,
285 FractionNumeratorDisplayStyleShiftUp,
286 FractionDenominatorShiftDown,
287 FractionDenominatorDisplayStyleShiftDown,
288 FractionNumeratorGapMin,
289 FractionNumeratorDisplayStyleGapMin,
290 FractionRuleThickness,
291 FractionDenominatorGapMin,
292 FractionDenominatorDisplayStyleGapMin,
293 SkewedFractionHorizontalGap,
294 SkewedFractionVerticalGap,
295 OverbarVerticalGap,
296 OverbarRuleThickness,
297 OverbarExtraAscender,
298 UnderbarVerticalGap,
299 UnderbarRuleThickness,
300 UnderbarExtraDescender,
301 RadicalVerticalGap,
302 RadicalDisplayStyleVerticalGap,
303 RadicalRuleThickness,
304 RadicalExtraAscender,
305 RadicalKernBeforeDegree,
306 RadicalKernAfterDegree,
307 RadicalDegreeBottomRaisePercent,
308 MinConnectorOverlap,
309 SubscriptShiftDownWithSuperscript,
310 FractionDelimiterSize,
311 FractionDelimiterDisplayStyleSize,
312 NoLimitSubFactor,
313 NoLimitSupFactor,
314 MATH_param_last,
315 } MATH_param_codes;
317 # define MATH_param_max MATH_param_last
319 extern const char *MATH_param_names[];
321 #endif