Graphics, Figures & TablesMy table is never in its correct location

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
RaulYazbeck
Posts: 1
Joined: Thu Apr 02, 2020 2:12 pm

My table is never in its correct location

Post by RaulYazbeck »

Hey, I wrote this thing in french. I am more than a beginner in latex, and I can't understand why my table keeps getting pushed up, and what can I do to help it. I need it to be between my "...". Thank you very much for your help. I am using many packages, and due to tons of copy pastes, and I don't know which ones are useful. If you want me to post them, I sure can.

\usepackage{booktabs}

\section{Différents concepts imaginés}

\subsection{\Large{Acheminement:}}

\subsection{\Large{Choix du concept final:}}

\subsection{\Large{Tableau récapitulatif:}}

...

\bigskip

...

\vspace{25pt}

\begin{table}[]
\centering
\begin{tabular}{ccccc}
\hline
\multicolumn{1}{|c|}{} &
\multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}Pondération\\ {[}\%{]}\end{tabular}} &
\multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}Roue dentée\\ Concept 1\end{tabular}} &
\multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}Axe tournant\\ Concept 2\end{tabular}} &
\multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}Roue dentée 2\\ Concept final\end{tabular}} \\ \hline
\multicolumn{1}{|c|}{Évitement du blocage} & \multicolumn{1}{c|}{40} & \multicolumn{1}{c|}{9} & \multicolumn{1}{c|}{5} & \multicolumn{1}{c|}{8} \\ \hline
\multicolumn{1}{|c|}{Facilité d'utilisation} & \multicolumn{1}{c|}{25} & \multicolumn{1}{c|}{5} & \multicolumn{1}{c|}{7} & \multicolumn{1}{c|}{8.5} \\ \hline
\multicolumn{1}{|c|}{Optimisation technique} & \multicolumn{1}{c|}{20} & \multicolumn{1}{c|}{6.5} & \multicolumn{1}{c|}{7} & \multicolumn{1}{c|}{9} \\ \hline
\multicolumn{1}{|c|}{Poids} & \multicolumn{1}{c|}{5} & \multicolumn{1}{c|}{6.5} & \multicolumn{1}{c|}{6.5} & \multicolumn{1}{c|}{7.5} \\ \hline
\multicolumn{1}{|c|}{Originalité} & \multicolumn{1}{c|}{5} & \multicolumn{1}{c|}{5.5} & \multicolumn{1}{c|}{6} & \multicolumn{1}{c|}{7.5} \\ \hline
\multicolumn{1}{|c|}{Précision} & \multicolumn{1}{c|}{5} & \multicolumn{1}{c|}{8.5} & \multicolumn{1}{c|}{7.5} & \multicolumn{1}{c|}{8.5} \\ \hline
& & & & \\ \cline{1-1} \cline{3-5}
\multicolumn{1}{|c|}{Note finale} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{6.8} & \multicolumn{1}{c|}{7.2} & \multicolumn{1}{c|}{8.3} \\ \cline{1-1} \cline{3-5}
\end{tabular}
\end{table}


\vspace{35pt}

...

Recommended reading 2024:

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

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

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

My table is never in its correct location

Post by kaiserkarl13 »

Tables are floating environments, meaning they end up on or after the page where they first appear, but in a location that TeX chooses based on the layout of the rest of the page. This is expected behavior.

If you really want a table to be exactly where it appears, you can add [h] as an optional argument to the figure environment. However, you should strongly consider NOT doing that: it's not usually what you want. (You're likely just used to doing it that way because floating environments in word processors are so unstable and therefore you've been trained to put them exactly where they occur in the text.)

My preferred alternative when I really need a table to be exactly where I want it is to forego the table environment entirely and just surround the tabular environment with a minipage and/or a center environment. This won't provide a caption, but I typically don't want captions in the event I want a table exactly in a certain location.
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

My table is never in its correct location

Post by Ijon Tichy »

[h] doesn't really make sense, because LaTeX will replace it by [ht] and you should always add p as fallback.

However, without a Infominimal working example nobody can say, what the OP does and what should happens. And as long as the document is a work in progress with several [t]\subsection[/t] following immediately on each others because of text just missing, the position of floats should be ignored. Float positioning should be done, after all text has been written.

BTW: All those \vspace in the shown code seem to be contra-productive if the table should move up.

And using \Large, which is a switch not a command with argument, in a the argument of a sectioning command like \subsection is nonsense, because it is a moving argument and also you would not reach the number if there is any. Instead the section command should be configured to do the correct formatting without such ugly hacks.

See “How to influence the position of float environments like figure and table in LaTeX?” for more information about floating environments like tables.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Post Reply