P. 1
chap12

chap12

|Views: 1|Likes:

More info:

Published by: Pritam Singh Bakariya on Jul 19, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

07/19/2013

pdf

text

original

Tricky Repetitions

Repeated placing Nesting All-purpose repetition

s s s s s s s s c c c c c c c c i i i i i i i i h h h h h h h h p p p p p p p p a a a a a a a a r r r r r r r r G G G G G G G G d d d d d d d d n n n n n n n a a a a a a a a X X X X X X X X T T T T T T T T E E E E E E E E

AT X Tutorial Online L E

Part II – Graphics
PSTricks

E Krishnan, CV Radhakrishnan and AJ Alex constitute the graphics tutorial team. Comments and suggestions may be mailed to tutorialteam@tug.org.in

c 2004–2009, The Indian TEX Users Group This document is generated by TEX with hyperref, pstricks, pdftricks and pdfscreen packages in an intel  running / and is released under 

The Indian TEX Users Group
http://www.tug.org.in

Floor ,  Buildings, Cotton Hills Trivandrum 695014, 

1/21

Repeated placing Nesting All-purpose repetition

12. Tricky Repetitions
In mathematical (and other kinds of) graphics, we often need to repeat the same thing according to a pattern. It may be a simple thing, such as placing equally spaced points on a line segment:
AT X Tutorial Online L E

Part II – Graphics
PSTricks

or slightly more complex, such as joining pairs of equally spaced points on a circle:

E Krishnan, CV Radhakrishnan and AJ Alex constitute the graphics tutorial team. Comments and suggestions may be mailed to tutorialteam@tug.org.in

c 2004–2009, The Indian TEX Users Group This document is generated by TEX with hyperref, pstricks, pdftricks and pdfscreen packages in an intel  running / and is released under 

These can be done using PSTricks in using the commands we have already seen in earlier chapters; but then, it will be a tedious job, keeping track of the various coordinates.

The Indian TEX Users Group
http://www.tug.org.in

Floor ,  Buildings, Cotton Hills Trivandrum 695014, 

2/21

 Buildings. Cotton Hills Trivandrum 695014.in c 2004–2009.in Floor . The Indian TEX Users Group This document is generated by TEX with hyperref.org. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www. Comments and suggestions may be mailed to tutorialteam@tug. pstricks.Tricky Repetitions We first see how simple repetitions can be done using certain commands available in the generic pstricks package itself and then see how all these and much more can be done using an additional package.tug.  3/21 .org. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team. Repeated placing Nesting All-purpose repetition AT X Tutorial Online L E Part II – Graphics PSTricks E Krishnan.

