When I post small examples of LaTeX code, I use the convert -density 600 -trim file.pdf file.png method. This gives files that are extremely lightweight and integrate well into TeX.SE's quote environment to look really nice, like:

enter image description here

These images are very high resolution but extremely lightweight, the above is just 116 kb but 2,869px by 1,866px—large enough to actually show how nice LaTeX looks.

However, we often get questions involving page layouts and margins, where this method doesn't work because we need to indicate where the page itself is. Usually this is done using screenshots, like:

enter image description here

However, these images don't integrate well into the surrounding text and are extremely low resolution, making the text blurry. There's also no way to guarantee the alignment (ok, I exaggerated here, it's not usually this bad), because you just have to guess using the selection.

Is there a better way to do this, preferably automated?

While typing this I found the question "What is the best method to capture latex output for questions and answers?" which has a similar ImageMagic solution to mine (I do recommend the -trim option though) but I don't think it's a duplicate because my question asks how to show the whole page too.

  • I don't understand what you mean when you're asking for a "better" way of doing this. Also, how would one automate something that may inherently be different from one post to the next?
    – Werner Mod
    Nov 24, 2014 at 16:57
  • I mean that I can run convert -density 600 -trim file.pdf file.png on any LaTeX pdf and get a high-quality, correctly sized file that looks really good to post here. It works with any single-page LaTeX output, so it's pretty well automated. I'm asking if someone has found a similar method to create images of whole pages for posting here, that can be run easily on a PDF to create small file size, high resolution, good looking images that integrate well and align well in TeX.SE answers.
    – Ryan
    Nov 24, 2014 at 17:04
  • It's better, in my point of view, just to use the clipboard features of the PDF viewer/reader and then paste the content to graphics into some graphics programme, exporting it to .jpg or .png
    – user31729
    Nov 24, 2014 at 17:20
  • 1
    @ChristianHupfer Or use a PDF viewer which lets you export to those formats when you use its clipboard feature... (Less work ;).)
    – cfr
    Dec 1, 2014 at 2:08


You must log in to answer this question.

Browse other questions tagged .