beta-0.89.2
[luatex.git] / source / texk / web2c / luatexdir / tex / texmath.h
blob90ae5f20a1d188418d851e485ecdb4ba8ce59340
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 typedef enum {
95 display_style = 0, /* |subtype| for \.{\\displaystyle} */
96 cramped_display_style, /* |subtype| for \.{\\crampeddisplaystyle} */
97 text_style, /* |subtype| for \.{\\textstyle} */
98 cramped_text_style, /* |subtype| for \.{\\crampedtextstyle} */
99 script_style, /* |subtype| for \.{\\scriptstyle} */
100 cramped_script_style, /* |subtype| for \.{\\crampedscriptstyle} */
101 script_script_style, /* |subtype| for \.{\\scriptscriptstyle} */
102 cramped_script_script_style, /* |subtype| for \.{\\crampedscriptscriptstyle} */
103 } math_style_subtypes;
105 extern const char *math_style_names[];
107 # define cramped 1 /* add this to an uncramped style if you want to cramp it */
109 # define cramped_style(A) 2*((A)/2)+cramped /* cramp the style */
110 # define sub_style(A) 2*((A)/4)+script_style+cramped /* smaller and cramped */
111 # define sup_style(A) 2*((A)/4)+script_style+((A)%2) /* smaller */
112 # define num_style(A) (A)+2-2*((A)/6) /* smaller unless already script-script */
113 # define denom_style(A) 2*((A)/2)+cramped+2-2*((A)/6) /* smaller, cramped */
114 # define sup_sup_style(A) sup_style(sup_style((A))) /* smaller */
116 void setup_math_style(void);
117 void print_math_style(void);
119 # define text_size 0
120 # define script_size 1
121 # define script_script_size 2
123 # define math_direction int_par(math_direction_code)
125 # define dir_math_save cur_list.math_field
126 # define m_style cur_list.math_style_field
127 # define init_math_fields() do { \
128 dir_math_save=false; \
129 m_style=-1; \
130 } while (0)
133 # define null_font 0
134 # define min_quarterword 0
136 # define undefined_math_parameter max_dimen
138 typedef enum {
139 math_param_quad,
140 math_param_axis,
141 math_param_operator_size,
142 math_param_overbar_kern,
143 math_param_overbar_rule,
144 math_param_overbar_vgap,
145 math_param_underbar_kern,
146 math_param_underbar_rule,
147 math_param_underbar_vgap,
148 math_param_radical_kern,
149 math_param_radical_rule,
150 math_param_radical_vgap,
151 math_param_radical_degree_before,
152 math_param_radical_degree_after,
153 math_param_radical_degree_raise,
154 math_param_stack_vgap,
155 math_param_stack_num_up,
156 math_param_stack_denom_down,
157 math_param_fraction_rule,
158 math_param_fraction_num_vgap,
159 math_param_fraction_num_up,
160 math_param_fraction_denom_vgap,
161 math_param_fraction_denom_down,
162 math_param_fraction_del_size,
163 math_param_skewed_fraction_hgap,
164 math_param_skewed_fraction_vgap,
165 math_param_limit_above_vgap,
166 math_param_limit_above_bgap,
167 math_param_limit_above_kern,
168 math_param_limit_below_vgap,
169 math_param_limit_below_bgap,
170 math_param_limit_below_kern,
171 math_param_under_delimiter_vgap,
172 math_param_under_delimiter_bgap,
173 math_param_over_delimiter_vgap,
174 math_param_over_delimiter_bgap,
175 math_param_sub_shift_drop,
176 math_param_sup_shift_drop,
177 math_param_sub_shift_down,
178 math_param_sub_sup_shift_down,
179 math_param_sub_top_max,
180 math_param_sup_shift_up,
181 math_param_sup_bottom_min,
182 math_param_sup_sub_bottom_max,
183 math_param_subsup_vgap,
184 math_param_space_after_script,
185 math_param_connector_overlap_min,
186 math_param_ord_ord_spacing,
187 math_param_ord_op_spacing,
188 math_param_ord_bin_spacing,
189 math_param_ord_rel_spacing,
190 math_param_ord_open_spacing,
191 math_param_ord_close_spacing,
192 math_param_ord_punct_spacing,
193 math_param_ord_inner_spacing,
194 math_param_op_ord_spacing,
195 math_param_op_op_spacing,
196 math_param_op_bin_spacing,
197 math_param_op_rel_spacing,
198 math_param_op_open_spacing,
199 math_param_op_close_spacing,
200 math_param_op_punct_spacing,
201 math_param_op_inner_spacing,
202 math_param_bin_ord_spacing,
203 math_param_bin_op_spacing,
204 math_param_bin_bin_spacing,
205 math_param_bin_rel_spacing,
206 math_param_bin_open_spacing,
207 math_param_bin_close_spacing,
208 math_param_bin_punct_spacing,
209 math_param_bin_inner_spacing,
210 math_param_rel_ord_spacing,
211 math_param_rel_op_spacing,
212 math_param_rel_bin_spacing,
213 math_param_rel_rel_spacing,
214 math_param_rel_open_spacing,
215 math_param_rel_close_spacing,
216 math_param_rel_punct_spacing,
217 math_param_rel_inner_spacing,
218 math_param_open_ord_spacing,
219 math_param_open_op_spacing,
220 math_param_open_bin_spacing,
221 math_param_open_rel_spacing,
222 math_param_open_open_spacing,
223 math_param_open_close_spacing,
224 math_param_open_punct_spacing,
225 math_param_open_inner_spacing,
226 math_param_close_ord_spacing,
227 math_param_close_op_spacing,
228 math_param_close_bin_spacing,
229 math_param_close_rel_spacing,
230 math_param_close_open_spacing,
231 math_param_close_close_spacing,
232 math_param_close_punct_spacing,
233 math_param_close_inner_spacing,
234 math_param_punct_ord_spacing,
235 math_param_punct_op_spacing,
236 math_param_punct_bin_spacing,
237 math_param_punct_rel_spacing,
238 math_param_punct_open_spacing,
239 math_param_punct_close_spacing,
240 math_param_punct_punct_spacing,
241 math_param_punct_inner_spacing,
242 math_param_inner_ord_spacing,
243 math_param_inner_op_spacing,
244 math_param_inner_bin_spacing,
245 math_param_inner_rel_spacing,
246 math_param_inner_open_spacing,
247 math_param_inner_close_spacing,
248 math_param_inner_punct_spacing,
249 math_param_inner_inner_spacing,
250 math_param_last
251 } math_parameters;
253 extern const char *math_param_names[];
255 # define math_param_first_mu_glue math_param_ord_ord_spacing
257 extern void def_math_param(int param_code, int style_code, scaled value,
258 int lvl);
259 extern scaled get_math_param(int param_code, int style_code);
262 typedef enum {
263 ScriptPercentScaleDown = 1,
264 ScriptScriptPercentScaleDown,
265 DelimitedSubFormulaMinHeight,
266 DisplayOperatorMinHeight,
267 MathLeading,
268 AxisHeight,
269 AccentBaseHeight,
270 FlattenedAccentBaseHeight,
271 SubscriptShiftDown,
272 SubscriptTopMax,
273 SubscriptBaselineDropMin,
274 SuperscriptShiftUp,
275 SuperscriptShiftUpCramped,
276 SuperscriptBottomMin,
277 SuperscriptBaselineDropMax,
278 SubSuperscriptGapMin,
279 SuperscriptBottomMaxWithSubscript,
280 SpaceAfterScript,
281 UpperLimitGapMin,
282 UpperLimitBaselineRiseMin,
283 LowerLimitGapMin,
284 LowerLimitBaselineDropMin,
285 StackTopShiftUp,
286 StackTopDisplayStyleShiftUp,
287 StackBottomShiftDown,
288 StackBottomDisplayStyleShiftDown,
289 StackGapMin,
290 StackDisplayStyleGapMin,
291 StretchStackTopShiftUp,
292 StretchStackBottomShiftDown,
293 StretchStackGapAboveMin,
294 StretchStackGapBelowMin,
295 FractionNumeratorShiftUp,
296 FractionNumeratorDisplayStyleShiftUp,
297 FractionDenominatorShiftDown,
298 FractionDenominatorDisplayStyleShiftDown,
299 FractionNumeratorGapMin,
300 FractionNumeratorDisplayStyleGapMin,
301 FractionRuleThickness,
302 FractionDenominatorGapMin,
303 FractionDenominatorDisplayStyleGapMin,
304 SkewedFractionHorizontalGap,
305 SkewedFractionVerticalGap,
306 OverbarVerticalGap,
307 OverbarRuleThickness,
308 OverbarExtraAscender,
309 UnderbarVerticalGap,
310 UnderbarRuleThickness,
311 UnderbarExtraDescender,
312 RadicalVerticalGap,
313 RadicalDisplayStyleVerticalGap,
314 RadicalRuleThickness,
315 RadicalExtraAscender,
316 RadicalKernBeforeDegree,
317 RadicalKernAfterDegree,
318 RadicalDegreeBottomRaisePercent,
319 MinConnectorOverlap,
320 SubscriptShiftDownWithSuperscript,
321 FractionDelimiterSize,
322 FractionDelimiterDisplayStyleSize,
323 MATH_param_last,
324 } MATH_param_codes;
326 # define MATH_param_max MATH_param_last
328 extern const char *MATH_param_names[];
330 #endif