5

This is similar, but not the same, as a previous question.

I want to do the following things:

  • Number tables and figures separately
  • Put tables exactly where I want them

To do the first one, I just use 'figure' and 'table' environments in the appropriate place. But the table environment doesn't seem work when I use \begin{table}{H}, which stops me being able to do the second thing. Any suggestions?

Correction: I should have said \begin{table}[H]

4
  • 1
    You need to include the float package and use [H] not {H}.
    – Werner
    Commented Mar 4, 2012 at 6:58
  • 1
    Please link this to the previous question.
    – qubyte
    Commented Mar 4, 2012 at 7:00
  • 1
    H is not a standard placement specifier. Please add a minimal working example (MWE) that illustrates your problem.
    – doncherry
    Commented Mar 4, 2012 at 9:20
  • @TomasLycken The question you linked to doesn't seem at all related to this, so I doubt that was what he was referring to. Commented Mar 4, 2012 at 14:47

2 Answers 2

10

As Werner noted in a comment, you should have square brackets ([]) rather than curly braces ({}) around the placement specifier. Also, as doncherry noted in another comment,H isn't a standard placement specifier.

Try \begin{table}[hp] instead, or if that doesn't work, try \begin{table}[!hp] (note the exclamation mark).

If you still do not achieve exactly what you want, then \usepackage{float} and try \begin{table}[H] as Werner suggested.

5
  • yeah, \usepackage{float} does the trick too.
    – Lucas
    Commented Mar 4, 2012 at 11:11
  • No. As Herbert provides, he shouldn't use a floating environment at all. Commented Mar 4, 2012 at 13:40
  • @MartinSchröder: Not using a floating environment at all does more than just changing the way LaTeX positions the table. Since the question explicitly talked about the table floating envirionment, I assumed they were a requirement. Commented Mar 4, 2012 at 14:39
  • @TomasLycken [h] or even [!h] shouldn't really be used as they almost inevitably take floats to the end of the document, almost always it is better to use [htp] or [!htp] see recent comments in tex.stackexchange.com/questions/46046/… Commented Mar 5, 2012 at 0:51
  • @DavidCarlisle: Noted, thanks! I chose to edit only to [hp], mainly because the t can induce behavior that is hard to troubleshoot (for example if you want the table after an orphaned line at the top of the page, LaTeX is likely to place the table above...). Now, h should be used whenever possible, and if there is no room a float page will be produced (if for no other purpose, to indicate that there isn't enough room for the table in the intended place). Commented Mar 5, 2012 at 1:48
10

Since you don't want your tables to float, don't use a float environment like figure but simulate it:

\documentclass[english]{article}
\usepackage{babel}
\usepackage{caption}
\usepackage{blindtext}%% only for demo

\begin{document}
\blindtext

\begin{center}
\captionof{table}{some noinsense text.}
\begin{tabular}{l}
Zeile 1\\
Zeile 2\\
Zeile 3\\
Zeile 4
\end{tabular}
\end{center}

\blindtext
\end{document}
1
  • Ah, so \captionof{table}{some noinsense text.} does all the TOC stuff if I don't put it any kind of float! Excellent.
    – Lucas
    Commented Mar 4, 2012 at 11:05

You must log in to answer this question.

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