## On formatting poems for e-readers — Part V. Use of TeXnicCenter to lay out PDF documents for print publication.

TeXnicCenter is a software system available free of charge from www.texniccenter.org It provides facilities for using the LaTeX formatting language to prepare documents suitable for printing, such as books of verse and textbooks.  It can format its output as a PDF file.  TeXnicCenter was used for the preparation of the paperback version of Farewell Rio.

Although Microsoft Word can also save documents as PDF files, TeXnicCenter and LaTeX provide superior formatting capabilities for print publication, especially superior capabilities for producing fully justified text in which the text of every full page has the same length, and for avoiding page breaks which isolate a single line at the bottom of a page (an orphan) or at the top of a page (a widow).

Use of TeXnicCenter requires more technical knowledge than the use of WYSIWYG editors like MSWord.  There are no hidden codes — all formatting codes are explicit.  The editor provided with TeXnicCenter makes available a number of valuable features, including a button to find the next formatting error.

Recommended documentation. Here are sources for some useful documentation:

Recommended plug-ins. The basic LaTeX package included in TeXnicCenter can, and should be, enhanced with optional plug-ins.  In order to add a plug-in, all that is required is to insert an appropriate \usepackage statement in the LaTeX document preamble.  The following statements were used in formatting Farewell Rio, and they can be recommended for a wide range of texts:

• \usepackage[paperwidth=5.5in, paperheight=8.5in, left=0.75in, right=0.5in]{geometry}
• \usepackage[T1]{fontenc}
• \usepackage{lmodern}
• \usepackage{microtype}
• \usepackage{verse}
• \usepackage{graphicx}

The parameters (between the square brackets) of the geometry package tell LaTeX what page size and margins to use.  You should set them as appropriate for your own book.

The fontenc and lmodern microtype packages provide LaTeX a useful set of fonts.  In particular, they allow you to enter accented characters with diacritical marks directly into the text of your document, just as you would in MSWord, without having to resort to the complicated coding scheme for accented characters that is described on page 24 of The (Not So) Short Introduction to LaTeX2e.

The microtype package provides additional fine control over the display of fonts.

The graphicx package provides a convenient set of commands for such graphic operations as scaling and rotation.

The verse package will help you meet the special requirements of formatting verse.

Importing an MSWord document into TeXnicCenter. The free program wsW2LTXGUI will convert an MSWord document to a format suitable for editing in TeXnicCenter.  In the conversion, it preserves much of the MSWord formatting, including italics and quotation marks.  Additional conversion routines can be found here.

Alternatively, you can simply use the Copy function in MSWord to pick up the text of an MSWord document and then Paste it into the TeXnicCenter editor.  However, if you do not use a conversion routine, you will have to do a lot of manual work to format the resulting document with appropriate codes.

Recommended settings. A LaTeX document begins with a preamble which contains a set of commands that specify the over-all form of the document, including such matters as add-in packages in use, page size, margins, list of available fonts and special hyphenation rules.  In addition to the \usepackage commands recommended above, I suggest that you might want to include the following commands in the preamble to your document, especially if your document contains significant amounts of expository text:

• \setlength{\emergencystretch}{3em}
This command attempts to avoid overlong lines that overlap the right margin.
• \hyphenation{list of hyphenated words such as Volks-wagen and Sér-gio, separated by spaces}
This command instructs the system how to hyphenate words that are not in its own hyphenation dictionary, particularly unusual proper names.
• %The following commands attempt to avoid widows and orphans.
\widowpenalty=2000
\clubpenalty=2000
\setlength{\parskip}{0.6ex plus 0.6ex minus 0.4ex}
These commands instruct the system to work hard to avoid widows and orphans and give it additional leeway to avoid widows and orphans by adjusting the spacing between paragraphs.  You may want to experiment with different values of the parameters inside the curly brackets of the \setlength{\parskip} command.  The line beginning with a % is just a comment to remind you why these commands are in the preamble.
• \newcommand{\romansection}[1]{\section*{\begin{center}\small #1\normalsize\end{center}}}
LaTeX allows its user to create user-defined commands using \newcommand.  The \romansection{} command, which I defined for use in Farewell Rio, makes it easy to separate sections of a document using, for example, Roman numerals.  In the text, if a section begins with the Roman numeral III, the break would be coded as \romansection{III}.

In the body of the text, I found the following tricks helpful to insert a blank space of a given size:  For a blank space 1.2 inches high, enter the following commands in the body of the text:

%The following insertion of a blank line is a trick to give
%the \vspace command a starting point.
\begin{verbatim}

\end{verbatim}
\vspace{1.2 in}
\begin{center}

The lines beginning with % signs are comments which serve only to remind you why these commands were inserted.  If you want a space of some other height, change the command \vspace{1.2 in} to reflect some other height.

Alternatively, to insert a blank space 7 points high following a line, end the line with the code \\[7pt] Of course, if you want some other height, replace 7pt with an appropriate amount.

Verse is set off between the codes \begin{verse} and \end{verse} .

Handling line length. The recommended preamble command, \setlength{\emergencystretch}{3em} , will avoid many problems with line length.  If your lines are too long, you can use some or all of the following measures to deal with them:

• Use a smaller font, at least for the part of the text where line length is a problem.  I used a smaller font for the poem fragments at the head of each chapter of Farewell Rio than the font used for the body of the text to avoid having a line of a poem flow onto the next line of the document.
• Use smaller indents.
• Adjust the margins and page size.
• Offer the system favorable opportunities for hyphenation by using the \hyphenation{} preamble command.
• Break the line where you want it to break using using the \\ code.  You may want to adopt some convention of indenting the part of the line following the break.

Tricks for avoiding widows and orphans. If it is instructed to do so, MSWord will eliminate all widows and orphans, but at the expense of a non-uniform page length which looks unprofessional in a printed book.  LaTex has a number of built-in adjustments for avoiding widows and orphans, while still retaining a uniform page length, but sometimes they don’t work.  In my experience, the recommended preamble command, \setlength{\parskip}{0.6ex plus 0.6ex minus 0.4ex}, got rid of most widows and orphans, but it left a few in some 270 pages.  A number of tricks for avoiding widows and orphans are mentioned in the recommended document, Notes On Page Makeup Using TeX .  The one which I found most useful was to force a page break using the \newpage command.  On a very few occasions, I was able to avoid widows and orphans by giving the system extra leeway to make paragraphs flow, as described in Notes On Page Makeup.  On some other occasions, I avoided widows and orphans by adjustment of the amount of blank space between paragraphs, or around a section break.  In the end, I got rid of all of them by hook or by crook, involving the manual inspection of every page.  Widows and orphans are probably of more concern in expository writing than they are in verse, where other considerations will predominate.