hwp_script_to_latex 1.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 03259e525390371a1ea032d34ab803e21a8e9733
4
+ data.tar.gz: 4f2cf97b722e1b7045e0b24e7e1d3e175b87d89d
5
+ SHA512:
6
+ metadata.gz: 69f4c3a3037f9fcf45c2e39b07eeae16c9b82e71355381ab9dba22760d1097b3b9f320d5aad7e45daeae0e932971be80e3392171cca58c38cce785c3dc138d74
7
+ data.tar.gz: 06ff3028b4daefe1af7e3a5f668bea455d28ccf0dbc238fd048f955db551ae6a36eeed9dbfe5537647dbe85b1bab38ffb949c0b2ef71891268a27ee7644363da
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.2.3
5
+ before_install: gem install bundler -v 1.12.5
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hwp_script_to_latex.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 bluesh55
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # HwpScriptToLatex
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/hwp_script_to_latex`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'hwp_script_to_latex'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install hwp_script_to_latex
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/hwp_script_to_latex.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "hwp_script_to_latex"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+ ## 한글 수식 문법으로 작성된 스크립트를 LaTeX 문법으로 변환해줍니다.
3
+
4
+ require 'optparse'
5
+ require 'hwp_script_to_latex/converter'
6
+
7
+ def print_converted_latex(script, latex, math_mode: false, inspect: false)
8
+ if inspect
9
+ puts("[HWP Script] \"#{script}\"")
10
+ puts("Converted To")
11
+ puts("[LaTeX] \"#{latex}\"")
12
+ puts("With following options")
13
+ puts("\tMath mode - #{math_mode}")
14
+ else
15
+ puts latex
16
+ end
17
+ end
18
+
19
+ options = {
20
+ math_mode: false,
21
+ inspect: false
22
+ }
23
+
24
+ optparser = OptionParser.new do |opt|
25
+ opt.banner = 'Usage: hml_to_note [options]'
26
+
27
+ opt.on('-s', '--script [HWP SCRIPT]', String, 'Script written in hwp syntax.') do |script|
28
+ options[:script] = script
29
+ end
30
+
31
+ opt.on('-m', '--mathmode', 'Insert `$` character to start and end of output. Default is `false`') do |math_mode|
32
+ options[:math_mode] = math_mode
33
+ end
34
+
35
+ opt.on('-i', '--inspect', 'Print output with inspection. Default is `false`') do |inspect|
36
+ options[:inspect] = inspect
37
+ end
38
+ end
39
+ optparser.parse!
40
+
41
+ if options[:script].nil?
42
+ abort(optparser.help)
43
+ end
44
+
45
+
46
+ latex = HwpScriptToLatex::Converter.new.convert(options[:script], math_mode: options[:math_mode])
47
+ print_converted_latex(
48
+ options[:script],
49
+ latex,
50
+ math_mode: options[:math_mode],
51
+ inspect: options[:inspect]
52
+ )
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'hwp_script_to_latex/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "hwp_script_to_latex"
8
+ spec.version = HwpScriptToLatex::VERSION
9
+ spec.authors = ["bluesh55"]
10
+ spec.email = ["bluesh55@naver.com"]
11
+
12
+ spec.summary = %q{Convert hwp script to latex}
13
+ spec.homepage = "https://github.com/PrivateCoach/hwp_script_to_latex"
14
+ spec.license = "MIT"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.12"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "rspec", "~> 3.0"
32
+ end
@@ -0,0 +1,4 @@
1
+ require "hwp_script_to_latex/version"
2
+
3
+ module HwpScriptToLatex
4
+ end
@@ -0,0 +1,58 @@
1
+ require 'json'
2
+ require 'hwp_script_to_latex/replacement_rule'
3
+
4
+ module HwpScriptToLatex
5
+ class Converter
6
+ # 한글 수식스크립트를 LaTeX 문법으로 변환
7
+
8
+ def convert(script, math_mode: false)
9
+ latex = script
10
+
11
+ # Step 1. 단순치환
12
+ replacement_rules.each do |rule|
13
+ full_match1 = latex.match(/(?<!\\)([^\\\s]*)(#{rule.regex_str})/).to_s
14
+ full_match2 = latex.match(/([^\\\s]*)(#{rule.regex_str})/).to_s
15
+
16
+ # 두 match가 같은 문자열이어야 치환
17
+ # ex) \theta는 eta로 치환하지 않아야 할 때
18
+ # full_match1 == 'heta'
19
+ # full_match2 == 'theta'
20
+ # 두 개가 같지 않으므로 치환하지 않는다.
21
+ if full_match1 == full_match2
22
+ latex = latex.gsub(rule.regex, rule.latex)
23
+ end
24
+
25
+ end
26
+
27
+ # Step 2. 분수 변환
28
+ #
29
+ # Parentheses fraction만 가능
30
+ # ex) {1} over {2}
31
+ # while문으로 nested fraction처리
32
+ # ex) {{1} over {2}} over {3}
33
+ frac_regex = /({(?>[^{}]+|(?:\g<1>))*})\s*over\s*({(?>[^{}]+|(?:\g<2>))*})/i
34
+ while latex.match(frac_regex)
35
+ latex = latex.gsub(frac_regex, ' \frac \1\2 ')
36
+ end
37
+
38
+ if math_mode
39
+ return "$#{latex}$"
40
+ end
41
+
42
+ return latex
43
+ end
44
+
45
+ private
46
+
47
+ def replacement_rules
48
+ return @rules if @rules
49
+
50
+ f = File.open(File.join(File.dirname(__FILE__), '..', '..', 'rules.json'), 'r')
51
+ file_content = f.read
52
+ f.close
53
+
54
+ arr = JSON.parse(file_content).sort_by { |hash| -1 * hash['regex'].inspect.length }
55
+ @rules = arr.map { |json| ReplacementRule.new(json['regex'], json['latex'], json['ignorecase']) }
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,21 @@
1
+ module HwpScriptToLatex
2
+ class ReplacementRule
3
+ attr_reader :regex_str, :latex
4
+
5
+ def initialize(regex_str, latex, ignorecase = false)
6
+ @regex_str = regex_str
7
+ @latex = latex
8
+ @ignorecase = ignorecase
9
+ end
10
+
11
+ def regex
12
+ return @reg if @reg
13
+
14
+ if @ignorecase
15
+ @reg = Regexp.new(@regex_str, 'i')
16
+ else
17
+ @reg = Regexp.new(@regex_str)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,3 @@
1
+ module HwpScriptToLatex
2
+ VERSION = "1.0.0"
3
+ end
data/rules.json ADDED
@@ -0,0 +1,1168 @@
1
+ [
2
+ {
3
+ "regex": "\r?\n",
4
+ "latex": ""
5
+ },
6
+ {
7
+ "regex": "&lt;|<",
8
+ "latex": " < "
9
+ },
10
+ {
11
+ "regex": "&rt;|>",
12
+ "latex": " > "
13
+ },
14
+
15
+ {
16
+ "regex": "box",
17
+ "latex": " \\fbox ",
18
+ "ignorecase": true
19
+ },
20
+ {
21
+ "regex": "dot",
22
+ "latex": " \\dot "
23
+ },
24
+ {
25
+ "regex": "ddot",
26
+ "latex": " \\ddot "
27
+ },
28
+ {
29
+ "regex": "acute",
30
+ "latex": " \\acute "
31
+ },
32
+ {
33
+ "regex": "grave",
34
+ "latex": " \\grave "
35
+ },
36
+ {
37
+ "regex": "check",
38
+ "latex": " \\check "
39
+ },
40
+ {
41
+ "regex": "breve",
42
+ "latex": " \\breve "
43
+ },
44
+ {
45
+ "regex": "tilde",
46
+ "latex": " \\tilde "
47
+ },
48
+ {
49
+ "regex": "bar",
50
+ "latex": " \\bar "
51
+ },
52
+ {
53
+ "regex": "hat",
54
+ "latex": " \\hat "
55
+ },
56
+ {
57
+ "regex": "widehat",
58
+ "latex": " \\widehat "
59
+ },
60
+ {
61
+ "regex": "vec",
62
+ "latex": " \\vec "
63
+ },
64
+
65
+ {
66
+ "regex": "exp",
67
+ "latex": " \\exp "
68
+ },
69
+ {
70
+ "regex": "ln",
71
+ "latex": " \\ln "
72
+ },
73
+ {
74
+ "regex": "lg",
75
+ "latex": " \\lg "
76
+ },
77
+ {
78
+ "regex": "log",
79
+ "latex": " \\log "
80
+ },
81
+ {
82
+ "regex": "sin",
83
+ "latex": " \\sin "
84
+ },
85
+ {
86
+ "regex": "cos",
87
+ "latex": " \\cos "
88
+ },
89
+ {
90
+ "regex": "tan",
91
+ "latex": " \\tan "
92
+ },
93
+ {
94
+ "regex": "cot",
95
+ "latex": " \\cot "
96
+ },
97
+ {
98
+ "regex": "sec",
99
+ "latex": " \\sec "
100
+ },
101
+ {
102
+ "regex": "csc",
103
+ "latex": " \\csc "
104
+ },
105
+ {
106
+ "regex": "arcsin",
107
+ "latex": " \\arcsin "
108
+ },
109
+ {
110
+ "regex": "arccos",
111
+ "latex": " \\arccos "
112
+ },
113
+ {
114
+ "regex": "arctan",
115
+ "latex": " \\arctan "
116
+ },
117
+ {
118
+ "regex": "sgn",
119
+ "latex": " \\sgn "
120
+ },
121
+ {
122
+ "regex": "vert",
123
+ "latex": " \\vert "
124
+ },
125
+ {
126
+ "regex": "min",
127
+ "latex": " \\min "
128
+ },
129
+ {
130
+ "regex": "max",
131
+ "latex": " \\max "
132
+ },
133
+
134
+ {
135
+ "regex": "inf",
136
+ "latex": " \\inf "
137
+ },
138
+ {
139
+ "regex": "sup",
140
+ "latex": " \\sup "
141
+ },
142
+ {
143
+ "regex": "lim",
144
+ "latex": " \\lim "
145
+ },
146
+ {
147
+ "regex": "liminf",
148
+ "latex": " \\liminf "
149
+ },
150
+ {
151
+ "regex": "limsup",
152
+ "latex": " \\limsup "
153
+ },
154
+ {
155
+ "regex": "dim",
156
+ "latex": " \\dim "
157
+ },
158
+ {
159
+ "regex": "deg",
160
+ "latex": " \\deg "
161
+ },
162
+ {
163
+ "regex": "det",
164
+ "latex": " \\det "
165
+ },
166
+ {
167
+ "regex": "ker",
168
+ "latex": " \\ker "
169
+ },
170
+
171
+ {
172
+ "regex": "Pr",
173
+ "latex": " \\Pr "
174
+ },
175
+ {
176
+ "regex": "hom",
177
+ "latex": " \\hom "
178
+ },
179
+ {
180
+ "regex": "(Vert)|(VERT)",
181
+ "latex": " \\Vert "
182
+ },
183
+ {
184
+ "regex": "arg",
185
+ "latex": " \\arg "
186
+ },
187
+
188
+ {
189
+ "regex": "partial",
190
+ "latex": " \\partial ",
191
+ "ignorecase": true
192
+ },
193
+ {
194
+ "regex": "nabla",
195
+ "latex": " \\nabla ",
196
+ "ignorecase": true
197
+ },
198
+ {
199
+ "regex": "prime",
200
+ "latex": " \\prime "
201
+ },
202
+
203
+ {
204
+ "regex": "infty",
205
+ "latex": " \\infty ",
206
+ "ignorecase": true
207
+ },
208
+ {
209
+ "regex": "hbar",
210
+ "latex": " \\hbar ",
211
+ "ignorecase": true
212
+ },
213
+ {
214
+ "regex": "imath",
215
+ "latex": " \\imath ",
216
+ "ignorecase": true
217
+ },
218
+ {
219
+ "regex": "jmath",
220
+ "latex": " \\jmath ",
221
+ "ignorecase": true
222
+ },
223
+ {
224
+ "regex": "ell",
225
+ "latex": " \\ell ",
226
+ "ignorecase": true
227
+ },
228
+ {
229
+ "regex": "mho",
230
+ "latex": " \\mho ",
231
+ "ignorecase": true
232
+ },
233
+ {
234
+ "regex": "wp",
235
+ "latex": " \\wp ",
236
+ "ignorecase": true
237
+ },
238
+
239
+ {
240
+ "regex": "sqrt",
241
+ "latex": " \\sqrt ",
242
+ "ignorecase": true
243
+ },
244
+ {
245
+ "regex": "root",
246
+ "latex": " \\sqrt ",
247
+ "ignorecase": true
248
+ },
249
+
250
+ {
251
+ "regex": "plusminus",
252
+ "latex": " \\pm ",
253
+ "ignorecase": true
254
+ },
255
+ {
256
+ "regex": "minusplus",
257
+ "latex": " \\mp ",
258
+ "ignorecase": true
259
+ },
260
+ {
261
+ "regex": "dsum",
262
+ "latex": " \\dotplus ",
263
+ "ignorecase": true
264
+ },
265
+ {
266
+ "regex": "times",
267
+ "latex": " \\times ",
268
+ "ignorecase": true
269
+ },
270
+ {
271
+ "regex": "div|divide",
272
+ "latex": " \\div ",
273
+ "ignorecase": true
274
+ },
275
+ {
276
+ "regex": "backslash",
277
+ "latex": " \\backslash ",
278
+ "ignorecase": true
279
+ },
280
+ {
281
+ "regex": "cdot",
282
+ "latex": " \\cdot ",
283
+ "ignorecase": true
284
+ },
285
+ {
286
+ "regex": "ast",
287
+ "latex": " \\ast ",
288
+ "ignorecase": true
289
+ },
290
+ {
291
+ "regex": "star",
292
+ "latex": " \\star ",
293
+ "ignorecase": true
294
+ },
295
+ {
296
+ "regex": "circ",
297
+ "latex": " \\circ ",
298
+ "ignorecase": true
299
+ },
300
+ {
301
+ "regex": "bullet",
302
+ "latex": " \\bullet ",
303
+ "ignorecase": true
304
+ },
305
+ {
306
+ "regex": "oplus",
307
+ "latex": " \\oplus ",
308
+ "ignorecase": true
309
+ },
310
+ {
311
+ "regex": "ominus",
312
+ "latex": " \\ominus ",
313
+ "ignorecase": true
314
+ },
315
+ {
316
+ "regex": "otimes",
317
+ "latex": " \\otimes ",
318
+ "ignorecase": true
319
+ },
320
+ {
321
+ "regex": "oslash",
322
+ "latex": " \\oslash ",
323
+ "ignorecase": true
324
+ },
325
+ {
326
+ "regex": "odot",
327
+ "latex": " \\odot ",
328
+ "ignorecase": true
329
+ },
330
+
331
+ {
332
+ "regex": "in",
333
+ "latex": " \\in ",
334
+ "ignorecase": true
335
+ },
336
+ {
337
+ "regex": "notin|not in",
338
+ "latex": " \\notin ",
339
+ "ignorecase": true
340
+ },
341
+ {
342
+ "regex": "ni",
343
+ "latex": " \\ni ",
344
+ "ignorecase": true
345
+ },
346
+ {
347
+ "regex": "notni|not ni",
348
+ "latex": " \\notni ",
349
+ "ignorecase": true
350
+ },
351
+ {
352
+ "regex": "cap",
353
+ "latex": " \\cap "
354
+ },
355
+ {
356
+ "regex": "Cap",
357
+ "latex": " \\Cap "
358
+ },
359
+ {
360
+ "regex": "sqcap",
361
+ "latex": " \\sqcap ",
362
+ "ignorecase": true
363
+ },
364
+ {
365
+ "regex": "bigcap",
366
+ "latex": " \\bigcap ",
367
+ "ignorecase": true
368
+ },
369
+ {
370
+ "regex": "cup",
371
+ "latex": " \\cup "
372
+ },
373
+ {
374
+ "regex": "Cup",
375
+ "latex": " \\Cup "
376
+ },
377
+ {
378
+ "regex": "sqcup",
379
+ "latex": " \\sqcup ",
380
+ "ignorecase": true
381
+ },
382
+ {
383
+ "regex": "bigcup",
384
+ "latex": " \\bigcup ",
385
+ "ignorecase": true
386
+ },
387
+ {
388
+ "regex": "bigsqcup",
389
+ "latex": " \\bigsqcup ",
390
+ "ignorecase": true
391
+ },
392
+ {
393
+ "regex": "uplus",
394
+ "latex": " \\uplus ",
395
+ "ignorecase": true
396
+ },
397
+ {
398
+ "regex": "biguplus",
399
+ "latex": " \\biguplus ",
400
+ "ignorecase": true
401
+ },
402
+ {
403
+ "regex": "subset",
404
+ "latex": " \\subset "
405
+ },
406
+ {
407
+ "regex": "Subset",
408
+ "latex": " \\Subset "
409
+ },
410
+ {
411
+ "regex": "sqsubset",
412
+ "latex": " \\sqsubset ",
413
+ "ignorecase": true
414
+ },
415
+ {
416
+ "regex": "supset",
417
+ "latex": " \\supset "
418
+ },
419
+ {
420
+ "regex": "Supset",
421
+ "latex": " \\Supset "
422
+ },
423
+ {
424
+ "regex": "sqsupset",
425
+ "latex": " \\sqsupset ",
426
+ "ignorecase": true
427
+ },
428
+ {
429
+ "regex": "subseteq",
430
+ "latex": " \\subseteq ",
431
+ "ignorecase": true
432
+ },
433
+ {
434
+ "regex": "nsubseteq",
435
+ "latex": " \\nsubseteq ",
436
+ "ignorecase": true
437
+ },
438
+ {
439
+ "regex": "subsetneq",
440
+ "latex": " \\subsetneq ",
441
+ "ignorecase": true
442
+ },
443
+ {
444
+ "regex": "varsubsetneq",
445
+ "latex": " \\varsubsetneq ",
446
+ "ignorecase": true
447
+ },
448
+ {
449
+ "regex": "sqsubseteq",
450
+ "latex": " \\sqsubseteq ",
451
+ "ignorecase": true
452
+ },
453
+ {
454
+ "regex": "supseteq",
455
+ "latex": " \\supseteq ",
456
+ "ignorecase": true
457
+ },
458
+ {
459
+ "regex": "nsupseteq",
460
+ "latex": " \\nsupseteq ",
461
+ "ignorecase": true
462
+ },
463
+ {
464
+ "regex": "supsetneq",
465
+ "latex": " \\supsetneq ",
466
+ "ignorecase": true
467
+ },
468
+ {
469
+ "regex": "varsupsetneq",
470
+ "latex": " \\varsupsetneq ",
471
+ "ignorecase": true
472
+ },
473
+ {
474
+ "regex": "sqsupseteq",
475
+ "latex": " \\sqsupseteq ",
476
+ "ignorecase": true
477
+ },
478
+
479
+ {
480
+ "regex": "ne",
481
+ "latex": " \\ne ",
482
+ "ignorecase": true
483
+ },
484
+ {
485
+ "regex": "neq",
486
+ "latex": " \\neq ",
487
+ "ignorecase": true
488
+ },
489
+ {
490
+ "regex": "equiv",
491
+ "latex": " \\equiv ",
492
+ "ignorecase": true
493
+ },
494
+ {
495
+ "regex": "notequiv|not equiv",
496
+ "latex": " \\not\\equiv ",
497
+ "ignorecase": true
498
+ },
499
+ {
500
+ "regex": "sim",
501
+ "latex": " \\sim ",
502
+ "ignorecase": true
503
+ },
504
+ {
505
+ "regex": "simeq",
506
+ "latex": " \\simeq ",
507
+ "ignorecase": true
508
+ },
509
+ {
510
+ "regex": "cong",
511
+ "latex": " \\cong ",
512
+ "ignorecase": true
513
+ },
514
+ {
515
+ "regex": "approx",
516
+ "latex": " \\approx ",
517
+ "ignorecase": true
518
+ },
519
+ {
520
+ "regex": "asymp",
521
+ "latex": " \\asymp ",
522
+ "ignorecase": true
523
+ },
524
+ {
525
+ "regex": "propto",
526
+ "latex": " \\propto ",
527
+ "ignorecase": true
528
+ },
529
+ {
530
+ "regex": "not\s*<",
531
+ "latex": " \\nless ",
532
+ "ignorecase": true
533
+ },
534
+ {
535
+ "regex": "<<",
536
+ "latex": " \\ll ",
537
+ "ignorecase": true
538
+ },
539
+ {
540
+ "regex": "not\s*<<",
541
+ "latex": " \\not\\ll ",
542
+ "ignorecase": true
543
+ },
544
+ {
545
+ "regex": "<<<|lll",
546
+ "latex": " \\lll ",
547
+ "ignorecase": true
548
+ },
549
+ {
550
+ "regex": "not\s*<<<|not\s*lll",
551
+ "latex": " \\not\\lll ",
552
+ "ignorecase": true
553
+ },
554
+ {
555
+ "regex": "not\s*>",
556
+ "latex": " \\ngtr ",
557
+ "ignorecase": true
558
+ },
559
+ {
560
+ "regex": ">>",
561
+ "latex": " \\gg ",
562
+ "ignorecase": true
563
+ },
564
+ {
565
+ "regex": "not\s*>>",
566
+ "latex": " \\not\\gg ",
567
+ "ignorecase": true
568
+ },
569
+ {
570
+ "regex": ">>>|ggg",
571
+ "latex": " \\ggg ",
572
+ "ignorecase": true
573
+ },
574
+ {
575
+ "regex": "not\s*>>>|not\s*ggg",
576
+ "latex": " \\not\\ggg ",
577
+ "ignorecase": true
578
+ },
579
+ {
580
+ "regex": "le",
581
+ "latex": " \\le ",
582
+ "ignorecase": true
583
+ },
584
+ {
585
+ "regex": "leq",
586
+ "latex": " \\leq ",
587
+ "ignorecase": true
588
+ },
589
+ {
590
+ "regex": "ge",
591
+ "latex": " \\ge ",
592
+ "ignorecase": true
593
+ },
594
+ {
595
+ "regex": "geq",
596
+ "latex": " \\geq ",
597
+ "ignorecase": true
598
+ },
599
+
600
+ {
601
+ "regex": "parallel",
602
+ "latex": " \\parallel ",
603
+ "ignorecase": true
604
+ },
605
+ {
606
+ "regex": "not\s*parallel",
607
+ "latex": " \\nparallel ",
608
+ "ignorecase": true
609
+ },
610
+ {
611
+ "regex": "angle",
612
+ "latex": " \\angle ",
613
+ "ignorecase": true
614
+ },
615
+ {
616
+ "regex": "deg",
617
+ "latex": " ^\\circ ",
618
+ "ignorecase": true
619
+ },
620
+ {
621
+ "regex": "diamond",
622
+ "latex": " \\diamond "
623
+ },
624
+ {
625
+ "regex": "Diamond",
626
+ "latex": " \\Diamond "
627
+ },
628
+ {
629
+ "regex": "bigcirc",
630
+ "latex": " \\bigcirc ",
631
+ "ignorecase": true
632
+ },
633
+ {
634
+ "regex": "triangle",
635
+ "latex": " \\triangle ",
636
+ "ignorecase": true
637
+ },
638
+ {
639
+ "regex": "triangled",
640
+ "latex": " \\triangledown ",
641
+ "ignorecase": true
642
+ },
643
+ {
644
+ "regex": "trianglel",
645
+ "latex": " \\triangleleft ",
646
+ "ignorecase": true
647
+ },
648
+ {
649
+ "regex": "triangler",
650
+ "latex": " \\triangleright ",
651
+ "ignorecase": true
652
+ },
653
+ {
654
+ "regex": "bar",
655
+ "latex": " \\bar ",
656
+ "ignorecase": true
657
+ },
658
+ {
659
+ "regex": "overline",
660
+ "latex": " \\overline ",
661
+ "ignorecase": true
662
+ },
663
+ {
664
+ "regex": "arch",
665
+ "latex": " \\stackrel\\frown ",
666
+ "ignorecase": true
667
+ },
668
+
669
+ {
670
+ "regex": "Forall|FORALL",
671
+ "latex": " \\forall "
672
+ },
673
+ {
674
+ "regex": "exists",
675
+ "latex": " \\exists ",
676
+ "ignorecase": true
677
+ },
678
+ {
679
+ "regex": "therefore",
680
+ "latex": " \\therefore ",
681
+ "ignorecase": true
682
+ },
683
+ {
684
+ "regex": "because",
685
+ "latex": " \\because ",
686
+ "ignorecase": true
687
+ },
688
+ {
689
+ "regex": "lor",
690
+ "latex": " \\lor ",
691
+ "ignorecase": true
692
+ },
693
+ {
694
+ "regex": "vee",
695
+ "latex": " \\vee ",
696
+ "ignorecase": true
697
+ },
698
+ {
699
+ "regex": "bigvee",
700
+ "latex": " \\bigvee ",
701
+ "ignorecase": true
702
+ },
703
+ {
704
+ "regex": "land",
705
+ "latex": " \\land ",
706
+ "ignorecase": true
707
+ },
708
+ {
709
+ "regex": "wedge",
710
+ "latex": " \\wedge ",
711
+ "ignorecase": true
712
+ },
713
+ {
714
+ "regex": "bigwedge",
715
+ "latex": " \\bigwedge ",
716
+ "ignorecase": true
717
+ },
718
+ {
719
+ "regex": "neg",
720
+ "latex": " \\neg ",
721
+ "ignorecase": true
722
+ },
723
+ {
724
+ "regex": "bot",
725
+ "latex": " \\bot ",
726
+ "ignorecase": true
727
+ },
728
+ {
729
+ "regex": "top",
730
+ "latex": " \\top ",
731
+ "ignorecase": true
732
+ },
733
+ {
734
+ "regex": "vdash",
735
+ "latex": " \\vdash ",
736
+ "ignorecase": true
737
+ },
738
+ {
739
+ "regex": "dashv",
740
+ "latex": " \\dashv ",
741
+ "ignorecase": true
742
+ },
743
+
744
+ {
745
+ "regex": "leftarrow|larrow",
746
+ "latex": " \\leftarrow "
747
+ },
748
+ {
749
+ "regex": "Leftarrow|LEFTARROW|LARROW",
750
+ "latex": " \\Leftarrow "
751
+ },
752
+ {
753
+ "regex": "rightarrow|rarrow",
754
+ "latex": " \\rightarrow "
755
+ },
756
+ {
757
+ "regex": "Rightarrow|RIGHTARROW|RARROW",
758
+ "latex": " \\Rightarrow "
759
+ },
760
+ {
761
+ "regex": "uparrow",
762
+ "latex": " \\uparrow "
763
+ },
764
+ {
765
+ "regex": "Uparrow|UPARROW",
766
+ "latex": " \\Uparrow "
767
+ },
768
+ {
769
+ "regex": "downarrow",
770
+ "latex": " \\downarrow "
771
+ },
772
+ {
773
+ "regex": "Downarrow|DOWNARROW",
774
+ "latex": " \\Downarrow "
775
+ },
776
+ {
777
+ "regex": "udarrow",
778
+ "latex": " \\updownarrow "
779
+ },
780
+ {
781
+ "regex": "Udarrow|UDARROW",
782
+ "latex": " \\Updownarrow "
783
+ },
784
+ {
785
+ "regex": "lrarrow",
786
+ "latex": " \\leftrightarrow "
787
+ },
788
+ {
789
+ "regex": "Lrarrow|LRARROW",
790
+ "latex": " \\Leftrightarrow "
791
+ },
792
+ {
793
+ "regex": "nwarrow",
794
+ "latex": " \\nwarrow ",
795
+ "ignorecase": true
796
+ },
797
+ {
798
+ "regex": "searrow",
799
+ "latex": " \\searrow ",
800
+ "ignorecase": true
801
+ },
802
+ {
803
+ "regex": "nearrow",
804
+ "latex": " \\nearrow ",
805
+ "ignorecase": true
806
+ },
807
+ {
808
+ "regex": "swarrow",
809
+ "latex": " \\swarrow ",
810
+ "ignorecase": true
811
+ },
812
+ {
813
+ "regex": "hookleft",
814
+ "latex": " \\hookleftarrow ",
815
+ "ignorecase": true
816
+ },
817
+ {
818
+ "regex": "hookright",
819
+ "latex": " \\hookrightarrow ",
820
+ "ignorecase": true
821
+ },
822
+ {
823
+ "regex": "mapsto",
824
+ "latex": " \\mapsto ",
825
+ "ignorecase": true
826
+ },
827
+
828
+ {
829
+ "regex": "amalg",
830
+ "latex": " \\amalg ",
831
+ "ignorecase": true
832
+ },
833
+ {
834
+ "regex": "dagger",
835
+ "latex": " \\dagger ",
836
+ "ignorecase": true
837
+ },
838
+ {
839
+ "regex": "ddagger",
840
+ "latex": " \\ddager ",
841
+ "ignorecase": true
842
+ },
843
+ {
844
+ "regex": "ldots",
845
+ "latex": " \\ldots ",
846
+ "ignorecase": true
847
+ },
848
+ {
849
+ "regex": "cdots",
850
+ "latex": " \\cdots ",
851
+ "ignorecase": true
852
+ },
853
+ {
854
+ "regex": "ddots",
855
+ "latex": " \\ddots ",
856
+ "ignorecase": true
857
+ },
858
+
859
+ {
860
+ "regex": "`",
861
+ "latex": " \\, "
862
+ },
863
+ {
864
+ "regex": "~",
865
+ "latex": " \\ "
866
+ },
867
+ {
868
+ "regex": "#",
869
+ "latex": "\\\\\\\\"
870
+ },
871
+ {
872
+ "regex": "&amp;",
873
+ "latex": ""
874
+ },
875
+ {
876
+ "regex": "cases",
877
+ "latex": " \\cases "
878
+ },
879
+
880
+ {
881
+ "regex": "left",
882
+ "latex": " \\left ",
883
+ "ignorecase": true
884
+ },
885
+ {
886
+ "regex": "right",
887
+ "latex": " \\right ",
888
+ "ignorecase": true
889
+ },
890
+ {
891
+ "regex": "langle",
892
+ "latex": " \\langle ",
893
+ "ignorecase": true
894
+ },
895
+ {
896
+ "regex": "rangle",
897
+ "latex": " \\rangle ",
898
+ "ignorecase": true
899
+ },
900
+ {
901
+ "regex": "left\s*{",
902
+ "latex": " left\\{ ",
903
+ "ignorecase": true
904
+ },
905
+ {
906
+ "regex": "right\s*}",
907
+ "latex": " right\\} ",
908
+ "ignorecase": true
909
+ },
910
+ {
911
+ "regex": "lfloor",
912
+ "latex": " \\lfloor ",
913
+ "ignorecase": true
914
+ },
915
+ {
916
+ "regex": "rfloor",
917
+ "latex": " \\rfloor ",
918
+ "ignorecase": true
919
+ },
920
+ {
921
+ "regex": "lceil",
922
+ "latex": " \\lceil ",
923
+ "ignorecase": true
924
+ },
925
+ {
926
+ "regex": "rceil",
927
+ "latex": " \\rceil ",
928
+ "ignorecase": true
929
+ },
930
+
931
+ {
932
+ "regex": "(Alpha)|(ALPHA)",
933
+ "latex": " A "
934
+ },
935
+ {
936
+ "regex": "alpha",
937
+ "latex": " \\alpha "
938
+ },
939
+ {
940
+ "regex": "(Beta)|(BETA)",
941
+ "latex": " B "
942
+ },
943
+ {
944
+ "regex": "beta",
945
+ "latex": " \\beta "
946
+ },
947
+ {
948
+ "regex": "(Gamma)|(GAMMA)",
949
+ "latex": " \\Gamma "
950
+ },
951
+ {
952
+ "regex": "gamma",
953
+ "latex": " \\gamma "
954
+ },
955
+ {
956
+ "regex": "(Delta)|(DELTA)",
957
+ "latex": " \\Delta "
958
+ },
959
+ {
960
+ "regex": "delta",
961
+ "latex": " \\delta "
962
+ },
963
+ {
964
+ "regex": "(Epsilon)|(EPSILON)",
965
+ "latex": " E "
966
+ },
967
+ {
968
+ "regex": "epsilon",
969
+ "latex": " \\epsilon "
970
+ },
971
+ {
972
+ "regex": "(Zeta)|(ZETA)",
973
+ "latex": " Z "
974
+ },
975
+ {
976
+ "regex": "zeta",
977
+ "latex": " \\zeta "
978
+ },
979
+ {
980
+ "regex": "(Eta)|(ETA)",
981
+ "latex": " H "
982
+ },
983
+ {
984
+ "regex": "eta",
985
+ "latex": " \\eta "
986
+ },
987
+ {
988
+ "regex": "(Theta)|(THETA)",
989
+ "latex": " \\Theta "
990
+ },
991
+ {
992
+ "regex": "theta",
993
+ "latex": " \\theta "
994
+ },
995
+ {
996
+ "regex": "(Iota)|(IOTA)",
997
+ "latex": " I "
998
+ },
999
+ {
1000
+ "regex": "iota",
1001
+ "latex": " \\iota "
1002
+ },
1003
+ {
1004
+ "regex": "(Kappa)|(KAPPA)",
1005
+ "latex": " K "
1006
+ },
1007
+ {
1008
+ "regex": "kappa",
1009
+ "latex": " \\kappa "
1010
+ },
1011
+ {
1012
+ "regex": "(Lambda)|(LAMBDA)",
1013
+ "latex": " \\Lambda "
1014
+ },
1015
+ {
1016
+ "regex": "lambda",
1017
+ "latex": " \\lambda "
1018
+ },
1019
+ {
1020
+ "regex": "(Mu)|(MU)",
1021
+ "latex": " M "
1022
+ },
1023
+ {
1024
+ "regex": "mu",
1025
+ "latex": " \\mu "
1026
+ },
1027
+ {
1028
+ "regex": "(Nu)|(NU)",
1029
+ "latex": " N "
1030
+ },
1031
+ {
1032
+ "regex": "nu",
1033
+ "latex": " \\nu "
1034
+ },
1035
+ {
1036
+ "regex": "(Xi)|(XI)",
1037
+ "latex": " \\Xi "
1038
+ },
1039
+ {
1040
+ "regex": "xi",
1041
+ "latex": " \\xi "
1042
+ },
1043
+ {
1044
+ "regex": "(Pi)|(PI)",
1045
+ "latex": " \\Pi "
1046
+ },
1047
+ {
1048
+ "regex": "pi",
1049
+ "latex": " \\pi "
1050
+ },
1051
+ {
1052
+ "regex": "(Rho)|(RHO)",
1053
+ "latex": " P "
1054
+ },
1055
+ {
1056
+ "regex": "rho",
1057
+ "latex": " \\rho "
1058
+ },
1059
+ {
1060
+ "regex": "(Sigma)|(SIGMA)",
1061
+ "latex": " \\Sigma "
1062
+ },
1063
+ {
1064
+ "regex": "sigma",
1065
+ "latex": " \\sigma "
1066
+ },
1067
+ {
1068
+ "regex": "(Tau)|(TAU)",
1069
+ "latex": " T "
1070
+ },
1071
+ {
1072
+ "regex": "tau",
1073
+ "latex": " \\tau "
1074
+ },
1075
+ {
1076
+ "regex": "(Upsilon)|(UPSILON)",
1077
+ "latex": " \\Upsilon "
1078
+ },
1079
+ {
1080
+ "regex": "upsilon",
1081
+ "latex": " \\upsilon "
1082
+ },
1083
+ {
1084
+ "regex": "(Phi)|(PHI)",
1085
+ "latex": " \\Phi "
1086
+ },
1087
+ {
1088
+ "regex": "phi",
1089
+ "latex": " \\phi "
1090
+ },
1091
+ {
1092
+ "regex": "(Chi)|(CHI)",
1093
+ "latex": " X "
1094
+ },
1095
+ {
1096
+ "regex": "chi",
1097
+ "latex": " \\chi "
1098
+ },
1099
+ {
1100
+ "regex": "(Psi)|(PSI)",
1101
+ "latex": " \\Psi "
1102
+ },
1103
+ {
1104
+ "regex": "psi",
1105
+ "latex": " \\psi "
1106
+ },
1107
+ {
1108
+ "regex": "(Omega)|(OMEGA)",
1109
+ "latex": " \\Omega "
1110
+ },
1111
+ {
1112
+ "regex": "omega",
1113
+ "latex": " \\omega "
1114
+ },
1115
+ {
1116
+ "regex": "varepsilon",
1117
+ "latex": " \\varepsilon "
1118
+ },
1119
+ {
1120
+ "regex": "digamma",
1121
+ "latex": " \\digamma "
1122
+ },
1123
+ {
1124
+ "regex": "varkappa",
1125
+ "latex": " \\varkappa "
1126
+ },
1127
+ {
1128
+ "regex": "varpi",
1129
+ "latex": " \\varpi "
1130
+ },
1131
+ {
1132
+ "regex": "varrho",
1133
+ "latex": " \\varrho "
1134
+ },
1135
+ {
1136
+ "regex": "varsigma",
1137
+ "latex": " \\varsigma "
1138
+ },
1139
+ {
1140
+ "regex": "vartheta",
1141
+ "latex": " \\vartheta "
1142
+ },
1143
+ {
1144
+ "regex": "varphi",
1145
+ "latex": " \\varphi "
1146
+ },
1147
+ {
1148
+ "regex": "aleph",
1149
+ "latex": " \\aleph "
1150
+ },
1151
+ {
1152
+ "regex": "beth",
1153
+ "latex": " \\beth "
1154
+ },
1155
+ {
1156
+ "regex": "gimel",
1157
+ "latex": " \\gimel "
1158
+ },
1159
+ {
1160
+ "regex": "daleth",
1161
+ "latex": " \\daleth "
1162
+ },
1163
+
1164
+ {
1165
+ "regex": "->",
1166
+ "latex": " \\to "
1167
+ }
1168
+ ]