1

\psTextFrame[origin={x,y}](0,0)(1,1){content} does slide its frame's center to (x,y) but leave the content at (0.5,0.5). Is it a bug or feature?

\documentclass{article}
\usepackage{pstricks}

\psset{unit=1cm}% default unit

%\newcommand\mybox[3]{\rput(#1,#2){\psTextFrame[dimen=outer](0,0)(1,1){#3}}}

\newcommand\mybox[3]{\psTextFrame[origin={#1,#2},dimen=outer](0,0)(1,1){#3}}

\begin{document}
\pspicture[showgrid=false](3,3)
                \mybox{1}{2}{A} \mybox{2}{2}{B}
\mybox{0}{1}{A} \mybox{1}{1}{0} \mybox{2}{1}{1}
\mybox{0}{0}{B} \mybox{1}{0}{1} \mybox{2}{0}{0}
\endpspicture
\end{document}

Bonus question: To solve this, I am forced to use \rput (see the commented line in the above code snippet). However, I noticed that there are some white gaps (marked by red circles) between boxes as shown below. The green circle shows there is no white gap.

enter image description here

2

origin works only for real PSTricks objects which are defined as \pst@object and \psTextFrame isn't. I cannot see your behaviour of the lines with a magnification of 6400 in avroread.

0

\psTextFrame can be simulated by using \psframe and \parbox displaced by \rput. So my own solution is as follows.

\documentclass{article}
\usepackage{pstricks}
\SpecialCoor
\psset{unit=1cm}% default unit

%\newcommand\mybox[3]{\rput(#1,#2){\psTextFrame[dimen=outer](0,0)(1,1){#3}}}

\newcommand\mybox[3]{
    \psframe[origin={#1,#2},dimen=outer](0,0)(1,1)
    \rput(!#1 0.5 add #2 0.5 add){#3}
}

\begin{document}
\pspicture[showgrid=false](3,3)
                \mybox{1}{2}{A} \mybox{2}{2}{B}
\mybox{0}{1}{A} \mybox{1}{1}{0} \mybox{2}{1}{1}
\mybox{0}{0}{B} \mybox{1}{0}{1} \mybox{2}{0}{0}
\endpspicture
\end{document}

Answer for the bonus question: Apparently the gaps occurs when using psTextFrame and when a small number passed to dvips -D<number>. To get rid of the gaps, pass 10000 to dvips or use xelatex.

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.