mathematical 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1de32519eb325713b4fc469821129edb7d1eb87b
4
- data.tar.gz: cd04d81c4d2d15f5e6e6f3b58ab94d4675ff4210
3
+ metadata.gz: 4576b12d1b564a608a32cef0d71f63a632a3bdc6
4
+ data.tar.gz: e8de25578c31dac66b2c0a2d1592723d92ba6c18
5
5
  SHA512:
6
- metadata.gz: ce89ed4c00f84c75d1f09ef0a083a3ea3c74a4caaee39ffbca6a392d6d5283de1dcf34e90e1e45bd31fe7dd2b0ae62d76e36818451e24f2454f981ee29a23530
7
- data.tar.gz: c3e6896a9e187f7f9454a432ca574c561f10d7d5a93cc0b469a32d5a4bf819522ce4bc0de70776ece0e24d06fd5743eb26f75709473c5dcd33752e802d6b9a39
6
+ metadata.gz: 662f87b0880f21f7d86c7d00ad96a3aadd15b6c2a4eac333d2ff5b490dcd450a8c08ac0d5089596fd4a0aaf16540dd20d655ba14d090d672a7dbc85d3d79a789
7
+ data.tar.gz: 8c05a0e0768b965264dae6df9a0c8338dedb352d05e2ea2486f0953958257776efb164d1471e9cae79fbf41f9c5fbf6f188121ae7710ec58563c5594a217ba5f
@@ -93,7 +93,7 @@ typedef struct {
93
93
  double value;
94
94
  } LsmMathmlLengthAttribute;
95
95
 
96
- double lsm_mathml_length_attribute_normalize (LsmMathmlLengthAttribute *atribute,
96
+ double lsm_mathml_length_attribute_normalize (LsmMathmlLengthAttribute *attribute,
97
97
  double base,
98
98
  const LsmMathmlLength *default_value,
99
99
  const LsmMathmlStyle *style);
@@ -49,6 +49,7 @@ static LsmMathmlSpace frame_spacing_values[2] = {
49
49
  {.name = LSM_MATHML_SPACE_NAME_ERROR, .length = {.unit = LSM_MATHML_UNIT_EX, .value = 0.5}}
50
50
  };
51
51
  static const LsmMathmlSpaceList frame_spacing_default = {.n_spaces = 2, .spaces = frame_spacing_values};
52
+ static const LsmMathmlLength label_spacing_default = {1.0, LSM_MATHML_UNIT_EM};
52
53
 
53
54
  static GObjectClass *parent_class;
54
55
 
@@ -76,6 +77,7 @@ lsm_mathml_table_element_update (LsmMathmlElement *self, LsmMathmlStyle *style)
76
77
  lsm_mathml_space_list_attribute_normalize (&table->row_spacing, 0.0, &row_spacing_default, style);
77
78
  lsm_mathml_space_list_attribute_normalize (&table->column_spacing, 0.0, &column_spacing_default, style);
78
79
  lsm_mathml_space_list_attribute_normalize (&table->frame_spacing, 0.0, &frame_spacing_default, style);
80
+ lsm_mathml_length_attribute_normalize (&table->label_spacing, 0.0, &label_spacing_default, style);
79
81
  }
80
82
 
81
83
  static const LsmMathmlBbox *
