I would like to change the position of my table so that it is not before the title of the current section as show in my screenshot enter image description here .

Here is what I've tried so far:

\subsection{Cinétique d'oxydation des joints de grains avec teneur nominale en chrome}

La cinétique blah blah blah
d'essai.

{\renewcommand{\arraystretch}{1.2}
\begin{table}
\centering
\caption{Données utilisées pour la calibration de la cinétique d'oxydation des joints de grains présentant une teneur nominale en chrome à 320/325°C}
\resizebox{\textwidth}{!}{
    \begin{tabular}{|c|c|c|c|c|}
    \hline
\textbf{Repère} & \textbf{Échantillon} & \textbf{pox max (nm)} &     \textbf{Température (°C)} & \textbf{Temps (h)} \\
    \hline
    \hline
B356 (TT 1h x 720°C) & 1816-22 & 10 & 325 & 0,16 \\
    \hline
T265 & 1866-20 & 307 & 325 & 100 \\
    \hline
B356 SA & 1866-187 & 847 & 320 & 1000 \\
    \hline
\end{tabular} 
}
\label{tab:calibrecinetique}
\end{table}}
\FloatBarrier

Sur la Figure

I have no idea why LaTeX always prints the table before the title, as I have enough place after (this is the beginning of the page). I've tried to use as for image the [H] to force the positionning, and also the FloatBarrier to force the cache of floating objects to be released (it would work if the table is printed ways after, which is not the case here).

  • 5
    you need \begin{table}[htp] in order to allow the figure to appear mid-page (h) also you might want to add \usepackage{flafter} which prevents figures ever floating backwards up the current page. – David Carlisle Mar 6 '16 at 9:50
  • 2
    Problem solved. Thank you so much! tex.se provides me with so many solutions, I can't see right know way to give back. I you make your comment a solution, I will mark my question as resolved. – philippe Mar 6 '16 at 10:01
  • The question is a duplicate of tex.stackexchange.com/questions/285238/… but the answer there only mentions flafter not also using h . maybe I will answer here as well . – David Carlisle Mar 6 '16 at 11:48
up vote 5 down vote accepted

I know that it is not a popular solution on this site but I like it anyway.

The float package offers an additional placement parameter/option called H. If you use it then the float object (figure or table) is exactly placed where you put it in the code.

Normally you want floating objects to float and let LaTeX decide where to put it. But with this approach you have full manual control of the float position if you want to.

You can still combine this approach with the other solutions mentioned here (flafter package and !htb placement parameter). Just decide from table to table (or figure and figure) what is best.

\documentclass{article}
\usepackage{float} % here for H placement parameter

\begin{document}

Text before table.    

\begin{table}[H] % placement parameter H
    \centering % if you want to center the table
    \caption{Table showing \ldots}
    \label{table:ExampleTable}
    % Code for table
\end{table}

Text after table.      

\end{document} 

By the way, normally you want to have a little unbreakable space between the number and the unit: 720\,°C or 720~°C. Where \, is a half space and ~ a full space. See here and here for further information. But this is not related to the question at all.

You need \begin{table}[htp] in order to allow the figure to appear mid-page (h).

Also you might want to add

\usepackage{flafter} 

which prevents figures ever floating backwards up the current page

So with flafter (but not h) the float will appear at the bottom of the current page or top of the next.

With [htpb] then without flafter the order that is tried is h, t on this page, b on this page, p, t on next page. (But it is t on this page that you want to avoid).

With [htpb] then withflafter the order that is tried is h, b on this page, p, t on next page.

Use the [!htbp] option. I also used makecell and siunitx to have a nicer formatting of the table, so you don't have to use \resizebox:

\documentclass[a4paper, french]{report}
\usepackage[utf8]{inputenc}
\usepackage[TS1,T1]{fontenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{geometry}
\usepackage{makecell, caption}
\renewcommand\theadfont{\normalsize\bfseries\boldmath}
\usepackage{siunitx}
\sisetup{detect-weight, range-phrase=/, range-units = single}
\usepackage{lipsum}
\renewcommand\thesection{\arabic{section}}
\setcounter{section}{3}

\begin{document}

\subsection{Cinétique d'oxydation des joints de grains avec teneur nominale en chrome}

\lipsum[2]

\begin{table}[!hbt]
  \centering\renewcommand{\arraystretch}{1.2}
  \caption{Données utilisées pour la calibration de la cinétique d'oxydation des joints de grains présentant une teneur nominale en chrome à \SIrange{320}{325}{\celsius}}
  \begin{tabular}{|c|c|c|c|c|}
    \hline
    \thead{Repère} & \thead{Échantillon} & \thead{pox max & & \\ (nm)} & \thead {Température \\ (\si{\celsius})} & \thead{Temps\\ (h)} \\
    \hline
    \hline
    B356 (TT 1\,h $ \times $ \SI{720}{\celsius}) & 1816-22 & 10 & 325 & 0,16 \\
    \hline
    T265 & 1866-20 & 307 & 325 & 100 \\
    \hline
    B356 SA & 1866-187 & 847 & 320 & 1000 \\
    \hline
  \end{tabular}
  \label{tab:calibrecinetique}
\end{table}

\lipsum[3]

\subsection{Cinétique d'oxydation des carbures de chrome}

\lipsum[5]

\end{document} 

enter image description here

  • @David Carlisle: Right. I changed to [!hbt] (top being last preferred). – Bernard Mar 6 '16 at 13:49
  • I agree floats should, well… float in general. However in some special circumstances, they shouldn't float too far away. – Bernard Mar 6 '16 at 14:03
  • Yes, I've learnt that today! For some reason, I thought the order of the letters was significant. Answer corrected. – Bernard Mar 6 '16 at 14:12

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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