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.

Why do I need to insert % right after the opening curly brace { of multido rather than right after the closing } of \pstVerb? In my mental model, the unnecessary white spaces exist after the \pstVerb call so they must be removed by appending % right after } of \pstVerb.

\documentclass[pstricks,border=24pt]{standalone}
\usepackage{multido}
\begin{document}
\begin{pspicture}[dimen=m](8,8)
    \multido{\ix=1+1,\ic=97+1}{8}
    {% <-- this comment is necessary but I don't understand why.
        \pstVerb{/hx \ix\space .5 sub def}
        \uput[d](!hx 0){$\char\ic\mathstrut$}
        \uput[l](!0 hx){$\ix\mathstrut$}
        \multido{\iy=1+1,\io=\ix+1}{8}
        {       
            \psframe[origin={\ix,\iy},fillstyle=\ifodd\io solid\else vlines\fi,hatchsep=.5pt,hatchcolor=lightgray](-1,-1)
            \rput(!hx \iy\space .5 sub){$(\iy,\ix)$}
        }
    }
\end{pspicture}
\end{document}
share|improve this question

1 Answer 1

up vote 5 down vote accepted

every macro which is declared as a PSTricks object like

\def\xyz{\pst@object{xyz}}
\def\xyz@i{%
   ...%
}

will kill all preceding glue. \pstVerb is not a PSTricks object or in short: it is a normal TeX macro and \psframe is such an object.

A shorter version:

\documentclass[pstricks,border=24pt]{standalone}
\usepackage{multido}
\begin{document}
\begin{pspicture}[dimen=m](8,8)
  \multido{\ix=1+1,\rx=0.5+1.0,\ic=97+1}{8}{%
    \uput[d](\rx,0){$\char\ic\mathstrut$}
    \uput[l](0,\rx){$\ix\mathstrut$}
    \multido{\iy=1+1,\ry=0.5+1.0,\io=\ix+1}{8}{%
      \psTextFrame[fillstyle=\ifodd\io solid\else none\fi,fillcolor=lightgray]%
         (\ix,\iy)(!\ix\space 1 sub \iy\space 1 sub){$(\iy,\ix)$}}}
\end{pspicture}
\end{document}
share|improve this answer
    
Why does the % come before \pstVerb{...} rather than after \pstVerb{...}? –  stalking is prohibited Apr 6 at 13:15
    
\uput has a \pst@killglue –  Herbert Apr 6 at 13:19
    
Does it make sense to insert \pst@killglue in \pstVerb to kill the unnecessary whitespaces automatically? –  stalking is prohibited Apr 6 at 13:28
    
no, makes no real sense. –  Herbert Apr 6 at 13:35

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.