Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
add comment

1 Answer 1

up vote 4 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:

\documentclass{article}
\usepackage[dvipdfmx]{graphicx}
\begin{document}

\includegraphics[width=0.9\columnwidth,keepaspectratio=true]{figure02.pdf}

\end{document}

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

share|improve this answer
add comment

Your Answer

 
discard

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.