mathematical 1.7.0-x86_64-linux-gnu
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 +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +284 -0
- data/Rakefile +128 -0
- data/ext/README.md +21 -0
- data/fonts/cmex10.ttf +0 -0
- data/fonts/cmmi10.ttf +0 -0
- data/fonts/cmr10.ttf +0 -0
- data/fonts/cmsy10.ttf +0 -0
- data/fonts/eufm10.ttf +0 -0
- data/fonts/fonts.conf +11 -0
- data/fonts/msam10.ttf +0 -0
- data/fonts/msbm10.ttf +0 -0
- data/lib/mathematical/3.0/mathematical.so +0 -0
- data/lib/mathematical/3.1/mathematical.so +0 -0
- data/lib/mathematical/3.2/mathematical.so +0 -0
- data/lib/mathematical/3.3/mathematical.so +0 -0
- data/lib/mathematical/3.4/mathematical.so +0 -0
- data/lib/mathematical/4.0/mathematical.so +0 -0
- data/lib/mathematical/configuration.rb +24 -0
- data/lib/mathematical/corrections.rb +17 -0
- data/lib/mathematical/validator.rb +41 -0
- data/lib/mathematical/version.rb +5 -0
- data/lib/mathematical.rb +135 -0
- data/mathematical.gemspec +34 -0
- metadata +159 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 42a02742484230dd0dbcf25103fe707d765adb6edb2c191344b387cc79ee833e
|
|
4
|
+
data.tar.gz: 14eb9ac009aba8008226b7ae050644c1fbd1e7aff2e37d2bd4a08f04bc6a56a9
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7a540559e24938d67faa00bd7416978c3fc9909b8b5fe018756d4fa9a8c4db59f071592213dfa21433dad8b4ebb3c822baf617b0fb381572a6c286afdd32e131
|
|
7
|
+
data.tar.gz: aef19bef5f1d25d1c0eb9df7682d45a32ded44d5f03a181b6a9196204636e59f8e411feec4366f9ea013bf373f21c3ee462e91d204ff13c567a54b6f2f74eb2d
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 Garen Torikian
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# Mathematical
|
|
2
|
+
|
|
3
|
+
Quickly convert math equations into beautiful SVGs (or PNGs/MathML).
|
|
4
|
+
|
|
5
|
+
[](https://travis-ci.org/gjtorikian/mathematical) [](http://badge.fury.io/rb/mathematical)
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## ⚠️ Maintenance Status ⚠️
|
|
10
|
+
|
|
11
|
+
SVG and especially PNG generation is currently unmaintained. This library should primarily be used for MathML generation.
|
|
12
|
+
|
|
13
|
+
Please reach out if you would like to mantain SVG and PNG portions of the library.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Precompiled native gems are available for Linux, macOS, and Windows. Add this line to your application's Gemfile:
|
|
18
|
+
|
|
19
|
+
gem 'mathematical'
|
|
20
|
+
|
|
21
|
+
And then execute:
|
|
22
|
+
|
|
23
|
+
$ bundle
|
|
24
|
+
|
|
25
|
+
Or install it yourself as:
|
|
26
|
+
|
|
27
|
+
$ gem install mathematical
|
|
28
|
+
|
|
29
|
+
### Platform-specific notes
|
|
30
|
+
|
|
31
|
+
**Linux** (x86_64 and ARM, glibc and musl): Fully self-contained — no additional dependencies needed.
|
|
32
|
+
|
|
33
|
+
**macOS**: Install runtime libraries via Homebrew:
|
|
34
|
+
|
|
35
|
+
$ brew install glib gdk-pixbuf cairo pango libxml2
|
|
36
|
+
|
|
37
|
+
**Windows**: Install runtime libraries via MSYS2 (UCRT64):
|
|
38
|
+
|
|
39
|
+
$ pacman -S mingw-w64-ucrt-x86_64-glib2 mingw-w64-ucrt-x86_64-cairo mingw-w64-ucrt-x86_64-pango mingw-w64-ucrt-x86_64-gdk-pixbuf2 mingw-w64-ucrt-x86_64-libxml2
|
|
40
|
+
|
|
41
|
+
### Building from source
|
|
42
|
+
|
|
43
|
+
If no precompiled gem is available for your platform, it will be compiled from source. You'll need cmake, pkg-config, bison, flex, and the development headers for glib, cairo, pango, gdk-pixbuf, and libxml2.
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
The simplest way to do this is
|
|
48
|
+
|
|
49
|
+
``` ruby
|
|
50
|
+
require 'mathematical'
|
|
51
|
+
|
|
52
|
+
Mathematical.new.render(string_with_math)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`string_with_math` should just be a string of TeX math. The default delimiters are `$..$` for inline and `$$..$$` for display. These can be changed by options--see below.
|
|
56
|
+
|
|
57
|
+
The output will be a hash, with keys that depend on the format you want:
|
|
58
|
+
|
|
59
|
+
* If you asked for an SVG, you'll get:
|
|
60
|
+
* `:width`: the width of the resulting image
|
|
61
|
+
* `:height`: the height of the resulting image
|
|
62
|
+
* `:data`: the actual string of SVG
|
|
63
|
+
* If you asked for a PNG, you'll get:
|
|
64
|
+
* `:width`: the width of the resulting image
|
|
65
|
+
* `:height`: the height of the resulting image
|
|
66
|
+
* `:data`: the PNG data
|
|
67
|
+
* If you asked for MathML, you'll get:
|
|
68
|
+
* `:data`: the MathML data
|
|
69
|
+
* If you pass in invalid TeX, you'll get:
|
|
70
|
+
* `:data`: the original invalid TeX
|
|
71
|
+
* `:exception`: the error class (with message)
|
|
72
|
+
|
|
73
|
+
**Note**: If you pass in invalid TeX, an error is not raised, but a message *is* printed to STDERR. It is the caller's responsibility to check for `:exception` and act on it.
|
|
74
|
+
|
|
75
|
+
`render` just converts a single equation. There are several other methods you can use:
|
|
76
|
+
|
|
77
|
+
* `filter`: Given a string with a mix of TeX math and non-math elements, this returns a single string containing just the converted math elements.
|
|
78
|
+
* `text_filter`: Given a string with a mix of TeX math and non-math elements, this converts all the math and leaves the rest of the string unmodified.
|
|
79
|
+
* `strict_filter`: Given a string with a mix of TeX math and non-math elements, this converts all the math and leaves the rest of the string unmodified. HTML tags are removed completely.
|
|
80
|
+
|
|
81
|
+
### Array of equations
|
|
82
|
+
|
|
83
|
+
Rather than just a string, you can also provide an array of math inputs:
|
|
84
|
+
|
|
85
|
+
``` ruby
|
|
86
|
+
inputs = []
|
|
87
|
+
inputs << '$\pi$'
|
|
88
|
+
inputs << '$not__thisisnotreal$'
|
|
89
|
+
inputs << '$\alpha$'
|
|
90
|
+
|
|
91
|
+
Mathematical.new.render(inputs)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This returns an array of hashes, rendering the indices. For example, for the above, you will receive the following output:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
[ {:data => "...", :width => ... }, { :data => '$not__thisisnotreal$', :exception => "...", {:data => "...", :width => ... }]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
That is, while the first and last elements are valid TeX math, the middle one is not, so the same string is returned. As with single strings, the error message is printed to STDERR, but not raised.
|
|
101
|
+
|
|
102
|
+
### Options
|
|
103
|
+
|
|
104
|
+
`Mathematical.new` takes an optional hash to define a few options:
|
|
105
|
+
|
|
106
|
+
| Name | Description | Default
|
|
107
|
+
|------|-------------|--------
|
|
108
|
+
| `:ppi` | A double determining the pixels per inch of the resulting SVG | `72.0`
|
|
109
|
+
| `:zoom` | A double determining the zoom level of the resulting SVG | `1.0`
|
|
110
|
+
| `:base64` | A boolean determining whether Mathematical's output should be a base64-encoded SVG string | `false`
|
|
111
|
+
| `:maxsize` | A numeral indicating the `MAXSIZE` the output string can be. | `unsigned long`
|
|
112
|
+
| `:format` | A symbol indicating whether you want an `:svg`, `:png`, or `:mathml` output. | `:svg`
|
|
113
|
+
| `:delimiter` | A symbol indicating whether you want an `:DOLLAR` for inline (`$..$`), `:DOUBLE` for display (`$$..$$`), `:PARENS` for inline (`\(..\)`), `:BRACKETS` for display (`[..\]`), or `:ENVIRONMENTS` for parsing bare `\\begin..\\end` environments. You can also pass in an array of symbols to have multiple delimiters considered. | `[:DOLLAR, :DOUBLE]`
|
|
114
|
+
|
|
115
|
+
Pass these in like this:
|
|
116
|
+
|
|
117
|
+
``` ruby
|
|
118
|
+
options = { :ppi => 200.0, :zoom => 5.0, :base64 => true }
|
|
119
|
+
renderer = Mathematical.new(options)
|
|
120
|
+
renderer.render('$a \ne b$')
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Supported commands and symbols
|
|
124
|
+
|
|
125
|
+
Check out [SUPPORTED.md on the mtex2MML website](https://github.com/gjtorikian/mtex2MML/blob/master/SUPPORTED.md).
|
|
126
|
+
|
|
127
|
+
**Note**: This library makes a few assumptions about the strings that you pass in. It assumes that `$..$` is inline math and `$$..$$` is display math.
|
|
128
|
+
|
|
129
|
+
## Building from source
|
|
130
|
+
|
|
131
|
+
To build from source, install the development dependencies for your platform:
|
|
132
|
+
|
|
133
|
+
**Linux (Debian/Ubuntu):**
|
|
134
|
+
|
|
135
|
+
$ sudo apt-get install cmake bison flex pkg-config libglib2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev libxml2-dev
|
|
136
|
+
|
|
137
|
+
**macOS:**
|
|
138
|
+
|
|
139
|
+
$ brew install glib gdk-pixbuf cairo pango cmake pkg-config
|
|
140
|
+
|
|
141
|
+
Then:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
bundle exec rake compile
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Fonts and special notices for Mac OS X
|
|
148
|
+
|
|
149
|
+
Install the fonts with:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
cd ~/Library/Fonts
|
|
153
|
+
curl -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmex10.ttf \
|
|
154
|
+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmmi10.ttf \
|
|
155
|
+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmr10.ttf \
|
|
156
|
+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmsy10.ttf \
|
|
157
|
+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/esint10.ttf \
|
|
158
|
+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/eufm10.ttf \
|
|
159
|
+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/msam10.ttf \
|
|
160
|
+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/msbm10.ttf
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Troubleshooting
|
|
164
|
+
|
|
165
|
+
### Issues building Lasem
|
|
166
|
+
|
|
167
|
+
If you're having issues building Lasem, or have Lasem already preinstalled, you should set the `MATHEMATICAL_USE_SYSTEM_LASEM` environment variable to skip the build:
|
|
168
|
+
|
|
169
|
+
* If you use bundler:
|
|
170
|
+
|
|
171
|
+
MATHEMATICAL_USE_SYSTEM_LASEM=1 bundle install
|
|
172
|
+
|
|
173
|
+
* If you use gem install:
|
|
174
|
+
|
|
175
|
+
MATHEMATICAL_USE_SYSTEM_LASEM=1 gem install mathematical
|
|
176
|
+
|
|
177
|
+
### Issues building mtex2mml
|
|
178
|
+
|
|
179
|
+
If you're having issues building mtex2mml, or have mtex2mml already preinstalled, you should set the `MATHEMATICAL_USE_SYSTEM_MTEX2MML` environment variable to skip the build:
|
|
180
|
+
|
|
181
|
+
* If you use bundler:
|
|
182
|
+
|
|
183
|
+
MATHEMATICAL_USE_SYSTEM_MTEX2MML=1 bundle install
|
|
184
|
+
|
|
185
|
+
* If you use gem install:
|
|
186
|
+
|
|
187
|
+
MATHEMATICAL_USE_SYSTEM_MTEX2MML=1 gem install mathematical
|
|
188
|
+
|
|
189
|
+
## Benchmark
|
|
190
|
+
|
|
191
|
+
Run benchmarks with `bundle exec rake benchmark`:
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
Benchmarking....
|
|
195
|
+
Count: 3868 equations
|
|
196
|
+
Iterations: 1
|
|
197
|
+
user system total real
|
|
198
|
+
Rendering... 3.280000 0.070000 3.350000 ( 4.324458)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## History
|
|
202
|
+
|
|
203
|
+
There are a smattering of libraries written in various languages to convert math
|
|
204
|
+
into a variety of formats. But there needs to be a sane way to show math
|
|
205
|
+
equations in the browser. With browser support for MathML under attack, it's
|
|
206
|
+
unfortunately not a sustainable solution. A PNG or SVG representation of the
|
|
207
|
+
equation is the safest way to go.
|
|
208
|
+
|
|
209
|
+
Most advice suggests using [MathJax](http://www.mathjax.org/). While extremely popular
|
|
210
|
+
I dislike the "stuttering" effect caused by pages loading math. JavaScript
|
|
211
|
+
shouldn't be used in situations where server-rendering is a possibility, in my opinion.
|
|
212
|
+
|
|
213
|
+
To that end, I obsessed over the problem of server-side math rendering for over a
|
|
214
|
+
week. Here was my journey:
|
|
215
|
+
|
|
216
|
+
* I started out with [`blahtexml`](https://github.com/gvanas/blahtexml), which takes
|
|
217
|
+
TeX equations and converts them to PNG. This wasn't a bad idea, but it took too long;
|
|
218
|
+
for twelve equations, it took eight seconds. It was slow because it shelled out
|
|
219
|
+
to [`LaTeX`](http://www.latex-project.org/), *then* [`dvipng`](http://www.nongnu.org/dvipng/).
|
|
220
|
+
|
|
221
|
+
In fact, as I discovered, most projects on the 'Net shell out to `LaTeX`, then
|
|
222
|
+
something else, which makes performance absolutely horrid. I had to find something
|
|
223
|
+
better, with preferably no dependency on `LaTeX`.
|
|
224
|
+
|
|
225
|
+
* [`mimetex`](http://www.forkosh.com/mimetex.html) was my next attempt. It looked
|
|
226
|
+
great: a pure C implementation that turned TeX equations into a rasterized representation,
|
|
227
|
+
and then into a PNG. The speed was there, but the output image was pretty jagged.
|
|
228
|
+
I tweaked the program to output BMPs, and tried to sharpen those with [`potrace`](http://potrace.sourceforge.net/),
|
|
229
|
+
but the results were less then pleasant. The "update" to `mimetex` is [`mathtex`](http://www.forkosh.com/mathtex.html),
|
|
230
|
+
but it, too, depends on `LaTeX` and `dvipng` binaries to produce images.
|
|
231
|
+
|
|
232
|
+
* [`pmml2svg`](http://pmml2svg.sourceforge.net/) had potential. It's a set of
|
|
233
|
+
XSLT stylesheets to convert MathML to SVG. Unfortunately, it relies on XSLT 2.0,
|
|
234
|
+
of which there are no Ruby bindings (at the time of this writing, April '14). It
|
|
235
|
+
had to rely on [Saxon](http://saxon.sourceforge.net/) and Java.
|
|
236
|
+
|
|
237
|
+
* [`tth`](http://hutchinson.belmont.ma.us/tth/) converts TeX to HTML, but the
|
|
238
|
+
output is aesthetically unpleasing, so I passed.
|
|
239
|
+
|
|
240
|
+
* Wikipedia uses [`texvc`](https://github.com/dlitz/texvc), which is written in OCaml,
|
|
241
|
+
a language I am utterly unfamiliar with. In any event, I could not get the code
|
|
242
|
+
to compile on my machine.
|
|
243
|
+
|
|
244
|
+
* It took me forever to finally compile [`gtkmathview`](https://github.com/khaledhosny/gtkmathview),
|
|
245
|
+
and when it did, I got a bunch of SVG images with screwed up fonts.
|
|
246
|
+
|
|
247
|
+
* [`dvisvgm`](http://dvisvgm.sourceforge.net/) worked well, but still depended
|
|
248
|
+
on two external binaries (`LaTeX` to convert the text to dvi, and `dvisvgm` to turn
|
|
249
|
+
it into SVG)
|
|
250
|
+
|
|
251
|
+
* At one point, I began to try and convert the MathJax code to Ruby to figure out
|
|
252
|
+
how it accomplished its `toSVG` methods. The MathJax codebase, while written by
|
|
253
|
+
geniuses, is incomprehensible, due in part to JavaScript's inability
|
|
254
|
+
to possess a coherent structure.
|
|
255
|
+
|
|
256
|
+
* Near the end of my wits, I mimicked the behavior of [`mathrender2`](https://github.com/quipper/mathrender2),
|
|
257
|
+
which uses [PhantomJS](http://phantomjs.org/) to embed MathJax onto a fake
|
|
258
|
+
HTML page. This produced exactly what I needed: a bunch of accurate SVG files with
|
|
259
|
+
no intermediate binaries. It was, unfortunately, a bit slow: for an arbitrary
|
|
260
|
+
composition of 880 equations, it took about eight seconds to complete. Could I
|
|
261
|
+
do better?
|
|
262
|
+
|
|
263
|
+
* I came across [Lasem](https://github.com/LasemProject/lasem),
|
|
264
|
+
which met every need. It has no external binary dependencies (only library packages),
|
|
265
|
+
can convert directly to SVG, and it's fast. The same arbitrary 880 equations were
|
|
266
|
+
rendered in moments.
|
|
267
|
+
|
|
268
|
+
And thus a wrapper was born.
|
|
269
|
+
|
|
270
|
+
## More math stuff
|
|
271
|
+
|
|
272
|
+
Check out [math-to-itex](https://github.com/gjtorikian/math-to-itex/), which quickly
|
|
273
|
+
parses out TeX notation from strings.
|
|
274
|
+
|
|
275
|
+
With it, you could do something fun like:
|
|
276
|
+
|
|
277
|
+
``` ruby
|
|
278
|
+
MathToItex(string).convert do |eq, type|
|
|
279
|
+
svg_content = Mathematical.new(:base64 => true).render(eq)
|
|
280
|
+
|
|
281
|
+
# create image tags of math with base64-encoded SVGs
|
|
282
|
+
%|<img class="#{type.to_s}-math" data-math-type="#{type.to_s}-math" src="#{svg_content}"/>|
|
|
283
|
+
end
|
|
284
|
+
```
|
data/Rakefile
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "bundler/gem_tasks"
|
|
5
|
+
require "rake/testtask"
|
|
6
|
+
require "fileutils"
|
|
7
|
+
require "tmpdir"
|
|
8
|
+
|
|
9
|
+
Rake::TestTask.new do |t|
|
|
10
|
+
t.libs << "test"
|
|
11
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
|
12
|
+
t.verbose = true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# ─── Extension compilation ─────────────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
require "rake/extensiontask"
|
|
18
|
+
|
|
19
|
+
CROSS_PLATFORMS = [
|
|
20
|
+
"x86_64-linux-gnu",
|
|
21
|
+
"x86_64-linux-musl",
|
|
22
|
+
"aarch64-linux-gnu",
|
|
23
|
+
"aarch64-linux-musl",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
NATIVE_PLATFORMS = [
|
|
27
|
+
"arm64-darwin",
|
|
28
|
+
"x86_64-darwin",
|
|
29
|
+
"x64-mingw-ucrt",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
ALL_PLATFORMS = CROSS_PLATFORMS + NATIVE_PLATFORMS
|
|
33
|
+
|
|
34
|
+
# Ruby versions to target for precompiled gems
|
|
35
|
+
CROSS_RUBIES = ["3.1.0", "3.2.0", "3.3.0", "3.4.0", "4.0.0"]
|
|
36
|
+
|
|
37
|
+
spec = Gem::Specification.load("mathematical.gemspec")
|
|
38
|
+
|
|
39
|
+
Rake::ExtensionTask.new("mathematical", spec) do |ext|
|
|
40
|
+
ext.lib_dir = File.join("lib", "mathematical")
|
|
41
|
+
ext.cross_compile = true
|
|
42
|
+
ext.cross_platform = CROSS_PLATFORMS
|
|
43
|
+
ext.cross_config_options << "--enable-cross-build"
|
|
44
|
+
|
|
45
|
+
ext.cross_compiling do |cross_spec|
|
|
46
|
+
# Native gems don't need source files — the compiled .so is included
|
|
47
|
+
cross_spec.files.reject! { |path| File.fnmatch?("ext/**/*", path) }
|
|
48
|
+
# Include font files in native gems
|
|
49
|
+
cross_spec.files += Dir.glob("fonts/**/*")
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Set RUBY_CC_VERSION for cross-compilation
|
|
54
|
+
begin
|
|
55
|
+
require "rake_compiler_dock"
|
|
56
|
+
ENV["RUBY_CC_VERSION"] = RakeCompilerDock.ruby_cc_version("3.1", "3.2", "3.3", "3.4", "4.0")
|
|
57
|
+
rescue LoadError
|
|
58
|
+
ENV["RUBY_CC_VERSION"] = CROSS_RUBIES.join(":")
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# ─── Cross-compiled gem tasks (Linux via rake-compiler-dock) ───────────────────
|
|
62
|
+
|
|
63
|
+
namespace "gem" do
|
|
64
|
+
CROSS_PLATFORMS.each do |platform|
|
|
65
|
+
desc "Build native gem for #{platform}"
|
|
66
|
+
task platform do
|
|
67
|
+
require "rake_compiler_dock"
|
|
68
|
+
|
|
69
|
+
# Both GNU and musl RCD containers are Debian-based (musl uses a cross-compiler,
|
|
70
|
+
# NOT Alpine). Install deps with apt-get, running as root inside the container.
|
|
71
|
+
RakeCompilerDock.sh(<<~SCRIPT, platform: platform, verbose: true)
|
|
72
|
+
set -e
|
|
73
|
+
sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends \
|
|
74
|
+
cmake bison flex pkg-config ninja-build python3 python3-pip
|
|
75
|
+
# RCD containers (Ubuntu 20.04) ship old CMake 3.16 and Meson 0.53;
|
|
76
|
+
# libxml2 2.12+ needs CMake 3.18+ and glib 2.80+ needs Meson 1.2+
|
|
77
|
+
pip3 install --upgrade cmake meson packaging
|
|
78
|
+
export PATH="$(python3 -m site --user-base)/bin:$PATH"
|
|
79
|
+
# Build static deps from source (Debian lacks .a files for meson-built libs)
|
|
80
|
+
script/build_static_deps
|
|
81
|
+
# RCD containers use rbenv; override .ruby-version which may not match
|
|
82
|
+
export RBENV_VERSION="$(rbenv versions --bare | tail -1)"
|
|
83
|
+
gem install bundler --no-document
|
|
84
|
+
bundle install
|
|
85
|
+
bundle exec rake native:#{platform} gem MAKE="nice make -j$(nproc)"
|
|
86
|
+
SCRIPT
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
desc "Build native gems for all Linux platforms"
|
|
91
|
+
multitask linux: CROSS_PLATFORMS
|
|
92
|
+
|
|
93
|
+
desc "Build the source (platform=ruby) gem"
|
|
94
|
+
task :source do
|
|
95
|
+
sh "gem build mathematical.gemspec"
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# ─── Default tasks ─────────────────────────────────────────────────────────────
|
|
100
|
+
|
|
101
|
+
task default: [:test]
|
|
102
|
+
|
|
103
|
+
Gem::PackageTask.new(spec)
|
|
104
|
+
|
|
105
|
+
Rake::Task[:test].prerequisites
|
|
106
|
+
|
|
107
|
+
task build: [:clean]
|
|
108
|
+
|
|
109
|
+
require "rubocop/rake_task"
|
|
110
|
+
|
|
111
|
+
RuboCop::RakeTask.new
|
|
112
|
+
|
|
113
|
+
desc "Pretty format C code"
|
|
114
|
+
task :format do
|
|
115
|
+
puts %x(astyle --indent=spaces=2 --style=1tbs --keep-one-line-blocks \
|
|
116
|
+
$(ack -n -f --type=cpp --type=cc ext/mathematical/))
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
desc "Run a benchmark"
|
|
120
|
+
task :benchmark do
|
|
121
|
+
$LOAD_PATH.unshift("lib")
|
|
122
|
+
load "script/benchmark.rb"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
GEMSPEC = Bundler.load_gemspec("mathematical.gemspec")
|
|
126
|
+
gem_path = Gem::PackageTask.new(GEMSPEC).define
|
|
127
|
+
desc "Package the ruby gem"
|
|
128
|
+
task "package" => [gem_path]
|
data/ext/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Lasem aims to be a C/Gobject based SVG/Mathml renderer and editor, supporting CSS
|
|
2
|
+
style sheets (only rendering is implemented for now). It uses cairo and pango as
|
|
3
|
+
it's rendering abstraction layer, and then support numerous output formats: xlib,
|
|
4
|
+
PNG, SVG, PDF, PS, EPS... It's written by Emmanuel Pacaud.
|
|
5
|
+
|
|
6
|
+
Lasem was added as a Git submodule of this project.
|
|
7
|
+
|
|
8
|
+
Some documentation can be found here:
|
|
9
|
+
|
|
10
|
+
* http://blogs.gnome.org/emmanuel/category/lasem/
|
|
11
|
+
* https://git.gnome.org/browse/lasem/
|
|
12
|
+
|
|
13
|
+
### Notes on building for OS X
|
|
14
|
+
|
|
15
|
+
* In *autogen.sh*, rename `libtoolize` to `glibtoolize`
|
|
16
|
+
* Debug with `-d dom,measure,update,render,viewport`
|
|
17
|
+
|
|
18
|
+
* * *
|
|
19
|
+
|
|
20
|
+
mtex2MML transforms itex (a dialect of LaTeX) into MathML. mtex2MML is developed by
|
|
21
|
+
me, but was forked from an original project by Paul Gartside and Jacques Distler.
|
data/fonts/cmex10.ttf
ADDED
|
Binary file
|
data/fonts/cmmi10.ttf
ADDED
|
Binary file
|
data/fonts/cmr10.ttf
ADDED
|
Binary file
|
data/fonts/cmsy10.ttf
ADDED
|
Binary file
|
data/fonts/eufm10.ttf
ADDED
|
Binary file
|
data/fonts/fonts.conf
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
|
|
3
|
+
<!--
|
|
4
|
+
Fontconfig configuration for bundled Computer Modern fonts.
|
|
5
|
+
This file is loaded via FONTCONFIG_PATH at runtime so that
|
|
6
|
+
lasem can find the math fonts for SVG/PNG rendering.
|
|
7
|
+
-->
|
|
8
|
+
<fontconfig>
|
|
9
|
+
<dir prefix="relative">.</dir>
|
|
10
|
+
<cachedir prefix="xdg">fontconfig</cachedir>
|
|
11
|
+
</fontconfig>
|
data/fonts/msam10.ttf
ADDED
|
Binary file
|
data/fonts/msbm10.ttf
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ruby-enum"
|
|
4
|
+
|
|
5
|
+
class Configuration
|
|
6
|
+
class Delimiters
|
|
7
|
+
include Ruby::Enum
|
|
8
|
+
|
|
9
|
+
define :DEFAULT, 0
|
|
10
|
+
define :DOLLAR, 1
|
|
11
|
+
define :DOUBLE, 2
|
|
12
|
+
define :PARENS, 4
|
|
13
|
+
define :BRACKETS, 8
|
|
14
|
+
define :ENVIRONMENTS, 16
|
|
15
|
+
|
|
16
|
+
class << self
|
|
17
|
+
def option_exists?(option)
|
|
18
|
+
unless Delimiters.key?(option)
|
|
19
|
+
raise(TypeError, "delimiter type does not exist: #{option}")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Mathematical
|
|
4
|
+
module Corrections
|
|
5
|
+
def apply_corrections(maths)
|
|
6
|
+
adjust_lt_gt(maths)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# from the itex website: http://bit.ly/1Et74ed
|
|
10
|
+
# It is possible (though probably not recommended) to insert MathML markup
|
|
11
|
+
# inside itex equations. So "<" and ">" are significant.
|
|
12
|
+
# To obtain a less-than or greater-than sign, you should use \lt or \gt, respectively.
|
|
13
|
+
def adjust_lt_gt(maths)
|
|
14
|
+
maths.gsub("<", '\lt').gsub(">", '\gt')
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Mathematical
|
|
4
|
+
module Validator
|
|
5
|
+
FORMAT_TYPES = [:svg, :png, :mathml].freeze
|
|
6
|
+
RENDER_TYPES = [:parse, :filter, :text_filter, :strict_filter].freeze
|
|
7
|
+
|
|
8
|
+
def validate_config(config)
|
|
9
|
+
raise(TypeError, "maxsize must be an integer!") unless config[:maxsize].is_a?(Integer)
|
|
10
|
+
raise(TypeError, "maxsize cannot be less than 0!") if config[:maxsize] < 0
|
|
11
|
+
raise(TypeError, "format must be a symbol!") unless config[:format].is_a?(Symbol)
|
|
12
|
+
raise(TypeError, "format type must be one of the following formats: #{FORMAT_TYPES.join(", ")}") unless FORMAT_TYPES.include?(config[:format])
|
|
13
|
+
|
|
14
|
+
if config[:delimiter].is_a?(Symbol)
|
|
15
|
+
Configuration::Delimiters.option_exists?(config[:delimiter])
|
|
16
|
+
elsif config[:delimiter].is_a?(Array)
|
|
17
|
+
config[:delimiter] = [nil] if config[:delimiter].empty?
|
|
18
|
+
|
|
19
|
+
config[:delimiter].each do |delim|
|
|
20
|
+
Configuration::Delimiters.option_exists?(delim)
|
|
21
|
+
end
|
|
22
|
+
else
|
|
23
|
+
raise(TypeError, "delimiter type must be a valid symbol or array of symbols")
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def validate_content(maths)
|
|
28
|
+
if maths.is_a?(Array)
|
|
29
|
+
maths.map { |m| validate_string(m) }
|
|
30
|
+
else
|
|
31
|
+
validate_string(maths)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def validate_string(maths)
|
|
36
|
+
raise(ArgumentError, "input must be string!") unless maths.is_a?(String)
|
|
37
|
+
|
|
38
|
+
maths.strip
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
data/lib/mathematical.rb
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Load the precompiled native extension (version-specific) or fall back
|
|
4
|
+
# to the source-compiled extension.
|
|
5
|
+
begin
|
|
6
|
+
RUBY_VERSION =~ /(\d+\.\d+)/
|
|
7
|
+
require "mathematical/#{Regexp.last_match(1)}/mathematical"
|
|
8
|
+
rescue LoadError
|
|
9
|
+
require "mathematical/mathematical"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
require "mathematical/configuration"
|
|
13
|
+
require "mathematical/corrections"
|
|
14
|
+
require "mathematical/validator"
|
|
15
|
+
require "mathematical/version"
|
|
16
|
+
|
|
17
|
+
require "base64"
|
|
18
|
+
|
|
19
|
+
class Mathematical
|
|
20
|
+
# Set up bundled fonts for fontconfig (used by lasem for SVG/PNG rendering).
|
|
21
|
+
# This allows SVG/PNG rendering without system font installation.
|
|
22
|
+
FONT_DIR = File.expand_path("../../fonts", __dir__)
|
|
23
|
+
if File.directory?(FONT_DIR)
|
|
24
|
+
existing = ENV.fetch("FONTCONFIG_PATH", "")
|
|
25
|
+
ENV["FONTCONFIG_PATH"] = existing.empty? ? FONT_DIR : "#{FONT_DIR}:#{existing}"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
include Corrections
|
|
29
|
+
include Validator
|
|
30
|
+
|
|
31
|
+
DEFAULT_OPTS = {
|
|
32
|
+
ppi: 72.0,
|
|
33
|
+
zoom: 1.0,
|
|
34
|
+
base64: false,
|
|
35
|
+
maxsize: 0,
|
|
36
|
+
format: :svg,
|
|
37
|
+
delimiter: [:DOLLAR, :DOUBLE],
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
|
41
|
+
|
|
42
|
+
MATH_MATCH = %r{<math xmlns.+?</math>}m
|
|
43
|
+
|
|
44
|
+
def initialize(options = {})
|
|
45
|
+
@config = DEFAULT_OPTS.merge(options)
|
|
46
|
+
|
|
47
|
+
validate_config(@config)
|
|
48
|
+
|
|
49
|
+
@config[:formatInt] = FORMAT_TYPES.index(@config[:format])
|
|
50
|
+
|
|
51
|
+
@config[:delimiter] = if @config[:delimiter].is_a?(Symbol)
|
|
52
|
+
Configuration::Delimiters.to_h[@config[:delimiter]]
|
|
53
|
+
else
|
|
54
|
+
@config[:delimiter].map do |delim|
|
|
55
|
+
Configuration::Delimiters.to_h[delim]
|
|
56
|
+
end.inject(0, :|)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
@processer = Mathematical::Process.new(@config)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def parse(maths)
|
|
63
|
+
maths = validate_content(maths)
|
|
64
|
+
result_data = @processer.process(maths, RENDER_TYPES.find_index(:parse))
|
|
65
|
+
result(result_data)
|
|
66
|
+
end
|
|
67
|
+
# TODO: deprecate this?
|
|
68
|
+
alias_method :render, :parse
|
|
69
|
+
|
|
70
|
+
def filter(maths)
|
|
71
|
+
maths = validate_content(maths)
|
|
72
|
+
result_data = @processer.process(maths, RENDER_TYPES.find_index(:filter))
|
|
73
|
+
result(result_data)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def text_filter(maths)
|
|
77
|
+
maths = validate_content(maths)
|
|
78
|
+
widths = []
|
|
79
|
+
heights = []
|
|
80
|
+
result_data = @processer.process(maths, RENDER_TYPES.find_index(:text_filter))
|
|
81
|
+
# TODO: can/should be optimized to not do two calls here, but I am thinking
|
|
82
|
+
# about moving to Rust and don't have time to write safe C...
|
|
83
|
+
if result_data[:data] && @config[:format] != :mathml
|
|
84
|
+
result_data[:data].gsub!(MATH_MATCH) do |_match|
|
|
85
|
+
result = @processer.process(maths, RENDER_TYPES.find_index(:parse))
|
|
86
|
+
widths << result[:width]
|
|
87
|
+
heights << result[:height]
|
|
88
|
+
result[:data]
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
result_data[:width] = widths
|
|
92
|
+
result_data[:height] = heights
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
result(result_data)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def strict_filter(maths)
|
|
99
|
+
maths = validate_content(maths)
|
|
100
|
+
result_data = @processer.process(maths, RENDER_TYPES.find_index(:strict_filter))
|
|
101
|
+
result(result_data)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def result(result_data)
|
|
105
|
+
raise(RuntimeError) if !result_data.is_a?(Hash) && !result_data.is_a?(Array)
|
|
106
|
+
|
|
107
|
+
if result_data.is_a?(Array)
|
|
108
|
+
result_data.map { |d| format_data(d) }
|
|
109
|
+
else
|
|
110
|
+
format_data(result_data)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
private
|
|
115
|
+
|
|
116
|
+
def format_data(result_hash)
|
|
117
|
+
# we passed in an array of math, and found an unprocessable element
|
|
118
|
+
return result_hash if result_hash[:exception]
|
|
119
|
+
|
|
120
|
+
case @config[:format]
|
|
121
|
+
when :svg
|
|
122
|
+
# remove starting <?xml...> tag
|
|
123
|
+
result_hash[:data] = result_hash[:data].gsub(XML_HEADER, "")
|
|
124
|
+
result_hash[:data] = svg_to_base64(result_hash[:data]) if @config[:base64]
|
|
125
|
+
|
|
126
|
+
result_hash
|
|
127
|
+
when :png, :mathml # do nothing with these...for now?
|
|
128
|
+
result_hash
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def svg_to_base64(contents)
|
|
133
|
+
"data:image/svg+xml;base64,#{Base64.strict_encode64(contents)}"
|
|
134
|
+
end
|
|
135
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
5
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
6
|
+
require "mathematical/version"
|
|
7
|
+
|
|
8
|
+
Gem::Specification.new do |spec|
|
|
9
|
+
spec.name = "mathematical"
|
|
10
|
+
spec.version = Mathematical::VERSION
|
|
11
|
+
spec.authors = ["Garen Torikian"]
|
|
12
|
+
spec.email = ["gjtorikian@gmail.com"]
|
|
13
|
+
spec.summary = "Quickly convert math equations into beautiful SVGs/PNGs/MathML."
|
|
14
|
+
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."
|
|
15
|
+
spec.homepage = "https://github.com/gjtorikian/mathematical"
|
|
16
|
+
spec.license = "MIT"
|
|
17
|
+
|
|
18
|
+
spec.required_ruby_version = ">= 3.1"
|
|
19
|
+
|
|
20
|
+
spec.files = ["LICENSE.txt", "README.md", "Rakefile", "mathematical.gemspec"]
|
|
21
|
+
spec.files += Dir.glob("lib/**/*.rb")
|
|
22
|
+
spec.files += Dir["ext/**/*"].reject { |f| f =~ /\.svg$|\.mml$|\.png$|\.o$/ }
|
|
23
|
+
spec.files += Dir.glob("fonts/**/*")
|
|
24
|
+
spec.require_paths = ["lib"]
|
|
25
|
+
spec.extensions = ["ext/mathematical/extconf.rb"]
|
|
26
|
+
|
|
27
|
+
spec.add_dependency("ruby-enum", ">= 0.4", "< 2.0")
|
|
28
|
+
|
|
29
|
+
spec.add_development_dependency("benchmark")
|
|
30
|
+
spec.add_development_dependency("math-to-itex", "~> 0.3")
|
|
31
|
+
spec.add_development_dependency("minitest", "~> 5.6")
|
|
32
|
+
spec.add_development_dependency("nokogiri", "~> 1.10")
|
|
33
|
+
spec.add_development_dependency("rake-compiler", "~> 1.2")
|
|
34
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mathematical
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.7.0
|
|
5
|
+
platform: x86_64-linux-gnu
|
|
6
|
+
authors:
|
|
7
|
+
- Garen Torikian
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: ruby-enum
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0.4'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '2.0'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: '0.4'
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '2.0'
|
|
32
|
+
- !ruby/object:Gem::Dependency
|
|
33
|
+
name: benchmark
|
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
type: :development
|
|
40
|
+
prerelease: false
|
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
42
|
+
requirements:
|
|
43
|
+
- - ">="
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: math-to-itex
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - "~>"
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '0.3'
|
|
53
|
+
type: :development
|
|
54
|
+
prerelease: false
|
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
56
|
+
requirements:
|
|
57
|
+
- - "~>"
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: '0.3'
|
|
60
|
+
- !ruby/object:Gem::Dependency
|
|
61
|
+
name: minitest
|
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
|
63
|
+
requirements:
|
|
64
|
+
- - "~>"
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: '5.6'
|
|
67
|
+
type: :development
|
|
68
|
+
prerelease: false
|
|
69
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
70
|
+
requirements:
|
|
71
|
+
- - "~>"
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: '5.6'
|
|
74
|
+
- !ruby/object:Gem::Dependency
|
|
75
|
+
name: nokogiri
|
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
|
77
|
+
requirements:
|
|
78
|
+
- - "~>"
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: '1.10'
|
|
81
|
+
type: :development
|
|
82
|
+
prerelease: false
|
|
83
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - "~>"
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '1.10'
|
|
88
|
+
- !ruby/object:Gem::Dependency
|
|
89
|
+
name: rake-compiler
|
|
90
|
+
requirement: !ruby/object:Gem::Requirement
|
|
91
|
+
requirements:
|
|
92
|
+
- - "~>"
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: '1.2'
|
|
95
|
+
type: :development
|
|
96
|
+
prerelease: false
|
|
97
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
98
|
+
requirements:
|
|
99
|
+
- - "~>"
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: '1.2'
|
|
102
|
+
description: A very fast way to turn TeX math equations into beautifully rendered
|
|
103
|
+
SVGs, to embed on the web. This library is mostly written in C and is a general
|
|
104
|
+
purpose wrapper to GNOME's Lasem.
|
|
105
|
+
email:
|
|
106
|
+
- gjtorikian@gmail.com
|
|
107
|
+
executables: []
|
|
108
|
+
extensions: []
|
|
109
|
+
extra_rdoc_files: []
|
|
110
|
+
files:
|
|
111
|
+
- LICENSE.txt
|
|
112
|
+
- README.md
|
|
113
|
+
- Rakefile
|
|
114
|
+
- ext/README.md
|
|
115
|
+
- fonts/cmex10.ttf
|
|
116
|
+
- fonts/cmmi10.ttf
|
|
117
|
+
- fonts/cmr10.ttf
|
|
118
|
+
- fonts/cmsy10.ttf
|
|
119
|
+
- fonts/eufm10.ttf
|
|
120
|
+
- fonts/fonts.conf
|
|
121
|
+
- fonts/msam10.ttf
|
|
122
|
+
- fonts/msbm10.ttf
|
|
123
|
+
- lib/mathematical.rb
|
|
124
|
+
- lib/mathematical/3.0/mathematical.so
|
|
125
|
+
- lib/mathematical/3.1/mathematical.so
|
|
126
|
+
- lib/mathematical/3.2/mathematical.so
|
|
127
|
+
- lib/mathematical/3.3/mathematical.so
|
|
128
|
+
- lib/mathematical/3.4/mathematical.so
|
|
129
|
+
- lib/mathematical/4.0/mathematical.so
|
|
130
|
+
- lib/mathematical/configuration.rb
|
|
131
|
+
- lib/mathematical/corrections.rb
|
|
132
|
+
- lib/mathematical/validator.rb
|
|
133
|
+
- lib/mathematical/version.rb
|
|
134
|
+
- mathematical.gemspec
|
|
135
|
+
homepage: https://github.com/gjtorikian/mathematical
|
|
136
|
+
licenses:
|
|
137
|
+
- MIT
|
|
138
|
+
metadata: {}
|
|
139
|
+
rdoc_options: []
|
|
140
|
+
require_paths:
|
|
141
|
+
- lib
|
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
|
+
requirements:
|
|
144
|
+
- - ">="
|
|
145
|
+
- !ruby/object:Gem::Version
|
|
146
|
+
version: '3.0'
|
|
147
|
+
- - "<"
|
|
148
|
+
- !ruby/object:Gem::Version
|
|
149
|
+
version: 4.1.dev
|
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
|
+
requirements:
|
|
152
|
+
- - ">="
|
|
153
|
+
- !ruby/object:Gem::Version
|
|
154
|
+
version: 3.3.22
|
|
155
|
+
requirements: []
|
|
156
|
+
rubygems_version: 4.0.3
|
|
157
|
+
specification_version: 4
|
|
158
|
+
summary: Quickly convert math equations into beautiful SVGs/PNGs/MathML.
|
|
159
|
+
test_files: []
|