4

I use in my document:

\begin{footnotesize}
..
\end{footnotesize}

This indeed give me footnote sized text, however nag is complaining:

Package nag Warning: There is no environment ``footnotesize''.

Why do I get this error and if this is not the right approach, what is the correct one?

1
  • 2
    It's not an environment, but a declaration. Use {\footnotesize <stuff>} or put it inside a \begingroup/\endgroup pair.
    – jon
    Commented Oct 23, 2016 at 6:29

2 Answers 2

8

Essentially lint checkers like nag can only check what they know, they are not a full specification of the language.

In this case it doesn't know that, by design, any declaration form can be used as an environment, so while just using \footnotesize is probably better and certainly more common, the environment form is also correct.

For font size commands it is usually best just to use the command without any grouping and rely on an outer environment

\begin{center}
\footnotesize
hello
\end{center}

here the close environment takes care of ending the paragraph in the scope of the size change.

If you go

{\footnotesize hello}

Then the size change ends before the paragraph so it is small text in a normal baseline, OK for a word but looks bad if there are any line breaks. You can use

{\footnotesize

}

But it is easy to forget and the environment form

\begin{footnotesize}
hello

\end{foootnotesize}

makes it perhaps even more likely to forget the blank line.

However it is still correct and if you know the paragraph ending isn't an issue, it can be useful,

\begin{footnotesize}
\begin{longtable}
.... thousand pages
\end{longtable}
\end{footnotesize}

Can make the source code easier to read than just having a trailing } after the table, thousands of lines of source file later than the matching {.

4

The "correct" way to use this switch is

{\footnotesize
...
}

\begin{foo} and \end{foo} internally just call commands \foo and \endfoo, respectively, surrounded by a local grouping. There's also an additional check that an environment started by \begin{foo} is properly closed by \end{foo}.

So in your example the expansion is roughly something like

{\footnotesize
...
\endfootnotesize}

The reason why your code still works is that the \endfoo command doesn't need to be defined. This is the case here, there's no \endfootnotesize, but \footnotesize is still called at the beginning of the environment. So \begin and \end work for many other commands beside environments too, even if they aren't defined via \newenvironment.

The nag package modifies a hard-coded list of font size (and other) commands to check what the current environment is whenever the font size command is called. If the environment appears to be the same as the command name, a warning is issued, otherwise nothing special happens.

Also see How to use \Large and its variants for a similar and more elaborate discussion.

1
  • Don't forget a trailing \par, if the text is meant to make a paragraph.
    – egreg
    Commented Oct 23, 2016 at 7:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .