# Generating iTeX bundles.

iTeX bundles are tar files of a directory laid out in a specific way. Since version 1.3, this layout format has been relaxed to simplify generation.

Basically, we place documents in a directory in a specific format, and use tar(1) to collect them up in a file. That tar file, given the extension ".itex", is the bundle accepted by the iTeX app.

## Quick Start Guide

The minimum iTeX bundle contains just a single portrait PDF file and title and author information in a single directory:
	mkdir dir
echo "Care and Nomenclature of the Anopheles Mosquito" >dir/Title
cp portrait.pdf dir
(cd dir; tar cf - *) >flathead1.itex


Portrait.pdf is generated from the document source using pdflatex. Some sample boilerplate to get the formatting right for the iPad in portrait.tex:

\documentclass[onecolumn,oneside]{book}
\usepackage[screen, paperheight=7.60606060in,
paperwidth=5.8181818in,left=1in,right=1in,
top=1in,bottom=1in]{geometry}
\pagestyle{empty}
%% because \pagestyle{empty} does not work on the first page:
\usepackage{fancyhdr}
\fancypagestyle{plain}{%
\fancyhf{}%
\renewcommand{\footrulewidth}{0pt}%
}
\batchmode
% lucida bright is better for iPad-s low res 132 DPI. You probably don't have Lucida
% unless you bought it from TUG.
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{lucidabr}
%% -- end of iTeX mods

\begin{document}
\sloppy
\raggedbottom
%% itex \pagestyle{empty}	(remove pagestyle commands from your document)

\title{Care and Nomenclature of the Anopheles Mosquito}
\maketitle

...



\documentclass[twocolumn,oneside]{book}
\usepackage[screen, paperheight=5.6666666in,
paperwidth=7.75757575in,left=7mm,right=7mm,
top=7mm,bottom=5mm,twocolumn]{geometry}

...



For large type versions (also optional), use:

\documentclass[onecolumn,11pt,oneside]{book}
\usepackage[screen, paperheight=7.60606060in,
paperwidth=5.8181818in,left=1in,right=1in,
top=1in,bottom=1in]{geometry}

...


and
\documentclass[twocolumn,11pt,oneside]{book}
\usepackage[screen, paperheight=5.6666666in,
paperwidth=7.75757575in,left=7mm,right=7mm,
top=7mm,bottom=5mm,twocolumn]{geometry}

...


(Twelve point documents might be better.)

These quick-start bundles create a simplified iTeX bundle. The actual bundle format is slightly fancier and is described below. It should be used for real efforts to use iTeX, since planned features require it.

## Scripts

Below are the scripts used to generate LaTeX and iTeX bundles from Project Gutenberg and arXiv inputs. They are useful for automating the process.

Note: these scripts are crude and hacked up, brittle and unreliable. I welcome improvements and will gladly incorporate improvements.

## Creating the versions for the iPad

There are two sample scripts. The first is run on a standard LaTeX document, and generates four LaTeX documents with a shot at appropriate settings for the iPad:

   latextoipad [-t title] [-a author] [master-dir|mydoc.tex]

You can specify the path to your LaTeX document, or to a directory (default is the current directory.) If a directory is given, latextoipad> will attempt to find the primary LaTeX file.

The program will attempt to extract the title and author from the document, or you can specify them explicitly.

Four LaTeX files are created:

These may be hand-edited, run through scripts, or hand generated without latextoipad. The are put in whatever directory was used, and are input for the next step. The author and title are also saved in files and used automatically by the second step, if present.

## Creating iTeX bundle

genitex may be used to create the iTeX tar bundle, which uses the file extension .itex. Its input are the four (or two) files you generated above, and it writes an iTeX bundle to standard output. Sample use of both might be something like:

   latextoipad -a "William Cheswick" -t "Migratory Patterns of the Australian Frost Moth" moth.tex

genitex also has the -a and -t parameters to specify author and title, if those aren't available on files from the previous step. It also has an -rl parameter that specifies that the document is to be presented right-to-left, perhaps for Chinese, Japanese, Hebrew, or Arabic documents.

## Main scripts

These scripts are used to implement the itex translation server.

• itex_server: the network translation service software.
• guttolatex: convert a Gutenberg document to LaTeX. It uses a modified version of Gutenmark, which I should make available but haven't gotten around to yet.
• latextoipad: convert a fairly standard LaTeX document into several iPad versions for various sizes and both orientations.
• mkgutindex: fetch and process the latest Project Gutenberg library master list. I run this once a day to acquire information about each document, including available file types.
• exml: an efficient kludge to process the PG XML format.

## Auxilary tools

These scripts do some testing and analysis of iTeX bundles. They may be helpful in figuring out what is going on. These are all mostly quick hacks.

• itexisok: some crude tests to see if the bundle is okay. This should improve.
• pageisok: some checks to see if a page is ok.
• itextohtml: builds a web page showing all the images in the document.