Wednesday, September 12, 2012

rput --- a most offen used pstricks command

"rput" is a most offen used pstricks command. It gives you the ability to place and rotate whatever you want. We have used this command before, and this time we come to examine it carefully.
The common useage of this command is "\rput[refpoint]{rotation}(x,y){stuff}".
"refpoints" determines the reference point of stuff. It take value of the combination of "t,b,B"(for vertical refpoint, means "top","bottom" and "Baseline" respectively) and "l,r"(for horizontal refpoint, means "left" and "right" respectively).

"rotation" is the angle "stuff" will be rotated. "(x,y)" is the position where "stuff" will be placed. And "stuff" is what you want to place at position (x,y), for example, some words, some pstricks element and so on. Note that the coordinates appear in "stuff" are coordinates relative to (x,y).

In the following example the usage of this command is shown practically.

\documentclass{article}
\usepackage{pst-plot}
\usepackage{pstricks}
\begin{document}
  \begin{pspicture}(0,0)(5,5)
  \psgrid[gridcolor=gray,
    subgridcolor=lightgray](0,0)(5,5)
  \rput[bl](0,1){bottom left (0,1)}
  \rput[tr](5,1){top right (5,1)}
  \rput[Bl](0,2){Baseline left (0,2)}
  \rput{45}(1,4){rotate $45^{\circ}$}
  \rput{45}(3.5,3.5)
  {
    \psframe[linecolor=red](-1,-1)(1,1)
  }
  \end{pspicture}
\end{document}

Fig.1 rput --- a most offen used pstricks command
Files Download: tex ps pdf

1 comment:

  1. Thank you. Works perfectly with xelatex. I tried pdflatex first, which did not work.

    ReplyDelete

Creative Commons License
Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.