@@ -92,6 +94,7 @@ lsm_mathml_table_element_measure (LsmMathmlElement *self, LsmMathmlView *view, c
92
94
  double max_depth = 0.0;
93
95
  double height;
94
96
  gboolean stretchy_found = FALSE;
97
+ gboolean has_label = FALSE;
95
98
 
96
99
  table->line_width = LSM_MATHML_TABLE_ELEMENT_LINE_WIDTH;
97
100
 
@@ -141,6 +144,10 @@ lsm_mathml_table_element_measure (LsmMathmlElement *self, LsmMathmlView *view, c
141
144
  column = 0;
142
145
  table->heights[row] = 0.0;
143
146
  table->depths[row] = 0.0;
147
+ if (LSM_MATHML_TABLE_ROW_ELEMENT(row_node)->type ==
148
+ LSM_MATHML_TABLE_ROW_ELEMENT_TYPE_LABELED_ROW) {
149
+ has_label = TRUE;
150
+ }
144
151
  for (cell_node = row_node->first_child;
145
152
  cell_node != NULL;
146
153
  cell_node = cell_node->next_sibling) {
@@ -216,6 +223,9 @@ lsm_mathml_table_element_measure (LsmMathmlElement *self, LsmMathmlView *view, c
216
223
  self->bbox.depth = height - self->bbox.height;
217
224
 
218
225
  self->bbox.width += 2 * table->frame_spacing.values[0];
226
+ if (has_label) {
227
+ self->bbox.width += table->label_spacing.value;
228
+ }
219
229
 
220
230
  {
221
231
  double axis_offset;
@@ -322,15 +332,26 @@ lsm_mathml_table_element_layout (LsmMathmlElement *self, LsmMathmlView *view,
322
332
  x_cell = x + x_offset + (table->widths[column] - bbox->width) * 0.5;
323
333
  }
324
334
 
325
- lsm_mathml_element_layout (LSM_MATHML_ELEMENT (cell_node), view,
326
- x_cell, y_cell, bbox);
327
-
328
- if (column < table->n_columns - 1) {
329
- x_offset += table->widths[column];
330
- x_offset += table->column_spacing.values[MIN (column, max_column)];
331
- x_offset += table->line_width;
332
- column++;
335
+ /* the first cell in <mlabeledtr> is the label; by default this should
336
+ render to the right */
337
+ if (cell_node == row_node->first_child &&
338
+ LSM_MATHML_TABLE_ROW_ELEMENT(row_node)->type ==
339
+ LSM_MATHML_TABLE_ROW_ELEMENT_TYPE_LABELED_ROW) {
340
+ x_cell = self->bbox.width - x_offset - table->widths[column];
341
+ if (column < table->n_columns - 1) {
342
+ column++;
343
+ }
333
344
  }
345
+ else {
346
+ if (column < table->n_columns - 1) {
347
+ x_offset += table->widths[column];
348
+ x_offset += table->column_spacing.values[MIN (column, max_column)];
349
+ x_offset += table->line_width;
350
+ column++;
351
+ }
352
+ }
353
+ lsm_mathml_element_layout (LSM_MATHML_ELEMENT (cell_node), view,
354
+ x_cell, y_cell, bbox);
334
355
  }
335
356
 
336
357
  if (row < table->n_rows - 1) {
@@ -513,6 +534,12 @@ static const LsmAttributeInfos _attribute_infos[] = {
513
534
  .attribute_offset = offsetof (LsmMathmlTableElement, frame_spacing),
514
535
  .trait_class = &lsm_mathml_space_list_trait_class,
515
536
  .trait_default = &frame_spacing_default
537
+ },
538
+ {
539
+ .name = "minlabelspacing",
540
+ .attribute_offset = offsetof (LsmMathmlTableElement, label_spacing),
541
+ .trait_class = &lsm_mathml_length_trait_class,
542
+ .trait_default = &label_spacing_default
516
543
  }
517
544
  };
518
545
 
@@ -49,6 +49,7 @@ struct _LsmMathmlTableElement {
49
49
  LsmMathmlEnumListAttribute column_lines;
50
50
  LsmMathmlEnumAttribute frame;
51
51
  LsmMathmlSpaceListAttribute frame_spacing;
52
+ LsmMathmlLengthAttribute label_spacing;
52
53
 
53
54
  LsmMathmlBooleanAttribute equal_rows;
54
55
  LsmMathmlBooleanAttribute equal_columns;
@@ -75,4 +76,3 @@ LsmDomNode * lsm_mathml_table_element_new (void);
75
76
  G_END_DECLS
76
77
 
77
78
  #endif
78
-
@@ -125,6 +125,8 @@ if(MSVC)
125
125
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
126
126
  endif()
127
127
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4127 /wd4244 /wd4267 /wd4706 /wd4800 /D_CRT_SECURE_NO_WARNINGS")
128
+
129
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/win32-shims)
128
130
  elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
129
131
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99 -pedantic-errors -fextended-identifiers ")
130
132
  endif()
@@ -6,6 +6,7 @@
6
6
  // MIT licensed
7
7
  //
8
8
 
9
+ #ifndef _WIN32
9
10
  #ifndef HAVE_STRDUP
10
11
 
11
12
  #include <stdlib.h>
@@ -22,3 +23,4 @@ strdup(const char *str) {
22
23
  }
23
24
 
24
25
  #endif /* HAVE_STRDUP */
26
+ #endif
@@ -6,6 +6,7 @@
6
6
  // MIT licensed
7
7
  //
8
8
 
9
+ #ifndef _WIN32
9
10
  #ifndef HAVE_STRDUP
10
11
  #define HAVE_STRDUP
11
12
 
@@ -22,3 +23,6 @@ char *
22
23
  strdup(const char *str);
23
24
 
24
25
  #endif /* HAVE_STRDUP */
26
+ #else
27
+ #define strdup _strdup
28
+ #endif
@@ -36,7 +36,7 @@ char *mtex2MML_dbl2em(char *str)
36
36
  utstring_new(em);
37
37
 
38
38
  dbl = mtex2MML_extract_number_from_pxstring(str);
39
- dbl *= 0.056;
39
+ dbl *= 0.056f;
40
40
 
41
41
  utstring_printf(em, "%.3fem", dbl);
42
42
  em_str = strdup(utstring_body(em));
@@ -9,7 +9,7 @@ extern "C" {
9
9
  #endif
10
10
 
11
11
  typedef enum {NONE = 0, TOPENCLOSE} encaseType;
12
- typedef enum {OTHER = 0, ENV_ALIGN, ENV_ALIGNAT, ENV_ALIGNED, ENV_EQUATION, ENV_GATHER, ENV_GATHERED, ENV_EQNARRAY, ENV_MULTLINE, ENV_MULTLINESTAR, ENV_SMALLMATRIX} envType;
12
+ typedef enum {OTHER = 0, ENV_ALIGN, ENV_ALIGNAT, ENV_ALIGNATSTAR, ENV_ALIGNED, ENV_EQUATION, ENV_GATHER, ENV_GATHERED, ENV_EQNARRAY, ENV_MULTLINE, ENV_MULTLINESTAR, ENV_SMALLMATRIX} envType;
13
13
 
14
14
  typedef struct {
15
15
  char *rowspacing;
@@ -39,6 +39,8 @@ char * mtex2MML_str;
39
39
 
40
40
  int mtex2MML_rowposn = 0;
41
41
 
42
+ envType environment_type;
43
+
42
44
  /* TODO: I'm not sure what the next option does. My addition
43
45
  of `display_style` is to fix issue776. Probably worth merging
44
46
  these in the future? */
@@ -84,7 +86,7 @@ int display_style = 0;
84
86
  "\\hline" |
85
87
  "\\hdashline" { /* Ignore */ ;}
86
88
 
87
- .?%.+$ { /* Ignore */ ;}
89
+ [^\\]?%.+$ { /* Ignore */ ;}
88
90
 
89
91
  "{" {mtex2MML_rowposn = 2; if(mtex2MML_inoptarg[mtex2MML_optarg_ind] != 0) mtex2MML_inoptarg[mtex2MML_optarg_ind]++; return MROWOPEN;}
90
92
  "}" {if(mtex2MML_inoptarg[mtex2MML_optarg_ind] != 0) mtex2MML_inoptarg[mtex2MML_optarg_ind]--; return MROWCLOSE;}
@@ -1135,7 +1137,7 @@ int display_style = 0;
1135
1137
  "\\mathcal" {BEGIN(CALLIGRAPHIC); return CAL;}
1136
1138
 
1137
1139
  "\\begin" {mtex2MML_env_start = 1; BEGIN(MATHENV); return BEGINENV;}
1138
- "\\end" {BEGIN(MATHENV); return ENDENV;}
1140
+ "\\end" {environment_type = OTHER;BEGIN(MATHENV); return ENDENV;}
1139
1141
 
1140
1142
  "\\notag" |
1141
1143
  "\\nonumber" { /* ignore, but address in .y */}
@@ -1303,8 +1305,8 @@ int display_style = 0;
1303
1305
  "\{aligned\}" {BEGIN(MATH); return ALIGNED;}
1304
1306
  "\{align\}" {BEGIN(MATH); return ALIGNENV;}
1305
1307
  "\{align*\}" {BEGIN(MATH); return ALIGNENV_STAR;}
1306
- "\{alignat\}" {if (mtex2MML_env_start == 1) BEGIN(ALIGNATOPTS); else BEGIN(MATH); return ALIGNAT;}
1307
- "\{alignat*\}" {if (mtex2MML_env_start == 1) BEGIN(ALIGNATOPTS); else BEGIN(MATH); return ALIGNAT_STAR;}
1308
+ "\{alignat\}" {environment_type = ENV_ALIGNAT; if (mtex2MML_env_start == 1) BEGIN(ALIGNATOPTS); else BEGIN(MATH); return ALIGNAT;}
1309
+ "\{alignat*\}" {environment_type = ENV_ALIGNATSTAR; if (mtex2MML_env_start == 1) BEGIN(ALIGNATOPTS); else BEGIN(MATH); return ALIGNAT_STAR;}
1308
1310
  "\{alignedat\}" {if (mtex2MML_env_start == 1) BEGIN(ALIGNATOPTS); else BEGIN(MATH); return ALIGNEDAT;}
1309
1311
  "\{eqnarray*\}" {BEGIN(MATH); return EQNARRAY_STAR;}
1310
1312
  "\{eqnarray\}" {BEGIN(MATH); return EQNARRAY;}
@@ -280,7 +280,11 @@ yydebug = 1;*/
280
280
  char * mtex2MML_global_label()
281
281
  {
282
282
  char * n = (char *) malloc(256);
283
+ #ifdef _WIN32
284
+ _snprintf(n, 256, "%d", global_label);
285
+ #else
283
286
  snprintf(n, 256, "%d", global_label);
287
+ #endif
284
288
  global_label++;
285
289
  char *prefix = mtex2MML_copy3("<mtd><mtext>(", n, ")</mtext></mtd>");
286
290
  mtex2MML_free_string(n);
@@ -309,7 +313,7 @@ yydebug = 1;*/
309
313
  %}
310
314
 
311
315
  %left TEXOVER TEXOVERWITHDELIMS TEXATOP TEXATOPWITHDELIMS TEXABOVE TEXABOVEWITHDELIMS
312
- %token CHAR STARTMATH STARTDMATH ENDMATH MTEXT MI MIB MN MO LIMITS NOLIMITS SUP SUB MROWOPEN MROWCLOSE MATHOPEN MATHCLOSE MATHORD MATHPUNCT VCENTER LEFT RIGHT BIG BBIG BIGG BBIGG BIGL BBIGL BIGGL BBIGGL BIGM BBIGM BIGGM BBIGGM FRAC TFRAC DFRAC CFRAC GENFRAC OPERATORNAME MATHOP MATHBIN MATHREL MATHINNER MOP MOL MOLL MOF MOR PERIODDELIM COMMADELIM OTHERDELIM LEFTDELIM RIGHTDELIM MOS MOB SQRT ROOT OF LEFTROOT UPROOT BINOM TBINOM BRACE BRACK CHOOSE DBINOM UNDER BUILDREL OVER OVERBRACE OVERBRACKET UNDERLINE UNDERBRACE UNDERBRACKET UNDEROVER TENSOR MULTI ALIGNATVALUE ARRAYALIGN COLUMNALIGN ARRAY SPACECUBE HSPACE MOVELEFT MOVERIGHT RAISE LOWER PXSTRING COLSEP ROWSEP ARRAYOPTS COLLAYOUT COLALIGN ROWALIGN ALIGN EQROWS EQCOLS ROWLINES COLLINES FRAME PADDING ATTRLIST ITALICS SANS TT ENCLOSE ENCLOSENOTATION ENCLOSEATTR ENCLOSETEXT BOLD BOXED FBOX HBOX MBOX BCANCELED XCANCELED CANCELEDTO NOT SLASHED PMB SCR RM BB ST END BBLOWERCHAR BBUPPERCHAR BBDIGIT CALCHAR FRAKCHAR CAL FRAK CLAP LLAP RLAP ROWOPTS TEXTSIZE OLDSTYLE SCSTY SCSIZE SCSCSIZE TINY TTINY SMALL NORMALSIZE LARGE LLARGE LLLARGE HUGE HHUGE DISPLAY TEXTSTY TEXTBOX TEXTSTRING COLORSTRING STYLESTRING VERBBOX VERBSTRING ACUTE GRAVE BREVE MATHRING XMLSTRING CELLOPTS ROWSPAN COLSPAN THINSPACE ENSPACE MEDSPACE THICKSPACE QUAD QQUAD NEGSPACE NEGMEDSPACE NEGTHICKSPACE STRUT MATHSTRUT SMASH PHANTOM HPHANTOM VPHANTOM HREF UNKNOWNCHAR EMPTYMROW STATLINE TOOLTIP TOGGLE TOGGLESTART TOGGLEEND FGHIGHLIGHT BGHIGHLIGHT COLORBOX SPACE NUMBER INTONE INTTWO INTTHREE OVERLEFTARROW OVERLEFTRIGHTARROW OVERRIGHTARROW UNDERLEFTARROW UNDERLEFTRIGHTARROW UNDERRIGHTARROW BAR WIDEBAR SKEW VEC WIDEVEC HAT WIDEHAT CHECK WIDECHECK TILDE WIDETILDE DOT DDOT DDDOT DDDDOT UNARYMINUS UNARYPLUS BEGINENV ENDENV EQUATION EQUATION_STAR EQALIGN EQALIGNNO MATRIX PMATRIX BMATRIX BBMATRIX VMATRIX VVMATRIX SUBARRAY SVG ENDSVG SMALLMATRIX CASES ALIGNED ALIGNENV ALIGNENV_STAR ALIGNAT ALIGNAT_STAR ALIGNEDAT GATHERED EQNARRAY EQNARRAY_STAR MULTLINE MULTLINE_STAR GATHER_STAR GATHER SUBSTACK SIDESET BMOD PMOD POD RMCHAR SCRCHAR PMBCHAR COLOR BGCOLOR BBOX XARROW OPTARGOPEN OPTARGCLOSE MTEXNUM RAISEBOX NEG LATEXSYMBOL TEXSYMBOL VARINJLIM VARLIMINF VARLIMSUP VARPROJLIM
316
+ %token CHAR STARTMATH STARTDMATH ENDMATH MTEXT MI MIB MN MO LIMITS NOLIMITS SUP SUB MROWOPEN MROWCLOSE MATHOPEN MATHCLOSE MATHORD MATHPUNCT VCENTER LEFT RIGHT BIG BBIG BIGG BBIGG BIGL BBIGL BIGGL BBIGGL BIGM BBIGM BIGGM BBIGGM FRAC TFRAC DFRAC CFRAC GENFRAC OPERATORNAME MATHOP MATHBIN MATHREL MATHINNER MOP MOL MOLL MOF MOR PERIODDELIM COMMADELIM OTHERDELIM LEFTDELIM RIGHTDELIM MOS MOB SQRT ROOT OF LEFTROOT UPROOT BINOM TBINOM BRACE BRACK CHOOSE DBINOM UNDER BUILDREL OVER OVERBRACE OVERBRACKET UNDERLINE UNDERBRACE UNDERBRACKET UNDEROVER TENSOR MULTI ALIGNATVALUE ARRAYALIGN COLUMNALIGN ARRAY SPACECUBE HSPACE MOVELEFT MOVERIGHT RAISE LOWER PXSTRING COLSEP COLSEPSPACE ROWSEP ARRAYOPTS COLLAYOUT COLALIGN ROWALIGN ALIGN EQROWS EQCOLS ROWLINES COLLINES FRAME PADDING ATTRLIST ITALICS SANS TT ENCLOSE ENCLOSENOTATION ENCLOSEATTR ENCLOSETEXT BOLD BOXED FBOX HBOX MBOX BCANCELED XCANCELED CANCELEDTO NOT SLASHED PMB SCR RM BB ST END BBLOWERCHAR BBUPPERCHAR BBDIGIT CALCHAR FRAKCHAR CAL FRAK CLAP LLAP RLAP ROWOPTS TEXTSIZE OLDSTYLE SCSTY SCSIZE SCSCSIZE TINY TTINY SMALL NORMALSIZE LARGE LLARGE LLLARGE HUGE HHUGE DISPLAY TEXTSTY TEXTBOX TEXTSTRING COLORSTRING STYLESTRING VERBBOX VERBSTRING ACUTE GRAVE BREVE MATHRING XMLSTRING CELLOPTS ROWSPAN COLSPAN THINSPACE ENSPACE MEDSPACE THICKSPACE QUAD QQUAD NEGSPACE NEGMEDSPACE NEGTHICKSPACE STRUT MATHSTRUT SMASH PHANTOM HPHANTOM VPHANTOM HREF UNKNOWNCHAR EMPTYMROW STATLINE TOOLTIP TOGGLE TOGGLESTART TOGGLEEND FGHIGHLIGHT BGHIGHLIGHT COLORBOX SPACE NUMBER INTONE INTTWO INTTHREE OVERLEFTARROW OVERLEFTRIGHTARROW OVERRIGHTARROW UNDERLEFTARROW UNDERLEFTRIGHTARROW UNDERRIGHTARROW BAR WIDEBAR SKEW VEC WIDEVEC HAT WIDEHAT CHECK WIDECHECK TILDE WIDETILDE DOT DDOT DDDOT DDDDOT UNARYMINUS UNARYPLUS BEGINENV ENDENV EQUATION EQUATION_STAR EQALIGN EQALIGNNO MATRIX PMATRIX BMATRIX BBMATRIX VMATRIX VVMATRIX SUBARRAY SVG ENDSVG SMALLMATRIX CASES ALIGNED ALIGNENV ALIGNENV_STAR ALIGNAT ALIGNAT_STAR ALIGNEDAT GATHERED EQNARRAY EQNARRAY_STAR MULTLINE MULTLINE_STAR GATHER_STAR GATHER SUBSTACK SIDESET BMOD PMOD POD RMCHAR SCRCHAR PMBCHAR COLOR BGCOLOR BBOX XARROW OPTARGOPEN OPTARGCLOSE MTEXNUM RAISEBOX NEG LATEXSYMBOL TEXSYMBOL VARINJLIM VARLIMINF VARLIMSUP VARPROJLIM
313
317
 
314
318
  %%
315
319
 
@@ -1953,7 +1957,7 @@ mfrac: FRAC closedTerm closedTerm {
1953
1957
  mtex2MML_free_string($3);
1954
1958
  }
1955
1959
  | GENFRAC MROWOPEN LEFTDELIM MROWCLOSE MROWOPEN RIGHTDELIM MROWCLOSE MROWOPEN PXSTRING MROWCLOSE compoundTermList compoundTermList compoundTermList {
1956
- char *s1, *s2, *s3, *s4;
1960
+ char *s1 = NULL, *s2 = NULL, *s3 = NULL, *s4 = NULL;
1957
1961
  int style = 0;
1958
1962
  sscanf ($11,"%d", &style);
1959
1963
 
@@ -2961,7 +2965,7 @@ mathenv: BEGINENV EQUATION tableRowList ENDENV EQUATION {
2961
2965
  | BEGINENV ALIGNAT ALIGNATVALUE END tableRowList ENDENV ALIGNAT {
2962
2966
  char *row_data = mtex2MML_combine_row_data(&environment_data_stack);
2963
2967
 
2964
- char * s1 = mtex2MML_copy3("<mrow><mtable displaystyle=\"true\" columnalign=\"right left right left right left right left right left\" columnspacing=\"0em\" ", row_data, ">");
2968
+ char * s1 = mtex2MML_copy3("<mrow><mtable displaystyle=\"true\" columnalign=\"right left\" columnspacing=\"0em\" ", row_data, ">");
2965
2969
 
2966
2970
  if (encase == TOPENCLOSE) {
2967
2971
  char *t = mtex2MML_copy3(s1, $5, "</mtable></mrow>");
@@ -2979,7 +2983,7 @@ mathenv: BEGINENV EQUATION tableRowList ENDENV EQUATION {
2979
2983
  | BEGINENV ALIGNAT_STAR ALIGNATVALUE END tableRowList ENDENV ALIGNAT_STAR {
2980
2984
  char *row_data = mtex2MML_combine_row_data(&environment_data_stack);
2981
2985
 
2982
- char * s1 = mtex2MML_copy3("<mrow><mtable displaystyle=\"true\" columnalign=\"right left right left right left right left right left\" columnspacing=\"0em\" ", row_data, ">");
2986
+ char * s1 = mtex2MML_copy3("<mrow><mtable displaystyle=\"true\" columnalign=\"right left\" columnspacing=\"0em\" ", row_data, ">");
2983
2987
 
2984
2988
  if (encase == TOPENCLOSE) {
2985
2989
  char *t = mtex2MML_copy3(s1, $5, "</mtable></mrow>");
@@ -3333,11 +3337,16 @@ arowopt: colalign {
3333
3337
  };
3334
3338
 
3335
3339
  tableCell: {
3336
- $$ = mtex2MML_copy_string("<mtd/>");
3340
+ $$ = mtex2MML_copy_string("<mtd></mtd>");
3337
3341
  }
3338
3342
  | compoundTermList {
3339
3343
  if (mtex2MML_current_env_type(&environment_data_stack) != ENV_MULTLINE && mtex2MML_current_env_type(&environment_data_stack) != ENV_MULTLINESTAR) {
3340
- $$ = mtex2MML_copy3("<mtd>", $1, "</mtd>");
3344
+ if (mtex2MML_current_env_type(&environment_data_stack) == ENV_ALIGNAT || mtex2MML_current_env_type(&environment_data_stack) == ENV_ALIGNATSTAR) {
3345
+ $$ = mtex2MML_copy3("<mtd><mi></mi>", $1, "</mtd>");
3346
+ }
3347
+ else {
3348
+ $$ = mtex2MML_copy3("<mtd>", $1, "</mtd>");
3349
+ }
3341
3350
  }
3342
3351
  else {
3343
3352
  int total_lines = mtex2MML_current_env_line_count(&environment_data_stack);
@@ -0,0 +1,51 @@
1
+ #ifndef _UNISTD_H
2
+ #define _UNISTD_H 1
3
+
4
+ /* This file intended to serve as a drop-in replacement for
5
+ * unistd.h on Windows
6
+ * Please add functionality as neeeded
7
+ */
8
+
9
+ #include <stdlib.h>
10
+ #include <io.h>
11
+ #include <process.h> /* for getpid() and the exec..() family */
12
+ #include <direct.h> /* for _getcwd() and _chdir() */
13
+
14
+ #define srandom srand
15
+ #define random rand
16
+
17
+ /* Values for the second argument to access.
18
+ These may be OR'd together. */
19
+ #define R_OK 4 /* Test for read permission. */
20
+ #define W_OK 2 /* Test for write permission. */
21
+ //#define X_OK 1 /* execute permission - unsupported in windows*/
22
+ #define F_OK 0 /* Test for existence. */
23
+
24
+ #define access _access
25
+ #define dup2 _dup2
26
+ #define execve _execve
27
+ #define ftruncate _chsize
28
+ #define unlink _unlink
29
+ #define fileno _fileno
30
+ #define getcwd _getcwd
31
+ #define chdir _chdir
32
+ #define isatty _isatty
33
+ #define lseek _lseek
34
+ /* read, write, and close are NOT being #defined here, because while there are file handle specific versions for Windows, they probably don't work for sockets. You need to look at your app and consider whether to call e.g. closesocket(). */
35
+
36
+ #define ssize_t int
37
+
38
+ #define STDIN_FILENO 0
39
+ #define STDOUT_FILENO 1
40
+ #define STDERR_FILENO 2
41
+ /* should be in some equivalent to <sys/types.h> */
42
+ typedef __int8 int8_t;
43
+ typedef __int16 int16_t;
44
+ typedef __int32 int32_t;
45
+ typedef __int64 int64_t;
46
+ typedef unsigned __int8 uint8_t;
47
+ typedef unsigned __int16 uint16_t;
48
+ typedef unsigned __int32 uint32_t;
49
+ typedef unsigned __int64 uint64_t;
50
+
51
+ #endif /* unistd.h */
@@ -1,3 +1,3 @@
1
1
  class Mathematical
2
- VERSION = '1.4.1'
2
+ VERSION = '1.4.2'
3
3
  end
data/mathematical.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ['Garen Torikian']
10
10
  spec.email = ['gjtorikian@gmail.com']
11
11
  spec.summary = 'Quickly convert math equations into beautiful SVGs/PNGs/MathML.'
12
- spec.description = 'A very fast way to turn LaTeX math equations into beautifully rendered SVGs, to embed on the web. This library is mostly written in C and is a general purpose wrapper to GNOME\'s Lasem.'
12
+ spec.description = 'A very fast way to turn TeX math equations into beautifully rendered SVGs, to embed on the web. This library is mostly written in C and is a general purpose wrapper to GNOME\'s Lasem.'
13
13
  spec.homepage = 'https://github.com/gjtorikian/mathematical'
14
14
  spec.license = 'MIT'
15
15
 
data/test/test_helper.rb CHANGED
@@ -2,6 +2,7 @@ require 'bundler/setup'
2
2
  require 'mathematical'
3
3
  require 'minitest/autorun'
4
4
  require 'minitest/pride'
5
+ require 'math-to-itex'
5
6
  require 'pp'
6
7
 
7
8
  MTEX2MML_FIXTURES_DIR = File.join('ext', 'mathematical', 'mtex2MML', 'tests', 'fixtures')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mathematical
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-15 00:00:00.000000000 Z
11
+ date: 2015-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-enum
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.6'
111
- description: A very fast way to turn LaTeX math equations into beautifully rendered
111
+ description: A very fast way to turn TeX math equations into beautifully rendered
112
112
  SVGs, to embed on the web. This library is mostly written in C and is a general
113
113
  purpose wrapper to GNOME's Lasem.
114
114
  email:
@@ -388,6 +388,7 @@ files:
388
388
  - ext/mathematical/mtex2MML/src/parser.y
389
389
  - ext/mathematical/mtex2MML/src/string_extras.c
390
390
  - ext/mathematical/mtex2MML/src/string_extras.h
391
+ - ext/mathematical/mtex2MML/src/win32-shims/unistd.h
391
392
  - ext/mathematical/mtex2MML/tests/array.c
392
393
  - ext/mathematical/mtex2MML/tests/basic.c
393
394
  - ext/mathematical/mtex2MML/tests/clar.c