[pstricks] pst-pdf and whitespace

Alan Ristow ristow at ece.gatech.edu
Thu Oct 25 16:32:26 CEST 2007


Hi all,

I'm trying to use pst-pdf to create subfigures and I'm finding that with 
pspicture it does not respect the shift parameter or changes to the 
origin. As a result, I am unable to get the vertical alignment that I 
want between adjacent subfigures. I think I understand *why* this is 
happening, but I'm having trouble finding a workaround. Has anybody else 
encountered this? If so, how did you solve it?

I have provided code below to illustrate the problem I'm talking about. 
When I comment out \usepackage{pst-pdf} and run:

latex test.tex
dvips -o test.ps test.dvi

I get exactly what I want -- two boxes, side-by-side, vertically 
centered. When I leave \usepackage{pst-pdf} in the document and run:

latex test.tex
dvips -o test-pics.ps test.dvi
ps2pdf test-pics.ps test-pics.pdf
pdflatex test.tex

I get two boxes, side-by-side, aligned at their bottoms -- not what I want.

As I understand it, this has to do with the way preview.sty works, which 
is fine, but I can't seem to work around it to get what I want. I've 
tried quite a few things, including putting \vspace after the first 
subfigure and putting a white dummy box in the background, but to no avail.

Alan


\documentclass{article}
\usepackage{subfig}
\usepackage{pstricks}
\usepackage{pst-pdf}% comment out for latex

\begin{document}
\begin{figure}
   \centering
   \subfloat[Short box.]{%
     \begin{pspicture}(0,0)(4,4)
       \psframe(0,1)(4,3)%
     \end{pspicture}
   }%
   \subfloat[Tall box.]{%
     \begin{pspicture}(0,0)(4,4)
       \psframe(0,0)(4,4)%
     \end{pspicture}
   }%
   \caption{Test.}
   \label{fig:test}
\end{figure}
\end{document}



More information about the PSTricks mailing list