| 1 |
/* texmath.h |
| 2 |
|
| 3 |
Copyright 1996-2006 Han The Thanh <[email protected]> |
| 4 |
Copyright 2006-2009 Taco Hoekwater <[email protected]> |
| 5 |
|
| 6 |
This file is part of LuaTeX. |
| 7 |
|
| 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. |
| 12 |
|
| 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. |
| 17 |
|
| 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/>. */ |
| 20 |
|
| 21 |
|
| 22 |
#ifndef TEXMATH_H |
| 23 |
# define TEXMATH_H 1 |
| 24 |
|
| 25 |
# define empty 0 |
| 26 |
|
| 27 |
extern pointer new_noad(void); |
| 28 |
|
| 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); |
| 34 |
|
| 35 |
# define math_reset(p) do { if (p!=null) flush_node(p); p = null; } while (0) |
| 36 |
|
| 37 |
# define scripts_allowed(A) ((type((A))>=simple_noad)&&(type((A))<fence_noad)) |
| 38 |
|
| 39 |
# define default_code 010000000000 /* denotes |default_rule_thickness| */ |
| 40 |
|
| 41 |
extern void initialize_math(void); |
| 42 |
extern void initialize_math_spacing(void); |
| 43 |
extern halfword math_vcenter_group(halfword); |
| 44 |
extern void build_choices(void); |
| 45 |
extern void close_math_group(halfword); |
| 46 |
extern void init_math(void); |
| 47 |
extern void start_eq_no(void); |
| 48 |
extern void set_math_char(mathcodeval); |
| 49 |
extern void math_char_in_text(mathcodeval); |
| 50 |
extern void math_math_comp(void); |
| 51 |
extern void math_limit_switch(void); |
| 52 |
extern void math_radical(void); |
| 53 |
extern void math_ac(void); |
| 54 |
extern pointer new_style(small_number); |
| 55 |
extern void append_choices(void); |
| 56 |
extern void sub_sup(void); |
| 57 |
extern void no_sub_sup(void); |
| 58 |
extern void math_fraction(void); |
| 59 |
extern void math_left_right(void); |
| 60 |
extern void after_math(void); |
| 61 |
|
| 62 |
extern void scan_extdef_del_code(int level, int extcode); |
| 63 |
extern void scan_extdef_math_code(int level, int extcode); |
| 64 |
|
| 65 |
extern int fam_fnt(int fam_id, int size_id); |
| 66 |
extern void def_fam_fnt(int fam_id, int size_id, int f, int lvl); |
| 67 |
extern void dump_math_data(void); |
| 68 |
extern void undump_math_data(void); |
| 69 |
void unsave_math_data(int lvl); |
| 70 |
|
| 71 |
/* |
| 72 |
@ We also need to compute the change in style between mlists and their |
| 73 |
subsidiaries. The following macros define the subsidiary style for |
| 74 |
an overlined nucleus (|cramped_style|), for a subscript or a superscript |
| 75 |
(|sub_style| or |sup_style|), or for a numerator or denominator (|num_style| |
| 76 |
or |denom_style|). |
| 77 |
*/ |
| 78 |
|
| 79 |
extern const char *math_style_names[]; |
| 80 |
|
| 81 |
# define cramped 1 /* add this to an uncramped style if you want to cramp it */ |
| 82 |
|
| 83 |
# define cramped_style(A) 2*((A)/2)+cramped /* cramp the style */ |
| 84 |
# define sub_style(A) 2*((A)/4)+script_style+cramped /* smaller and cramped */ |
| 85 |
# define sup_style(A) 2*((A)/4)+script_style+((A)%2) /* smaller */ |
| 86 |
# define num_style(A) (A)+2-2*((A)/6) /* smaller unless already script-script */ |
| 87 |
# define denom_style(A) 2*((A)/2)+cramped+2-2*((A)/6) /* smaller, cramped */ |
| 88 |
# define sup_sup_style(A) sup_style(sup_style((A))) /* smaller */ |
| 89 |
|
| 90 |
void setup_math_style(void); |
| 91 |
void print_math_style(void); |
| 92 |
|
| 93 |
# define text_size 0 |
| 94 |
# define script_size 1 |
| 95 |
# define script_script_size 2 |
| 96 |
|
| 97 |
# define dir_math_save cur_list.math_field |
| 98 |
# define m_style cur_list.math_style_field |
| 99 |
# define init_math_fields() do { \ |
| 100 |
dir_math_save=false; \ |
| 101 |
m_style=-1; \ |
| 102 |
} while (0) |
| 103 |
|
| 104 |
|
| 105 |
# define null_font 0 |
| 106 |
# define min_quarterword 0 |
| 107 |
|
| 108 |
# define undefined_math_parameter max_dimen |
| 109 |
|
| 110 |
typedef enum { |
| 111 |
math_param_quad, |
| 112 |
math_param_axis, |
| 113 |
math_param_operator_size, |
| 114 |
math_param_overbar_kern, |
| 115 |
math_param_overbar_rule, |
| 116 |
math_param_overbar_vgap, |
| 117 |
math_param_underbar_kern, |
| 118 |
math_param_underbar_rule, |
| 119 |
math_param_underbar_vgap, |
| 120 |
math_param_radical_kern, |
| 121 |
math_param_radical_rule, |
| 122 |
math_param_radical_vgap, |
| 123 |
math_param_radical_degree_before, |
| 124 |
math_param_radical_degree_after, |
| 125 |
math_param_radical_degree_raise, |
| 126 |
math_param_stack_vgap, |
| 127 |
math_param_stack_num_up, |
| 128 |
math_param_stack_denom_down, |
| 129 |
math_param_fraction_rule, |
| 130 |
math_param_fraction_num_vgap, |
| 131 |
math_param_fraction_num_up, |
| 132 |
math_param_fraction_denom_vgap, |
| 133 |
math_param_fraction_denom_down, |
| 134 |
math_param_fraction_del_size, |
| 135 |
math_param_skewed_fraction_hgap, |
| 136 |
math_param_skewed_fraction_vgap, |
| 137 |
math_param_limit_above_vgap, |
| 138 |
math_param_limit_above_bgap, |
| 139 |
math_param_limit_above_kern, |
| 140 |
math_param_limit_below_vgap, |
| 141 |
math_param_limit_below_bgap, |
| 142 |
math_param_limit_below_kern, |
| 143 |
math_param_nolimit_sub_factor, /* bonus */ |
| 144 |
math_param_nolimit_sup_factor, /* bonus */ |
| 145 |
math_param_under_delimiter_vgap, |
| 146 |
math_param_under_delimiter_bgap, |
| 147 |
math_param_over_delimiter_vgap, |
| 148 |
math_param_over_delimiter_bgap, |
| 149 |
math_param_sub_shift_drop, |
| 150 |
math_param_sup_shift_drop, |
| 151 |
math_param_sub_shift_down, |
| 152 |
math_param_sub_sup_shift_down, |
| 153 |
math_param_sub_top_max, |
| 154 |
math_param_sup_shift_up, |
| 155 |
math_param_sup_bottom_min, |
| 156 |
math_param_sup_sub_bottom_max, |
| 157 |
math_param_subsup_vgap, |
| 158 |
math_param_space_after_script, |
| 159 |
math_param_connector_overlap_min, |
| 160 |
math_param_ord_ord_spacing, |
| 161 |
math_param_ord_op_spacing, |
| 162 |
math_param_ord_bin_spacing, |
| 163 |
math_param_ord_rel_spacing, |
| 164 |
math_param_ord_open_spacing, |
| 165 |
math_param_ord_close_spacing, |
| 166 |
math_param_ord_punct_spacing, |
| 167 |
math_param_ord_inner_spacing, |
| 168 |
math_param_op_ord_spacing, |
| 169 |
math_param_op_op_spacing, |
| 170 |
math_param_op_bin_spacing, |
| 171 |
math_param_op_rel_spacing, |
| 172 |
math_param_op_open_spacing, |
| 173 |
math_param_op_close_spacing, |
| 174 |
math_param_op_punct_spacing, |
| 175 |
math_param_op_inner_spacing, |
| 176 |
math_param_bin_ord_spacing, |
| 177 |
math_param_bin_op_spacing, |
| 178 |
math_param_bin_bin_spacing, |
| 179 |
math_param_bin_rel_spacing, |
| 180 |
math_param_bin_open_spacing, |
| 181 |
math_param_bin_close_spacing, |
| 182 |
math_param_bin_punct_spacing, |
| 183 |
math_param_bin_inner_spacing, |
| 184 |
math_param_rel_ord_spacing, |
| 185 |
math_param_rel_op_spacing, |
| 186 |
math_param_rel_bin_spacing, |
| 187 |
math_param_rel_rel_spacing, |
| 188 |
math_param_rel_open_spacing, |
| 189 |
math_param_rel_close_spacing, |
| 190 |
math_param_rel_punct_spacing, |
| 191 |
math_param_rel_inner_spacing, |
| 192 |
math_param_open_ord_spacing, |
| 193 |
math_param_open_op_spacing, |
| 194 |
math_param_open_bin_spacing, |
| 195 |
math_param_open_rel_spacing, |
| 196 |
math_param_open_open_spacing, |
| 197 |
math_param_open_close_spacing, |
| 198 |
math_param_open_punct_spacing, |
| 199 |
math_param_open_inner_spacing, |
| 200 |
math_param_close_ord_spacing, |
| 201 |
math_param_close_op_spacing, |
| 202 |
math_param_close_bin_spacing, |
| 203 |
math_param_close_rel_spacing, |
| 204 |
math_param_close_open_spacing, |
| 205 |
math_param_close_close_spacing, |
| 206 |
math_param_close_punct_spacing, |
| 207 |
math_param_close_inner_spacing, |
| 208 |
math_param_punct_ord_spacing, |
| 209 |
math_param_punct_op_spacing, |
| 210 |
math_param_punct_bin_spacing, |
| 211 |
math_param_punct_rel_spacing, |
| 212 |
math_param_punct_open_spacing, |
| 213 |
math_param_punct_close_spacing, |
| 214 |
math_param_punct_punct_spacing, |
| 215 |
math_param_punct_inner_spacing, |
| 216 |
math_param_inner_ord_spacing, |
| 217 |
math_param_inner_op_spacing, |
| 218 |
math_param_inner_bin_spacing, |
| 219 |
math_param_inner_rel_spacing, |
| 220 |
math_param_inner_open_spacing, |
| 221 |
math_param_inner_close_spacing, |
| 222 |
math_param_inner_punct_spacing, |
| 223 |
math_param_inner_inner_spacing, |
| 224 |
math_param_last |
| 225 |
} math_parameters; |
| 226 |
|
| 227 |
extern const char *math_param_names[]; |
| 228 |
|
| 229 |
# define math_param_first_mu_glue math_param_ord_ord_spacing |
| 230 |
|
| 231 |
extern void def_math_param(int param_code, int style_code, scaled value, |
| 232 |
int lvl); |
| 233 |
extern scaled get_math_param(int param_code, int style_code); |
| 234 |
|
| 235 |
|
| 236 |
typedef enum { |
| 237 |
ScriptPercentScaleDown = 1, |
| 238 |
ScriptScriptPercentScaleDown, |
| 239 |
DelimitedSubFormulaMinHeight, |
| 240 |
DisplayOperatorMinHeight, |
| 241 |
MathLeading, |
| 242 |
AxisHeight, |
| 243 |
AccentBaseHeight, |
| 244 |
FlattenedAccentBaseHeight, |
| 245 |
SubscriptShiftDown, |
| 246 |
SubscriptTopMax, |
| 247 |
SubscriptBaselineDropMin, |
| 248 |
SuperscriptShiftUp, |
| 249 |
SuperscriptShiftUpCramped, |
| 250 |
SuperscriptBottomMin, |
| 251 |
SuperscriptBaselineDropMax, |
| 252 |
SubSuperscriptGapMin, |
| 253 |
SuperscriptBottomMaxWithSubscript, |
| 254 |
SpaceAfterScript, |
| 255 |
UpperLimitGapMin, |
| 256 |
UpperLimitBaselineRiseMin, |
| 257 |
LowerLimitGapMin, |
| 258 |
LowerLimitBaselineDropMin, |
| 259 |
StackTopShiftUp, |
| 260 |
StackTopDisplayStyleShiftUp, |
| 261 |
StackBottomShiftDown, |
| 262 |
StackBottomDisplayStyleShiftDown, |
| 263 |
StackGapMin, |
| 264 |
StackDisplayStyleGapMin, |
| 265 |
StretchStackTopShiftUp, |
| 266 |
StretchStackBottomShiftDown, |
| 267 |
StretchStackGapAboveMin, |
| 268 |
StretchStackGapBelowMin, |
| 269 |
FractionNumeratorShiftUp, |
| 270 |
FractionNumeratorDisplayStyleShiftUp, |
| 271 |
FractionDenominatorShiftDown, |
| 272 |
FractionDenominatorDisplayStyleShiftDown, |
| 273 |
FractionNumeratorGapMin, |
| 274 |
FractionNumeratorDisplayStyleGapMin, |
| 275 |
FractionRuleThickness, |
| 276 |
FractionDenominatorGapMin, |
| 277 |
FractionDenominatorDisplayStyleGapMin, |
| 278 |
SkewedFractionHorizontalGap, |
| 279 |
SkewedFractionVerticalGap, |
| 280 |
OverbarVerticalGap, |
| 281 |
OverbarRuleThickness, |
| 282 |
OverbarExtraAscender, |
| 283 |
UnderbarVerticalGap, |
| 284 |
UnderbarRuleThickness, |
| 285 |
UnderbarExtraDescender, |
| 286 |
RadicalVerticalGap, |
| 287 |
RadicalDisplayStyleVerticalGap, |
| 288 |
RadicalRuleThickness, |
| 289 |
RadicalExtraAscender, |
| 290 |
RadicalKernBeforeDegree, |
| 291 |
RadicalKernAfterDegree, |
| 292 |
RadicalDegreeBottomRaisePercent, |
| 293 |
MinConnectorOverlap, |
| 294 |
SubscriptShiftDownWithSuperscript, |
| 295 |
FractionDelimiterSize, |
| 296 |
FractionDelimiterDisplayStyleSize, |
| 297 |
NoLimitSubFactor, |
| 298 |
NoLimitSupFactor, |
| 299 |
MATH_param_last, |
| 300 |
} MATH_param_codes; |
| 301 |
|
| 302 |
# define MATH_param_max MATH_param_last |
| 303 |
|
| 304 |
extern const char *MATH_param_names[]; |
| 305 |
|
| 306 |
#endif |