plurimath 0.8.7 → 0.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/gen_docs.yml +28 -0
- data/Gemfile +1 -0
- data/README.adoc +464 -76
- data/Rakefile +63 -1
- data/lib/plurimath/formatter/numbers/fraction.rb +5 -3
- data/lib/plurimath/formatter/numeric_formatter.rb +3 -3
- data/lib/plurimath/number_formatter.rb +8 -0
- data/lib/plurimath/version.rb +1 -1
- data/supported_parens_list.adoc +121 -366
- data/supported_symbols_list.adoc +7174 -20191
- metadata +3 -3
- data/tasks/symbols_documentation_list.rake +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49c6f8268d1cc7dbaa215281ef92e0ce3e7884635976510d02058d6b95632ba2
|
4
|
+
data.tar.gz: 72830804f1dab626d5ec7da7c02071d8423965bf0381f2089708d8e94f126341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bc88e28991910932794cee1d883d15971fcf8bddf381bdf097eee7bed7263a13fb2431ca12fadb6b1dcc1e35634d5383fcb00f05a2a7b631979727b08009847
|
7
|
+
data.tar.gz: c22ca2f15f8ab7c86bc6992f06b54007d57be6d6d3262f8a2987b4a2b91f8b2172d9328f5900ed1410ce0d7a3a490dda075cda424a3f2595ff9ae8ebba8a0b14
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: gen_docs
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
tags: [ v* ]
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
generate_docs:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v4
|
14
|
+
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: '3.3'
|
18
|
+
bundler-cache: true
|
19
|
+
|
20
|
+
- name: Generate supported_parens_list.adoc
|
21
|
+
run: |
|
22
|
+
rm -f supported_parens_list.adoc
|
23
|
+
bundle exec rake supported_parens_list.adoc
|
24
|
+
|
25
|
+
- name: Generate supported_symbols_list.adoc
|
26
|
+
run: |
|
27
|
+
rm -f supported_symbols_list.adoc
|
28
|
+
bundle exec rake supported_symbols_list.adoc
|
data/Gemfile
CHANGED
data/README.adoc
CHANGED
@@ -1,123 +1,511 @@
|
|
1
1
|
= Plurimath
|
2
2
|
|
3
|
-
|
3
|
+
== Purpose
|
4
|
+
|
5
|
+
Plurimath provides a common data model for mathematical representation languages
|
6
|
+
and allows conversion between various math representation languages.
|
7
|
+
|
8
|
+
Plurimath aims to streamline the process of converting mathematical expressions
|
9
|
+
between different representation languages. This facilitates easier integration
|
10
|
+
across different systems and platforms, ensuring that mathematical content
|
11
|
+
remains consistent and accurate regardless of the format it is presented in.
|
12
|
+
|
13
|
+
Supported math representational languages:
|
14
|
+
|
15
|
+
* MathML
|
16
|
+
* AsciiMath
|
17
|
+
* UnicodeMath
|
18
|
+
* LaTeX math
|
19
|
+
* OMML
|
20
|
+
|
21
|
+
Supported units representation languages:
|
22
|
+
|
23
|
+
* UnitsML
|
24
|
+
|
25
|
+
|
26
|
+
== Benefits
|
27
|
+
|
28
|
+
Suitability:: Convert mathematical content to the required format for different
|
29
|
+
tools and platforms.
|
30
|
+
|
31
|
+
Correctness:: Ensure mathematical expressions are correctly formatted for print
|
32
|
+
and digital publications.
|
33
|
+
|
34
|
+
Interoperability:: Facilitate the integration of mathematical expressions across
|
35
|
+
various software systems and platforms.
|
36
|
+
|
37
|
+
Accessibility:: Convert mathematical content into formats that are more
|
38
|
+
accessible for screen readers and other assistive technologies.
|
4
39
|
|
5
|
-
1. **AsciiMath**
|
6
|
-
2. **MathML**
|
7
|
-
3. **Latex**
|
8
40
|
|
9
41
|
== Installation
|
10
42
|
|
11
43
|
Add this line to your application's Gemfile:
|
12
44
|
|
13
|
-
|
45
|
+
[source,ruby]
|
46
|
+
----
|
14
47
|
gem "plurimath"
|
15
|
-
|
48
|
+
----
|
49
|
+
|
16
50
|
And then execute:
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
51
|
+
|
52
|
+
[source,sh]
|
53
|
+
----
|
54
|
+
$ bundle install
|
55
|
+
----
|
56
|
+
|
57
|
+
Or install it yourself with:
|
58
|
+
|
59
|
+
[source,sh]
|
60
|
+
----
|
61
|
+
$ gem install plurimath
|
62
|
+
----
|
24
63
|
|
25
64
|
== Usage
|
26
65
|
|
27
|
-
|
66
|
+
The central data model in Plurimath is the `Plurimath::Formula` class, which
|
67
|
+
allows you to transform any math representation language into any other
|
68
|
+
representation language.
|
28
69
|
|
29
|
-
=== *Conversion Examples*
|
30
70
|
|
31
|
-
|
32
|
-
|
71
|
+
=== Conversion Examples
|
72
|
+
|
73
|
+
==== AsciiMath Formula Example
|
74
|
+
|
75
|
+
[source,ruby]
|
33
76
|
----
|
34
77
|
asciimath = "sin(1)"
|
35
78
|
formula = Plurimath::Math.parse(asciimath, :asciimath)
|
36
79
|
----
|
37
|
-
|
38
|
-
|
80
|
+
|
81
|
+
==== MathML Formula Example
|
82
|
+
|
83
|
+
[source,ruby]
|
39
84
|
----
|
40
85
|
mathml = <<~MATHML
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
formula = Plurimath::Math.parse(mathml,
|
49
|
-
----
|
50
|
-
|
51
|
-
|
86
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
87
|
+
<mstyle displaystyle='true'>
|
88
|
+
<mi>sin</mi>
|
89
|
+
<mn>1</mn>
|
90
|
+
</mstyle>
|
91
|
+
</math>
|
92
|
+
MATHML
|
93
|
+
formula = Plurimath::Math.parse(mathml, :mathml)
|
94
|
+
----
|
95
|
+
|
96
|
+
==== LaTeX Formula Example
|
97
|
+
|
98
|
+
[source,ruby]
|
52
99
|
----
|
53
100
|
latex = "\\sin{1}"
|
54
|
-
formula = Plurimath::Math.parse(latex,
|
101
|
+
formula = Plurimath::Math.parse(latex, :latex)
|
55
102
|
----
|
56
|
-
---
|
57
|
-
Since we have the object of **Plurimath::Formula**,We can generate **AsciiMath**, **MathMl** or **Latex** string from the formula object,All we have to do is call conversion function on formula object, see examples below.
|
58
103
|
|
59
|
-
|
60
|
-
|
104
|
+
==== UnicodeMath Formula Example
|
105
|
+
|
106
|
+
[source,ruby]
|
107
|
+
----
|
108
|
+
unicodemath = "sin(1)"
|
109
|
+
formula = Plurimath::Math.parse(unicodemath, :unicodemath)
|
110
|
+
----
|
111
|
+
|
112
|
+
==== OMML Formula Example
|
113
|
+
|
114
|
+
[source,ruby]
|
115
|
+
----
|
116
|
+
omml = <<~OMML
|
117
|
+
<m:oMathPara xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">
|
118
|
+
<m:oMath>
|
119
|
+
<m:f>
|
120
|
+
<m:fPr>
|
121
|
+
<m:ctrlPr />
|
122
|
+
</m:fPr>
|
123
|
+
<m:num>
|
124
|
+
<m:r>
|
125
|
+
<m:t>sin</m:t>
|
126
|
+
</m:r>
|
127
|
+
</m:num>
|
128
|
+
<m:den>
|
129
|
+
<m:r>
|
130
|
+
<m:t>1</m:t>
|
131
|
+
</m:r>
|
132
|
+
</m:den>
|
133
|
+
</m:f>
|
134
|
+
</m:oMath>
|
135
|
+
</m:oMathPara>
|
136
|
+
OMML
|
137
|
+
formula = Plurimath::Math.parse(omml, :omml)
|
138
|
+
----
|
139
|
+
|
140
|
+
=== Converting to Other Formats
|
141
|
+
|
142
|
+
Once you have a `Plurimath::Math::Formula` object, you can convert it to
|
143
|
+
AsciiMath, MathML, LaTeX, UnicodeMath, or OMML by calling the respective
|
144
|
+
conversion function on the `Formula` object.
|
145
|
+
|
146
|
+
==== AsciiMath Output Conversion
|
147
|
+
|
148
|
+
[source,ruby]
|
61
149
|
----
|
62
150
|
formula.to_asciimath
|
63
|
-
|
151
|
+
# => "sin(1)"
|
64
152
|
----
|
65
|
-
*Note:*
|
66
|
-
Asciimath doesn't support link:AsciiMath-Supported-Data.adoc#symbols-inherited-from-latex[*following symbols*] but Latex does.So from Latex to Asciimath conversion we are returning latex's supported symbols if it's not supported in Asciimath.
|
67
153
|
|
68
|
-
|
69
|
-
[
|
154
|
+
NOTE: AsciiMath doesn't support
|
155
|
+
link:AsciiMath-Supported-Data.adoc#symbols-inherited-from-latex[certain symbols]
|
156
|
+
that LaTeX does. During conversion from LaTeX to AsciiMath, if a symbol is not
|
157
|
+
supported in AsciiMath, the LaTeX symbol will be returned.
|
158
|
+
|
159
|
+
|
160
|
+
==== LaTeX Output Conversion
|
161
|
+
|
162
|
+
[source,ruby]
|
70
163
|
----
|
71
164
|
formula.to_latex
|
72
|
-
|
165
|
+
# => "\\sin1"
|
73
166
|
----
|
74
|
-
|
75
|
-
|
167
|
+
|
168
|
+
==== MathML Output Conversion
|
169
|
+
|
170
|
+
[source,ruby]
|
76
171
|
----
|
77
172
|
formula.to_mathml
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
173
|
+
# => "<math xmlns='http://www.w3.org/1998/Math/MathML'><mstyle displaystyle='true'><mi>sin</mi><mn>1</mn></mstyle></math>"
|
174
|
+
----
|
175
|
+
|
176
|
+
==== UnicodeMath Output Conversion
|
177
|
+
|
178
|
+
[source,ruby]
|
179
|
+
----
|
180
|
+
formula.to_unicodemath
|
181
|
+
# => "sin(1)"
|
182
|
+
----
|
183
|
+
|
184
|
+
==== OMML Output Conversion
|
185
|
+
|
186
|
+
[source,ruby]
|
187
|
+
----
|
188
|
+
formula.to_omml
|
189
|
+
# => "<m:oMathPara xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\"><m:oMath><m:f><m:fPr><m:ctrlPr /></m:fPr><m:num><m:r><m:t>sin</m:t></m:r></m:num><m:den><m:r><m:t>1</m:t></m:r></m:den></m:f></m:oMath></m:oMathPara>"
|
190
|
+
----
|
191
|
+
|
192
|
+
== Handling Complex Mathematical Expressions
|
193
|
+
|
194
|
+
Plurimath is capable of handling complex mathematical expressions with nested
|
195
|
+
functions and operators.
|
196
|
+
|
197
|
+
This feature is particularly useful for application that requires consistent and
|
198
|
+
accurate conversion of intricate mathematical content.
|
199
|
+
|
200
|
+
=== Example of a Complex Expression
|
201
|
+
|
202
|
+
Consider the following complex LaTeX expression:
|
203
|
+
|
204
|
+
[source,latex]
|
84
205
|
----
|
85
|
-
|
206
|
+
\frac{\sqrt{a^2 + b^2}}{\sin(\theta) + \cos(\theta)}
|
207
|
+
----
|
208
|
+
|
209
|
+
You can parse and convert this complex expression with Plurimath:
|
210
|
+
|
211
|
+
[source,ruby]
|
212
|
+
----
|
213
|
+
complex_latex = "\\frac{\\sqrt{a^2 + b^2}}{\\sin(\\theta) + \\cos(\\theta)}"
|
214
|
+
formula = Plurimath::Math.parse(complex_latex, :latex)
|
215
|
+
|
216
|
+
# Convert to AsciiMath
|
217
|
+
asciimath = formula.to_asciimath
|
218
|
+
# => "frac(sqrt(a^2 + b^2))(sin(theta) + cos(theta))"
|
219
|
+
|
220
|
+
# Convert to MathML
|
221
|
+
mathml = formula.to_mathml
|
222
|
+
# => "<math xmlns='http://www.w3.org/1998/Math/MathML'><mfrac><msqrt><mrow><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup></mrow></msqrt><mrow><mi>sin</mi><mo>(</mo><mi>θ</mi><mo>)</mo><mo>+</mo><mi>cos</mi><mo>(</mo><mi>θ</mi><mo>)</mo></mrow></mfrac></math>"
|
223
|
+
|
224
|
+
# Convert to UnicodeMath
|
225
|
+
unicodemath = formula.to_unicodemath
|
226
|
+
# => "frac(√(a^2 + b^2))(sin(θ) + cos(θ))"
|
227
|
+
|
228
|
+
# Convert to OMML
|
229
|
+
omml = formula.to_omml
|
230
|
+
# => "<omml representation of the expression>"
|
231
|
+
----
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
== Displaying the Math Parse Tree
|
237
|
+
|
238
|
+
Plurimath allows you to display the math parse tree both as `Formula` objects
|
239
|
+
and in the math language of expression.
|
240
|
+
|
241
|
+
=== Displaying as Formula Objects
|
242
|
+
|
243
|
+
You can display the parse tree as `Formula` objects to understand the structure
|
244
|
+
of the parsed mathematical expression.
|
245
|
+
|
246
|
+
[source,ruby]
|
247
|
+
----
|
248
|
+
formula = Plurimath::Math.parse("sin(1)", :asciimath)
|
249
|
+
formula.to_display(:asciimath)
|
250
|
+
# |_ Math zone
|
251
|
+
# |_ "sin(1)"
|
252
|
+
# |_ "sin" function apply
|
253
|
+
# |_ "1" argument
|
254
|
+
----
|
255
|
+
|
256
|
+
=== Displaying in the Math Language of Expression
|
257
|
+
|
258
|
+
You can also display the parse tree in the math language of expression to see
|
259
|
+
how the expression is represented in that language.
|
260
|
+
|
261
|
+
[source,ruby]
|
262
|
+
----
|
263
|
+
formula = Plurimath::Math.parse("sin(1)", :asciimath)
|
264
|
+
formula.to_display(:latex)
|
265
|
+
# |_ Math zone
|
266
|
+
# |_ "\\sin1"
|
267
|
+
# |_ "sin" function apply
|
268
|
+
# |_ "1" argument
|
269
|
+
----
|
270
|
+
|
271
|
+
// == Integration
|
272
|
+
|
273
|
+
// Integrate Plurimath into your project by requiring the gem and using its
|
274
|
+
// conversion capabilities as shown in the above examples. You can parse
|
275
|
+
// mathematical expressions from various formats and convert them as needed for
|
276
|
+
// your application's requirements.
|
86
277
|
|
87
|
-
**Plurimath** supports two XML engines.
|
88
278
|
|
89
|
-
|
90
|
-
|
279
|
+
== Working with UnitsML
|
280
|
+
|
281
|
+
=== General
|
282
|
+
|
283
|
+
Plurimath supports https://www.unitsml.org[UnitsML], a markup language used to
|
284
|
+
express units of measure in a way that can be understood by humans and machines.
|
285
|
+
This allows you to handle mathematical expressions involving units of measure
|
286
|
+
seamlessly.
|
287
|
+
|
288
|
+
UnitsML can be used with the following math representation languages:
|
289
|
+
|
290
|
+
* MathML
|
291
|
+
* AsciiMath
|
292
|
+
|
293
|
+
For detailed information on supported units and symbols in UnitsML, refer to the
|
294
|
+
link:UnitsML-Supported-Data.adoc[UnitsML Supported Data] documentation.
|
295
|
+
|
296
|
+
|
297
|
+
=== Parsing and Converting UnitsML Expressions
|
298
|
+
|
299
|
+
Plurimath can parse UnitsML expressions and convert them to other mathematical
|
300
|
+
representation languages. Here's an example of how to work with UnitsML in
|
301
|
+
Plurimath.
|
302
|
+
|
303
|
+
=== Example: Parsing and Converting UnitsML
|
304
|
+
|
305
|
+
Consider the following UnitsML expression in AsciiMath syntax:
|
306
|
+
|
307
|
+
[source,asciimath]
|
308
|
+
----
|
309
|
+
h = 6.62607015 xx 10^(-34) "unitsml(kg*m^2*s^(-1))"
|
310
|
+
----
|
311
|
+
|
312
|
+
==== Step-by-Step Customization
|
313
|
+
|
314
|
+
. **Parse the UnitsML Expression**
|
315
|
+
. **Customize and Convert to AsciiMath**
|
316
|
+
. **Customize and Convert to MathML**
|
317
|
+
. **Customize and Convert to UnicodeMath**
|
318
|
+
. **Customize and Convert to OMML**
|
319
|
+
|
320
|
+
==== Parse the UnitsML Expression
|
321
|
+
|
322
|
+
First, parse the UnitsML expression using Plurimath:
|
323
|
+
|
324
|
+
[source,ruby]
|
325
|
+
----
|
326
|
+
require 'plurimath'
|
327
|
+
|
328
|
+
asciimath_unitsml = 'h = 6.62607015 xx 10^(-34) "unitsml(kg*m^2*s^(-1))"'
|
329
|
+
formula = Plurimath::Math.parse(asciimath_unitsml, :asciimath)
|
330
|
+
----
|
331
|
+
|
332
|
+
==== Customize and Convert to AsciiMath
|
333
|
+
|
334
|
+
You can customize the output by modifying the resulting string after conversion:
|
335
|
+
|
336
|
+
[source,ruby]
|
337
|
+
----
|
338
|
+
asciimath = formula.to_asciimath
|
339
|
+
# Customization logic (if any)
|
340
|
+
puts asciimath
|
341
|
+
# Output: 'h = 6.62607015 xx 10^(-34) "unitsml(kg*m^2*s^(-1))"'
|
342
|
+
----
|
343
|
+
|
344
|
+
==== Customize and Convert to MathML
|
345
|
+
|
346
|
+
To customize the MathML output, you can use additional attributes and options:
|
347
|
+
|
348
|
+
[source,ruby]
|
349
|
+
----
|
350
|
+
mathml = formula.to_mathml
|
351
|
+
# Customization logic (if any)
|
352
|
+
puts mathml
|
353
|
+
# Output: "<math xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>h</mi><mo>=</mo><mn>6.62607015</mn><mo>×</mo><msup><mn>10</mn><mrow><mo>−</mo><mn>34</mn></mrow></msup><mtext>kg·m²·s⁻¹</mtext></mrow></math>"
|
354
|
+
----
|
355
|
+
|
356
|
+
==== Customize and Convert to UnicodeMath
|
357
|
+
|
358
|
+
Similarly, customize the UnicodeMath output:
|
359
|
+
|
360
|
+
[source,ruby]
|
361
|
+
----
|
362
|
+
unicodemath = formula.to_unicodemath
|
363
|
+
# Customization logic (if any)
|
364
|
+
puts unicodemath
|
365
|
+
# Output: 'h = 6.62607015 × 10^(−34) kg·m²·s⁻¹'
|
366
|
+
----
|
367
|
+
|
368
|
+
==== Customize and Convert to OMML
|
369
|
+
|
370
|
+
For OMML output, you can customize the XML structure:
|
371
|
+
|
372
|
+
[source,ruby]
|
373
|
+
----
|
374
|
+
omml = formula.to_omml
|
375
|
+
# Customization logic (if any)
|
376
|
+
puts omml
|
377
|
+
# Output: "<m:oMathPara xmlns:m='http://schemas.openxmlformats.org/officeDocument/2006/math'><m:oMath><m:r><m:t>h</m:t></m:r><m:r><m:t>=</m:t></m:r><m:r><m:t>6.62607015</m:t></m:r><m:r><m:t>×</m:t></m:r><m:sSup><m:sSupPr><m:ctrlPr /></m:sSupPr><m:e><m:r><m:t>10</m:t></m:r></m:e><m:sup><m:r><m:t>−34</m:t></m:r></m:sup></m:sSup><m:r><m:t>kg·m²·s⁻¹</m:t></m:r></m:oMath></m:oMathPara>"
|
378
|
+
----
|
379
|
+
|
380
|
+
=== Complete Example Code with Customization
|
381
|
+
|
382
|
+
Here's the complete code for parsing, converting, and customizing the UnitsML
|
383
|
+
expression between different formats:
|
384
|
+
|
385
|
+
[source,ruby]
|
386
|
+
----
|
387
|
+
require 'plurimath'
|
388
|
+
|
389
|
+
# Step 1: Parse the UnitsML Expression
|
390
|
+
asciimath_unitsml = 'h = 6.62607015 xx 10^(-34) "unitsml(kg*m^2*s^(-1))"'
|
391
|
+
formula = Plurimath::Math.parse(asciimath_unitsml, :asciimath)
|
392
|
+
|
393
|
+
# Step 2: Convert to AsciiMath
|
394
|
+
asciimath = formula.to_asciimath
|
395
|
+
# Customization logic for AsciiMath (if needed)
|
396
|
+
puts "AsciiMath: #{asciimath}"
|
397
|
+
# Output: 'h = 6.62607015 xx 10^(-34) "unitsml(kg*m^2*s^(-1))"'
|
398
|
+
|
399
|
+
# Step 3: Convert to MathML
|
400
|
+
mathml = formula.to_mathml
|
401
|
+
# Customization logic for MathML (if needed)
|
402
|
+
puts "MathML: #{mathml}"
|
403
|
+
# Output: "<math xmlns='http://www.w3.org/1998/Math/MathML'><mrow><mi>h</mi><mo>=</mo><mn>6.62607015</mn><mo>×</mo><msup><mn>10</mn><mrow><mo>−</mo><mn>34</mn></mrow></msup><mtext>kg·m²·s⁻¹</mtext></mrow></math>"
|
404
|
+
|
405
|
+
# Step 4: Convert to UnicodeMath
|
406
|
+
unicodemath = formula.to_unicodemath
|
407
|
+
# Customization logic for UnicodeMath (if needed)
|
408
|
+
puts "UnicodeMath: #{unicodemath}"
|
409
|
+
# Output: 'h = 6.62607015 × 10^(−34) kg·m²·s⁻¹'
|
410
|
+
|
411
|
+
# Step 5: Convert to OMML
|
412
|
+
omml = formula.to_omml
|
413
|
+
# Customization logic for OMML (if needed)
|
414
|
+
puts "OMML: #{omml}"
|
415
|
+
# Output: "<m:oMathPara xmlns:m='http://schemas.openxmlformats.org/officeDocument/2006/math'><m:oMath><m:r><m:t>h</m:t></m:r><m:r><m:t>=</m:t></m:r><m:r><m:t>6.62607015</m:t></m:r><m:r><m:t>×</m:t></m:r><m:sSup><m:sSupPr><m:ctrlPr /></m:sSupPr><m:e><m:r><m:t>10</m:t></m:r></m:e><m:sup><m:r><m:t>−34</m:t></m:r></m:sup></m:sSup><m:r><m:t>kg·m²·s⁻¹</m:t></m:r></m:oMath></m:oMathPara>"
|
416
|
+
----
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
== Compatibility
|
422
|
+
|
423
|
+
=== General
|
424
|
+
|
425
|
+
Not every math representation language supports expressing all symbols and
|
426
|
+
primitives supported by another. For example, the `backepsilon` symbol is
|
427
|
+
supported by LaTeX and UnicodeMath, but not AsciiMath.
|
428
|
+
|
429
|
+
Plurimath implements a "compatibility wrapper" syntax for each math
|
430
|
+
representation language to allow all symbols usable by Plurimath to be expressed
|
431
|
+
in a side-effect-free wrapper in those languages. For example, in AsciiMath, the
|
432
|
+
`"__{symbol-name}"` is side-effect-free because it is considered a single symbol
|
433
|
+
as a text string of `"__{symbol-name}"`. Plurimath can recognize it, but other
|
434
|
+
renderers or processors would treat it as a single symbol, which is accurate.
|
435
|
+
|
436
|
+
|
437
|
+
=== Example of Compatibility Wrapper
|
438
|
+
|
439
|
+
For a symbol like `backepsilon`.
|
440
|
+
|
441
|
+
In AsciiMath:
|
442
|
+
|
443
|
+
[source,ruby]
|
444
|
+
----
|
445
|
+
"__{backepsilon}"
|
446
|
+
----
|
447
|
+
|
448
|
+
In LaTeX:
|
449
|
+
|
450
|
+
[source,ruby]
|
451
|
+
----
|
452
|
+
"\\backepsilon"
|
453
|
+
----
|
454
|
+
|
455
|
+
In UnicodeMath:
|
456
|
+
|
457
|
+
[source,ruby]
|
458
|
+
----
|
459
|
+
"∍"
|
460
|
+
----
|
461
|
+
|
462
|
+
In MathML:
|
463
|
+
|
464
|
+
[source,xml]
|
465
|
+
----
|
466
|
+
<mi>∍</mi>
|
467
|
+
----
|
468
|
+
|
469
|
+
== XML Engines
|
470
|
+
|
471
|
+
**Plurimath** supports two XML engines:
|
472
|
+
|
473
|
+
. **Oga**: A pure Ruby XML parser
|
474
|
+
. **Ox**: A fast XML parser
|
475
|
+
|
476
|
+
By default, **Ox** is used.
|
477
|
+
|
478
|
+
To switch to **Oga**, use the following syntax:
|
479
|
+
|
480
|
+
[source,ruby]
|
481
|
+
----
|
482
|
+
require "plurimath/xml_engines/oga" = load files related to Oga
|
483
|
+
Plurimath.xml_engine = Plurimath::XmlEngine::Oga = set Oga as Plurimath XML engine
|
484
|
+
----
|
91
485
|
|
92
|
-
|
93
|
-
```[source, ruby]
|
94
|
-
require "plurimath/xml_engines/oga" # load files related to oga
|
486
|
+
You can switch back to **Ox** similarly.
|
95
487
|
|
96
|
-
|
97
|
-
```
|
98
|
-
Using the same syntax you can change from **Oga** to **Ox**.
|
488
|
+
=== Supported content
|
99
489
|
|
100
|
-
===
|
490
|
+
=== General
|
101
491
|
|
102
|
-
|
492
|
+
Consult the following tables for details on supported symbols and parentheses:
|
103
493
|
|
104
|
-
|
105
|
-
link:
|
106
|
-
--
|
494
|
+
* link:supported_symbols_list.adoc[Symbols]
|
495
|
+
* link:supported_parens_list.adoc[Parentheses]
|
107
496
|
|
108
|
-
|
109
|
-
|
110
|
-
--
|
497
|
+
NOTE: To regenerate these files, delete them and run:
|
498
|
+
`bundle exec rake supported_symbols_list.adoc`.
|
111
499
|
|
112
|
-
|
113
|
-
link:Latex-Supported-Data.adoc[Latex Supported Data, target="_blank"]
|
114
|
-
--
|
500
|
+
==== Supported Data Files
|
115
501
|
|
116
|
-
|
117
|
-
link:
|
118
|
-
|
502
|
+
* link:AsciiMath-Supported-Data.adoc[AsciiMath Supported Data]
|
503
|
+
* link:MathML-Supported-Data.adoc[MathML Supported Data]
|
504
|
+
* link:Latex-Supported-Data.adoc[LaTeX Supported Data]
|
505
|
+
* link:UnicodeMath-Supported-Data.adoc[UnicodeMath Supported Data]
|
506
|
+
* link:OMML-Supported-Data.adoc[OMML Supported Data]
|
507
|
+
* link:UnitsML-Supported-Data.adoc[UnitsML Supported Data]
|
119
508
|
|
509
|
+
== Copyright and license
|
120
510
|
|
121
|
-
|
122
|
-
link:UnitsML-Supported-Data.adoc[UnitsML Supported Data, target="_blank"]
|
123
|
-
--
|
511
|
+
Copyright Ribose. BSD 2-clause license.
|