Consider the following MWE:

\RequirePackage[l2tabu, orthodox]{nag}
\documentclass[oneside, a4paper, 10pt]{book}



This throws the following warning:

Package nag Warning: \label in float, but not after \caption on input line 9.

As far as I understand it, nag expects to see a caption for the table and does not realize that the \label belongs to the \chapter. For semantic reasons pertaining to that particular table, I cannot give it a caption.

What are my options here, besides ignoring the warning?

(Please note that the thread Why does an environment's label have to appear after the caption? deals with a slightly different problem and this thread is not a duplicate.)

  • 2
    I don't really understand: if you use the H specifier and you don't want to give the table a caption, why using a table environment at all? – campa Oct 9 at 14:13
  • @campa Because it contains data that needs to be visually arranged in a tabular form (specifically, it's a table on the document title page with metadata about the document like creation date, a document ID, etc.) – LokiRagnarok Oct 9 at 14:15
  • 5
    Sorry, still not getting it: table (1) is a floating environment , but you are suppressing the floating, and (2) uses a predefined counter, but you are not issuing \caption. So basically you want a table which appears exactly there where you write it and without numbering. What's wrong with a simple tabular? – campa Oct 9 at 14:19
  • 3
    To add to @campa's objections: there is no requirement whatsoever that tabular be contained in a table environment; similarly, there's no requirement that \includegraphics be in a figure environment. – egreg Oct 9 at 14:30
  • @egreg Thanks for correcting my conceptual mistake about table and figure. If you add an answer, I'll accept it. – LokiRagnarok Oct 14 at 9:18

A common misconception is that a tabular environment needs a table environment around it. This is not true: to TeX, a tabular is just like a big character (a box, in more correct terminology), with its vertical and horizontal sizes and its reference point (that can be influenced by using the [t] or [b] options to \begin{tabular}).

The same holds for \includegraphics: it need not be inside a figure environment: it creates a box like for tabular and TeX uses this box.

Another common misconception is about the usefulness of the [H] option to \begin{table} provided by the float package. To the contrary, it is quite useless or, perhaps better said, dangerous for typesetting (elephant in a suitcase problem).

As a rule of thumb, any captioned object (image or tabular data) should be allowed to float; one can work on a more sensible placement, if possible, when the document is in final form for text and page dimensions. For non captioned objects, one can use nothing at all, just placing the object as a normal box, or use center, equation and so on depending on the object's nature.

In your case, I guess that a simple center environment is what you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.