Graphics, Figures & TablesTable wider than Text Body

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
scipion
Posts: 1
Joined: Sun May 12, 2013 2:09 pm

Table wider than Text Body

Post by scipion »

Hello,

I have a table that isn't well centered at all. A picture of the problem is attached. I'd like the distance from the left margin to be equal to the distance from the right margin. My table code is this.

Code: Select all

\begin{table*}[!ht]
\centering
\caption{Cette table indique pour chaque méthode si elles sont statistiquement meilleures qu'un classeur ne prédisant que la classe dominante pour la base de données "Nombre d'enfants".}
\begin{tabular}{|c|c|c|c|c|c|c|} % 7 colonnes
\hline
\textbf{Méthodes} & LapRLS & LapRKLS & LRreglog & Autolog & BagOfPath & RCTK % premiere colonne
\\ \hline
   \textbf{>=0.5501} & 5 & 0 & 5 & 5 & 0 & 5
\\ \hline\hline
SVM & SVMmoran & SVMgeary & LogisticReg & Logmoran & Loggeary & MultiVarLog
\\ \hline
5 & 5 & 5 & 0 & 0 & 4 & 1
\\ \hline
\end{tabular}
\end{table*}
Does anyone know how could I solve this problem ?
Attachments
table-margin-problem.png
table-margin-problem.png (21.12 KiB) Viewed 11457 times
Last edited by localghost on Wed May 29, 2013 10:20 am, edited 2 times in total.

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

tom
Posts: 73
Joined: Thu Apr 18, 2013 4:02 am

Table wider than Text Body

Post by tom »

Hi,

The problem is not about centering, the table is too wide and reaches into the margin. You could do one of the following:
  • Decrease the font size
  • Decrease column title lengths (e.g. by adding line breaks)
  • Rotate the table (e.g. by rotating)
alainremillard
Posts: 45
Joined: Fri Mar 16, 2012 8:22 pm

Table wider than Text Body

Post by alainremillard »

As Tom said, the table is too wide to fit in the text. An other solution with the help of the \makebox command. I added it in your code.

Code: Select all

\begin{table*}[h!] \centering
\caption{Cette table indique pour chaque méthode si elles sont statistiquement meilleures qu'un classeur ne prédisant que la classe dominante pour la base de données "Nombre d'enfants".}
\makebox[\linewidth]{
\begin{tabular}{|c|c|c|c|c|c|c|} % 7 colonnes
\hline
\textbf{Méthodes} & LapRLS & LapRKLS & LRreglog & Autolog & BagOfPath & RCTK % premiere colonne
\\ \hline
   \textbf{>=0.5501} & 5 & 0 & 5 & 5 & 0 & 5
\\ \hline\hline
SVM & SVMmoran & SVMgeary & LogisticReg & Logmoran & Loggeary & MultiVarLog
\\ \hline
5 & 5 & 5 & 0 & 0 & 4 & 1
\\ \hline
\end{tabular}
}
\end{table*}
Have a nice day
Alain Rémillard
Post Reply