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
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% braille.sty
%
% William Park <opengeometry@yahoo.ca>
% September 1998, April 1999
%
% Major additions made by Dominique Unruh <dominique@unruh.de>
% March 2001, October 2001
% - braille yields error, if invalid points are used in \braillbox
% - Option compact causes loading of \braille and tables to be ommitted
% (saves memory)
% - Option 8dots enables 8-dot braille
% - Option mirror mirrors.
% - Options useemptybox, puttinydots, 8dots, mirror can be switched on and off
% inside the document via \ifbraille...true and \ifbraille...false
% - Documentation in the header of braille.sty updated to reflect above
% changes
% - \braille{} command
% - compatible with e-LaTeX's r2l mode.
%
%
% This package defines macros, commands, and fonts to typeset 6- or
% 8-dot braille symbols for the blinds. Both Grade 1 and 2 Braille are
% supported. All 189 Grade 2 contractions are defined; however, some
% puctuation symbols are missing, simply because I couldn't find them.
%
% Normally,
% \usepackage{braille}
% is sufficient. The command \braille{} takes braille "text" which is
% made up of single character or string enclosed in {}. It converts
% "text" arguments into braille tags and calls predefined TeX macros to
% print out the braille symbols. For example,
% \usepackage{braille}
% \braille{I {like} {com}put{er}}
% will print braille symbols for
% 'I', 'like', 'com', 'p', 'u', 't', 'er'
% along with the 2 spaces.
%
% In the argument, whitespaces are processed by TeX in the usual manner.
% Multiple whitespaces (' ', '\t', '\n') collapse to single space. If
% extra spacing is needed, then it must come from outside of \braille{}.
%
% Examples:
% \braille{September {Number}1998}
% \braille{I run L{in}ux Slackw{ar}e {Number}3.3}
% \braille{{Capital}{this} is LaTeX package {for} {braille} {ou}tput.}
% \braille{I {also} wrote Py{th}on script {for} {con}v{er}t{ing}
% text {to}{braille}.}
%
% Therefore, you can type braille paragraph just as you would type
% normal text paragraph. To print single character, type that
% character. To print multi-character contraction, type that string
% enclosed in {}.
%
% Note that the \braille command assumes English text. Other languages have
% other abbreviations.
%
% The package is used as
% \usepackage[puttinydots,useemptybox,compact,8dots]{braille}
% where
% puttinydots -- puts {\tiny.} at all dot positions for visual check
% useemptybox -- uses empty braille box instead of \hskip
% compact -- load only command \braillebox, not \braille (saves
% memory)
% 8dots -- display 8-dot braille (not used by \braille)
% mirror -- mirrors each braille box (for "printing" braille by hand
% with a needle, use e-LaTeX to get right-to-left
% writing).
% You may activate or deactive inside the document
% puttinydots by \brailleputtinydotstrue resp. \brailleputtinydotsfalse
% useemptybox by \brailleuseemptyboxtrue resp. \brailleuseemptyboxfalse
% 8dots by \brailleeightdotstrue resp. \brailleeightdotsfalse
% mirror by \braillemirrortrue resp. \braillemirrorfalse
%
% Four macros are available to the user:
% \braillebox{} -- LaTeX picture box used as braille font
% \brailleunit -- \unitlength for \braillebox{}
% \brailledot{} -- actual dot printed in \braillebox{}
% \braille{} -- main user command (unless option compact is
% activated)
%
% Additional vertical space between paragraphs may be necessary, since
% \parskip=0pt is default. \braillebox{} is simple LaTeX picture box
% \begin{picture}(2,3) ... \end{picture}
% containing the actual patterns of dot which are placed with
% \put(0.5,0.5){\brailledot} ...
% The size and shape of braille box and dot can be changed by modifying
% \brailleunit and \brailledot{}, respectively.
%
%
% List of TeX macros and braille symbols defined here is summarized in
% summary.tex -- "Summary of Grade 1 and 2 Braille"
% summary.ps
% In order to type the braille tags manually, user would have to know
% Braille. To make it easier for people who don't know Braille, I wrote
% Python scripts to convert ordinary ASCII text into grade 1 and 2
% braille tags:
% grade1.py -- converts text into grade 1 braille
% grade2.py -- converts text into grade 2 braille
% which behave like any Unix filters. Since my knowledge of Braille is
% limited, there will be errors and omissions. So, check with a braille
% expert.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{braille}
% With options
% puttinydots = put {\tiny.} at all dot positions
% useemptybox = use empty braille box for space, not \hskip
% Usage: \braillebox{12345678}
% Put dot (\brailledot) at positions 1, 2, 3, 4, 5, 6, 7, 8
% Dot locations:
% 14
% 25
% 36
% 78
%
\newlength{\brailleunit} % size of box containing one dot
\setlength{\brailleunit}{2mm}
\newcommand{\brailledot}{\circle*{0.6}}
\newif\ifbrailleputtinydots
\newif\ifbrailleeightdots
\newif\ifbraillecompact
\newif\ifbrailleuseemptybox
\newif\ifbraillemirror
\DeclareOption{puttinydots}{\brailleputtinydotstrue}
\DeclareOption{8dots}{\brailleeightdotstrue}
\DeclareOption{compact}{\braillecompacttrue}
\DeclareOption{useemptybox}{\brailleuseemptyboxtrue}
\DeclareOption{mirror}{\braillemirrortrue}
\ProcessOptions
\newcommand{\braillebox}[1]{{\unitlength=\brailleunit
\ifx\TeXXeTstate\undefined\else\ifnum\TeXXeTstate=0\else\beginL\fi\fi
\kern0.5\unitlength
\ifbrailleeightdots
\raisebox{-0.5\unitlength}[4\unitlength]{%
\begin{picture}(2,4)(0,-1)
\ifbrailleputtinydots\put@tinydots\fi
\put@dot{#1}
\end{picture}}%
\else
\raisebox{-0.5\unitlength}[3\unitlength]{%
\begin{picture}(2,3)
\ifbrailleputtinydots\put@tinydots\fi
\put@dot{#1}
\end{picture}}%
\fi
\kern0.5\unitlength
\ifx\TeXXeTstate\undefined\else\ifnum\TeXXeTstate=0\else\endL\fi\fi}}
\newcommand{\put@tinydots}{%
\put(0.5,2.5){\makebox[0pt]{\tiny.}}
\put(0.5,1.5){\makebox[0pt]{\tiny.}}
\put(0.5,0.5){\makebox[0pt]{\tiny.}}
\put(1.5,2.5){\makebox[0pt]{\tiny.}}
\put(1.5,1.5){\makebox[0pt]{\tiny.}}
\put(1.5,0.5){\makebox[0pt]{\tiny.}}
\ifbrailleeightdots
\put(0.5,-.5){\makebox[0pt]{\tiny.}}%
\put(1.5,-.5){\makebox[0pt]{\tiny.}}\fi}
\newcommand{\put@dot}[1]{\@tfor\tempyyy:=#1\do{\ifcase\tempyyy
\PackageError{braille}{Bad dots #1}%
{Can only display dots 1-8}\or
\put(\ifbraillemirror1\else0\fi.5,2.5){\brailledot}\or
\put(\ifbraillemirror1\else0\fi.5,1.5){\brailledot}\or
\put(\ifbraillemirror1\else0\fi.5,0.5){\brailledot}\or
\put(\ifbraillemirror0\else1\fi.5,2.5){\brailledot}\or
\put(\ifbraillemirror0\else1\fi.5,1.5){\brailledot}\or
\put(\ifbraillemirror0\else1\fi.5,0.5){\brailledot}\or
\ifbrailleeightdots\put(\ifbraillemirror1\else0\fi.5,-.5){\brailledot}\else
\PackageError{braille}{Bad dots in #1}{Use option 8dots to use
eight dot braille}\fi\or
\ifbrailleeightdots\put(\ifbraillemirror0\else1\fi.5,-.5){\brailledot}\else
\PackageError{braille}{Bad dots in #1}{Use option 8dots to use
eight dot braille}\fi\else
\PackageError{braille}{Bad dots #1}%
{Can only display dots 1-8}\fi}}
\ifbraillecompact
\newcommand\braille[1]{\PackageError{braille}{Command \protect\braille\space
not loaded}{Do not use option compact, then you will get
\protect\braille}}
\else
% \newcommand{\braille}[1]{\@tfor\tempxxx:=#1\do{\old@char{\tempxxx}}}
%
% \braille{ab{the} c} runs sequence of predefined command associated
% with each character or string in {}. For example,
% \BRAILLEa\BRAILLEb\BRAILLEthe\BRAILLEc
% Skips all whitespaces.
%
%
% {\obeyspaces\gdef\braille{\begingroup\obeyspaces\@braille}}
% \def\@braille#1{\@tfor\tempxxx:=#1\do{\old@char{\tempxxx}}\endgroup}
%
% Here, each space is dutifully printed with \hskip. However, since
% any previous spaces are removed with \unskip, multiple spaces
% collapse to one space. It still skips \t and \n, though. So, for
% multiple lines, put spaces at the beginning of each line. Spaces
% at the end of line will be ignored.
%
%
% -- Fixed by Dominique:
%
\def\braille{\begingroup
\catcode`\ =12
\catcode`\^^M=12
\let\brl@@spc\undefined
\@braille}
\def\@braille#1{\@tfor\tempxxx:=#1\do{\old@char{\tempxxx}%
\let\brl@@spc\brl@spc\let\brl@spc\undefined}\endgroup}
% \new@char{new}{commands} define \BRAILLE... command
% \old@char{old} run \BRAILLE... command
%
\newcommand{\new@char}[2]{%
\@ifundefined{BRAILLE#1}%
{\@namedef{BRAILLE#1}{#2}}%
{\@latex@error{Braille symbol for {#1} already defined}\@ehc}%
}
\newcommand{\old@char}[1]{%
\@ifundefined{BRAILLE#1}%
{\@latex@error{Braille symbol for {#1} not defined}\@ehc}%
{\@nameuse{BRAILLE#1}}%
}
% \def@char{new}{123456} define one braille code
% \ln@char{old}{new} ln old new
% \ln@@char{olda}{oldb}{new} ln olda+oldb new
% \prefix@char{123456}{old}{new} ln prefix+old new
% \suffix@char{old}{123456}{new} ln old+suffix new
%
\newcommand{\def@char}[2]{\new@char{#1}{\braillebox{#2}}}
\newcommand{\ln@char}[2]{\new@char{#2}{\old@char{#1}}}
\newcommand{\ln@@char}[3]{\new@char{#3}{\old@char{#1}\old@char{#2}}}
\newcommand{\prefix@char}[3]{\new@char{#3}{\braillebox{#1}\old@char{#2}}}
\newcommand{\suffix@char}[3]{\new@char{#3}{\old@char{#1}\braillebox{#2}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Defines \BRAILLE...
% where ... can be one or more characters.
% blank space -- Fixed by Dominique:
\newcommand\brl@space{%
\ifx\brl@@spc\undefined
\ifbrailleuseemptybox
\relax\braillebox{}\relax
\else
\unskip\hskip3\brailleunit\relax
\fi\fi
\let\brl@spc\@ne} % 6mm
\new@char{ }{\brl@space}
\catcode`\^^M=12\relax%
\new@char{^^M}{\brl@space}%
\catcode`\^^M=5\relax%
% Prefix
\def@char{Number}{3456}
\def@char{Letter}{56}
\def@char{Capital}{6}
\ln@@char{Capital}{Capital}{Upper}
\def@char{Italic}{46}
% Letter and number
\def@char{a}{1} \prefix@char{6}{a}{A} \ln@char{a}{1}
\def@char{b}{12} \prefix@char{6}{b}{B} \ln@char{b}{2} \ln@char{b}{but}
\def@char{c}{14} \prefix@char{6}{c}{C} \ln@char{c}{3} \ln@char{c}{can}
\def@char{d}{145} \prefix@char{6}{d}{D} \ln@char{d}{4} \ln@char{d}{do}
\def@char{e}{15} \prefix@char{6}{e}{E} \ln@char{e}{5} \ln@char{e}{every}
\def@char{f}{124} \prefix@char{6}{f}{F} \ln@char{f}{6} \ln@char{f}{from}
\def@char{g}{1245} \prefix@char{6}{g}{G} \ln@char{g}{7} \ln@char{g}{go}
\def@char{h}{125} \prefix@char{6}{h}{H} \ln@char{h}{8} \ln@char{h}{have}
\def@char{i}{24} \prefix@char{6}{i}{I} \ln@char{i}{9}
\def@char{j}{245} \prefix@char{6}{j}{J} \ln@char{j}{0} \ln@char{j}{just}
\def@char{k}{13} \prefix@char{6}{k}{K} \ln@char{k}{knowledge}
\def@char{l}{123} \prefix@char{6}{l}{L} \ln@char{l}{like}
\def@char{m}{134} \prefix@char{6}{m}{M} \ln@char{m}{more}
\def@char{n}{1345} \prefix@char{6}{n}{N} \ln@char{n}{not}
\def@char{o}{135} \prefix@char{6}{o}{O}
\def@char{p}{1234} \prefix@char{6}{p}{P} \ln@char{p}{people}
\def@char{q}{12345} \prefix@char{6}{q}{Q} \ln@char{q}{quite}
\def@char{r}{1235} \prefix@char{6}{r}{R} \ln@char{r}{rather}
\def@char{s}{234} \prefix@char{6}{s}{S} \ln@char{s}{so}
\def@char{t}{2345} \prefix@char{6}{t}{T} \ln@char{t}{that}
\def@char{u}{136} \prefix@char{6}{u}{U} \ln@char{u}{us}
\def@char{v}{1236} \prefix@char{6}{v}{V} \ln@char{v}{very}
\def@char{w}{2456} \prefix@char{6}{w}{W} \ln@char{w}{will}
\def@char{x}{1346} \prefix@char{6}{x}{X} \ln@char{x}{it}
\def@char{y}{13456} \prefix@char{6}{y}{Y} \ln@char{y}{you}
\def@char{z}{1356} \prefix@char{6}{z}{Z} \ln@char{z}{as}
% Punctuation
\def@char{,}{2} \ln@char{,}{ea}
\def@char{;}{23} \ln@char{;}{bb} \ln@char{;}{be}
\def@char{:}{25} \ln@char{:}{cc} \ln@char{:}{con}
\def@char{.}{256} \ln@char{.}{$} \ln@char{.}{dd} \ln@char{.}{dis}
\def@char{!}{235} \ln@char{!}{ff} \ln@char{!}{to}
\def@char{(}{2356} \ln@char{(}{)} \ln@char{(}{gg} \ln@char{(}{were}
\def@char{``}{236} \ln@char{``}{?} \ln@char{``}{his}
\def@char{''}{356} \ln@char{''}{by} \ln@char{''}{was}
\def@char{-}{36} \ln@char{-}{com}
\def@char{'}{3}
\def@char{/}{34}
\prefix@char{6}{(}{[}
\suffix@char{)}{3}{]}
\prefix@char{6}{``}{.`} % `...' is same as {.`}...{'.} which is
\suffix@char{''}{3}{'.} % similar to actual braille code.
\ln@@char{in}{in}{*}
\ln@@char{:}{p}{percent} % spell out \%
% Multi letter
\def@char{and}{12346}
\def@char{for}{123456}
\def@char{of}{12356}
\def@char{the}{2346}
\def@char{with}{23456}
\def@char{ch}{16} \ln@char{ch}{child}
\def@char{sh}{146} \ln@char{sh}{shall}
\def@char{th}{1456} \ln@char{th}{this}
\def@char{wh}{156} \ln@char{wh}{which}
\def@char{ou}{1256} \ln@char{ou}{out}
\def@char{st}{34} \ln@char{st}{still} % same as /
\def@char{ar}{345}
\def@char{er}{12456}
\def@char{ed}{1246}
\def@char{gh}{126}
\def@char{ow}{246}
% Miscellaneous
\def@char{ble}{3456} % same as {Number}
\def@char{ing}{346}
\def@char{in}{35}
\ln@@char{in}{to}{into}
\def@char{en}{26} \ln@char{en}{enough}
% Final letter contraction
\prefix@char{46}{d}{ound}
\prefix@char{46}{e}{ance}
\prefix@char{46}{n}{sion}
\prefix@char{46}{s}{less}
\prefix@char{46}{t}{ount}
\prefix@char{56}{e}{ence}
\prefix@char{56}{g}{ong}
\prefix@char{56}{l}{ful}
\prefix@char{56}{n}{tion}
\prefix@char{56}{s}{ness}
\prefix@char{56}{t}{ment}
\prefix@char{56}{y}{ity}
\prefix@char{6}{n}{ation}
\prefix@char{6}{y}{ally}
% Initial letter contraction
\prefix@char{45}{u}{upon}
\prefix@char{45}{w}{word}
\prefix@char{45}{th}{those}
\prefix@char{45}{wh}{whose}
\prefix@char{45}{the}{these}
\prefix@char{456}{c}{cannot}
\prefix@char{456}{h}{had}
\prefix@char{456}{m}{many}
\prefix@char{456}{s}{spirit}
\prefix@char{456}{w}{world}
\prefix@char{456}{the}{their}
\prefix@char{5}{d}{day}
\prefix@char{5}{e}{ever}
\prefix@char{5}{f}{father}
\prefix@char{5}{h}{here}
\prefix@char{5}{k}{know}
\prefix@char{5}{l}{lord}
\prefix@char{5}{m}{mother}
\prefix@char{5}{n}{name}
\prefix@char{5}{o}{one}
\prefix@char{5}{p}{part}
\prefix@char{5}{q}{question}
\prefix@char{5}{r}{right}
\prefix@char{5}{s}{some}
\prefix@char{5}{t}{time}
\prefix@char{5}{u}{under}
\prefix@char{5}{w}{work}
\prefix@char{5}{y}{young}
\prefix@char{5}{ch}{character}
\prefix@char{5}{th}{through}
\prefix@char{5}{wh}{where}
\prefix@char{5}{ou}{ought}
\prefix@char{5}{the}{there}
% Abbreviation for whole word
\new@char{about}{\braille{ab}}
\new@char{above}{\braille{abv}}
\new@char{according}{\braille{ac}}
\new@char{across}{\braille{acr}}
\new@char{after}{\braille{af}}
\new@char{afternoon}{\braille{afn}}
\new@char{afterward}{\braille{afw}}
\new@char{again}{\braille{ag}}
\new@char{against}{\braille{ag{st}}}
\new@char{almost}{\braille{alm}}
\new@char{already}{\braille{alr}}
\new@char{also}{\braille{al}}
\new@char{although}{\braille{al{th}}}
\new@char{altogether}{\braille{alt}}
\new@char{always}{\braille{alw}}
\new@char{because}{\braille{{be}c}}
\new@char{before}{\braille{{be}f}}
\new@char{behind}{\braille{{be}h}}
\new@char{below}{\braille{{be}l}}
\new@char{beneath}{\braille{{be}n}}
\new@char{beside}{\braille{{be}s}}
\new@char{between}{\braille{{be}t}}
\new@char{beyond}{\braille{{be}y}}
\new@char{blind}{\braille{bl}}
\new@char{braille}{\braille{brl}}
\new@char{children}{\braille{{ch}n}}
\new@char{conceive}{\braille{{con}cv}}
\new@char{conceiving}{\braille{{con}cvg}}
\new@char{could}{\braille{cd}}
\new@char{deceive}{\braille{dcv}}
\new@char{deceiving}{\braille{dcvg}}
\new@char{declare}{\braille{dcl}}
\new@char{declaring}{\braille{dclg}}
\new@char{either}{\braille{ei}}
\new@char{first}{\braille{f{st}}}
\new@char{friend}{\braille{fr}}
\new@char{good}{\braille{gd}}
\new@char{great}{\braille{grt}}
\new@char{herself}{\braille{h{er}f}}
\new@char{him}{\braille{hm}}
\new@char{himself}{\braille{hmf}}
\new@char{immediate}{\braille{imm}}
\new@char{its}{\braille{xs}}
\new@char{itself}{\braille{xf}}
\new@char{letter}{\braille{lr}}
\new@char{little}{\braille{ll}}
\new@char{much}{\braille{m{ch}}}
\new@char{must}{\braille{m{st}}}
\new@char{myself}{\braille{myf}}
\new@char{necessary}{\braille{nec}}
\new@char{neither}{\braille{nei}}
\new@char{o'clock}{\braille{o'c}}
\new@char{oneself}{\braille{{one}f}}
\new@char{ourselves}{\braille{{ou}rvs}}
\new@char{paid}{\braille{pd}}
\new@char{perceive}{\braille{p{er}cv}}
\new@char{perceiving}{\braille{p{er}cvg}}
\new@char{perhaps}{\braille{p{er}h}}
\new@char{quick}{\braille{qk}}
\new@char{receive}{\braille{rcv}}
\new@char{receiving}{\braille{rcvg}}
\new@char{rejoice}{\braille{rjc}}
\new@char{rejoicing}{\braille{rjcg}}
\new@char{said}{\braille{sd}}
\new@char{should}{\braille{{sh}d}}
\new@char{such}{\braille{s{ch}}}
\new@char{themselves}{\braille{{the}mvs}}
\new@char{thyself}{\braille{{th}yf}}
\new@char{today}{\braille{td}}
\new@char{together}{\braille{tgr}}
\new@char{tomorrow}{\braille{tm}}
\new@char{tonight}{\braille{tn}}
\new@char{would}{\braille{wd}}
\new@char{your}{\braille{yr}}
\new@char{yourself}{\braille{yrf}}
\new@char{yourselves}{\braille{yrvs}}
\fi
|