RSS

[latex] Crop, resize and rotate figures in LaTeX

26 Oct

First of all, make sure to include the graphicx package in the preamble of your LaTeX source file. The following command exemplifies how to crop, resize and rotate figures in LaTeX.

\begin{figure}[h]
\centering
\includegraphics[trim=1cm 2cm 3cm 4cm, clip=true, totalheight=0.5\textheight, angle=90]{figure}
\caption{The caption goes here}
\end{figure}

Needless to say, the above goes in between begin{document} and end{document} statements.

Let’s explain the various parts in the argument of \includegraphics command:

  • Cropping:trim=1cm 2cm 3cm 4cm” trims (crops) from left, bottom, right and top by 1, 2, 3 and 4cm respectively. It must be accompanied by “clip=true”.
  • Resizing: totalheight=0.5\textheight” will force the figure to occupy 50% of the page length-wise keeping the aspect ratio constant.
  • Rotating:angle=90” rotates the figure by 90 degrees.

Reference: For more options, refer to this.

About these ads
 
8 Comments

Posted by on October 26, 2009 in latex

 

Tags: , , , , , , , , , , ,

8 responses to “[latex] Crop, resize and rotate figures in LaTeX

  1. j.g

    November 4, 2012 at 10:55 AM

    nice!

     
  2. fahmifahim

    February 10, 2013 at 5:55 AM

    Thank you for the article!
    It helped me find out the way to rotate a long figure and fit it into one page.

     
  3. Anonymous

    November 10, 2013 at 3:56 AM

    Perfect, thx you very much :-)

     
  4. Snehal Shekatkar

    May 29, 2014 at 6:44 AM

    I tried trim for my plot. But instead of cropping the image it simply resizes it. I wanted to get rid of white margins of two sides of my figure. What am I missing?

     

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

 
Follow

Get every new post delivered to your Inbox.

Join 32 other followers

%d bloggers like this: