I have come across this code here(How to manipulate an externally-generated pdf figure in LateX?) that allows me to send some labels/annotations to an image in a pdf file. The pdf file is already cropped but when I compile it, I see the pdf file as a whole A4 paper with a number in the bottom.

Here is the code:







This is the original image in the pdf file (notice how the image is cropped): enter image description here

And this is the image i get when I compile (Notice the page number and how long the image has become): enter image description here

Any idea what is happening here? Many thanks

  • Erh, you're explicitly setting the width of the inserted image, so your second image looks like how I'd expect it
    – daleif
    May 10, 2022 at 5:44
  • 1
    Welcome to TEX StackExchange! Standard article class use letter paper in page size. According to your setting width=.4\textwidth, the image is displayed properly. This is the way how it will be shown in the page. What is your expected result?
    – Tom
    May 10, 2022 at 5:44
  • Thank you @Tom for the reply. I am expecting an image exactly like the first image. I just did not understand why there is a page number in the bottom while my first image is cropped and ready for annotations. My purpose was to send some annotations/labels to the image but ended up with this long A4-type page! May 10, 2022 at 6:18
  • The article class will do that for you: it inserts your image into a full-size sheet of paper. Perhaps some other class (standalone ?) might be more appropriate. Of course everything depends upon your final goal.
    – Ingmar
    May 10, 2022 at 7:07
  • 2
    You could probably use \documentclass{standalone} and package tikz to achieve that.
    – Tom
    May 10, 2022 at 7:10

1 Answer 1


As answered by Ingmar and Tom

The \documentclass{standalone} and package tikz will do the job.

Thank you both.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .