## Saturday, November 26, 2011

### pspicture--an easy way to allocate space for pstricks elements

pspicture is a latex environment which can make the allocation of space for pstricks elements very easy. To show its utility, now we come to fix the second example in the previous posts.

\documentclass{article}
\usepackage{pstricks}
\begin{document}
Pstricks Hello world! Pstricks Hello world!

Hello,world!
\begin{pspicture}(13ex,1ex)
\rput(6ex,0.5ex){\color{red} Hello,world!}
\end{pspicture}
Hello,World!

Pstricks Hello world! Pstricks Hello world!
\end{document}


 Fig.1 pspicture environment
We see (Fig.1 pspicture environment) that this time the pstricks element "Hello,world!" has been placed in a right place. And some explanations on the pspicture environment is shown below:

1. Pspicture environment can followed by two coordinate argument, i.e., "\begin{pspicture}(x0,y0)(x1,y1)". The first one represents the lower left corner and the second one represents the upper right corner. If the first one is not specified, it is (0,0) by default.

2.There is a optional argument called "baseline"("\begin{pspicture}[baseline](x0,y0)(x1,y2)"). It sets the baseline fraction from the bottom. (Note that the value of baseline is not necessarily between 0 and 1.) If this argument is include but it is empty ([]), the baseline is set a horizontal line through the origin.

3.The pstricks element may extents out the space specified. But if you specify the environment like this "\begin{pspicture}*[baseline](x0,y0)(x1,y1)", the anything outside the specified area will be clipped.