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.

Please carefully consider the following diagram. What makes the \psframebox nodes gradually move down?

enter image description here

\documentclass[preview,border=15pt]{standalone}
\usepackage{pst-node}
\addtopsstyle{gridstyle}{griddots=0}
\psset
{
    framearc=0.5,
    framesep=0.5,
    linewidth=0.5,
    colsep=1,
    rowsep=1,   
    mnode=r,
}

\def\A{\psframebox{\pspicture(2,1)\psframe*[linecolor=blue](2,1)\endpspicture}}
\begin{document}
\begin{preview}
\pspicture[showgrid=top](6,20)
\rput[tl](1,20){%
\psmatrix
    \A  \\
    \A  \\
    \A  \\
    \A  \\
    \A  \\
\endpsmatrix}
\endpspicture
\end{preview}
\end{document}
share|improve this question
add comment

2 Answers

It looks like there is some extra vertical space added after the row separator. Correction of -1bp:

\begin{preview}
\newdimen\rfix \rfix=1cm \advance\rfix-1bp
\pspicture[showgrid=top,rowsep=\rfix](6,20)

seems to fix this.

\documentclass[preview,border=15pt]{standalone}
\usepackage{pst-node}
\addtopsstyle{gridstyle}{griddots=0}
\psset
{
    framearc=0.5,
    framesep=0.5,
    linewidth=0.5,
    colsep=1,
    rowsep=1,   
    mnode=r,
}

\def\A{\psframebox{\pspicture(2,1)\psframe*[linecolor=blue](2,1)\endpspicture}}
\begin{document}
\begin{preview}
\newdimen\rfix \rfix=1cm \advance\rfix-1bp
\pspicture[showgrid=top,rowsep=\rfix](6,20)
\rput[tl](1,20){%
\psmatrix
    \A  \\
    \A  \\
    \A  \\
    \A  \\
    \A  \\
\endpsmatrix}
\endpspicture
\end{preview}
\end{document}

enter image description here

share|improve this answer
add comment
up vote 0 down vote accepted

From Herbert's answer in the PSTricks' mailing list:

which has nothing to do with PSTricks...

\rput[tl](1,20){\offinterlineskip\psmatrix\A\\\A\\\A\\\A\\\A\\\endpsmatrix}
\documentclass[preview,border=15pt]{standalone}
\usepackage{pst-node}
\addtopsstyle{gridstyle}{griddots=0}
\psset
{
    framearc=0.5,
    framesep=0.5,
    linewidth=0.5,
    colsep=1,
    rowsep=1,   
    mnode=r,
}

\def\A{\psframebox{\pspicture(2,1)\psframe*[linecolor=blue](2,1)\endpspicture}}
\begin{document}
\begin{preview}
\pspicture[showgrid=top](6,20)
\rput[tl](1,20){%
\offinterlineskip
\psmatrix
    \A  \\
    \A  \\
    \A  \\
    \A  \\
    \A  \\
\endpsmatrix}
\endpspicture
\end{preview}
\end{document}

enter image description here

The following is my addition for those who are interested to know what causes the interlineskip.

% DG/SR modification begin - Nov. 27, 1998 - Patch 8
%\let\mscount\@multicnt
\ifx\mscount\@undefined\let\mscount\@multicnt\fi
% DG/SR modification end
\def\psmatrix{\begingroup{\ifnum0=`}\fi % Don't want to expand any &.
  \@ifnextchar[{\psmatrix@i}{\ifnum0=`{\fi}{}\psmatrix@ii}}
\def\psmatrix@i[#1]{%
  \ifnum0=`{\fi}{}%
  \psset{#1}%
  \psmatrix@ii}
\def\psmatrix@ii{%
  \KillGlue
  \edef\psm@beginmath{%
    \ifmmode$\m@th\ifinner\textstyle\else\displaystyle\fi\fi}%
  \edef\psm@endmath{\ifmmode$\fi}%
  \let\\\psm@cr
  \advance\psmatrixcnt by \@ne
  \def\psm@thenode{M-\the\psmatrixcnt-\the\psrow-\the\pscol}%
  \tabskip\z@
  \psrow=\@ne
  \pscol\z@
  \psset{shortput=tablr}%
  \leavevmode
  \vbox\bgroup\halign\bgroup&%
  \begingroup
  \global\advance\pscol by \@ne
  \csname psrowhook\romannumeral\psrow\endcsname
  \csname pscolhook\romannumeral\pscol\endcsname
  \psm@beginnode##\psm@endnode\endgroup
  \cr}
%
\def\endpsmatrix{%
  \crcr\egroup\unskip\egroup
  \endgroup}

According to David Carlisle's answer in the chat room:

\lineskip glue is a TeX primitive feature of the way TeX constructs vertical boxes

share|improve this answer
    
I am not trying to be rude, but to me this is a picture, a quote that "something" (what?) has nothing to do with PSTricks, and some code. I can't see how this answers the original question. (But then again, I don't know PSTricks....) Can you be a bit more specific, add some more explanation? –  Marc van Dongen Mar 17 '13 at 10:55
    
@MarcvanDongen: My intent of putting Herbert's short answer (taken from the PSTricks' mailing list) here is to be regarded as a starting point from which you can elaborate more as well as to help others with the same problem. That is why I set it as a community wiki. If I did not put his answer here, how can I finalize my question because I need to make a single accepted answer? –  I am who I say I am Mar 17 '13 at 11:03
    
Thanks. It still would be nice if you could add some more background and point out why this is relevant. For example, the OP asked what caused the problem. So far, nobody has answered this, except that "extra space" is added (not what causes it). –  Marc van Dongen Mar 17 '13 at 11:09
    
@MarcvanDongen: Hopefully, my update gives little enlightenment. –  I am who I say I am Mar 17 '13 at 11:19
    
I think this greatly improves the answer. –  Marc van Dongen Mar 17 '13 at 11:28
show 1 more 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.