0)(4.0)(0. The next pair of numbers. The first coordinate (0.0)(0.4) \multirput(0.5.0)(0. using the \rput command. Thus the first picture at the beginning of the chapter can be easily drawn with the code c 2004–2009.1.0. 0 + 8 × 0.Tricky Repetitions 12.tug.5.0)(4. It has a variant named \multirput which places multiple copies of an object at equally spaced points along a line.0) is the first point where a copy is to be put.5). Cotton Hills Trivandrum 695014.in Here.5.org.0. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team. the small dark squares are all drawn with the single command \multirput(0.1) and so on.in Floor .5)} E Krishnan.5) = (4. the third at (1.0. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www.5) gives the successive increments to the coordinates.org. this means. which also means the final copy would be put at (0 + 8 × 0.  4/21 . the small square drawn with the \psframe* is the object to be repeatedly placed.0)(0.0.4) \psframe[fillstyle=solid.5.% linecolor=Mahogany]% (0.% fillcolor=Apricot. (0. Repeated placing We have seen how objects can be placed at specified locations of a PSTricks picture. The Indian TEX Users Group This document is generated by TEX with hyperref.5){8}{% \psframe*[linecolor=Mahogany] (0. 4). Comments and suggestions may be mailed to tutorialteam@tug.5)} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition AT X Tutorial Online L E Part II – Graphics PSTricks In this example. The numbers 8 in the command specifies the number of copies.5){8}{\psframe*[linecolor=Mahogany](0. pstricks.5. Look at this example: \begin{center} \begin{pspicture}(0.5. the next copy is to be put at (0.5.0.0.  Buildings.

5. The Indian TEX Users Group This document is generated by TEX with hyperref. pstricks.in c 2004–2009. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www.  5/21 .1.4) \psframe[fillstyle=solid.% fillcolor=Apricot.  Buildings.0){11}{% \psdots[linecolor=Red](0.tug.0){8}{% \psframe*[linecolor=Mahogany] (0.0)} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition The \multirput command has an additional argument to specify rotation. Cotton Hills Trivandrum 695014.35)} \end{pspicture} \end{center} AT X Tutorial Online L E Part II – Graphics PSTricks This command comes in handy.1) \psline[linecolor=Blue](0.0.4) \multirput{45}(0.0)(1.0)(0. in drawing periodic extensions of functions: E Krishnan.Tricky Repetitions \begin{center} \begin{pspicture}(0.0)(4. used as in the next example: \begin{center} \begin{pspicture}(0.0) \multirput(0.0)(4.in Floor . for example.-1)(10.0)(10.org. Comments and suggestions may be mailed to tutorialteam@tug.org.25.75)(0.35.% linecolor=Mahogany]% (0.

2)(6.% fillcolor=Cyan.in Floor .2.0)(-7. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team.-0. The Indian TEX Users Group This document is generated by TEX with hyperref.8cm} \begin{pspicture}(-7.5cm} \begin{center} \begin{pspicture}(-0.  Buildings.tug. c 2004–2009.in Note the use [bl] in this example.1) \psset{fillstyle=solid.org.0){3}{% \pbarc} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition 5 4 3 2 1 -7 -6 -5 -4 -3 -2 -1 -1 -2 1 2 3 4 5 6 7 AT X Tutorial Online L E Part II – Graphics PSTricks We can \multirput pieces of text also: \DeclareFixedFont{\bigsf}{T1}{phv}{b}{n}{1. Comments and suggestions may be mailed to tutorialteam@tug.-0. pstricks.0)(4.02){10}{% \pscharpath{\bigsf PSTricks}} \end{pspicture} \end{center} E Krishnan. and so such a specification is redundant for placing these objects.2.0)(-0. As has been mentioned earlier. the pure graphic objects produced by PSTricks are zero-dimensional TEX boxes. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www. Cotton Hills Trivandrum 695014.-2)(7.org.  6/21 .% linecolor=Blue} \multirput[bl](0.Tricky Repetitions \renewcommand{\pshlabel}[1]{% \tiny\color{Mahogany}#1} \renewcommand{\psvlabel}[1]{% \tiny\color{Mahogany}#1} \newcommand{\pbarc}{% \psplot[linecolor=Blue]% {-2}{2}{x 2 exp}} \begin{center} \psset{unit=0.-2)(7.5) \multirput(-4.02.5) \psaxes[linecolor=Apricot]% (0. which refers to the bottom left of the (TEX ) box containing the text.

0)(0.eps}} \begin{center} \color{Blue} \begin{pspicture}(0.0){2}{% \includeman} \rput(1. pstricks.5.25){1975} \multirput[bl](2. pdftricks and pdfscreen packages in an intel  running / and is released under  with \multips(0.Tricky Repetitions We can also \multirput external graphics.org.0){6}{% \includeman} \rput(1. Comments and suggestions may be mailed to tutorialteam@tug.5)} E Krishnan.25){1999} \multirput[bl](2. in drawing pictographs: \newcommand{\includeman}{% \includegraphics[scale=0.0)(1.0.0)(0.0)(0.org.-1.  7/21 .0.2)(1.25){1850} \rput[bl](2. so that we can get the same output as in the first example above by replacing the line \multirput(0.3.tug.in Floor .2.3){\includeman} \rput(4.0.5){8}{\psframe*[linecolor=Mahogany](0.1.1)(1.5.0)(0.5.5.5){8}{\psframe*[linecolor=Mahogany](0.0){4}{% \includeman} \rput(1. for example.0.  Buildings. Cotton Hills Trivandrum 695014.in c 2004–2009.075]{% iconman.-1){\includeman} \rput[l](4.4) \rput(1.-1){$=1$ billion} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition 1850 1930 1975 1999 AT X Tutorial Online L E Part II – Graphics PSTricks = 1 billion We now look at a similar command with slightly different functionality The command \multips is similar to \multirput.5)} The Indian TEX Users Group http://www. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team. The Indian TEX Users Group This document is generated by TEX with hyperref.0.5)(8. which is useful.25){ 1930} \multirput[bl](2.5.

5.Tricky Repetitions But \multips can handle only pure graphic objects produced by PSTricks.0)(5.0)(!5 7 div 3 7 div)} \end{pspicture} \end{center} E Krishnan.0)(!5 7 div 3 7 div){7}{% \psframe*[linecolor=Mahogany]% (0.% linecolor=Mahogany]% (0. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www.0)} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition AT X Tutorial Online L E Part II – Graphics PSTricks \begin{center} \begin{pspicture}(0.in c 2004–2009.0)(4.  Buildings.0)(5. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team. Comments and suggestions may be mailed to tutorialteam@tug.% fillcolor=Apricot.0)(5.  8/21 . with this command.0)(5. we can use other kinds of coordinates (remember \SpecialCoor ?) as increments.3) \SpecialCoor \psframe[fillstyle=solid. Cotton Hills Trivandrum 695014.4) \psline[linecolor=Blue](0.tug.30){9}{% \psdots[linecolor=Red](0.3) \multips(0.org.0)(0.4) \SpecialCoor \coloraxes(0. pstricks.org. On the other hand.in Floor . The Indian TEX Users Group This document is generated by TEX with hyperref.30) \multips(0. Look at these examples: \begin{center} \begin{pspicture}(0.

1)(2. look at the output produced by the inner \multirput alone: \begin{center} \psset{unit=0.2)} \end{pspicture} \end{center} E Krishnan.Tricky Repetitions 12. The Indian TEX Users Group This document is generated by TEX with hyperref.org. Nesting The command \multirput can be nested.1)(2.2){4}{% \multirput(0.0)(8.0)(2.0)(1. We first draw a small cube like this: c 2004–2009. Cotton Hills Trivandrum 695014. to produce two-dimensional arrays as below: \begin{center} \psset{unit=0.8) \psframe*[linecolor=Red](0.1) \psframe*(1.0)(8.0)(0.  9/21 .0){4}{% \psframe*(0.8) \multirput(0.  Buildings.2)}} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition AT X Tutorial Online L E Part II – Graphics PSTricks To understand why this works. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team.0)(8. pstricks.0)(8.8) \psframe*[linecolor=Red](0.tug.in Floor .org.5cm} \begin{pspicture}(0.in The outer \multirput repeats these two rows of small black squares four times to fill the large red square. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www.5cm} \begin{pspicture}(0.0)(2. Comments and suggestions may be mailed to tutorialteam@tug. With deeper nesting.2.8) \multirput(0.1) \psframe*(1.0)(1.0){4}{% \psframe*(0. we can produce three-dimensional arrays as well: As an example.

2)(2.-0. The Indian TEX Users Group This document is generated by TEX with hyperref.2) \pspolygon[fillcolor=Apricot]% (1. we can repeatedly stack such cubes as below: \begin{center} \psset{unit=0.1.0)(0.2.Tricky Repetitions \newcommand{\smallcube}{% \psset{fillstyle=solid. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team.1)(2.-0. Comments and suggestions may be mailed to tutorialteam@tug.4) \multirput(0.in Floor .org.28){4}{% \smallcube} \end{pspicture} \end{center} E Krishnan.org.8)(2.1.tug.% linestyle=none} \pspolygon[fillcolor=Mahogany]% (0.0)(-1.5cm} \begin{pspicture}(0.1.2)(1.-0.  10/21 .1.1.1)(1. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www.2)(2.2)(1.4)} \begin{center} \psset{unit=0. Cotton Hills Trivandrum 695014.4.2)(1.4) \smallcube \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition AT X Tutorial Online L E Part II – Graphics PSTricks By nesting \multirput.5cm} \begin{pspicture}(-4.0) \pspolygon[fillcolor=Tan]% (0.2)(1.-0.1.-0.1)(2.  Buildings. pstricks.in c 2004–2009.1.

4){4}{% \multirput(0.1.Tricky Repetitions \begin{center} \psset{unit=0.2.-0. Comments and suggestions may be mailed to tutorialteam@tug. The Indian TEX Users Group This document is generated by TEX with hyperref.org.  11/21 .28){4}{% \multirput(0.1.2.) E Krishnan.28){4}{% \smallcube}}} \end{pspicture} \end{center} AT X Tutorial Online L E Part II – Graphics PSTricks The \multips can also be nested as in the next example.0)(-1.in c 2004–2009. (Yes.0)(1.org.0)(0. the red lines are indeed parallel.5.-2.2)(6. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www.-0.2.tug.4.5cm} \begin{pspicture}(-4.  Buildings. pstricks.4.0)(-1.28){4}{% \multirput(0.in Floor .4) \multirput(0.2)(6. Cotton Hills Trivandrum 695014.6) \multirput(0. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team.4.-2.5cm} \begin{pspicture}(-4.28){4}{% \smallcube}} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition \begin{center} \psset{unit=0.4.-0.-0.2.0)(1.

5.4){2}{% \multips(0. pstricks.0){5}{% \psframe*(0. Cotton Hills Trivandrum 695014.5.3)(2.32.0} \begin{center} \psset{unit=0.0){5}{% \psframe*(0.0)(1.0)(1.0)(10.  12/21 .0)(10.0.0)} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition AT X Tutorial Online L E Part II – Graphics PSTricks E Krishnan.5cm} \begin{pspicture}(-1.tug.0)(2.in Floor .org. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team. Comments and suggestions may be mailed to tutorialteam@tug. The Indian TEX Users Group This document is generated by TEX with hyperref.8) \psset{linecolor=Sepia} \psframe*[linecolor=LightApricot](-1.Tricky Repetitions \definecolor{LightApricot}{cmyk}{0.1)(2.0)(1. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www.1){9}{% \psline[linecolor=Red.2){4}{% \multips(0.0){5}{% \psframe*(0.12.in c 2004–2009.0)(0.1)}} \multips(0.1)}} \multips(0.  Buildings.org.0.0)(0.1)} \multips(-0.8) \multips(0.0)(0.% linewidth=1pt]% (-1.0)(10.

also both these numbers are given as values to the single variable \i. The Indian TEX Users Group This document is generated by TEX with hyperref.0){\color{Red}\i}} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition AT X Tutorial Online L E Part II – Graphics PSTricks 0 1 2 3 4 5 Unlike \multirput or \multips.in Floor . starting with 1 instead of 0? The obvious solution of specifying \i+1 for the \pdots won’t work.org.0) \multido{\i=0+1}{6}{% \psdots[linecolor=Red](\i. our own first picture. We will have to define different variables for the points and the labels. by \i=0+1.  13/21 .0) \uput[d](\i.Tricky Repetitions 12.-1)(5.) Let’s see it in action in a simple example. All-purpose repetition The commands \multirput and \multips can only place the same object repeatedly at different places in a picture. Comments and suggestions may be mailed to tutorialteam@tug. which is admirably suited for such purposes. It was written by Timothy von Zandt. the author of pstricks. We cannot use them. for example. the first value and increment are single numbers instead of pairs of coordinates. as in the example below: E Krishnan. Cotton Hills Trivandrum 695014.in c 2004–2009.0)(5. We next specify the number of repetitions as 11. Finally the (variable) objects to be drawn (or placed) by the \psdots and \uput.1) \psline[linecolor=Blue](0. but with the points labeled: \begin{center} \begin{pspicture}(0. we want to number the same points.3.  Buildings.org. with the initial value and the increment specified in one stroke. as a general purpose loop macro for TEX. Suppose. using the variable \i. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team. (So. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www.tug. multido can be used independent of PSTricks. pstricks. The package multido contains the command \multido. to place circles of different radii at different points.

0){% \color{Red}\footnotesize\n}} \end{pspicture} \end{center} AT X Tutorial Online L E Part II – Graphics PSTricks 0 0. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team. as seen in the first example. Thus \i is actually a prefix.0){\color{Red}\ib}} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition 1 2 3 4 5 6 Note that we have named the two variables \ia and \ib. if there is only one variable.5 4 4.\ib=1+1}{6}{% \psdots[linecolor=Red](\ia.1) \psline[linecolor=Blue](0.0}{5}{% \psdots[linecolor=Red](\n.5 5 E Krishnan.0) \uput[d](\i.-1)(5.5+1.0) \uput[d](\n. pstricks. The Indian TEX Users Group This document is generated by TEX with hyperref.0)(5.-1)(5.tug.  14/21 .in A more colorful example is given below: c 2004–2009.  Buildings. If we want to use a variable with decimal values.0) \multido{\ai=0+1.0) \multido{\i=0+1}{6}{% \psdots[linecolor=Red](\i.5 2 2. Also. Cotton Hills Trivandrum 695014. Comments and suggestions may be mailed to tutorialteam@tug.0) \uput[d](\i. we need not not name it.in Floor .org.1) \psline[linecolor=Blue](0. specifying the type of the variable (i for integer). pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www. as in the next example: \begin{center} \begin{pspicture}(0.5 1 1. we can use the \n type.0)(5.5 3 3.0){\color{Red}\i}} \multido{\n=0.org.Tricky Repetitions \begin{center} \begin{pspicture}(0.

1.org. specified as \d.\ny){\nr}} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition The type \n can handle integers also. (Actually.org. As an illustration.005}% {200}% {\definecolor{varblue}{hsb}{\nc.025. then we can use it without any decimal point. pstricks.0)(7.03.\nc=0+0. which draws a line joining two specified points and divides into a specified number of equal parts: AT X Tutorial Online L E Part II – Graphics PSTricks E Krishnan.01.tug.1} \pscircle[linecolor=varblue](\nx.) The \multido command also has a variable type of variable for TEX dimensions. Comments and suggestions may be mailed to tutorialteam@tug. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team.\ny=0+0. both the initial number and the increment should have the same number of decimal places after the decimal point.in Floor . if the initial number is an integer.\nr=0+0. here’s the code for a generic command.  Buildings.  15/21 .8) \psset{linecolor=Blue} \multido{\nx=0+0. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www. but if we use it with decimal values. The Indian TEX Users Group This document is generated by TEX with hyperref.5cm} \begin{pspicture}(0.Tricky Repetitions \begin{center} \psset{unit=0. Cotton Hills Trivandrum 695014.in c 2004–2009.

\dy)}} \begin{center} \begin{pspicture}(-2.org. The Indian TEX Users Group This document is generated by TEX with hyperref. Cotton Hills Trivandrum 695014.#2)(#3.#2)(#3.Tricky Repetitions \newlength{\RunBegin} \newlength{\RunEnd} \newlength{\RiseBegin} \newlength{\RiseEnd} \newlength{\RunPart} \newlength{\RisePart} \newcounter{PartNo} \def\LineDivide(#1. we have to load the package calc for the computations with the TEX dimensions.4)(3.8) \colgrid \LineDivide(-2. since the c 2004–2009. Comments and suggestions may be mailed to tutorialteam@tug.  Buildings. Here we use the TEX command \def for A defining the macro. pstricks. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www.#4)#5{% \setlength{\RunBegin}{#1cm} \setlength{\RunEnd}{#3cm} \setlength{\RiseBegin}{#2cm} \setlength{\RiseEnd}{#4cm} \setlength{\RunPart}{(\RunEnd-\RunBegin)/#5} \setlength{\RisePart}{(\RiseEnd-\RiseBegin)/#5} \setcounter{PartNo}{#5} \addtocounter{PartNo}{1} \multido{\dx=\RunBegin+\RunPart.8){6} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition 8 7 6 5 4 -2 -1 0 1 2 3 AT X Tutorial Online L E Part II – Graphics PSTricks E Krishnan.  16/21 .tug. Also.#4)% \psdots[linecolor=Red]% (\dx.in Note that the command \colgrid is just a customized \psgrid. instead of the L TEX command \newcommand. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team. as explained in an earlier chapter.% \dy=\RiseBegin+\RisePart}% {\value{PartNo}}% {\psline[linecolor=Blue]% (#1.in Floor .org.4)(3.

82 mul} \psplot[linecolor=Blue]% {9}{15}{x 9 sub sqrt 2. \multido can also be nested.5.9) \SpecialCoor \multido{\nx=0+0. as in the next example: \begin{center} \psset{unit=0.25)(\ny.0)(20.  17/21 .org.-25)} \psplot[linecolor=Blue]% {9}{15}{x 9 sub sqrt 2.\ny=20+-0.5}{41}{% \psline[linecolor=Periwinkle]% (\nx.org.3cm} \begin{pspicture}(0.82 mul neg} \psline[linecolor=Red](20. as in the example below: E Krishnan.in c 2004–2009.in Floor . pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www.-9)(20. Increments can also be negative. but has to be specified using +-. pstricks.Tricky Repetitions former can accommodate general delimiters for arguments.tug.  Buildings.25)(0.-25) \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition AT X Tutorial Online L E Part II – Graphics PSTricks Like the other loop commands. Comments and suggestions may be mailed to tutorialteam@tug. The Indian TEX Users Group This document is generated by TEX with hyperref. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team. Cotton Hills Trivandrum 695014.

The Indian TEX Users Group This document is generated by TEX with hyperref.% fillstyle=solid.0){4} \multido{\nx=0+18}{20}{% \psdots[linecolor=Green](4. with 10 iterations instead of 20 (and of course.4) \psset{linewidth=0.in Floor .) E Krishnan. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www.% fillcolor=Yellow]% (0.4pt} \SpecialCoor \pscircle[linestyle=none.\nx)(4.Tricky Repetitions \begin{center} \psset{unit=0. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team.75cm} \begin{pspicture}(-4. pstricks. Comments and suggestions may be mailed to tutorialteam@tug. Cotton Hills Trivandrum 695014.org.\nx) \multido{\ny=0+18}{20}{% \psline[linecolor=Red]% (4. with a change of color.in c 2004–2009.  Buildings.org.-4)(4.tug.  18/21 .\ny)}} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition AT X Tutorial Online L E Part II – Graphics PSTricks The second picture at the beginning of the chapter is produced by the same code as above.

CV Radhakrishnan and AJ Alex constitute the graphics tutorial team.  Buildings. However.org. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www.Tricky Repetitions Non-linear repetitions All the three loop macros we have discussed can handle only linear increments directly. Comments and suggestions may be mailed to tutorialteam@tug. pstricks. wrapping it in a TEX macro and then putting the macro in \multido. Cotton Hills Trivandrum 695014.  19/21 . we can use non-linear variables depending on a linear variable.org.in c 2004–2009. The example below illustrates a simple implementation of this idea.tug. Repeated placing Nesting All-purpose repetition AT X Tutorial Online L E Part II – Graphics PSTricks E Krishnan. by doing the computation in PostScript.in Floor . The Indian TEX Users Group This document is generated by TEX with hyperref.

to interchange the coordinates.in Floor . 3 ) 1 ) (4.\n\right)}$}} \uput[60](1.2) (1. This is then used in \multido to produce the 1 \psdots at points like (2.0)(6. The A L TEX macro \Reciprocal converts a specified number to PostScript code for the number and its reciprocal.tug. To produce dots at points like ( 2 . Comments and suggestions may be mailed to tutorialteam@tug.org.6) \psplot[linecolor=Blue]{0.\frac{1}{\n}\right)}$}} \multido{\n=2+1}{3}{% \uput[r](\Reciprocal{\n} exch){% \color{Red} $\scriptstyle{% \left(\frac{1}{\n}.1){% \color{Red}$\scriptstyle{(1. CV Radhakrishnan and AJ Alex constitute the graphics tutorial team.1) E Krishnan.3) (3 Part II – Graphics PSTricks 1 (2.6) \psaxes[linecolor=Apricot.  Buildings.% labels=none. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www.4) (4 AT X Tutorial Online L E 1 .% arrows=->](6. The same trick is c 2004–2009. The Indian TEX Users Group This document is generated by TEX with hyperref.org.2}{5}{1 x div} \SpecialCoor \multido{\n=1+1}{4}{% \psset{linecolor=Red} \psdots(\Reciprocal{\n}) \psdots(\Reciprocal{\n} exch)} \multido{\n=2+1}{3}{% \uput[u](\Reciprocal{\n}){% \color{Red} $\scriptstyle{% \left(\n. Cotton Hills Trivandrum 695014. pstricks. 1 2 ). 4 (1 2 .in Here. we want to locate and label some points on the curve xy = 1.% ticks=none. 2) we use the PostScript operator exch.Tricky Repetitions \newcommand{\Reciprocal}[1]{% !#1 1 #1 div} \begin{center} \begin{pspicture}(0.1)}$} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition 1 .  20/21 . 2 ) 1 (3.

-1)(1. E Krishnan. The Indian TEX Users Group This document is generated by TEX with hyperref.  Buildings.in c 2004–2009.org. and painted alternately red and black. Cotton Hills Trivandrum 695014.Tricky Repetitions used to produce the labels. pstricks.tug. 1). CV Radhakrishnan and AJ Alex constitute the graphics tutorial team.1) \SpecialCoor \multido{\na=1+2. pdftricks and pdfscreen packages in an intel  running / and is released under  The Indian TEX Users Group http://www. Comments and suggestions may be mailed to tutorialteam@tug.-1)(1.in Floor . We conclude with another example of this trick: \newcommand{\rotsq}[3]{% \rput{!#2 #1 mul}{% \psframe*[linecolor=#3]% (!1 2 sqrt 135 #1 sub sin mul div #2 exp neg dup) (!1 2 sqrt 135 #1 sub sin mul div #2 exp dup)}} \begin{center} \psset{unit=2cm} \begin{pspicture}(-1. rotated more and more. except at (1.org.1) \psframe*[linecolor=Red](-1.  21/21 .\nb=2+2}{50}{% \rotsq{5}{\na}{Black} \rotsq{5}{\nb}{Red}} \end{pspicture} \end{center} Repeated placing Nesting All-purpose repetition AT X Tutorial Online L E Part II – Graphics PSTricks The picture is conceived (and produced) as a sequence of shrinking squares.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->