more pstricks and tables

Denis Girou Denis.Girou at idris.fr
Thu Oct 12 18:11:32 CEST 2000


-----------------------------------------------------------------------------
This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.
-----------------------------------------------------------------------------

The following message is a courtesy copy of an article
that has been posted to comp.text.tex as well.

>>>>> "Kendall.Shaw" == Kendall Shaw <kshaw at sadmail.com> writes:

    Kendall.Shaw> Thanks for helping me with my other pstricks/table alignment question. I've
    Kendall.Shaw> now read the manual a little more carefully. But, I still have a question:

    Kendall.Shaw> The spacing between rows seems to change if I adjust the baseline in
    Kendall.Shaw> pspicture, e.g.:

    Kendall.Shaw> \documentclass{letter}
    Kendall.Shaw> \usepackage{pstricks}
    Kendall.Shaw> \begin{document}
    Kendall.Shaw> \begin{tabular}{ll}
    Kendall.Shaw> blah &
    Kendall.Shaw> \begin{pspicture}(-3,-3)(3,3)
    Kendall.Shaw> \psframe(-3,-3)(3,3)
    Kendall.Shaw> \end{pspicture} \\[16pt]
    Kendall.Shaw> yah & $a+b$ \\
    Kendall.Shaw> \end{tabular}
    Kendall.Shaw> \end{document}

    Kendall.Shaw> looks as I would expect, i.e. a large gap between rows of the table. But, if
    Kendall.Shaw> I adjust the baseline for the pspicture, the gap goes away:

    Kendall.Shaw> \documentclass{letter}
    Kendall.Shaw> \usepackage{pstricks}
    Kendall.Shaw> \begin{document}
    Kendall.Shaw> \begin{tabular}{ll}
    Kendall.Shaw> blah &
    Kendall.Shaw> \begin{pspicture}[.97](-3,-3)(3,3)
    Kendall.Shaw> \psframe(-3,-3)(3,3)
    Kendall.Shaw> \end{pspicture} \\[16pt]
    Kendall.Shaw> yah & $a+b$ \\
    Kendall.Shaw> \end{tabular}
    Kendall.Shaw> \end{document}

    Kendall.Shaw> I imagine this has to do with it being the baseline that I'm adjusting. But,
    Kendall.Shaw> how can I account for this aside from guessing at the space to add after the
    Kendall.Shaw> row?

    Kendall.Shaw> Also, is there an easy way to adjust the baseline properly rather than
    Kendall.Shaw> trying numbers that are close to 1?

  You are right that the management of inter-row space is not exactly
what we can expect. Even in your first case, we loose the vertical space
above the frame. I cannot give you the real explanation, but this is
rather unusual to include graphic objects in such environment (for instance,
PSTricks has his own environment "psmatrix" to position text and graphic
objects on a grid, with a lot of additional capabilities - but this is
probably not what you need in your case, as you explained before that you need 
to use the "longtable" environment) and it can generate some unexpected
effects. This is not really specific to PSTricks, and you can verify that the
result is the same if you use the standard LaTeX environment "picture".

  Nevertheless, the simplest workaround for you is probably only to load
the "tabls" package from Donald Arseneau (one of his numberous useful tricks).
It will automagically greatly improve the situation (and even you can control
it effect).

\documentclass[a4paper]{article}

\usepackage{pstricks}
\usepackage{tabls}    % In CTAN/macros/latex/contrib/other/misc

\setlength{\unitlength}{1cm}
\newcommand{\MyPictureLaTeX}{%
\begin{picture}(2,2)
  \framebox(2,2){}
\end{picture}}

\newcommand{\MyPicturePST}[1][]{%
\begin{pspicture}[#1](2,2)
  \psframe[linecolor=red](2,2)
\end{pspicture}}

\pagestyle{empty}

\begin{document}

\begin{tabular}{|c|}
  \hline
  \MyPictureLaTeX \\
  \hline
\end{tabular}
\hfill
\begin{tabular}{|c|}
  \hline
  \MyPicturePST \\
  \hline
\end{tabular}
\hfill
\setlength{\tablinesep}{5mm}
\begin{tabular}{|c|}
  \hline
  \MyPictureLaTeX \\
  \hline
\end{tabular}
\hfill
\begin{tabular}{|c|}
  \hline
  \MyPicturePST \\
  \hline
\end{tabular}

\vspace{1cm}
\setlength{\tablinesep}{2mm}
\begin{tabular}{|c|c|}
  \hline
  AA & \MyPictureLaTeX \\
  \hline
\end{tabular}
\hfill
\begin{tabular}{|c|c|}
  \hline
  AA & \MyPicturePST \\
  \hline
\end{tabular}
\hfill
\begin{tabular}{|c|c|}
  \hline
  AA & \MyPicturePST[0.88] \\
  \hline
\end{tabular}

\end{document}


Denis Girou
-- 
--------------------------------------------------------------------------
Institut du Développement et des Ressources en Informatique Scientifique |
Centre National de la Recherche Scientifique                             |
Bâtiment 506 - B.P. 167 - 91403 Orsay Cedex - France                     |
--------------------------------------------------------------------------

-----------------------------------------------------------------------------
The list interface (subscription, information, access to the archives) is on:
http://www.tug.org/cgi-bin/lwgate/pstricks
Otherway to unsubscribe, send mail to pstricks-request at mail.tug.org
with a blank subject and in body the line unsubscribe <email-address>
-----------------------------------------------------------------------------



More information about the PSTricks mailing list