1

I have some tables and figures which are (slightly) wider than the text width. This results in them aligning with the left side of my text and going far out in the right side instead of actually being centered.

I understand that using memoir and adjustwidth can solve the problem, but is there any options when using the article class?

1
  • 1
    \hspace*{-2cm}\begin{tabular}...\end{tabular}\hspace*{-2cm} Oct 14, 2014 at 10:46

3 Answers 3

2

You could steal this from the memoir class

\makeatletter
\newcommand*{\centerfloat}{%
  \parindent \z@
  \leftskip \z@ \@plus 1fil \@minus \textwidth
  \rightskip\leftskip
  \parfillskip \z@skip}
\makeatother

use it instead of \centering to center the figure. AFAIR from the manual it will make it extend into both margins equally.

0
1

For figure you can set an option to scale the figure to the page with.

\includegraphics[width=\textwidth]{[path]}

You can also scale to a percentage of text width

\includegraphics[width=0.5\textwidth]{[path]}

will scale to 50% of the page width.

For tables you can use resizebox

\begin{table}[h]
\resizebox{\textwidth}{!}{
   \begin{tabular}
     ... table ...
   \end{tabular}
}
\end{table}

The first argument is the width. The second is the height. ! makes the height auto adjust to the width.

1

You could use \makebox[\linewidth][c]{...}

enter image description here

\documentclass{article}
\usepackage{graphicx}

\usepackage{mwe}% for example-image
\usepackage{showframe}% to show the page layout

\begin{document}
\begin{figure}[htp]
\makebox[\linewidth][c]{\includegraphics[width=1.1\linewidth]{example-image}}
\caption{}%
\end{figure}

\begin{figure}[htp]
\makebox[\linewidth][c]{\includegraphics[width=.25\linewidth]{example-image}}
\caption{}%
\end{figure}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .