Centering wide tables or figures

When you want to include an image or a table that’s wider than the text width, you will notice that even when \centering or the center-environment is used this wide object will not be centered in relation to the surrounding text. It will be placed at the left margin but go into the right margin. Its frequently requested that wide figures or tables should overlap at both sides in equal measure.

It can easily achieved by putting the table or picture inside a box, giving the box the width of the text, by the \makebox command. Here is a compilable example, where I’m centering a table having 1.5 times the width of the text:

\documentclass[a4paper,10pt]{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{tabularx}
\begin{document}
 
\blindtext
\bigskip
 
\noindent\makebox[\textwidth]{%
\begin{tabularx}{1.5\textwidth}{XX}
  \blindtext & \blindtext
\end{tabularx}}
 
\bigskip
\blindtext
 
\end{document}

I’ve used \noindent to suppress the paragraph indentation, otherwise I would get an overfull \hbox. As you may notice there’s no \centering necessary because the width of the box equals \textwidth.

This topic was discussed in the LaTeX Community Forum, on CQF.info and on mrunix.de.

17. September 2008 by stefan
Categories: Figures and Tables | 39 comments

Comments (39)

Leave a Reply