Showing posts with label trim. Show all posts
Showing posts with label trim. Show all posts

How to crop figures in LaTex?



It is common when we inserting figures in the papers in LaTex where some of them can have a white border taking up a lot of space. The trim option in \includegraphics aims to crop the figures inside the LaTex environment, which makes manipulating figures easy. For example, 
\begin{figure}[!bh]
\centering
\includegraphics[width=.8\linewidth,
trim=0cm 0cm 0cm .4cm, clip=true]
{images/user_difference.pdf}
\caption{The relationship between the number of favorites and retweets for two different users in a log scale.}
\label{fig:user_diff}
\end{figure}

The four locations after trim= are [left bottom right top] respectively, and [0cm 0cm 0cm .4cm] means we are trimming top for .4cm of the figure.

We can also use the clip=true or clip=false to turn on and off the trimming of the figure.