summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/stex/schema/rnc/LaTeXML/LaTeXML-math.rnc
blob: d310c3df53b77a9d0a66edc9e9f03e2b675ad8d0 (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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# /=====================================================================\ 
# |  LaTeXML-math.rnc                                                   |
# | RelaxNG model for LaTeXML generated documents                       |
# |=====================================================================|
# | Part of LaTeXML:                                                    |
# |  Public domain software, produced as part of work done by the       |
# |  United States Government & not subject to copyright in the US.     |
# |=====================================================================|
# | Bruce Miller <bruce.miller@nist.gov>                        #_#     |
# | http://dlmf.nist.gov/LaTeXML/                              (o o)    |
# \=========================================================ooo==U==ooo=/

default namespace = "http://dlmf.nist.gov/LaTeXML"

## The math module defines LaTeXML's internal representation of mathematical
## content, including the basic math container \elementref{Math}.  This element is
## considered inline, as it will be contained within some other block-level
## element, eg. \elementref{equation} for display-math.
Inline.class &= Math*

## This class defines the content of the \elementref{Math} element.
## Additionally, it could contain MathML or OpenMath, after postprocessing.
Math.class   = XMath

## These elements comprise the internal math representation, being
## the content of the \elementref{XMath} element.
XMath.class = XMApp* & XMTok* & XMRef* & XMHint* & XMArg* & XMWrap* & XMDual* & XMText* & XMArray*

#======================================================================

Math =
## Outer container for all math. This holds the internal 
## \elementref{XMath} representation, as well as image data and other representations.
element Math { Math_attributes & Math_model }

## Attributes for \elementref{Math}.
Math_attributes = 
  Common.attributes & 
  Imageable.attributes & 
  ID.attributes & 

  ## display or inline mode.
  attribute mode { "display" | "inline" }? &

  ## reconstruction of the \TeX\ that generated the math.
  attribute tex { text }? &

  ## more semantic version of \attr{tex}.
  attribute content-tex { text }? &

  ## a textified representation of the math.
  attribute text { text }?

## Content model for \elementref{Math}.
Math_model =   Math.class

#======================================================================
XMath.attributes =

  ## The role that this item plays in the Grammar.
  attribute role { text }? &

  ## an open delimiter to enclose the object;
  attribute open { text }? &

  ## an close delimiter to enclose the object;
  attribute close { text }? &

  ## an open delimiter to enclose the argument list,
  ## when this token is applied to arguments with \elementref{XMApp}.
  attribute argopen { text }? &

  ## a close delimiter to enclose the argument list,
  ## when this token is applied to arguments with \elementref{XMApp}.
  attribute argclose { text }? &

  ## characters to separate arguments,
  ## when this token is applied to arguments with \elementref{XMApp}.
  ## Can be multiple characters for different argument positions;
  ## the last character is repeated if there aren't enough.
  attribute separators { text }? &

  ## trailing (presumably non-semantic) punctuation.
  attribute punctuation { text }? &

  ## an annotation placed by the parser when it suspects this token may be used as a function.
  attribute possibleFunction { text }?

#======================================================================

XMath =
## Internal representation of mathematics.
element XMath { XMath_attributes & XMath_model }

## Attributes for \elementref{XMath}.
XMath_attributes = Common.attributes

## Content model for \elementref{XMath}.
XMath_model = XMath.class

#======================================================================

XMTok =
## General mathematical token.
element XMTok { XMTok_attributes & XMTok_model }

## Attributes for \elementref{XMTok}.
XMTok_attributes = 
  Common.attributes &
  XMath.attributes &
  ID.attributes &

  ## The name of the token, typically the control sequence that created it.
  attribute name { text }? & 

  ## A more semantic name corresponding to the intended meaning,
  ## such as the OpenMath name.
  attribute meaning { text }? & 

  ## The OpenMath CD for which \attr{meaning} is a symbol.
  attribute omcd { text }? & 

  ## Various random styling information. NOTE This needs to be made consistent.
  attribute style { text }? & 

  ## The font, size a used for the symbol.
  attribute font { text }? & 

  ## The size for the symbol, not presumed to be meaningful(?)
  attribute size { text }? & 

  ## The color (CSS format) for the symbol, not presumed to be meaningful(?)
  attribute color { text }? & 

  ## An encoding of the position of this token as a sub/superscript, used
  ## to handle aligned and nested scripts, both pre and post.
  ## It is a concatenation of (pre|mid|post), which indicates the horizontal
  ## positioning of the script with relation to it's base, and a counter
  ## indicating the level. These are used to position the scripts, 
  ## and to pair up aligned sub- and superscripts.
  ## NOTE: Clarify where this appears: token, base, script operator, apply?
  attribute scriptpos { text }? & 

  ## NOTE: How is this used?
  attribute thickness { text }?

## Content model for \elementref{XMTok}.
XMTok_model = text*


#======================================================================

XMApp =
## Generalized application of a function, operator, whatever (the first child)
## to arguments (the remaining children).
## The attributes are a subset of those for \elementref{XMTok}.
element XMApp { XMApp_attributes & XMApp_model }

## Attributes for \elementref{XMApp}.
XMApp_attributes = 
  Common.attributes & 
  XMath.attributes & 
  ID.attributes & 

  ## The name of the token, typically the control sequence that created it.
  attribute name { text }? &

  ## A more semantic name corresponding to the intended meaning,
  ## such as the OpenMath name.
  attribute meaning { text }? &

  ## An encoding of the position of this token as a sub/superscript, used
  ## to handle aligned and nested scripts, both pre and post.
  ## (See \elementref{XMTok} for details)
  attribute scriptpos { text }?

## Content model for \elementref{XMApp}.
XMApp_model = XMath.class

#======================================================================

XMDual =
## Parallel markup of content (first child) and presentation (second child)
## of a mathematical object.
## Typically, the arguments are shared between the two branches:
## they appear in the content branch, with \attr{id}'s,
## and \elementref{XMRef} is used in the presentation branch
element XMDual { XMDual_attributes &  XMDual_model }

## Attributes for \elementref{XMDual}.
XMDual_attributes = 
  Common.attributes & 
  XMath.attributes & 
  ID.attributes

## Content model for \elementref{XMDual}.
XMDual_model = XMath.class, XMath.class

#======================================================================

XMHint =
## Various spacing items, generally ignored in parsing.
## The attributes are a subset of those for \elementref{XMTok}.
element XMHint { XMHint_attributes &  XMHint_model }

## Attributes for \elementref{XMHint}.
XMHint_attributes = 
  Common.attributes & 
  XMath.attributes & 
  ID.attributes & 
  attribute name { text }? &
  attribute meaning { text }? &
  attribute style { text }?

## Content model for \elementref{XMHint}.
XMHint_model = empty

#======================================================================

XMText =
## Text appearing within math.
element XMText { XMText_attributes &  XMText_model }

## Attributes for \elementref{XMText}.
XMText_attributes = 
  Common.attributes & 
  XMath.attributes & 
  ID.attributes & 
  
  ## An encoding of the position of this token as a sub/superscript, used
  ## to handle aligned and nested scripts, both pre and post.
  ## (See \elementref{XMTok} for details)
  attribute scriptpos { text }?

## Content model for \elementref{XMText}.
XMText_model = text & Inline.class & Misc.class

#======================================================================

XMWrap =
## Wrapper for a sequence of tokens used to assert the role of the
## contents in its parent. This element generally disappears after parsing.
## The attributes are a subset of those for \elementref{XMTok}.
element XMWrap { XMWrap_attributes &  XMWrap_model }

## Attributes for \elementref{XMWrap}.
XMWrap_attributes = 
  Common.attributes & 
  XMath.attributes & 
  ID.attributes & 

  attribute name { text }? &

  ## A more semantic name corresponding to the intended meaning,
  ## such as the OpenMath name.
  attribute meaning { text }? &

  attribute style { text }? &

  ## An encoding of the position of this token as a sub/superscript, used
  ## to handle aligned and nested scripts, both pre and post.
  ## (See \elementref{XMTok} for details)
  attribute scriptpos { text }?


## Content model for \elementref{XMWrap}.
XMWrap_model = XMath.class

#======================================================================

XMArg =
## Wrapper for an argument to a structured macro.
## It implies that its content can be parsed independently of its parent,
## and thus generally disappears after parsing.
element XMArg { XMArg_attributes &  XMArg_model }

## Attributes for \elementref{XMArg}.
XMArg_attributes = 
  Common.attributes & 
  XMath.attributes & 
  ID.attributes & 
  attribute rule { text }? &

  ## An encoding of the position of this token as a sub/superscript, used
  ## to handle aligned and nested scripts, both pre and post.
  ## (See \elementref{XMTok} for details)
  attribute scriptpos { text }?

## Content model for \elementref{XMArg}.
XMArg_model = XMath.class

#======================================================================

XMRef =
## Structure sharing element typically used in the presentation
## branch of an \elementref{XMDual} to refer to the arguments present in the content branch.
element XMRef { XMRef_attributes &  XMRef_model }

## Attributes for \elementref{XMRef}.
XMRef_attributes = 
  Common.attributes & 
  XMath.attributes & 
  ID.attributes & 
  IDREF.attributes

## Content model for \elementref{XMRef}.
XMRef_model = empty

#======================================================================

XMArray =
## Math Array/Alignment structure.
# The attributes are a subset of those for \elementref{XMTok} or of \elementref{tabular}.
element XMArray { XMArray_attributes &  XMArray_model }

## Attributes for \elementref{XMArray}.
XMArray_attributes = 
  Common.attributes & 
  XMath.attributes & 
  ID.attributes & 
  attribute name { text }? &
  attribute meaning { text }? &
  attribute style { text }? &
  attribute vattach { "top" | "bottom" }? &
  attribute width { text }?

## Content model for \elementref{XMArray}.
XMArray_model = XMRow*

#======================================================================
XMRow =
## A row in a math alignment.
element XMRow { XMRow_attributes &  XMRow_model }

## Attributes for \elementref{XMRow}.
XMRow_attributes =  Common.attributes

## Content model for \elementref{XMRow}.
XMRow_model = XMCell*

#======================================================================

XMCell =
## A cell in a row of a math alignment.
element XMCell { XMCell_attributes &  XMCell_model }

## Attributes for \elementref{XMCell}.
XMCell_attributes = 
  Common.attributes & 

  ## indicates how many columns this cell spans or covers.
  attribute colspan { xsd:nonNegativeInteger }? &

  ## indicates how many rows this cell spans or covers.
  attribute rowpan { xsd:nonNegativeInteger }? &

# This would have been clearer, but messes up conversion to dtd
#  attribute align { "left" | "right" | "center" | "justify" | text }? &
  ##  specifies the alignment of the content.
  attribute align { text }? &

  ## specifies the desired width for the column.
  attribute width { text }? &

  ## records a sequence of t or tt, r or rr, b or bb and l or ll
  ## for borders or doubled borders on any side of the cell.
  attribute border { text }? &

  ## whether this cell corresponds to a table head or foot.
  attribute thead {xsd:boolean}?

## Content model for \elementref{XMCell}.
XMCell_model =   XMath.class
#======================================================================