Skip to content

Cropping figures in LaTeX

July 23, 2013

Sometimes when you include a figure, you dont want to have to edit the picture file itself. In MS Word for instance you can use the crop command. LaTeX being LaTeX doesnt work quite the same way, but it is still possible. The standard way is to use the trim and clip options to \includegraphics

\begin{figure}
\includegraphics[trim= left bottom right top, clip=true]{file.jpeg}
\end{figure}

This method doesnt always work however. For instance, if you use xelatex, like me.

There is a way around this though – the adjustbox package. It includes, among other handy functions, the function \adjincludegraphics which does the trick. One of the best things about it is that it even seems to use the same coding, so no need to change all of the argument names…just add adj to the function call.

\usepackage{adjustbox}
...
\begin{figure}
\adjincludegraphics[trim= left bottom right top, clip=true]{file.jpeg}
\end{figure}

I think that its even possible to have it export its settings so that \includegraphics is recoded to do the same as \adjincludegraphics. I’ve not yet tried that though. (It should be just a case of using \usepackage[Export]{adjustbox} instead of \usepackage{adjustbox})

Advertisements

From → LaTeX

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: