TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On windows 7 64bits with Miktex 2.9 latex compile correctly my document and DVI shows all images correctly. Then dvipdfm produces a correct PDF except for one image that is cropped horizontally. To reproduce download the example and then:

latex test.tex
yap test.dvi           # correct
dvipdfm test.dvi
AcroRd32.exe test.pdf  # cropped

Question: how to prevent this behavior?

share|improve this question
Welcome to tex.sx! Some users are paranoid and would prefer not to download suspicious .zip files. If possible, you should reduce your .tex file to a minimal example showing the problem, and then include it in your question as a code snippet. – T. Verron Nov 30 '12 at 13:45
up vote 5 down vote accepted

The conversion from PostScript to PDF is configured in dvipdfmx.cfg:

%% Ghostscript (PS-to-PDF and PDF-to-PDF):
%% ps2pdf is a front-end to gs. For a complete list of options, see
%% http://ghostscript.com/doc/current/Ps2pdf.htm#Options
%% By default, gs encodes all images contained in a PS file using
%% the lossy DCT (i.e., JPEG) filter. This often leads to inferior
%% result (see the discussion at http://electron.mit.edu/~gsteele/pdf/).
%% The "-dAutoFilterXXXImages" and "-dXXXImageFilter" options used
%% below force all images to be encoded with the lossless Flate (zlib,
%% same as PNG) filter. Note that if the PS file already contains DCT
%% encoded images (which is possible in PS level 2), then these images
%% will also be re-encoded using Flate. To turn the conversion off,
%% simply remove the options mentioned above.
%% Also note that PAPERSIZE=a0 is specified below. This converts PS
%% files (including EPS) to A0 papersize PDF. This is necessary to
%% prevent gs from clipping PS figure at some papersize. (A0 above
%% simply means large size paper.) If you have figures even larger
%% than A0, and their llx=lly=0, you can use "-dEPSCrop" instead of
%% "-sPAPERSIZE=a0"
%% In TeX Live, we use the rungs wrapper instead of ps2pdf, becuse we
%% must omit the -dSAFER which ps2pdf specifies: in order for pstricks
%% to work with xetex,
%% /usr/local/texlive/*/texmf-dist/dvips/pstricks/pstricks.pro (for
%% example) needs to be accessed.  (Also, it is better to use our
%% supplied gs on Windows.)  You can also add -dNOSAFER to the ps2pdf
%% command line.
%% Incidentally, especially in TL, more than one dvipdfmx.cfg may be
%% extant.  You can find the one that is active by running:
%% kpsewhich -progname=dvipdfmx -format='other text files' dvipdfmx.cfg
D  "rungs -q -dNOPAUSE -dBATCH -sPAPERSIZE=a0 -sDEVICE=pdfwrite -dCompatibilityLevel=%v -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilter ColorImages=false -dColorImageFilter=/FlateEncode -sOutputFile='%o' '%i' -c quit"

figure02.eps has size 3854bp x 1882bp that is larger than A0 with 841mm x 1189mm.

Thus you can use reconfigure using -dEPSCrop or convert the file manually to PDF:

ps2pdf -dEPSCrop figure02.eps

And run ebb to get a bounding box data file for driver dvipdfmx of LaTeX's graphics package:

ebb -x figure02.pdf

Then the image can be included as PDF file:




This also speeds up the compilation, because the EPS figure does not need to be converted each time running dvipdfmx.

share|improve this answer

I had the same problem as SiliconValley but I was not allowed to use any additional latex packages and options. Therefore I could not apply Heiko's solution - which would be great otherwise.

If the height of the eps figure is less than the maximum width and the width of the eps figure is less than the maximum height, you rotate the eps figure during creation by 90 degree and rotate it -90 degree in the latex include command. Thus, the rotated eps file is included as follows in the tex file:


Without rotating, it would have been included as


edit 2015-11-21:
There might be a situation in which you are not allowed to use the graphicx package with the option dvipdfmx. In my situation, I am writing an journal article for Atmospheric Chemistry and Physics and have to use the Copernicus Publications LaTeX Package, version 3.8. The guidelines of using additional packages are quite strict.

Assume we have an eps file with the width width_eps and the height height_eps. The maximum possible width and height above those the image is cropped are width_max and height_max, respectively. Unfortunately, we have width_eps > width_max. But, if width_eps < height_max and height_eps < width_max we

  • rotate our eps file outside of latex (a create it rotated) and
  • include it with the option angle=-90 or angle=90 (code posted above).

Yes, the solution is useless if width_eps > height_max or height_eps > width_max

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.