| 1 |
<html><head><title> |
| 2 |
LaTeX2e package for typesetting Braille |
| 3 |
</title></head><body bgcolor="whitesmoke"> |
| 4 |
<center> |
| 5 |
<p><big><big>LaTeX2e package for typesetting Braille</big></big></p> |
| 6 |
<p><big>William Park <a href="mailto:[email protected]"><[email protected]></a></big></p> |
| 7 |
<p><big>April 1999</big></p> |
| 8 |
</center> |
| 9 |
<h2><a name="Sec1">1 Introduction</a></h2> |
| 10 |
<p>This package allows user to produce Braille documents on |
| 11 |
paper for the blind without knowing Braille which can take years to |
| 12 |
learn. Essentially, Python scripts <b>grade1.py</b> and |
| 13 |
<b>grade2.py</b> convert ordinary text to grade 1 and 2 braille tags; |
| 14 |
then, LaTeX2e package <b>braille.sty</b> takes the tags and prints out |
| 15 |
corresponding braille symbols. |
| 16 |
<h2><a name="Sec2">2 braille.sty</a></h2> |
| 17 |
LaTeX2e package <b>braille.sty</b> defines macros, commands, |
| 18 |
and fonts to typeset 6-dot braille symbols. Both Grade 1 and 2 |
| 19 |
Braille are supported. All 189 grade 2 contractions are defined; |
| 20 |
however, some puctuation symbols are missing simply because I couldn't |
| 21 |
find them. List of TeX macros and braille symbols can be found in |
| 22 |
<b>summary.tex</b> and <b>summary.pdf</b>. |
| 23 |
The full usage is |
| 24 |
<xmp>\usepackage[puttinydots,useemptybox]{braille}</xmp> |
| 25 |
where <tt>puttinydots</tt> puts <tt>{\tiny.}</tt> at all dot positions |
| 26 |
for visual check, and <tt>useemptybox</tt> uses empty braille box |
| 27 |
instead of <tt>\hskip</tt>. In addition, 4 macros are available to |
| 28 |
the user: |
| 29 |
<ul> |
| 30 |
<li><tt>\braillebox{}</tt> -- LaTeX picture box used as braille font |
| 31 |
<li><tt>\brailleunit</tt> -- <tt>\unitlength</tt> for <tt>\braillebox{}</tt> |
| 32 |
<li><tt>\brailledot{}</tt> -- actual dot printed in <tt>\braillebox{}</tt> |
| 33 |
<li><tt>\braille{}</tt> -- main user command |
| 34 |
</ul> |
| 35 |
The command <tt>\braille{}</tt> is used to print braille |
| 36 |
"text" or tags which are made up of |
| 37 |
<ul> |
| 38 |
<li> single characters, such as <tt>a</tt>, <tt>b</tt>, <tt>1</tt>, |
| 39 |
<tt>?</tt>, <tt>!</tt> |
| 40 |
<li> string enclosed in {}, such as <tt>{this}</tt>, <tt>{every}</tt>, |
| 41 |
<tt>{his}</tt>, <tt>{''}</tt> |
| 42 |
</ul> |
| 43 |
For example, given input text of <tt>I {like} {com}put{er}</tt>, it |
| 44 |
will print braille symbols for <i>I</i>, <i>like</i>, <i>com</i>, |
| 45 |
<i>p</i>, <i>u</i>, <i>t</i>, <i>er</i>, along with the 2 spaces. |
| 46 |
Therefore, you can type braille paragraph just as you would |
| 47 |
type normal text paragraph. To print single character, type that |
| 48 |
character. To print multi-character contraction, type that string |
| 49 |
enclosed in {}. Because of the way TeX processes macro arguments, if |
| 50 |
the argument is more than one line, then put at least one space after |
| 51 |
newline (<tt>\n</tt>). Spaces at the end of line, and tabs and |
| 52 |
newlines everywhere are ignored; but, multiple spaces in between words |
| 53 |
collapse to single space. |
| 54 |
<p>For example, if you want to insult someone, |
| 55 |
<pre> |
| 56 |
\usepackage{braille} |
| 57 |
\braille{May you live in an interesting time.} |
| 58 |
</pre> |
| 59 |
will print grade 1 braille, |
| 60 |
<p> <img height="72" width="636" src="braillegif1.gif"> |
| 61 |
<p>and |
| 62 |
<pre>\braille{May {you} live {in} an {in}t{er}e{st}{ing} {time}.}</pre> |
| 63 |
will print grade 2 braille, |
| 64 |
<p> <img height="72" width="534" src="braillegif2.gif"> |
| 65 |
<p>Now, if you can read and write Braille, then you can type |
| 66 |
the braille tags manually. But, since my knowledge of Braille is |
| 67 |
limited and recent, I wrote Python scripts to generate the braille |
| 68 |
tags automatically. |
| 69 |
<h2><a name="Sec3">3 grade1.py, grade2.py</a></h2> |
| 70 |
<p>Grade 1 Braille is simple character-by-character |
| 71 |
translation of text. Most braille tags are the same as text |
| 72 |
characters. However, some puctuation markups, such as double and |
| 73 |
single quotations, are made up of multi-character string which must be |
| 74 |
enclosed in {} in order to be understood by LaTeX. |
| 75 |
<p>Grade 2 Braille defines translation of 189 common strings |
| 76 |
and where they can be used. Since braille tags here are the same |
| 77 |
multi-character string as the text, they must be enclosed in {}. The |
| 78 |
complexity of grade 2 is not so much in the replacement of strings, |
| 79 |
words, or part of words, but it is in figuring out whether the |
| 80 |
replacement can take place. The rules for applying grade 2 |
| 81 |
contractions are complicated with many exceptions; sometimes you can |
| 82 |
replace it, sometimes you can't. |
| 83 |
<p>The Python scripts <b>grade1.py</b> and <b>grade2.py</b> |
| 84 |
take ordinary text and generate grade 1 and 2 braille tags as defined |
| 85 |
by <b>braille.sty</b>. Since the output is returned all in one line, |
| 86 |
the scripts are originally designed to be used from text editor which |
| 87 |
can format a long line into multi-line paragraph. The command line |
| 88 |
usages are |
| 89 |
<dl> |
| 90 |
<dd>python grade1.py < <i>text_file</i> > <i>tag_file</i> |
| 91 |
<dd>python grade2.py < <i>text_file</i> > <i>tag_file</i> |
| 92 |
</dl> |
| 93 |
or their usage as python module are |
| 94 |
<dl> |
| 95 |
<dd><i>string</i> = grade1.convert(<i>string</i>) |
| 96 |
<dd><i>string</i> = grade2.convert(<i>string</i>) |
| 97 |
</dl> |
| 98 |
<h2><a name="Sec4">4 Table of Contents</a></h2> |
| 99 |
<ul> |
| 100 |
<li> <a href="#Sec1">1 Introduction</a> |
| 101 |
<li> <a href="#Sec2">2 braille.sty</a> |
| 102 |
<li> <a href="#Sec3">3 grade1.py, grade2.py</a> |
| 103 |
<li> <a href="#Sec4">4 Table of Contents</a> |
| 104 |
</ul> |
| 105 |
</body></html> |