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.

Note:

Rather than creating a new question that has almost the same code base, I rewrote my previous question. Because this issue is not specific to PSTricks, I changed the code so everybody can play with it.


I want to avoid using pdfcrop so I set the paper size to tightly suit my need in advance as follows.

% sample.tex
\documentclass{minimal}
\usepackage
[
paperwidth=144bp,%2in = 2x72bp = 144bp
paperheight=108bp,%1.5in = 1.5x72bp = 108bp
margin=0bp
]
{geometry}
\usepackage{xcolor,calc}
\fboxsep=0bp
\fboxrule=2bp
\begin{document}
\noindent\fbox{\color{yellow}\rule{\paperwidth-2\fboxrule}{\paperheight-2\fboxrule}}%
\end{document}

or without using geometry.sty:

% sample.tex
\documentclass{minimal}
\paperwidth=144bp%2in = 2x72bp = 144bp
\paperheight=108bp%1.5in = 1.5x72bp = 108bp
\voffset=-72bp
\hoffset=-72bp
\special{papersize=144bp,108bp}
\usepackage{xcolor,calc}
\fboxsep=0bp
\fboxrule=2bp
\begin{document}
\noindent\fbox{\color{yellow}\rule{\paperwidth-2\fboxrule}{\paperheight-2\fboxrule}}%
\end{document}

Then I compiled it with latex->dvips->ps2pdf and I got a strange result as follows:

enter image description here

I also got EPS with strange bounding box as follows:

%!PS-Adobe-3.0 EPSF-3.0
% Produced by xpdf/pdftops 3.02pl4
%%Creator: TeX
%%LanguageLevel: 2
%%DocumentSuppliedResources: (atend)
%%BoundingBox: 0 0 105 145
%%HiResBoundingBox: 0 0 104.994 144.018
%%EndComments
%%BeginProlog
%%BeginResource: procset xpdf 3.02pl4 0
%%Copyright: Copyright 1996-2007 Glyph & Cog, LLC

Summary

I tested this using pdflatex with no problem. Herbert tested it using xelatex with no problem too. According to Herbert, there is a problem in dvips.

share|improve this question
2  
What final output file format do you require? (E)PS or PDF? You could avoid several steps if you would change from PSTricks to TikZ and use pdflatex (maybe in combination with the preview package or standalone class) –  Martin Scharrer Jul 10 '11 at 9:45
    
@xport: run the code snippets wioth xelatex and everything will be fine. –  Herbert Jul 10 '11 at 16:19
add comment

1 Answer

up vote 2 down vote accepted

As Ulrike mentions in a comment, dvips tries a known paper size that is near the specified dimensions. The call

dvips -t unknown sample -o

produces the following header:

%!PS-Adobe-2.0
%%Creator: dvips(k) 5.99 Copyright 2010 Radical Eye Software
%%Title: sample.dvi
%%CreationDate: Sun Jul 10 19:22:45 2011
%%Pages: 1
%%PageOrder: Ascend
%%BoundingBox: 0 0 144 108
%%EndComments
%DVIPSWebPage: (www.radicaleye.com)
%DVIPSCommandLine: dvips -t unknown sample -o
%DVIPSParameters: dpi=600
%DVIPSSource:  TeX output 2011.07.10:1911
%%BeginProcSet: tex.pro 0 0
%!

to be compared with the code obtained without -t unknown:

%!PS-Adobe-2.0
%%Creator: dvips(k) 5.99 Copyright 2010 Radical Eye Software
%%Title: sample.dvi
%%CreationDate: Sun Jul 10 19:19:40 2011
%%Pages: 1
%%PageOrder: Ascend
%%Orientation: Landscape
%%BoundingBox: 0 0 105 148
%%DocumentPaperSizes: a9
%%EndComments
%DVIPSWebPage: (www.radicaleye.com)
%DVIPSCommandLine: dvips sample -o
%DVIPSParameters: dpi=600
%DVIPSSource:  TeX output 2011.07.10:1911
%%BeginProcSet: tex.pro 0 0
%!
share|improve this answer
    
is it ok to always use -t unknown switch even when I use a4paper? –  xport Jul 10 '11 at 17:29
1  
geometry issues a \special command; if geometry is not used the default paper size is used, which is letter, since the bounding box is %%BoundingBox: 0 0 612 792. –  egreg Jul 10 '11 at 17:56
1  
I should add that dvips uses the "distribution default", when -t unknown or any other options relative to paper is not given; on my machine it's A4, as customary with TeX Live. –  egreg Jul 10 '11 at 19:08
    
To increase accuracy, pass -D10000 to dvips and pass -r10000 to ghostscript. See the detailed in How should I express my length calculation to minimize rounding errors?. –  xport Jul 27 '11 at 6:53
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.