LaTeX2e package for typesetting Braille

William Park <opengeometry@yahoo.ca>

April 1999

## 1 Introduction

This package allows user to produce Braille documents on paper for the blind without knowing Braille which can take years to learn. Essentially, Python scripts grade1.py and grade2.py convert ordinary text to grade 1 and 2 braille tags; then, LaTeX2e package braille.sty takes the tags and prints out corresponding braille symbols.

## 2 braille.sty

LaTeX2e package braille.sty defines macros, commands, and fonts to typeset 6-dot braille symbols. 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. List of TeX macros and braille symbols can be found in summary.tex and summary.pdf. The full usage is

    \usepackage[puttinydots,useemptybox]{braille}

where `puttinydots` puts `{\tiny.}` at all dot positions for visual check, and `useemptybox` uses empty braille box instead of `\hskip`. In addition, 4 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

The command `\braille{}` is used to print braille "text" or tags which are made up of

- single characters, such as `a`, `b`, `1`, `?`, `!`
- string enclosed in {}, such as `{this}`, `{every}`, `{his}`, `{''}`

For example, given input text of `I {like} {com}put{er}`, it will print braille symbols for I, like, com, p, u, t, er, along with the 2 spaces. 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 {}. Because of the way TeX processes macro arguments, if the argument is more than one line, then put at least one space after newline (`\n`). Spaces at the end of line, and tabs and newlines everywhere are ignored; but, multiple spaces in between words collapse to single space.

For example, if you want to insult someone,

    \usepackage{braille}
    \braille{May you live in an interesting time.}

will print grade 1 braille,

and

    \braille{May {you} live {in} an {in}t{er}e{st}{ing} {time}.}

will print grade 2 braille,

Now, if you can read and write Braille, then you can type the braille tags manually. But, since my knowledge of Braille is limited and recent, I wrote Python scripts to generate the braille tags automatically.

## 3 grade1.py, grade2.py

Grade 1 Braille is simple character-by-character translation of text. Most braille tags are the same as text characters. However, some puctuation markups, such as double and single quotations, are made up of multi-character string which must be enclosed in {} in order to be understood by LaTeX.

Grade 2 Braille defines translation of 189 common strings and where they can be used. Since braille tags here are the same multi-character string as the text, they must be enclosed in {}. The complexity of grade 2 is not so much in the replacement of strings, words, or part of words, but it is in figuring out whether the replacement can take place. The rules for applying grade 2 contractions are complicated with many exceptions; sometimes you can replace it, sometimes you can't.

The Python scripts grade1.py and grade2.py take ordinary text and generate grade 1 and 2 braille tags as defined by braille.sty. Since the output is returned all in one line, the scripts are originally designed to be used from text editor which can format a long line into multi-line paragraph. The command line usages are

  python grade1.py < text_file > tag_file
  python grade2.py < text_file > tag_file

or their usage as python module are

  string = grade1.convert(string)
  string = grade2.convert(string)

## 4 Table of Contents

- 1 Introduction
- 2 braille.sty
- 3 grade1.py, grade2.py
- 4 Table of Contents