forked from liblouis/liblouisutdml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnemeth.ctb
503 lines (477 loc) · 16.9 KB
/
nemeth.ctb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# liblouis: Nemeth Table for mathematics
#
# Based on the Linux screenreader BRLTTY, copyright (C) 1999-2006 by
# The BRLTTY Team
#
# Copyright (C) 2004-2008 ViewPlus Technologies, Inc. www.viewplus.com
# Copyright (C) 2004-2006 JJB Software, Inc. www.jjb-software.com
# Expanded and modified by Norbert Márkus (hamilfonz at gmail dot com), Hungary, 2023.
#
# This file is part of liblouis.
#
# liblouis is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 2.1 of the
# License, or (at your option) any later version.
#
# liblouis is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with liblouis. If not, see
# <http://www.gnu.org/licenses/>.
space \x001b 1b escape character for html back-translation
include loweredDigits6Dots.uti
include latinLetterDef6Dots.uti
include latinUppercaseComp6.uti
replace \x00AF \x2015
punctuation ( 12356
punctuation } 12456
punctuation ] 124567
punctuation ? 1456
punctuation : 156
punctuation ) 23456
punctuation ! 2346
punctuation { 246
punctuation [ 2467
punctuation ' 3
punctuation - 36
punctuation . 46
punctuation " 5
punctuation ; 56
punctuation , 6
sign & 12346
sign $ 1246
sign | 1256
sign \\ 12567
sign % 146
sign * 16
sign # 3456
punctuation ` 4
sign _ 456
sign ^ 457
sign @ 47
math = 123456
math < 126
math / 34
math > 345
math + 346
math ~ 45
punctuation : 456-25-0
punctuation ; 456-23-0
math \x2218 45-46-16-5 degrees sign (actually a composit sign, in Braille shown in superscript)
#Reversed the order of the two include lines below to give priority to the math character definitions
include nemethdefs.cti
include en-chardefs.cti All character definition opcodes
attribute spacetildedotfive \x0020\x00A0~\x0022
attribute rightbrace }
attribute mathdot \x00B7\x02D9\x22C5
attribute greekletter abgdez:?jklmnxoprstuf&yw3
math \x00a8 16-16 DIAERESIS (double dots) in math expressions
math \x2322 1246-1 FROWN (CONCAVE UPWARD ARC)
math \x2323 1246-3 SMILE (CONCAVE DOWNWARD ARC)
math \x0023 3456a pseudo hash mark for further processing
# Braille indicators
multind 56-6 letsign capsletter
capsletter 6
emphclass italic
emphclass underline
emphclass bold
begemph italic 46
endemph italic 46-46
begemph bold 456
endemph bold 456-456
begcomp 456-346
endcomp 456-156
# Letters are defined in en-chardefs
# punctuation
prepunc " 236
postpunc " 356
postpunc , 6
always \e0 5
always , 6-a
#always # 35-2345 print number sign before number
always # 3456a number sign (hashmark) in print - a temporary representation for further processing
decpoint . 46
hyphen - 36
postpunc . 456-256
endnum . 456-256
always . 256
always ! 12346 factorial
always < a-5-13-a
always = a-46-13-a
always > a-46-2-a
postpunc ? 456-236
#endnum % 4-356
always ~~ 4-156-5-4-156
always ~ 4-156
always & 456-12346
midnum * 4-16
always [ 4-12356
always ] 4-23456
always { 46-12356
always } 46-23456
always @ 4-1
always \\ 456-16
always | 1256
always $ 4-234
always \x2015 156 horizontal bar above accented centered
repeated \s 0
noback context ["\x25A1"]$d @1246-256-5
noback context ["\x25A0"]$d @1246-456-256-5
always \x00b0 45-46-16-5 #This is not a simple symbol. It contains a local superscript and a base-line suffix that may get removed if it is not needed
always \x00B1 346-36
# semantic character pairs
math \xf400 0
math \xf401 0
math \xf402 0
math \xf403 0
# Begin and end equation
# replace \xf32e
# replace \xf32f
grouping math \xf32e\xf32f 12e,15e
# Sub and superscript
math \xf320 56
replace \xf401\xf320
always \xf402\xf320 5
math \xf321 45
replace \xf401\xf321
always \xf402\xf321 5
# Underscript and overscript
math \xf322 146
always \xf401\xf322 5
always \xf402\xf322 12456
math \xf323 126
always \xf401\xf323 5
always \xf402\xf323 12456
# Fenced characters
always \xf401( 12356
always \xf402) 23456
always \xf401{ 246
always \xf402} 12456
# Expression groups
replace \xf326
replace \xf327
# Fractions
math \xf500 1456
math \xf501 34
math \xf502 456-34
math \xf503 3456
# Mixed Fractions
math \xf504 456-1456
math \xf505 34
math \xf506 456-34
math \xf507 456-3456
# Complex Fractions
math \xf508 6-1456
math \xf509 6-34
math \xf50a 6-456-34
math \xf50b 6-3456
# Roots
math \xf32a 345
always \xf403\xf32a 345
math \xf32b 12456
math \xf32c 126
# Matrices
replace \xf330
replace \xf331
math \xf332 4-6-12356
math \xf333 4-6-23456
replace \xf334
replace \xf335
# Protect against wrong use of prefixes
replace \xf400
replace \xf401
replace \xf402
replace \xf403
# Old LibLouisUTDML semantic character pairs
always ^, 6
always ^; 56
always ^: 156
always ^. 46
always ^! 2346
always ^" 5
always ^' 3
always ^( 12356
always ^) 23456
always ^- 36
always ^_ 456
always ^< 126
always ^= 123456
always ^> 345
always ^% 146
always ^+ 346
always ^~ 45
always ^` 4
always ^& 12346
always ^$ 1246
always ^? 1456
always ^{ 246
always ^} 12456
always ^# 3456
always ^| 1256
always ^/ 34
always ^* 16
repeated ^1 a
always ^ 456-126 #default the CARET character to its Nemeth Braille representation if it has not been consumed as a prefix in the lines above
always % 4-356 #default the actual percent sign to its Nemeth Braille representation if it has not been consumed earlier
# Function names and abbreviations
always acos 1-14-135-234-a
always antilog 1-1345-2345-24-123-135-1245-a
always arc 1-1235-14-a
always arccos 1-1235-14-14-135-234-a
always arg 1-1235-1245-a
always asin 1-234-24-1345-a
always atan 1-2345-1-1345-a
always colog 14-123-135-1245 #-a
always cos 14-135-234-a
always cosh 14-135-234-125-a
always cot 14-135-2345-a
always coth 14-135-2345-125-a
always covers 14-135-1236-15-1235-234-a
always csc 14-234-14-a
always csch 14-234-14-125-a
always erf 15-1235-124-a
always inf 24-1345-124-a
always ln 123-1345-a
always log 123-135-1245 #-a
always max 134-1-1346-a
always min 134-24-1345-a
always sec 234-15-14-a
always sech 234-15-14-125-a
always sin 234-24-1345-a
always sinh 234-24-1345-125-a
always tan 2345-1-1345-a
always tanh 2345-1-135-125-a
always vers 1236-15-1235-234-a
always sgn 234-1245-1345-a
always tg 2345-1245-a
always ctg 14-2345-1245-a
always lg 123-1245-a
always arcsin 1-1235-14-234-24-1345-a
always arctg 1-1235-14-2345-1245-a
# computer braille character sequences
compbrl :// URLs
compbrl www.
compbrl .com
compbrl .edu
compbrl .gov
compbrl .mil
compbrl .net
compbrl .org
compbrl .doc
compbrl .htm
compbrl .html
compbrl .tex
compbrl .txt
compbrl .gif
compbrl .jpg
compbrl .png
compbrl .wav
compbrl .tar
compbrl .zip
# multipass corrections
#Process print number sign (hash mark)
noback pass2 [@3456a]$d @46-3456-3456 #a digit following a print hash mark needs its own Braille number sign
noback pass2 @3456a @46-3456 #produce a hash mark symbol when not followed by a number
#Fix the context of the hollow dot for its uses as degrees sign or composit operator
noback pass2 @45[@45-46-16-5]@5 * #remove the nesting superscript in cases the degrees sign happens to be in the correct syntax
noback pass3 $d@45-46-16[@5]@6-124 @a #insert space before the F for Fahrenheit
noback pass3 $d@45-46-16[@5]@6-14 @a #insert space before the C for Celsius
noback pass2 $l[@45-46-16-5]$l @46-16 #composit sign between two functions like f ring g
# get rid of base-line ind. after subscripts
#Handle stand-alone subscripts
noback pass2 @1b-12-56[]$d1-5@5-1b-15 @3456
noback pass2 @1b-12-56[]$d1-5@5$s @3456
noback pass2 $s@56[]$d1-5@5-1b-15 @3456
noback pass2 $s@56[]$d1-5@5$s @3456
#handle prescribed subscripts
noback pass2 @1b-12-56$d1-5[@5]@45 ? #testing for a preceding letter won't work because the math start sign ends with letter b
noback pass2 @1b-12-56$d1-5[@5]@56 ?
noback pass2 @1b-12-56$d1-5[@5] @5
noback pass3 @1b-12-56$d1-5[@5] @5
#Preserve the subscript ind. and the base-line ind. if the subscript is not preceded by a letter
#but remove the base-line ind. if the subscript is either followed by a superscript or a subscript
#Remove the subscript prefix if it is preceded by a letter or a letter and prime(s).
#But after this numeric subscript, do not remove the base-line ind. if it is followed by a number
noback pass2 @123-135-1245-56$d1-5[@5] @a #following a numeric subscript, introduce a space required for the function abbreviation (log)
#If the function "log" has a subscript or superscript, find the indication of its end (\e0 or quotation mark" and replace it with a dot 5 followed by a space
noback context "log"["^;"] @56#11=1
noback context "log"["^~"] @45#11=1
noback context #11=1["\e0"] #11=0@5-a
noback context #11=1["\""] #11=0@5-a
#Handle when a letter has a prime or a double prime in superscript and something else in subscript (needs to be shown in reverse order in Nemeth)
noback context $l[]"^;"!$w1-100"~'^\"" #19=1@3
noback context $l[]"^;"!$w1-100"~\x2032^\"" #19=1@3
noback context $l[]"^;"!$w1-100"~''^\"" #18=1@3-3
noback context $l[]"^;"!$w1-100"~\"^\"" #18=1@3-3
noback context $l[]"^;"!$w1-100"~\x2033^\"" #18=1@3-3
noback context #19=1["^~'^\""] #19=0@5
noback context #19=1["^~\x2032^\""] #19=0@5
noback context #18=1["^~''^\""] #18=0@5
noback context #18=1["^~\"^\""] #18=0@5
noback context #18=1["^~\x2033^\""] #18=0@5
#Else replace \e0 with a dot 5 unconditionally
noback context "\e0" @5
noback pass2 $l@56$d1-5[@5]!$d ?
noback pass2 $l@3-56$d1-5[@5]!$d ?
noback pass2 $l@3-3-56$d1-5[@5]!$d ?
noback pass3 $l[@56]$d1-5 ?
noback pass3 $l@3[@56]$d1-5 ?
noback pass3 $l@3-3[@56]$d1-5 ?
#get rid of extra baseline inds.
noback pass4 @5-5 @5
noback pass2 @5-0 @0
noback pass3 @5-0 @0
noback pass2 @5-a @a
noback pass3 @5-a @a
noback pass2 @5-1b-15 @1b-15
noback pass3 @5-1b-15 @1b-15
# get rid of superscript ind. on prime sign
noback pass2 @45-3-5 @3
noback pass2 @45-3-3-5 @3-3
# Put 456 in mixed numbers
noback pass2 $d[]@1456 @456#1=1
noback pass2 #1=1[]@3456 @456#1=0 #
# Put number sign on numbers after spaces
noback pass2 @a[]$d @3456
noback pass2 [@a-0]$d @a-3456
noback pass2 @a-36[]$d @3456
noback pass2 [@a-0-36]$d @a-36-3456
noback pass2 @0[]$d @3456
noback pass2 @0-36[]$d @3456
noback pass2 @a-0 @a
noback pass2 @0-a @a
# fix anomaly with superscripts
noback pass2 @45-0-5 @45
noback pass2 @45-5 @45
#Handle bold prefix on English and Greek lower-case and capital letters
#noback pass2 @456-56-46 @456-46 #remove English letter sign from before Greek letters
noback pass2 @456-56-46-6[%greekletter] @456-46-6* #remove the unnecessary English letter sign
noback pass2 @456-56-46-4[%greekletter] @456-46-4* #remove the unnecessary English letter sign
noback pass2 @456-56-46[%greekletter] @456-46* #remove the unnecessary English letter sign
noback pass2 @456-56-6$l * #English capital letter with bold prefix must remain unchanged
noback pass2 @456-56$l * #English lower-case letter must remain unchanged
noback pass2 @456-56 ? #Otherwise the prefix is removed
# Fix single letter and digit with overbar
#noback pass2 @5$l[@126-12456] @156
noback pass2 @5[$l]@126-156-12456 *@156 #English small letter
noback pass2 @5[@6$l]@126-156-12456 *@156 #English capital letter
noback pass2 @5[@456-56$l]@126-156-12456 *@156 #boldface English small letter
noback pass2 @5[@456-56-6$l]@126-156-12456 *@156 #boldface English capital letter
noback pass2 @5[@46%greekletter]@126-156-12456 *@156 #Greek small letter
noback pass2 @5[@46-4%greekletter]@126-156-12456 *@156 #Greek small letter math variant
noback pass2 @5[@46-6%greekletter]@126-156-12456 *@156 #Greek capital letter
noback pass2 @5-456-56[@46%greekletter]@126-156-12456 @456*@156 #boldface Greek small letter
noback pass2 @5-456-56[@46-4%greekletter]@126-156-12456 @456*@156 #boldface Greek small letter math variant
noback pass2 @5-456-56[@46-6%greekletter]@126-156-12456 @456*@156 #boldface Greek capital letter
noback pass2 @5[$d]@126-156-12456 *@156 #digit
# Fix single letter and digit with bar directly under
noback pass2 @5[$l]@146-156-12456 *@146-156 #English small letter
noback pass2 @5[@6$l]@146-156-12456 *@146-156 #English capital letter
noback pass2 @5[@456-56$l]@146-156-12456 *@146-156 #boldface English small letter
noback pass2 @5[@456-56-6$l]@146-156-12456 *@146-156 #boldface English capital letter
noback pass2 @5[@46%greekletter]@146-156-12456 *@146-156 #Greek small letter
noback pass2 @5[@46-4%greekletter]@146-156-12456 *@146-156 #Greek small letter math variant
noback pass2 @5[@46-6%greekletter]@146-156-12456 *@146-156 #Greek capital letter
noback pass2 @5-456-56[@46%greekletter]@146-156-12456 @456*@146-156 #boldface Greek small letter
noback pass2 @5-456-56[@46-4%greekletter]@146-156-12456 @456*@146-156 #boldface Greek small letter math variant
noback pass2 @5-456-56[@46-6%greekletter]@146-156-12456 @456*@146-156 #boldface Greek capital letter
noback pass2 @5[$d]@146-156-12456 *@146-156
#It is sufficient to indicate one dot above a series of digits if two or more consecutive digits each have a dot above
noback pass2 @5$d2-100@126[%mathdot2-100]@12456 @16
#Fix the appearance of double dots in overscript or underscript
noback pass2 @126[@456-256-456-256]@12456 @16-16
noback pass2 @146[@456-256-456-256]@12456 @16-16
noback pass2 @46-a @456-256
noback pass2 [@456-256]@5$d @46
# get rid of space for overscripts
noback pass2 @126-a @126
noback pass2 @146-a @146
noback pass2 @0-146 @146
noback pass2 @a-146 @146
noback pass2 @a-12456 @12456
# fix complex fraction begin and end (not perfectly)
noback pass2 @1456-1456 @6-1456-1456
noback pass2 @3456-3456 @3456-6-3456
#Insert the missing space for "lim" after the termination of the "directly under" passage
noback context []"^\"lim^%"!$x1-100"}" #20=1
noback context #20=1["^}"] #20=0@12456-a
# Fix lim with overbar sign
noback pass2 @5-123-24-134-126-12456 @126-123-24-134
#Fix the modified right arrow: use the full form of the arrow and move its surrounding spaces outside the five-step modification structure
noback context ["^\"\x2192^<"] #21=1@a-5-1246-25-25-135-126 #when something is placed over the arrow
noback context ["^\"\x2192^%"] #21=1@a-5-1246-25-25-135-146 #when something is placed under the arrow
noback context #21=1["^}"] #21=0@12456-a #the space is moved beyond the termination of the modification
# Get rid of open paren before matrices
noback pass2 @12356-4-6-12356 @4-6-12356
noback pass2 @1256-4-6-12356 @4-6-12356
# take off baseline ind. comma space
noback pass2 [@5-6]!$l @6
noback pass2 @1b-12[]$d @3456 number sign before digit at beginning
noback pass2 @1b-12[]@5$d @3456
noback pass2 $s[]@5$d @3456
noback pass3 @1b-12[]$d @3456
noback pass2 @1b-12-36[]$d @3456 number sign before minus before digit at beginning
noback pass2 @1b-12-5-36[]$d @3456
noback pass2 @1b-12-36[]@5$d @3456
noback pass2 $s@5-36[]$d @3456
noback pass2 $s@36[]@5$d @3456
noback pass3 @1b-12-36[]$d @3456
noback pass2 [@12e]$d @3456
noback pass2 [@12e-36]$d @36-3456
noback pass2 [@12e-46]$d @3456-46
noback pass2 @12e ?
noback pass2 @15e ?
#Remove space from behind colon or semicolon when followed by other than a number
noback pass2 @456-25[@0]!$d ?
noback pass2 @456-23[@0]!$d ?
#Insert space between {} for the empty set
noback pass2 @46-12356[]@46-23456 @a
#Remove space between a grouping symbol and a horizontal ellipsis
noback pass2 @46-46-12356[@0]@3-3-3 ?
noback pass2 @46-12356[@0]@3-3-3 ?
noback pass2 @4-12356[@0]@3-3-3 ?
noback pass2 @12356[@0]@3-3-3 ?
noback pass2 @3-3-3[@0]@46-46-23456 ?
noback pass2 @3-3-3[@0]@46-23456 ?
noback pass2 @3-3-3[@0]@4-23456 ?
noback pass2 @3-3-3[@0]@23456 ?
#function names with superscript, remove the space from before the superscript prefix
noback pass2 @1-14-135-234[@a]@45 ? #acos
noback pass2 @1-1345-2345-24-123-135-1245[@a]@45 ? #antilog
noback pass2 @1-1235-14[@a]@45 ? #arc
noback pass2 @1-1235-14-14-135-234[@a]@45 ? #arccos
noback pass2 @1-1235-1245[@a]@45 ? #arg
noback pass2 @1-234-24-1345[@a]@45 ? #asin
noback pass2 @1-2345-1-1345[@a]@45 ? #atan
noback pass2 @14-135-123-135-1245[@a]@45 ? #colog
noback pass2 @14-135-234[@a]@45 ? #cos
noback pass2 @14-135-234-125[@a]@45 ? #cosh
noback pass2 @14-135-2345[@a]@45 ? #cot
noback pass2 @14-135-2345-125[@a]@45 ? #coth
noback pass2 @14-135-1236-15-1235-234[@a]@45 ? #covers
noback pass2 @14-234-14[@a]@45 ? #csc
noback pass2 @14-234-14-125[@a]@45 ? #csch
noback pass2 @15-1235-124[@a]@45 ? #erf
noback pass2 @24-1345-124[@a]@45 ? #inf
noback pass2 @123-1345[@a]@45 ? #ln
noback pass2 @123-135-1245[@a]@45 ? #log
noback pass2 @134-1-1346[@a]@45 ? #max
noback pass2 @134-24-1345[@a]@45 ? #min
noback pass2 @234-15-14[@a]@45 ? #sec
noback pass2 @234-15-14-125[@a]@45 ? #sech
noback pass2 @234-24-1345[@a]@45 ? #sin
noback pass2 @234-24-1345-125[@a]@45 ? #sinh
noback pass2 @2345-1-1345[@a]@45 ? #tan
noback pass2 @2345-1-1345-125[@a]@45 ? #tanh
noback pass2 @1236-15-1235-234[@a]@45 ? #vers
noback pass2 @234-1245-1345[@a]@45 ? #sgn
noback pass2 @123-1245[@a]@45 ? #lg
noback pass2 @2345-1245[@a]@45 ? #tg with superscript
noback pass2 @14-2345-1245[@a]@45 ? #ctg with superscript
noback pass2 @1-1235-14-234-24-1345[@a]@45 ? #arcsin with superscript
noback pass2 @1-1235-14-2345-1245[@a]@45 ? #arctg with superscript
noback pass4 [$s]$s ?