[Tex/LaTex] Quickest way to include graphics

graphics

Whenever I make a presentation with LaTeX, it takes me a long time to include the graphics in the way I want them to look.

  • I start with \includegraphics{foo.jpg},
  • run pdflatex to see what it looks like,
  • then add [trim=1cm 2cm 3cm 4cm],
  • run pdflatex to see what it looks like,
  • then add [scale=.8],
  • then run pdflatex,
  • then change [trim=...],
  • then change [scale].... etc.

Is there a tool that lets on manipulate the picture directly and then produces the LaTeX source? Or what is a better practice to achieve the results?

Best Answer

A good practice IMHO is, depending on the type of graphic:

  • Photos: Use the JPG format and crop it to the size and viewport your need using an image processing program, e.g. Gimp or Photoshop. DO NOT use JPG for anything else, it is really just thought for photos. It can handle other stuff as well but not as good as other formats.

  • Screenshoots and other Artificial Pixel-graphics: Use PNG format and again crop it to the size and viewport needed. The PNG format is lossless, i.e. doesn't create artifacts like JPG. Its compresses this kind of images well.

  • Diagrams, Pictures and other Vector-graphics: Should really be included as vector-graphics and not as pixel-graphics (and if so NOT as JPG!). You should export them as PDF or EPS which is then converted to PDF (e.g. epstopdf). Extra whitespace from margins etc. can be removed by pdfcrop.

To include your image:

  • the width (and height) option should IMHO be preferred before scale in many cases, e.g. larger graphics. A width=x\textwidth (x = 0.95 .. 0.8) normally includes larger images nicely. The scale options is better suited to increase smaller images or adjust middle sized images when they already have almost the correct size.
  • In beamer presentation I had to watch the height as well. Note that in beamer the \textheight spans over the frame title, so height=\textheight will not result in a good slide.

About your current method:

  • If you are using trim to remove white space (see also above), you might want to also use the clip option to get fully rid of it. (Ok, with white space it doesn't make much difference)
  • There are tools which give you a live preview, like the -pvc mode of latexmk. Use it for the recompilation while you change the settings.
  • Note that beamer has a \includeonlyframe which allows you to only compile certain frame, which speeds things up during adjustments and creation of e.g. TikZ pictures.