diff options
Diffstat (limited to 'Master/texmf-dist/source/generic/pstricks/psd-para.tex')
-rw-r--r-- | Master/texmf-dist/source/generic/pstricks/psd-para.tex | 345 |
1 files changed, 345 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/generic/pstricks/psd-para.tex b/Master/texmf-dist/source/generic/pstricks/psd-para.tex new file mode 100644 index 00000000000..d644733a5dc --- /dev/null +++ b/Master/texmf-dist/source/generic/pstricks/psd-para.tex @@ -0,0 +1,345 @@ +%% BEGIN psd-para.tex + +\part{More graphics parameters} + +The graphics parameters described in this part are common to all or most of +the graphics objects. + +\Section{Coordinate systems} + +The following manipulations of the coordinate system apply only to pure +graphics objects. + +A simple way to move the origin of the coordinate system to \c{} is with the +\begin{Ex} + \Par{origin=\{coor\}}({0pt,0pt}) +\end{Ex} +This is the one time that coordinates \emph{must} be enclosed in curly brackets +"{}" rather than parentheses "()". + +A simple way to switch swap the axes is with the +\begin{Ex} + \Par{swapaxes=true} +\end{Ex} +parameter. E.g., you might change your mind on the orientation of a plot after +generating the data. + +\Section{Line styles\label{S-linestyles}} + +The following graphics parameters (in addition to \p{linewidth} and +\p{linecolor}) determine how the lines are drawn, whether they be open or +closed curves. +\begin{description}\raggedright + +\pitem[linestyle=style] + Valid styles are "none", "solid", "dashed" and "dotted". + +\pitem[dash=dim1 dim2] + The <black-white> dash pattern for the "dashed" line style. For example: +\begin{MEx}(4,2) + \psellipse[linestyle=dashed,dash=3pt 2pt](2,1)(2,1) +\end{MEx} + +\pitem[dotsep=dim] + The distance between dots in the "dotted" line style. For example +\begin{MEx}(4,1) + \psline[linestyle=dotted,dotsep=2pt]{|->>}(4,1) +\end{MEx} + +\pitem[border=dim] + A positive value draws a border of width <dim> and color \p{bordercolor} on +each side of the curve. This is useful for giving the impression that one line +passes on top of another. The value is saved in the dimension register +\n\psborder. + +\pitem[bordercolor=color] + See \p{border} above. + + For example: +\begin{MEx}(4,3) + \psline(0,0)(1.8,3) + \psline[border=2pt]{*->}(0,3)(1.8,0) + \psframe*[linecolor=gray](2,0)(4,3) + \psline[linecolor=white,linewidth=1.5pt]{<->}(2.2,0)(3.8,3) + \psellipse[linecolor=white,linewidth=1.5pt, + bordercolor=gray,border=2pt](3,1.5)(.7,1.4) +\end{MEx} + +\pitem[doubleline=true/false] + When "true", a double line is drawn, separated by a space that is +\p{doublesep} wide and of color \p{doublecolor}. This doesn't work as expected +with the "dashed" \p{linestyle}, and some arrows look funny as well. + +\pitem[doublesep=dim] + See \p{doubleline}, above. + +\pitem[doublecolor=color] + See \p{doubleline}, above. + +Here is an example of double lines: +\begin{MEx}(4,1) + \psline[doubleline=true,linearc=.5, + doublesep=1.5pt]{->}(0,0)(3,1)(4,0) +\end{MEx} + +\pitem[shadow=true/false] + When "true", a shadow is drawn, at a distance \p{shadowsize} from the +original curve, in the direction \p{shadowangle}, and of color +\p{shadowcolor}. + +\pitem[shadowsize=dim] + See \p{shadow}, above. + +\pitem[shadowangle=angle] + See \p{shadow}, above. + +\pitem[shadowcolor=color] + See \p{shadow}, above. + +Here is an example of the \p{shadow} feature, which should look familiar: +\begin{MEx}[-1,-.5](1,.7) + \pspolygon[linearc=2pt,shadow=true,shadowangle=45, + xunit=1.1](-1,-.55)(-1,.5)(-.8,.5)(-.8,.65) + (-.2,.65)(-.2,.5)(1,.5)(1,-.55) +\end{MEx} +\end{description} + +Here is another graphics parameter that is related to lines but that applies +only to the closed graphics objects \n\psframe, \n\pscircle, \n\psellipse{} and +\n\pswedge: +\begin{Ex} + \Par{dimen=outer/inner/middle} +\end{Ex} +It determines whether the dimensions refer to the inside, outside or middle of +the boundary. The difference is noticeable when the linewidth is large: +\begin{MEx*}(4,3) + \psset{linewidth=.25cm} + \psframe[dimen=inner](0,0)(2,1) + \psframe[dimen=middle](0,2)(2,3) + \psframe[dimen=outer](3,0)(4,3) +\end{MEx*} +With "\pswedge", this only affects the radius; the origin always lies in the +middle the boundary. The right setting of this parameter depends on how you +want to align other objects. + + +\Section{Fill styles\label{S-fillstyles}} + +The next group of graphics parameters determine how closed regions are filled. +Even open curves can be filled; this does not affect how the curve is painted. +\begin{description}\raggedright + +\pitem[fillstyle=style] + Valid styles are + \begin{quote}\raggedright + "none", "solid", "vlines", "vlines*", "hlines", "hlines*", "crosshatch" and +"crosshatch*". + \end{quote} + "vlines", "hlines" and "crosshatch" draw a pattern of lines, according to +the four parameters list below that are prefixed with "hatch". The "*" +versions also fill the background, as in the "solid" style. + +\pitem[fillcolor=color] + The background color in the "solid", "vlines*", "hlines*" and "crosshatch*" +styles. + +\pitem[hatchwidth=dim] + Width of lines. + +\pitem[hatchsep=dim] + Width of space between the lines. + +\pitem[hatchcolor=color] + Color of lines. Saved in \n\pshatchcolor. + +\pitem[hatchangle=rot] + Rotation of the lines, in degrees. For example, if \p{hatchangle} is set to +"45", the "vlines" style draws lines that run NW-SE, and the "hlines" style +draws lines that run "SW-NE", and the "crosshatch" style draws both. +\end{description} + +Here is an example of the "vlines" and related fill styles:\footnote{% +PSTricks adjusts the lines relative to the resolution so that they all have +the same width and the same intervening space. Otherwise, the checkered +pattern in this example would be noticeably uneven, even on 300 dpi devices. +This adjustment is resolution dependent, and may involve adjustments to the +\p{hatchangle} when this is not initially a multiple of 45 degrees.} +\begin{MEx}(4,3) + \pspolygon[fillstyle=vlines](0,0)(0,3)(4,0) + \pspolygon[fillstyle=hlines](0,0)(4,3)(4,0) + \pspolygon[fillstyle=crosshatch*,fillcolor=black, + hatchcolor=white,hatchwidth=1.2pt,hatchsep=1.8pt, + hatchangle=0](0,3)(2,1.5)(4,3) +\end{MEx} + +Each of the pure graphics objects (except those beginning with "q") has a +starred version that produces a solid object of color \p{linecolor}. (It +automatically sets \p{linewidth} to zero, \p{fillcolor} to \p{linecolor}, +\p{fillstyle} to "solid", and \p{linestyle} to "none".) + + +\Section{Arrowheads and such\label{S-arrows}} + + Lines and other open curves can be terminated with various arrowheads, +t-bars or circles. The +\begin{Ex} + \Par{arrows=style} +\end{Ex} +parameter determines what you get. It can have the following values, which are +pretty intuitive:\footnote{This is \TeX's version of WYSIWYG.}% +\newbox\arrowtable +\setbox\arrowtable=\hbox{% + \def\myline#1{\psline{#1}(0,1ex)(1.3,1ex)}% + \catcode`\<=12 + \begin{tabular}{cll}% + \emph{Value} & \hbox to 1.3cm{\emph{Example}}\hss & \emph{Name} \\[2pt] + "-" & \myline{-} & None\\ + "<->" & \myline{<->} & Arrowheads.\\ + ">-<" & \myline{>-<} & Reverse arrowheads.\\ + "<<->>" & \myline{<<->>} & Double arrowheads.\\ + ">>-<<" & \myline{>>-<<} & Double reverse arrowheads.\\ + "|-|" & \myline{|-|} & T-bars, flush to endpoints.\\ + "|*-|*" & \myline{|*-|*} & T-bars, centered on endpoints.\\ + "|<->|" & \myline{|<->|} & T-bars and arrowheads.\\ + "|<*->|*" & \myline{|<*->|*} & T-bars and arrowheads, flush.\\ + "[-]" & \myline{[-]} & Square brackets.\\ + "(-)" & \myline{(-)} & Rounded brackets.\\ + "o-o" & \myline{o-o} & Circles, centered on endpoints.\\ + "*-*" & \myline{*-*} & Disks, centered on endpoints.\\ + "oo-oo" & \myline{oo-oo} & Circles, flush to endpoints.\\ + "**-**" & \myline{**-**} & Disks, flush to endpoints.\\ + "c-c" & \myline{c-c} & Extended, rounded ends.\\ + "cc-cc" & \myline{cc-cc} & Flush round ends.\\ + "C-C" & \myline{C-C} & Extended, square ends. + \end{tabular}}% +\addtoquickref{center}{% + {\large\textbf{Arrows}}\par + \leavevmode\box\arrowtable} +\begin{center} + \leavevmode\copy\arrowtable +\end{center} +You can also mix and match. E.g., "->", "*-)" and "[->" are all valid values +of the \p{arrows} parameter. + +Well, perhaps the "c", "cc" and "C" arrows are not so obvious. "c" and "C" +correspond to setting PostScript's "linecap" to 1 and 2, respectively. "cc" is +like "c", but adjusted so that the line flush to the endpoint. These arrows +styles are noticeable when the \p{linewidth} is thick: +\begin{MEx}[-.25,-.25](3.25,2.25) + \psline[linewidth=.5cm](0,0)(0,2) + \psline[linewidth=.5cm]{c-c}(1,0)(1,2) + \psline[linewidth=.5cm]{cc-cc}(2,0)(2,2) + \psline[linewidth=.5cm]{C-C}(3,0)(3,2) + "\rput[t](0,-.3){\texttt{-}} + "\rput[t](1,-.3){\texttt{c-c}} + "\rput[t](2,-.3){\texttt{cc-cc}} + "\rput[t](3,-.3){\texttt{C-C}} +\end{MEx} + +Almost all the open curves let you include the \p{arrows} parameters as an +optional argument, enclosed in curly braces and before any other arguments +(except the optional parameters argument). E.g., instead of +\begin{LVerb} + \psline[arrows=<-,linestyle=dotted](3,4) +\end{LVerb} +you can write +\begin{LVerb} + \psline[linestyle=dotted]{<-}(3,4) +\end{LVerb} +The exceptions are a few streamlined macros that do not support the use of +arrows (these all begin with "q"). + +The size of these line terminators is controlled by the following parameters. +In the description of the parameters, the width always refers to the dimension +perpendicular to the line, and length refers to a dimension in the direction +of the line. +\begin{description} + +\pitem[arrowsize=dim `num'] + The width of arrowheads is <dim> plus <num> times \p{linewidth} +(if the optional `num' is inclued). See the diagram below. + +\pitem[arrowlength=num] + Length of arrowheads, as a fraction of the width, as shown below. + +\pitem[arrowinset=num] + Size of inset for arrowheads, as a fraction of the length, as shown below. + +\begin{center}\leavevmode +\hbox to \linewidth{% + \psset{unit=.5cm} + \pspicture[shift=3cm](-3.6,-1.3)(3.4,4.8) + \pspolygon*(-2,0)(0,4)(2,0)(0,1) + \psset{arrows=|-|} + \psline(-2.5,0)(-2.5,4)\rput(-2.7,2){\psframebox*{\emph{length}}} + \psline(-2,-.5)(2,-.5)\rput(0,-.5){\psframebox*{\emph{width}}} + \psline(2.5,0)(2.5,1)\rput[l](2.8,.5){\emph{inset}} + \endpspicture + \hfill + \begin{tabular}{rcl} + \texttt{arrowsize} & = & <dim num>\\ + \emph{width} & = & <num> x \p{linewidth} + <dim1>\\ + \emph{length} & = & \p{arrowlength} x \emph{width}\\ + \emph{inset} & = & \p{arrowinset} x \emph{height} + \end{tabular}} +\end{center} + +\pitem[tbarsize=dim `num'] + The width of a t-bar, square bracket or rounded bracket is <dim> plus <num> +times \p{linewidth} (if the optional `num' is included). +\p{linewidth}, plus <dim>. + +\pitem[bracketlength=num] + The height of a square bracket is <num> times its width. + +\pitem[rbracketlength=num] + The height of a round bracket is <num> times its width. + +\pitem[arrowscale=arrowscale=num1 <num2>] + Imagine that arrows and such point down. This scales the width of the arrows +by <num1> and the length (height) by <num2>. If you only include one number, +the arrows are scaled the same in both directions. Changing \p{arrowscale} can +give you special effects not possible by changing the parameters described +above. E.g., you can change the width of lines used to draw brackets. + +\end{description} + +The size of dots is controlled by the \p{dotsize} parameter. + + +\Section{Custom styles} + +You can define customized versions of any macro that has parameter changes as +an optional first argument using the \n\newpsobject{} command: + \Mac \newpsobject{name}{object}{par1=value1`,\ldots'} +as in +\begin{LVerb} + \newpsobject{myline}{psline}{linecolor=green,linestyle=dotted} + \newpsobject{mygrid}{psgrid}{subgriddiv=1,griddots=10, + gridlabels=7pt} +\end{LVerb} +The first argument is the name of the new command you want to define. The +second argument is the name of the graphics object. Note that both of these +arguments are given without the backslash. The third argument is the special +parameter values that you want to set. + +With the above examples, the commands "\myline" and "\mygrid" work just like +the graphics object \n\psline{} it is based on, and you can even reset the +parameters that you set when defining "\myline", as in: +\begin{LVerb} + \myline[linecolor=gray,dotsep=2pt](5,6) +\end{LVerb} + +Another way to define custom graphics parameter configurations is with the + \Mac \newpsstyle{name}{par1=value1`,\ldots'} +command. You can then set the \p{style} graphics parameter to <name>, rather +than setting the parameters given in the second argument of \n\newpsstyle. For +example, +\begin{LVerb} + \newpsstyle{mystyle}{linecolor=green,linestyle=dotted} + \psline[style=mystyle](5,6) +\end{LVerb} + +\endinput + +%% END psd-para.tex |