# Problem with margins and tables

Here is a picture of my problem :

As you can see, the table isn't well centered at all. I'd like the distance from the left margin to be equal to the distance from the right margin. Here is my latex code:

\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".}
\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 ?

• Welcome to TeX.SX! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Marco Daniel May 12 '13 at 12:46
• In addition to other comments, don't use [h!] It stops latex putting tlhe float in all float areas so makes it likely to go to the end of the document. (LaTeX warns about this and changes it to [!ht] But even that does not allow page floats. – David Carlisle May 12 '13 at 13:20
• Also you have used table* h does not work at all with two-column floats – David Carlisle May 12 '13 at 13:31

It usually gives a more consistent appearance if you choose a defined document font size such as \footnotesize rather than scaling the table. I also used array package to give extra padding below the horizontal lines, and used table rather than table*. Please always give complete documents showing the class and all packages used. The font size here is suitable for article class A4, but may not be right for other page sizes, but your example does not give that information.

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{array}
\begin{document}

\begin{table}
\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".}

\footnotesize
\setlength\tabcolsep{3pt}
\setlength\extrarowheight{3pt}
\smallskip
\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}

\end{document}


This is because your table is too wide. The best way is to adjust the arrangement of your table contents. But if you don't want to change the arrangement, Here is a solution:

...
\leavevmode\hbox to 0pt{\hss
\begin{tabular}{|c|c|c|c|c|c|c|} % 7 colonnes
...
\end{tabular}
\hss}
...


needs package graphicx

...
\noindent
\resizebox{\linewidth}{!}{%
\begin{tabular}{|c|c|c|c|c|c|c|} % 7 colonnes
...
\end{tabular}%
}
...


or if you do want want to resize it:

...
\noindent
\makebox[\linewidth]{%
\begin{tabular}{|c|c|c|c|c|c|c|} % 7 colonnes
...
\end{tabular}%
}
...