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.

\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

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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.

share|improve this answer
add comment

\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.

share|improve this answer
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.