17

Once I posted a simple LaTeX code and the associated PDF output when I asked a question. Few minutes later some nice person edited my post by cropping the empty area of the PDF document. Since then I read the FAQ, went through all 88 support questions to learn how to do it without luck. Hence the question. Am I overlooking something simple?

  • 1
    related question: tex.stackexchange.com/questions/11866/… – doncherry Sep 29 '11 at 22:32
  • 1
    I was going to say, "Isn't this actually a question for the main site, and isn't it already answered there?" but then I read the answers and learnt about imgur accepting PDFs - which I didn't already know - so agree that this should stay as a meta question! In fact, with a little polishing it could serve as an FAQ. Would you mind if we tidied it (and the answers) a little to do that? (If not, we can just ask a new question.) – Loop Space Sep 30 '11 at 7:47
  • 1
    Related question: here mentions several alternatives, some not mentioned below. – DJP Sep 30 '11 at 16:32
  • @AndrewStacey: If your question is directed to me, then I do not mind. Please feel free to polish it and make it part of the faq. – Sony Oct 1 '11 at 13:35
4

On Mac OS, Preview.app has a crop tool. I usually just crop the pdf and then save as PNG. Since Preview is my default PDF viewer, it's only a few clicks/keystrokes to do so.

14

Another way to crop an image in someone's question is to use the imgur website that hosts the pictures for TeX.sx:

  1. copy the image URL of the image you want to edit (e.g. right-click on the image, click Copy Image Location, in Firefox)
  2. go to http://imgur.com/
  3. paste the URL
  4. click Edit
  5. draw a rectangle around the desired area
  6. click Save
  7. copy the URL of the edited image that's presented to you
  8. in the question, insert a new image, paste the URL
  • 2
    Apparently there's a couple of tools for imgur – web browser addons, bash scripts, etc. – at imgur.com/tools – N.N. Sep 30 '11 at 6:44
11

pdfcrop is very useful for cropping PDF files, capable of automatically removing all white margins.

However, as you cannot directly embed PDF images, I guess you mean PNG images or other bitmap formats. In this case I assume, it's done using any picture editor such as GIMP (which I use), just line N.N. said.

  • 1
    This is interesting. I posted a pdf output generated by TeXShop without converting to a PNG to tex.stackexchange. – Sony Sep 29 '11 at 22:51
  • 5
    @Sony: ok, there's an automatic conversion of PDF to PNG when posting images. So pdfcrop is still a recommendation, and bitmap editors too. – Stefan Kottwitz Sep 29 '11 at 22:56
  • Thank you very much. I will be posting a question soon that I have been postponing to ask, because I did not know how to crop a pdf. Now I know. Thanks again. – Sony Sep 29 '11 at 23:19
7

I use a screenshot tool called Shutter under Ubuntu Linux which allows making screenshots by manual selection. I open the PDF with Acrobat Reader, start Shutter, click "Selection" and select the area I want. I configured it to place it as PNG in my /tmp folder so I can easily access it in the image upload dialog of this site.

An alternative is to use the standalone class for the LaTeX document which also creates a cropped PDF. Note that imgur is able to convert PDFs to PNGs by itself, however you don't have control over the used resolution, i.e. the image might be quite small.

3

Recent editions of Windows (Vista & 7) is shipped with the Snipping Tool application that allows you to capture parts of the screen through a marquee. Saving to PNG (or other image formats) is done after capturing the screen selection, without having to use other external image manipulation software applications.

Since February 2013, users have been able to copy-and-paste images directly into posts via the regular "Insert image" (or Ctrl+G) tool. This skips saving content to file for uploading, which is much easier and faster.

2

They probably saved the picture of the pdf output, opened it in an image editor, cropped it and finally replaced the picture in your question with it.

2

You could also directly take a cropped screenshot, using an appropriate tool. E.g. on Gnome/Linux you can use gnome-screenshot --area to select an arbitrary rectangular part of the screen to export as a picture.

2

For ConTeXt examples, I normally add

\startTEXpage
 ....
\stopTEXpage

around the relevant code. This generates a cropped pdf page.

1

Within the TeXniverse itself there's also the preview package and Martin's standalone class (which, used on its own, uses preview in an easy automagic way, although this isn't the main purpose of the associated package).

You must log in to answer this question.

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