Go to the first, previous, next, last section, table of contents.

Why does it do that?

What's going on in my \include commands?

The original LaTeX provided the \include command to address the problem of long documents: with the relatively slow computers of the time, the companion \includeonly facility was a boon. With the vast increase in computer speed, \includeonly is less valuable (though it still has its place in some very large projects). Nevertheless, the facility is retained in current LaTeX, and causes some confusion to those who misunderstand it.

In order for \includeonly to work, \include makes a separate .aux file for each included file, and makes a `checkpoint' of important parameters (such as page, figure, table and footnote numbers); as a direct result, it must clear the current page both before and after the \include command. What's more, this mechanism doesn't work if a \include command appears in a file that was \included itself: LaTeX diagnoses this as an error.

So, we can now answer the two commonest questions about \include:

Why does it ignore paragraph parameters?

When TeX is laying out text, it doesn't work from word to word, or from line to line; the smallest complete unit it formats is the paragraph. The paragraph is laid down in a buffer, as it appears, and isn't touched further until the end-paragraph marker is processed. It's at this point that the paragraph parameters have effect; and it's because of this sequence that one often makes mistakes that lead to the paragraph parameters not doing what one would have hoped (or expected).

Consider the following sequence of LaTeX:

  {\raggedright % declaration for ragged text
  Here's text to be ranged left in our output,
  but it's the only such paragraph, so we now
  end the group.}

  Here's more that needn't be ragged...

TeX will open a group, and set the ragged-setting parameters within that group; it will then save a couple of sentences of text and close the group (thus restoring the previous value of the ragged-setting parameters). Then it encounters a blank line, which it knows to treat as a \par token, so it typesets the two sentences; but because the enclosing group has now been closed, the parameter settings have been lost, and the paragraph will be typeset normally.

The solution is simple: close the paragraph inside the group, so that the setting parameters remain in place. An appropriate way of doing that is to replace the last three lines above with:

  end the group.\par}
  Here's more that needn't be ragged...

In this way, the paragraph is completed while the setting parameters are still in force within the enclosing group.

Another alternative is to define an environment that does the appropriate job for you. For the above example, LaTeX already defines an appropriate one:

  Here's text to be ranged left...

What's the reason for `protection'?

Sometimes LaTeX saves data it will reread later. These data are often the argument of some command; they are the so-called moving arguments. (`Moving' because data are moved around.) Places to look for are all arguments that may go into table of contents, list of figures, etc.; namely, data that are written to an auxiliary file and read in later. Other places are those data that might appear in head- or footlines. Section headers and figure captions are the most prominent examples; there's a complete list in Lamport's book (see TeX-related books).

What's going on really, behind the scenes? The commands in the moving arguments are already expanded to their internal structure during the process of saving. Sometimes this expansion results in invalid TeX code when processed again. ``\protect\cmd'' tells LaTeX to save \cmd as \cmd, without expansion.

What is a `fragile command'? It's a command that expands into illegal TeX code during the save process.

What is a `robust command'? It's a command that expands into legal TeX code during the save process.

No-one (of course) likes this situation; the LaTeX3 team have removed the need for protection of some things in the production of LaTeX2e, but the techniques available to them within current LaTeX mean that this is an expensive exercise. It remains a long-term aim of the team to remove all need for these things.

Why doesn't \verb work within...?

The LaTeX verbatim commands work by changing category codes. Knuth says of this sort of thing ``Some care is needed to get the timing right...'', since once the category code has been assigned to a character, it doesn't change. So \verb has to assume that it is getting the first look at its parameter text; if it isn't, TeX has already assigned category codes so that \verb doesn't have a chance. For example:


will work (typesetting `\error'), but


will not (it will attempt to execute \error). Other errors one may encounter are `\verb ended by end of line', or even `\verb illegal in command argument'.

This is why the LaTeX book insists that verbatim commands must not appear in the argument of any other command; they aren't just fragile, they're quite unusable in any command parameter, regardless of \protection.

Case-changing oddities

TeX provides two primitive commands \uppercase and \lowercase to change the case of text; they're not much used, but are capable creating confusion.

The two commands do not expand the text that is their parameter - the result of \uppercase{abc} is `ABC', but \uppercase{\abc} is always `\abc', whatever the meaning of \abc. The commands are simply interpreting a table of equivalences between upper- and lowercase characters. They have (for example) no mathematical sense, and

  \uppercase{About $y=f(x)$}

will produce

  ABOUT $Y=F(X)$

which is probably not what is wanted.

In addition, \uppercase and \lowercase do not deal very well with non-American characters, for example \uppercase{\ae} is the same as \ae.

LaTeX provides commands \MakeUppercase and \MakeLowercase which fixes the latter problem. These commands are used in the standard classes to produce upper case running heads for chapters and sections.

Unfortunately \MakeUppercase and \MakeLowercase do not solve the other problems with \uppercase, so for example a section title containing \begin{tabular} ... \end{tabular} will produce a running head containing \begin{TABULAR}. The simplest solution to this problem is using a user-defined command, for example:

   \section{A section title \protect\mytable{}
       with a table}

Note that \mytable has to be protected, otherwise it will be expanded and made upper case.

Why are # signs doubled in macros?

The way to think of this is that ## gets replaced by # in just the same way that #1 gets replaced by `whatever is the first argument'.

So if you define a macro and use it as:

  \def\a#1{+++#1+++#1+++#1+++}  \a{b}

the macro expansion produces `+++b+++b+++b+++', which people find normal. However, if we now replace part of the macro:

  \def\a#1{+++#1+++\def\x #1{xxx#1}}

\a{b} will expand to `+++b+++\def\x b{xxxb}'. This defines \x to be a macro delimited by b, and taking no arguments, which people may find strange, even though it is just a specialisation of the example above. If you want \a to define \x to be a macro with one argument, you need to write:

  \def\a#1{+++#1+++\def\x ##1{xxx##1}}

and \a{b} will expand to `+++b+++\def\x #1{xxx#1}', because #1 gets replaced by `b' and ## gets replaced by #.

To nest a definition inside a definition inside a definition then you need ####1, as at each stage ## is replaced by #. At the next level you need 8 #s each time, and so on.

Why does LaTeX split footnotes across pages?

LaTeX splits footnotes when it can think of nothing better to do. Typically, when this happens, the footnote mark is at the bottom of the page, and the complete footnote would overfill the page. LaTeX could try to salvage this problem by making the page short of both the footnote and the line with the footnote mark, but its priorities told it that splitting the footnote would be preferable.

As always, the best solution is to change your text so that the problem doesn't occur in the first place. Consider whether the text that bears the footnote could move earlier in the current page, or on to the next page.

If this isn't possible, you might want to change LaTeX's perception of its priorities: they're controlled by \interfootnotelinepenalty - the larger it is, the less willing LaTeX is to split footnotes.



inhibits split footnotes altogether, which will cause `Underfull \vbox' messages unless you also specify \raggedbottom. The default value of the penalty is 100, which is rather mild.

An alternative technique is to juggle with the actual size of the pages. \enlargethispage changes the size of the current page by its argument (for example, you might say \enlargethispage{\baselineskip} to add a single line to the page, but you can use any ordinary TeX length such as 15mm or -20pt as argument). Reducing the size of the current page could force the offending text to the next page; increasing the size of the page may allow the footnote to be included in its entirety. It may be necessary to change the size of more than one page.

Go to the first, previous, next, last section, table of contents.