4

I'm trying to include given PostScript files in my document. However, I'm not really successful using the latex -> dvips chain as the image is not well included:

latex dvips example

However, the same file works fine when using XeTeX:

xetex sample

Used image: Get it here

MWE:

\documentclass{article}
\usepackage{graphicx}

\begin{document}
% \fbox to visualize the dimensions  
\fbox{\includegraphics[width=\textwidth]{Reflection_and_Refraction_2D.ps}}
\end{document}

What do I have to do to get a proper ps-output file?

I would like to use XeTeX overall, but the output file has to be a PostScript file and pdf2ps does not seem to produce vector output.

  • But it is a .psfile, anot an .eps one! – Bernard Mar 2 '14 at 17:02
4

The bounding box in the ps file is wrong:

%%BoundingBox: 0 0 460 77

The correct one is:

%%BoundingBox: 72 -5 127 4

The is the reason why you cannot insert the ps file. Converting it to pdf (what xetex internally does) or to eps with a following correcting the bounding box with for example:

epstool --bbox --copy  <file>.eps <file>-new.eps

or with a correct bb:

\fbox{\includegraphics[bb=72 -5 127 4,width=\textwidth]{Reflection_and_Refraction_2D.ps}}

If it needs addtional rotating and/or reflecting use

\fbox{\reflectbox{\includegraphics[bb=72 -5 127 4,angle=180,width=\textwidth]{<file>.ps}}}
  • I'm wondering why the bounding box is wrong, as they have been created some while ago using pstricks + latex -> dvips. However, I get the warning Input file "....ps" is not EPSF. This is obviously true. – MrD Mar 2 '14 at 17:53
  • epstool needs an eps! You have to convert it first. The bounding box in a ps file is the same as the used paper dimensions and not the one of a image size! – user2478 Mar 2 '14 at 18:36
  • Okay, converting it with ps2eps together with your solution works in principle, but the boundingbox is sometimes too large. In addition, as you have already said, the pictures are upside down. Overall I think that I will have to look into the question "How to get a proper PS from XeTeX" to get to where I wanna go. – MrD Mar 2 '14 at 20:52
  • The question is more: Why do you want to use a PS file and not PDF or EPS?? – user2478 Mar 2 '14 at 20:54
  • I have to hand in a proceeding as PostScript file. No other option given. I do not make the rules. I found that the CUPS PostScript driver does a fairly good job in converting from PDF to PS, but however, it is still not perfect. – MrD Mar 2 '14 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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