# Various table formatting problems

I've been trying to format a table for my thesis for two days and it just doesn't work. I've already searched everywhere for answers but couldn't find them and/or understand them.

Here's what I want to do:

1. I want the table to fit to the page, and to be horizontally centered (keeping some equal margins left and right).
2. The table should be wider than the text of my thesis (so smaller margins left and right of the table, and only for the table! Using \geometry unfortunately changes the margins for the whole thesis). I'm using \adjustbox, but this modifies the font size (which I don't want) and doesn't solve the centering problem.
3. I'm using the X type of columns for the 3d, 4th and 5th columns so they adjust their width. I don't know if there's a better way to do this.
4. I want the text in the header to be vertically centered, while the other rows are vertically at the top.
5. The header has a specified background color, but this seems to cover some of the borders. I don't know how to fix this :s.

Here's my code:

\begin{table}[]
\centering
\begin{tabularx}{1\textwidth}{l|l|X|X|X}

\hline
\rowcolor[HTML]{FFCB2F}
& {\bf Best for:} \\[3ex] \hline

&  &  &  & \\

DNS: & DNS & Direct and exact resolution of the Navier-Stokes equations
=\textgreater Best accuracy! & - Computationally very heavy, especially
for turbulent flows. \\ - Not usable for practical turbulent flows. &
Very small-scale laminar flows, theoretical analyses, 2D laminar flows.\\

RANS: & Standard k-$\varepsilon$ &  &  &  \\

& k-$\varepsilon$ RNG &  &  &  \\

& k-$\varepsilon$ Realizable &  &  &  \\

& k-$\omega$ SST &  &  &  \\

DNS/RANS: & LES &  &  &

\end{tabularx}
\caption{My caption}
\label{my-label}
\end{table}

• Welcome to TeX.SX! It would help us if your MWE was not just the table part, but a fully compilable document starting with \documentclass{...} and containing \begin{document}...\end{document}. Especially because I feel that some of the points you raise it might depend what kind of document class you use. – moewe Aug 6 '15 at 12:00

1. no need for \centering, if you have something greater or equal to \textwidth
2. Put it in a makebox
3. That's fine if you want the last three columns to have the same width
4. Use booktabs
5. Use booktabs

NB: Don't use \bf any more.

% arara: pdflatex

\documentclass[11pt, oneside]{Thesis}
\usepackage[english]{babel}
\usepackage[table]{xcolor}
\usepackage{tabularx}
\usepackage{showframe} % for demo
\usepackage{booktabs}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{ragged2e}

\begin{document}
\begin{table}
\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}
\setlength{\extrarowheight}{.75ex}
\makebox[\textwidth][c]{%
\begin{tabularx}{1.3\textwidth}{>{\RaggedRight}p{2.7cm}>{\RaggedRight}p{2.7cm}>{\RaggedRight}X>{\RaggedRight}X>{\RaggedRight\arraybackslash}X}
\toprule\rowcolor[HTML]{FFCB2F}
\\\midrule
DNS: & DNS & Direct and exact resolution of the Navier-Stokes equations
$\Rightarrow$~Best accuracy! & - Computationally very heavy, especially
for turbulent flows. &
\\
- Not usable for practical turbulent flows. & Very small-scale laminar flows, theoretical analyses, 2D laminar flows. & & &
\\
RANS: & Standard k-$\varepsilon$ &  &  &  \\
& k-$\varepsilon$ RNG &  &  &  \\
& k-$\varepsilon$ Realizable &  &  &  \\
& k-$\omega$ SST &  &  &  \\
DNS/RANS: & LES &  &  & \\
\bottomrule
\end{tabularx}}%
\caption{My caption}\label{my-label}
\end{table}
\end{document}


• Thank you sooo much, it works :D! There's just one thing left: the table is slightly more to the right than to the left. Is it possible to have equal margins on both sides? This could be because of my documentclass though (\documentclass[11pt, oneside]{Thesis}). – Romain Aug 6 '15 at 13:03
• @Romain Are you sure? For me, it looks centred like on my new screen shot. Please provide information such as your documentclass earlier as it gives us extra work. If you are really seeing a slight displacement, it could be due to some binding correction or alike. Don't know. Please show an example where it is clearly displaced. – LaRiFaRi Aug 6 '15 at 13:20