TeX Frequently Asked Questions

How do I produce a double-spaced manuscript appropriate for copyediting?

\renewcommand\baselinestretch{2}

That makes it really long, and puts the page breaks in strange places, and
moves the figures around, but that’s okay; it’s not supposed to be pretty. It’s supposed to be easy for the copyeditor to annotate.

How do I suppress the running head or page number on a blank page?

Use \thispagestyle{empty}

How to I insert a completely blank page?

Use \cleardoublepage, which ensures that you’ll start on a new right-hand page, and use \thispagestyle{empty} to suppress the running head and page number on the blank page.

How do I spell check the text in my Latex project?

There are several tools available:

My figures are sticking out into the margins too much. How can I resize them?

Suppose you have graphics which may or may not be able to fit within the width of the page; if they will fit, then you want to set them at their natural size, but otherwise you want to scale the whole picture so that it fits within the page width. Follow these two steps.

  1.  Define a variable called \maxwidth, like so:
              \makeatletter
                   \def\maxwidth{%
                    \ifdim\Gin@nat@width>\linewidth
                        \linewidth
                       \else
                         \Gin@nat@width
                       \fi
                     }
                     \makeatother
  2. Include your image files using the new \maxwidth command:
    \includegraphics[width=\maxwidth]{figure}

How do I fix text overflow into the right margin?

Overflow is LaTex’s way of saying it needs human decision-making intervention. Try these options:

  1. globally suggest hyphenation for a nearby word in preamble using, for example, “\hyphenation{auto-maton}”
  2. hyphenate a troublesome word locally using “-”
  3. change the equation that you are considering breaking into a displayed equation
  4. force line break using “\linebreak”
  5. use \sloppy before first word of a paragraph and \fussy before first word of next paragraph (this relaxes the internal rules for how much text is placed on one line)
  6. use\kern to make all spaces in a line smaller (Example: If the line is overfull by 1 point, and there are 11 spaces on the line, including one after a period. Divide 1 point by 12 to get 0.083 points, put, \kern-0.166pt after the space following the period, and \kern-0.083pt after every other space.)
  7. reword/rewrite text

How do I include a frontispiece on page ii?

  1. Suppress the page number on page ii (use \thispagestyle{empty}).
  2. Insert the figure and then just put the caption text AFTER the figure on page ii, without actually putting the caption text inside a caption command. This prevents the assignment of a nonsense figure number.
  3. Don’t make the image too big to fit on the page. The width should be at most \textwidth, the width of the text column. If the natural width is okay, omit the shown code for the width option from the \includegraphics command; if the figure is large, shrink it using the code as is.
  4. When inserting caption text, use the “small” font command to make the font the same size as for captions. Then return it to normal with the “normalsize” command.
  5. There is no need to list the frontispiece in the list of figures, as long as it already has a caption and source.
  6. Thus, the code for frontispiece insertion:
    \thispagestyle{empty}
    \begin{figure}
    \includegraphics{width=\textwidth}{filename}
    \end{figure}
    |noindent \small{Description of frontispiece image.  \emph{Source:
    [insert relevant source info here].}}\normalsize

How do I create an index?

  • Mark the words to be indexed in the text, with \index{<term>} or:

 \index{<term>} or
\index{<term>!<secondary term>} or
\index{<term>!<secondary term>!<tertiary term>}.
 

Terms after the ‘!’ will align beneath the major term in the index. For example, if you enter \index{trees}, followed at some later point in your book with a subentry, \index{trees!pointy} (the primary entry followed by an exclamation mark and the new term); and for a subsub entry, you follow a similar sequence: \index{trees!pointy!green}, in the finished index, you will see

trees 24
    pointy 26
          green 30

  • Run XeLATEX on the file.

  • On the command line, or in the program you are using for editing your text, run makeindex filename. This will produce a <filename.ind> file.

  • Run LATEX on your file again; the index will appear where you have typed \printindex, at the end of your book.