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.

I have tried to remove any possible white spaces by appending % but the gaps still exist. What causes these gaps?

\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{graphicx}
\newsavebox\IBox
\savebox\IBox{\includegraphics[scale=.5]{example-grid-100x100pt}}

\begin{document}
\begin{pspicture}(2\wd\IBox,2\ht\IBox)%
    \rput[bl](0,0){\usebox\IBox}%
    \rput[bl](\wd\IBox,0){\psscalebox{-1 -1}{\usebox\IBox}}%
    \rput[bl](\wd\IBox,\ht\IBox){\psscalebox{1 -1}{\usebox\IBox}}%
    \rput[bl](0,\ht\IBox){\psscalebox{-1 1}{\usebox\IBox}}%
\end{pspicture}
\end{document}

enter image description here

share|improve this question

2 Answers 2

up vote 16 down vote accepted

The bounding box info for the image says 0 0 100 100, so the image is 100bp high. The default resolution for dvips is 600dpi; scaling to 50% makes for 416.66667 pixels, truncated to 416.

The height of the image is computed by TeX to be 50.1875pt, which is the same, but apparently EPS inclusion truncates, while rule positioning rounds. So if I compile

% arara: latex
% arara: dvips
% arara: ps2pdf

\documentclass[border=12pt]{standalone}
\usepackage{graphicx,picture}
\newsavebox\IBox
\savebox\IBox{\includegraphics[scale=.5]{example-grid-100x100pt}}

\begin{document}
\fboxsep=0pt
\fbox{\usebox{\IBox}}
\the\ht\IBox
\end{document}

enter image description here

If I run instead

% arara: latex
% arara: dvips: { options: "-D 10000" }
% arara: ps2pdf

\documentclass[border=12pt]{standalone}
\usepackage{graphicx,picture}
\newsavebox\IBox
\savebox\IBox{\includegraphics[scale=.5]{example-grid-100x100pt}}

\begin{document}
\fboxsep=0pt
\fbox{\usebox{\IBox}}
\the\ht\IBox
\end{document}

I get a better filling at the top, worse on the side.

enter image description here

If I pass the EPS image through eps2eps so a hires bounding box is computed, I get in example-grid-100x100pt-hires.eps the prolog

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 100 100
%%HiResBoundingBox: 0.000000 0.000000 99.600000 99.600000

Now the input

% arara: latex
% arara: dvips
% arara: ps2pdf

\documentclass[border=12pt]{standalone}
\usepackage{graphicx,picture}
\newsavebox\IBox
\savebox\IBox{\includegraphics[hiresbb,scale=0.5]{example-grid-100x100pt-hires}}

\begin{document}
\fboxsep=0pt
\fbox{\usebox{\IBox}}
\the\ht\IBox
\end{document}

produces

enter image description here

No gap and the height is computed correctly.

share|improve this answer
    
Does \includegraphics use hiresbb by default? –  Please don't touch Dec 3 '13 at 20:15
    
@DonutE.Knot No: if you notice, the "good" example uses the key hiresbb –  egreg Dec 3 '13 at 20:16
    
So, when do we need to use hiresbb? Is it a best practice to always use hiresbb? –  Please don't touch Dec 3 '13 at 20:18
1  
@DonutE.Knot If the EPS file has no HiResBoundingBox information it's useless. –  egreg Dec 3 '13 at 20:23
    
What option did you pass to eps2eps to avoid getting rastered output? –  Please don't touch Dec 4 '13 at 1:45

This doesn't seem to have anything to do with pstricks. This seems to have to do with the image you're importing.

Try the following:

\documentclass[pstricks,border=12pt,12pt]{standalone}

\usepackage{graphicx}
\newsavebox\IBox
\setlength{\fboxrule}{4pt}
\setlength{\fboxsep}{0pt}
\savebox\IBox{\fbox{\includegraphics[scale=5.5]{example-grid-100x100pt}}}

\begin{document}
\begin{pspicture}(2\wd\IBox,2\ht\IBox)%
    \rput[bl](0,0){\usebox\IBox}%
%    \rput[bl](\wd\IBox,0){\psscalebox{-1 -1}{\usebox\IBox}}%
%    \rput[bl](\wd\IBox,\ht\IBox){\psscalebox{1 -1}{\usebox\IBox}}%
%    \rput[bl](0,\ht\IBox){\psscalebox{-1 1}{\usebox{\IBox}}}%
\end{pspicture}
\end{document}

From the output, it seems pretty clear that the white space you're getting is from the image itself that you're importing.

enter image description here

share|improve this answer
    
+1: I am waiting for other responses if any. –  Please don't touch Dec 3 '13 at 5:04

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.