Page LayoutProblem with exact table placement

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
dagna
Posts: 16
Joined: Wed Mar 03, 2010 7:28 pm

Problem with exact table placement

Post by dagna »

Hi!

In one chapter i have some tables. It looks like:
text1 blablqvlavlavlablablablabla

[table1]

text2 blablqvlavlavlablablablabla

[table2]

text3 blablqvlavlavlablablablabla
I need to have tables exactly in plase, where I put them. I tried to use /table[h], but not works. Is any method to forse latex to input table exactly where I want to?

Best regards!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Problem with exact table placement

Post by gmedina »

Hi,

there are at least two options to prevent your tables from floating.

1) Do not to use the table floating environment; in its stead, use minipages and the \captionof command from the caption package (if the tabular material requires caption). A little example:

Code: Select all

\documentclass{article}
\usepackage{caption}

\begin{document}

text text text text

\noindent\begin{minipage}{\linewidth}
  \centering
  \begin{tabular}{cc}\hline
    column1 & column2 \\\hline
  \end{tabular}
  \captionof{table}{a non-floating table}
  \label{tab:test1}
\end{minipage}

text text text text

\noindent\begin{minipage}{\linewidth}
  \centering
  \begin{tabular}{cc}\hline
    column1 & column2 \\\hline
  \end{tabular}
  \captionof{table}{another non-floating table}
  \label{tab:test2}
\end{minipage}

text text text text
\end{document}
2) Use the H modifier from the float package:

Code: Select all

\documentclass{article}
\usepackage{float}

\begin{document}

text text text text

\begin{table}[H]
  \centering
  \begin{tabular}{cc}\hline
    column1 & column2 \\\hline
  \end{tabular}
  \caption{a non-floating table}
  \label{tab:test1}
\end{table}

text text text text

\begin{table}[H]
  \centering
  \begin{tabular}{cc}\hline
    column1 & column2 \\\hline
  \end{tabular}
  \caption{another non-floating table}
  \label{tab:test2}
\end{table}

text text text text
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
dagna
Posts: 16
Joined: Wed Mar 03, 2010 7:28 pm

Problem with exact table placement

Post by dagna »

gmedina wrote:
2) Use the H modifier from the float package:

Code: Select all

\documentclass{article}
\usepackage{float}

\begin{document}

text text text text

\begin{table}[H]
  \centering
  \begin{tabular}{cc}\hline
    column1 & column2 \\\hline
  \end{tabular}
  \caption{a non-floating table}
  \label{tab:test1}
\end{table}

text text text text

\begin{table}[H]
  \centering
  \begin{tabular}{cc}\hline
    column1 & column2 \\\hline
  \end{tabular}
  \caption{another non-floating table}
  \label{tab:test2}
\end{table}

text text text text
\end{document}
It's works! Thank you very much for help :)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Problem with exact table placement

Post by localghost »

I would have started with [!ht] as placement specifiers. The exclamation mark is often underestimated.


Best regards
Thorsten
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Problem with exact table placement

Post by gmedina »

localghost wrote:I would have started with [!ht] as placement specifiers...
Yes, you're right!
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply