# Overwide Graphics

Sometimes graphics (or other stuff) are wider as the text (defined by \textwidth). In the case they extend into the right margin and creating a 'badblock'-warning. Following recipe shows how the first can be controlled (align left, centering or align right) and the latter avoided.

\begin{figure}
% We put the overwide graphic into a \textwidth makebox to avoid a badbox warning and to align it
\makebox[\textwidth][l]{% exchange [l] with [r] or [c] to extend it into the left border or both, respectively
\includegraphics[width=1.2\textwidth]{graphic_filename} % here 20% wider than \textwidth
}
\caption{Graphic caption text}
\label{fig:graphiclabel}
\end{figure}



Result: align left - extend into the right margin [l], centering - extend into both margins [c], align right - extend into the left margin [r]

# Overwide graphics in two-sided documents

If you writting two-sided books (or similar documents), then you presumably want overwide graphics to extend into the larger margin, which is the right on odd and the left on even pages. The LaTeX packet changepage is providing the needed commands to check on what kind of page the graphic is.

This TeX FAQ was giving me the hint. See also this answer on tex.sx for another example.

\begin{figure}[tbh]
\checkoddpage % check if graphic is on a odd page (needs two LaTeX runs to work)
% extend into the right border on odd pages and into the left border on even pages:
\edef\side{\ifoddpage l\else r\fi}
% We put the overwide graphic into a \textwidth makebox to avoid a badbox warning and to align it
\makebox[\textwidth][\side]{%
\includegraphics[width=1.2\textwidth]{graphic_filename} % here 20% wider than \textwidth
}%
\caption{Graphic caption text}
\label{fig:graphiclabel}
\end{figure}



Result: Two pages (1 & 2) of a two-sided document