Monday, 14 May 2012

Adjusting LaTeX margins to fit a wide figure

I'm currently writing my PhD thesis, trying to shape a number of scientific articles into a coherent whole. In this process, I've come across a problem: The PhD thesis format has a text width of 120mm, which is suitable for one-column text, but I sometimes want my figures to be wider than this. How can I adjust the margins of a page on a per-figure basis? The answer: The changepage package.

Include the package by adding this line to the preamble

\usepackage[strict]{changepage}

... and use the \adjustwidth{leftmargin}{rightmargin} inside the figure environment, for example

\begin{figure}
    \begin{adjustwidth}{-10mm}{-10mm}
        \includegraphics{wide}
        \caption{Wide figure}
    \end{adjustwidth}
\end{figure}

In this example, both the left and right margins are reduced by 10 mm, making more room for the figure. The command also works with subfigures. 

2 comments:

Anonymous said...

Awesome, thanks !

Calvin Chan said...

Thanks Martin,

It seems like the figure is following the new margin, but the caption doesn't. Any suggestions? (I know this is a post from 2012, but let me know if you have any clue.)

Cheers,

Cal

Post a Comment