summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/xpicture/xpicture-doc.tex
blob: df3ce30ded4e768427ede9476d6a275381bf442c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
\documentclass{article}

\usepackage[a4paper,margin=2cm]{geometry}
\usepackage[T1]{fontenc}

\usepackage{xpicture}

\usepackage{ifthen}
\usepackage{array}
\usepackage{fancyvrb}
\usepackage[colorlinks]{hyperref}

\usepackage{amsmath}
\usepackage{paralist}
\usepackage{graphicx}
\usepackage{makeidx}
\makeindex
\renewcommand{\today}{2012/12/17}

\newcommand{\TIT}{\textit}
\newcommand{\TTT}{\texttt}
\newcommand{\TTTit}[1]{\TTT{\TIT{#1}}}
\newcommand{\cs}[1]{\mbox{\textnormal{\TTT{\textbackslash #1}}}}
\newcommand{\environ}[1]{\textnormal{\TTT{#1}}}
\newcommand{\package}[1]{\textnormal{\TTT{#1}}}
\newcommand{\ttindex}[1]{\index{#1@\texttt{#1}}}
\newcommand{\ttslashindex}[1]{\index{#1@\texttt{\textbackslash #1}}}
\newcommand{\csdef}[1]{\cs{#1}\ttslashindex{#1}}
\newcommand{\packagedef}[1]{%
   \package{#1}\index{#1@\texttt{#1} (package)}}
\newcommand{\environdef}[1]{%
   \package{#1}\index{#1@\texttt{#1} (environment)}}
\newcommand{\optiondef}[1]{%
   \textnormal{\TTT{#1}}\index{#1@\texttt{#1} (package option)}}
\newcounter{exem}\stepcounter{exem}
\newenvironment{exemple}{%
   \VerbatimEnvironment\begin{VerbatimOut}{./xpicture\theexem.tex}}{%
   \end{VerbatimOut}
   \par\medskip\noindent
   \marginpar{\fbox{Ex. \theexem}}\begin{minipage}{\linewidth}
      \begin{minipage}{0.45\linewidth}
         \setlength{\parindent}{2ex}
         \catcode`\%=14
         \input{./xpicture\theexem}
      \end{minipage}\hfill
      \begin{minipage}{0.45\linewidth}
         \small
         \VerbatimInput{./xpicture\theexem.tex}
      \end{minipage}
   \end{minipage}
   \stepcounter{exem}\par\bigskip\noindent}
\newenvironment{Exemple}{%
   \VerbatimEnvironment\begin{VerbatimOut}{./xpicture\theexem.tex}}{%
   \end{VerbatimOut}
   \par\noindent
   \marginpar{\fbox{Ex. \theexem}}\fbox{\begin{minipage}{\linewidth}
      \begin{minipage}{\linewidth}
         \setlength{\parindent}{2ex}
         \bigskip\par
         \catcode`\%=14
         \input{./xpicture\theexem}
      \end{minipage}\medskip\par
      \hspace*{0.125\linewidth}\rule{0.75\linewidth}{0.4pt}\par\medskip
      \small
      \VerbatimInput{./xpicture\theexem.tex}
   \end{minipage}}\stepcounter{exem}\par\bigskip\noindent}

\begin{document}
\begin{titlepage}
   \centering
   \bfseries\Large Robert Fuster

   \rule{\textwidth}{1pt}

   The \textsf{xpicture} package 

   (\Verb+http://www.upv.es/~rfuster/xpicture+)

   Several extensions of the \textsf{picture} standard environment

   User Manual
   \vspace{\stretch{1}}
   \begin{Exemple}
      \setlength{\unitlength}{1cm}
      \footnotesize
      \DIVIDE{1}{12}{\invXII}
      \MULTIPLY{12}{\numberTWOPI}{\phione}
      \MULTIPLY{12}{64}{\divisions}

      \COMPOSITIONfunction{\EXPfunction}{\COSfunction}{\Afunction}
      \SCALEVARIABLEfunction{4}{\COSfunction}{\Bfunction}
      \SCALEVARIABLEfunction{\invXII}{\SINfunction}{\cfunction}
      \POWERfunction{\cfunction}{5}{\Cfunction}
      \LINEARCOMBINATIONfunction{1}{\Afunction}{-2}{\Bfunction}{\ABfunction}
      \SUMfunction{\ABfunction}{\Cfunction}{\ABCfunction}
      \PRODUCTfunction{\SINfunction}{\ABCfunction}{\Xfunction}
         % x=(sin t)(exp(cos t)-2 cos 4t + (sin(t/12))^5)
      \PRODUCTfunction{\COSfunction}{\ABCfunction}{\Yfunction}
         % y=(cos t)(exp(cos t)-2 cos 4t + (sin(t/12))^5)
      \PARAMETRICfunction{\Xfunction}{\Yfunction}{\butterfly}
      \centering
      \begin{Picture}(-4,-3)(4,4)
         \PlotParametricFunction[\divisions]\butterfly{0}{\phione}
      \end{Picture}
      \begin{gather*}
         x=\sin t\left(\mathrm e^{\cos t}-2\cos 4t 
                      +\sin^5\left(\frac t{12}\right)\right) \\
         y=\cos t\left(\mathrm e^{\cos t}-2\cos 4t 
                      +\sin^5\left(\frac t{12}\right)\right)
     \end{gather*}
   \end{Exemple}
    \footnotesize\today
\end{titlepage}
\stepcounter{page}

\tableofcontents
\newpage

   The \package{xpicture} package extends the 
   \environ{picture} standard environment
   and packages \package{pict2e} and \package{curve2e}, 
   adding the ability to work with arbitrary 
   reference systems and with Cartesian or polar coordinates. 
   In addition to other utilities,
   the greater interest of \package{xpicture} 
   lies in its capacity to draw function graphs,
   conic sections and arcs, and parametrically defined curves.
    
   This is the user manual of \package{xpicture}.
   Technical documentation and reference manual are contained 
   in file \texttt{xpicture.pdf}, distributed together with the package.

\section{Introduction. New graphical instructions}
The \package{xpicture} package introduces several new graphical 
instructions, and some enriched versions of standard
instructions used inside the \environ{picture} environment.
All these new instructions can be classified as follows:
\begin{itemize}
 \item Reference systems and coordinates:
\begin{itemize}
\item Declaration and use of different reference systems,
with Cartesian or polar coordinates.
\item Instructions to show Cartesian or polar reference systems.
\end{itemize}
 \item  An alternative to the \environ{picture} environment,
compatible with the new reference systems.
 \item Alternative instructions or extensions of the standard
 \environ{picture} commands and those defined by the packages
 \packagedef{pict2e} and \packagedef{curve2e}:
\begin{itemize}
 \item Enriched versions of marks \cs{put} and \cs{multiput},
 providing an adequate control of the precise position 
in which objects are composed
(this functionality is especially useful in the composition
of not strictly graphical objects, such as formulas or labels).
\item Instructions for drawing straight segments, vectors
(in any direction and using any reference system), polygonal lines,
and regular and arbitrary polygons.
\end{itemize}
\item Regular curves:
\begin{itemize}
\item Instructions for drawing conic sections (circles, ellipses,
hyperbolas and parabolas) and arcs of these curves.
\item Instructions to graph functions and parametrically defined curves
(this is the most interesting feature of this package).
\end{itemize}
\end{itemize}

The only requeriments for \package{xpicture} are packages 
\packagedef{calculator}, \packagedef{calculus}, 
\packagedef{curve2e} and \packagedef{xcolor}.
Therefore, it works with any \TeX{}
extension compatible with these packages. You can compile a document 
including \package{xpicture} pictures directly with 
\TTT{pdflatex},\ttindex{pdflatex}
\TTT{lualatex},\ttindex{lualatex} 
\TTT{xelatex}\ttindex{xelatex} 
or indirectly, via \TTT{latex/dvips}\ttindex{latex},\ttindex{dvips}
 \TTT{latex/dvips/dvipdfm},\ttindex{dvipdfm} \ldots
Pure \TTT{dvi} files are not supported, but some \TTT{dvi} previewers
may show partially \package{xpicture} draws included in \TTT{dvi} files. 

\section{A preliminary observation.
         Compatibility with text composition in color}
The \package{xpicture} package automatically loads the
\packagedef{xcolor} package.
So, we can compose our
pictures (and the whole document) in various colors. However,
when used in the body of the \textsf{picture} environment,
marks \cs{color} and \cs{colortext}
often introduce spurious spaces.
For this reason, the \package{xpicture} package introduces the new command
\csdef{pictcolor}.
\begin{Verbatim}[commandchars=\|\[\]]
\pictcolor{|TIT[color]}
\end{Verbatim}
This mark behaves like the \cs{color} command, but does not produces these
inappropriate spaces.
To change colors inside a picture, instead of \cs{color} or \cs{colortext},
use always the \cs{pictcolor} declaration.

\section{Coordinate systems and the \environ{Picture} environment}
\subsection{Coordinates}
The standard \environ{picture} environment establishes
a rectangular coordinate system, so that all
graphic objects are placed in the picture using the canonical
coordinates of the plane. From now on, we will call
this reference system \emph{the standard reference system}.
Loading the \package{xpicture} package, we can use any other affine
reference system and combine it with the use of polar coordinates.

\subsubsection{Reference systems}
The \package{xpicture} package allows us to use other reference systems.
For the purpose we are interested, a reference system consists
of an origin of coordinates and a pair of linearly independent vectors.
Typing\ttslashindex{referencesystem}
\begin{Verbatim}[commandchars=\|\[\]]
\referencesystem(|TIT[x0],|TIT[y0])(|TIT[x1],|TIT[y1])(|TIT[x2],|TIT[y2])
\end{Verbatim}
we declare the new reference system  with origin at point
$(\TTT{\TIT{x0}},\TTT{\TIT{y0})} $ and coordinate vectors
$(\TTT{\TIT{x1}},\TTT{\TIT{y1}})$ and
$(\TTT{\TIT{x2}},\TTT{\TIT{y2}})$.
If the coordinates of the point $P$ with respect to this reference system
are $(\bar{\TTT{\TIT{x}}},\bar{\TTT{\TIT{y}}})$, then the
coordinates of $ P $ with respect to the standard system,
$(\TTT{\TIT{x}},\TTT{\TIT{y}})$, are calculated with the formula
\newenvironment{qmatrix}{\left[\begin{matrix}}{\end{matrix}\right]}
\[
 \begin{qmatrix}
          \TTT{\TIT{x}} \\ \TTT{\TIT{y}}
     \end{qmatrix}=\begin{qmatrix}
         \TTT{\TIT{x0}} \\ \TTT{\TIT{y0}}
    \end{qmatrix} +
    \begin{qmatrix}
         \TTT{\TIT{x1}} & \TTT{\TIT{x2}} \\
         \TTT{\TIT{y1}} & \TTT{\TIT{y2}}
    \end{qmatrix}    \begin{qmatrix}
         \bar{\TTT{\TIT{x}}} \\ \bar{\TTT{\TIT{y}}}
    \end{qmatrix}
\]

For example,
\begin{Verbatim}[commandchars=\|\[\]]
\referencesystem(1,2)(1,0)(0.5,0.5)
\end{Verbatim}
sets a new reference system that has its origin in the point $O(1,2)$
and the coordinate vectors $\vec u_1=(1,0)$ and $\vec u_2=(1/2,1/2)$.
The following pictures show this coordinate system built on the standard
reference system
and a Cartesian grid refered to the new reference system.

\noindent
\setlength\unitlength{1cm}%
 \renewcommand{\Pictlabelsep}{0.2}
\begin{Picture}(-3.1,-3.1)(3.1,3.1)
\put(-1.5,0){\line(1,0){3}}
\put(0,-1.5){\line(0,1){3}}
{\makenolabels
\cartesianaxes(-3,-3)(3,3)}
\thicklines
 \xVECTOR(0,0)(1,2)
\pictcolor{red}
\referencesystem(1,2)(1,0)(0.5,0.5)
\Put[-45](0,0){$O$}
\renewcommand\axescolor{red}
\renewcommand\axeslabelcolor{red}
\cartesianaxes(-2.1,-2.1)(2.1,2.1)
\linethickness{1pt}
\xVECTOR(0,0)(1,0)
\xVECTOR(0,0)(0,1)
\rPut{SE}(1,0){$\vec u_1$}
\Put[SE](0,1){$\vec u_2$}
\end{Picture}
\hfill%
{\referencesystem(1,2)(1,0)(0.5,0.5)
\begin{Picture}(-3.6,-3.6)(3.5,3.5)
\thinlines
\cartesiangrid(-3,-3)(3,3)
\pictcolor{red}
\linethickness{1pt}
\xVECTOR(0,0)(1,0)
\xVECTOR(0,0)(0,1)
\end{Picture}}

Alternatively, you can use the \csdef{changereferencesystem} declaration:
in the instruction
\begin{Verbatim}[commandchars=\|\[\]]
\changereferencesystem(|TIT[x0],|TIT[y0])(|TIT[x1],|TIT[y1])(|TIT[x2],|TIT[y2])
\end{Verbatim}
point $(\TTT{\TIT{x0}},\TTT{\TIT{y0})}$ and vectors
$(\TTT{\TIT{x1}},\TTT{\TIT{y1}})$ i $(\TTT{\TIT{x2}},\TTT{\TIT{y2}})$
are not refered to the standard system,
but to the \emph{active} reference system.\footnote{%
In other words, the instruction
\cs{referencesystem} changes from the standard reference system
to the new one, while
\cs{changereferencesystem} changes from the active system.}
Moreover, as the more interesting (and frequent) reference system changes
consist of translations of the origin, rotations of the axes
and symmetries, \package{xpicture}
introduces three specific commands to these special cases:
\ttslashindex{translateorigin}
\begin{Verbatim}[commandchars=\|\[\]]
\translateorigin(|TIT[x0],|TIT[y0])
\end{Verbatim}
moves the origin to the specified coordinates.
\ttslashindex{rotateaxes}
\begin{Verbatim}[commandchars=\|\[\]]
\rotateaxes{|TIT[angle]}
\end{Verbatim}
rotates the axes. The \TTT{\TIT{angle}}  parameter is interpreted
as the rotation angle in radians
(if the \csdef{radiansangles} declaration is active) or in
sexagesimal degrees (if the \csdef{degreesangles} declaration is active).
And\ttslashindex{symmetrize}
\begin{Verbatim}[commandchars=\|\[\]]
\symmetrize{|TIT[angle]}
\end{Verbatim}
performs a symmetry, being \TTT{\TIT{angle}}
the angle between the $x$ axis and  the symmetry axis.
Also here, the \csdef{radiansangles} and \csdef{degreesangles}
declarations determine if angles are
interpreted as radians or degrees.
%
These three declarations always apply to the active reference system.
\begin{Exemple}
\newcommand{\mypicture}{%
{\thicklines
\xVECTOR(-1,-1)(1,1)
\pictcolor{red}\Circle{1}
\pictcolor{blue}\regularPolygon{1}{4}
\polarreference\degreesangles
\pictcolor{green}\Polygon(1,90)(0,0)(1,-30)}}
\centering
\setlength{\unitlength}{1cm}
\fbox{\begin{Picture}[black!5!white](-1.5,-6.5)(14.5,1.5)
\cartesiangrid(-1,-1)(14,1)
\mypicture
{\referencesystem(3,0)(1,1)(1,0)
\mypicture
\changereferencesystem(0,4)(-1,1)(1,-2)
\mypicture}
\degreesangles
\translateorigin(10,0)
{\rotateaxes{45}
\mypicture}
\translateorigin(3,0)
\symmetrize{45}
\mypicture
\referencesystem(6.5,-4)(7,0)(0,-2)\mypicture
\end{Picture}}
\end{Exemple}

The \csdef{standardreferencesystem} declaration restores the standard 
reference.

\medskip

Changes of reference system can
be used inside or outside the \environ{Picture} environment.
In the next sections we will see what are the effects produced in each case.

\subsubsection{Polar coordinates}
Instead of Cartesian coordinates, we can refer to a point $P$ using the 
polar coordinates $(r,\phi)$ of this point: 
$r$ is the distance from the origin $O$ and $\phi$ is the angle between 
the first coordinate vector and the $OP$ segment.
The \csdef{cartesianreference} and \csdef{polarreference} declarations
establish the coordinates of one or the other type.
By default, the Cartesian coordinates are used, but in some cases
is much easier determine polar coordinates.
Additionally, the \csdef{radiansangles} and \csdef{degreesangles}
declarations
sets angle measuring in radians or in degrees, respectively
(by default, angles are measured in radians).

The following example shows a typical situation in which it is more
appropriate to use polar coordinates:
the \emph{natural} way to enter coordinates on a circle is using 
polar coordinates.

\begin{exemple}
\setlength{\unitlength}{3cm}
\fbox{\begin{Picture}(-1.3,-1.3)(1.3,1.3)
\polarreference
\degreesangles

\renewcommand{\Pictlabelsep}{0.1}

\multiPut(1,0)(0,30){12}{\circle*{0.05}}
    % Put twelve dots, one unit apart, 
    % at 0, 30, 60, ..., 330 degrees

\cPut{90}(1,90){\textsc{xii}}
\cPut{0}(1,0){\textsc{iii}}
\cPut{270}(1,270){\textsc{vi}}
\cPut{180}(1,180){\textsc{ix}}

\pictcolor{blue}\thicklines

\arrowsize{8}{2}
\xtrivVECTOR(0,0)(0.5,37.5)
\xtrivVECTOR(0,0)(0.9,180)

\Put(0,0){\circle*{0.1}}
\linethickness{4pt}
\Circle{1.3}
\end{Picture}}
\end{exemple}

The new commands defined in the \package{xpicture} package and requiring
some kind of coordinates support polar coordinates,
except the \environ{Picture} and \environ{xpicture} environments
and the \cs{cartesianaxes} and \cs{cartesiangrid} environments.
\subsection{The \environ{Picture} (or \environ{xpicture}) environment}
The \package{xpicture} package supports all drawing commands
from standard \LaTeX;
in particular, you can use the \environ{picture} environment.
However, in the expression
\begin{Verbatim}[commandchars=\|\[\]]
\begin{picture}(|TIT[x],|TIT[y])(|TIT[x0],|TIT[y0])
\end{Verbatim}
the pairs of numbers \TTT{(\TIT x,\TIT y)} and
\TTT{(\TIT{x0},\TIT{y0})} always denote standard coordinates,
namely,
the \environ{picture} environment only uses the standard reference,
thus it defines, as drawing area, the rectangle
\TTT{[\TIT{x0},\TIT{x-x0}]}$\times$\TTT{[\TIT{y0},\TIT{y-y0}]},
regardless of whether this is the  active reference.
If we want draw a picture referring coordinates to an alternative reference
system, to determine the appropriate drawing area in absolute coordinates
is not obvious (and often is difficult).
However, the \environdef{Picture} environment 
defines a working area on the active reference system: the
\begin{Verbatim}[commandchars=\|\{\}]
\begin|{Picture|}[|TIT{color}](|TIT{x0},|TIT{y0})(|TIT{x1},|TIT{y1})
\end{Verbatim}
instruction fixes the drawing area
\TTT{[\TIT{x0},\TIT{x1}]}$\times$\TTT{[\TIT{y0},\TIT{y1}]},
refered to the active reference system.
Here, the \TTT{(\TIT{x0},\TIT{y0})} i \TTT{(\TIT{x1},\TIT{y1})}
coordinates are always rectangular
(even when reference in polar coordinates is active).
More precisely, this environment defines a \environ{picture} box
that circumscribes our drawing area.
If the optional argument is used, background is colored in the given 
\textit{color}. 

\emph{Very important: note that the syntax of the 
\environ{picture} environment is not analogous
to the new environment \environ{Picture}}:
Here two pairs of coordinates are required,
\TTT{(\TIT{x0},\TIT{y0})} and \TTT{(\TIT{x1},\TIT{y1})},
representing two opposite corners of the drawing area.\footnote{%
Although it may seem more \emph{logical}
preserve the syntax of \environ{picture} environment, 
it is more natural to define the drawing area in that way.}
Obviously, if the reference sustem is the standard, expression
\begin{Verbatim}[commandchars=\|\[\]]
\begin{Picture}(0,0)(|TIT[x],|TIT[y])
\end{Verbatim}
is equivalent to
\begin{Verbatim}[commandchars=\|\[\]]
\begin{picture}(|TIT[x],|TIT[y])
\end{Verbatim}

The following example shows the boxes produced by the 
\environ{picture} and \environ{Picture} environments.

\medskip

\begin{Exemple}
 \begin{center}
  \setlength{\unitlength}{0.5cm}
  \referencesystem(0,0)(1,-1)(1,1)

  \fbox{\begin{picture}(6,6)(-3,-3)
   \cartesiangrid(-3,-3)(3,3)
  \end{picture}}\qquad
  \fbox{\begin{Picture}(-3,-3)(3,3)
   \cartesiangrid(-3,-3)(3,3)
  \end{Picture}}
 \end{center}
\end{Exemple}

The left picture does not fit the box.
 In fact, some elementary geometric considerations
shown that a square box of $ 12\times12$ units of length must be reserved,
\begin{Verbatim}[commandchars=\|\[\]]
\begin{picture}(12,12)(-6,-6)
\end{Verbatim}
The use of the \environ{Picture} environment frees us to determine the
actual dimensions of the drawing.

The new environment \environdef{xpicture} is an alias to the
\environ{Picture} environment.
Its sintax and its behavior are identical.

On the other hand, the \csdef{draftPictures} declaration 
disables all the instructions defined in this package, 
replacing each picture set in a \environ{Picture} environment
by a parallelogram circumscribed by a white rectangle (the box that shows
the area reserved for the drawing).\footnote{If you use an instruction 
not directly defined by \package{xpicture} (inside of a \environ{Picture}
environment), this instruction may take effect.}

\begin{center}
\setlength{\unitlength}{1cm}
\draftPictures

\begin{minipage}{5cm}\centering
\begin{Picture}(0,0)(5,5)
\end{Picture}

\verb+\standardreferencesystem+
\end{minipage}\quad
\begin{minipage}{7.5cm}\centering
\referencesystem(0,0)(1,0)(0.5,1)
\begin{Picture}(0,0)(5,5)
\end{Picture}

\verb+\referencesystem(0,0)(1,0)(0.5,1)+
\end{minipage}
\end{center}

\subsection{Coordinate axes}
Instruction\ttslashindex{cartesianaxes}
\begin{Verbatim}[commandchars=\|\[\]]
\cartesianaxes(|TIT[x0],|TIT[y0])(|TIT[x1],|TIT[y1])
\end{Verbatim}
draws the coordinate axes corresponding to the
\TTT{[\TIT{x0},\TIT{x1}]}$\times$\TTT{[\TIT{y0},\TIT{y1}]} rectangle.
Arguments \TTT{\TIT{x0}}, \TTT{\TIT{y0}},
\TTT{\TIT{x1}} and \TTT{\TIT{y1}} must satisfy the conditions
\TTT{\TIT{x0}}$<$\TTT{\TIT{x1}} and \TTT{\TIT{y0}}$<$\TTT{\TIT{y1}}.
Here, coordinates \TTT{(\TIT{x0},\TIT{y0})} and \TTT{(\TIT{x1},\TIT{y1})}
are always rectangular (even when reference in polar coordinates is active).
\begin{exemple}
\begin{center}
\setlength{\unitlength}{0.75cm}%
\begin{Picture}[black!10!white](-4,-3)(4,3)
\renewcommand{\Pictlabelsep}{0.2}
\cartesianaxes(-3.5,-2.5)(3.5,2.5)
\Put[r](3.5,0){$x$}
\Put[t](0,2.5){$y$}
\end{Picture}
\end{center}
\end{exemple}
\begin{exemple}
\begin{center}
\referencesystem(0,0)(1,0)(0.5,1)
\setlength{\unitlength}{0.75cm}%
\begin{Picture}[black!10!white](-4,-3)(4,3)
\renewcommand{\Pictlabelsep}{0.2}
\cartesianaxes(-3.5,-2.5)(3.5,2.5)
\Put[r](3.5,0){$x$}
\Put[t](0,2.5){$y$}
\end{Picture}
\end{center}
\end{exemple}
The following parameters control the style of the axes, the cut marks
and labels on the axes:

\subsubsection{The style of the axes}
\begin{description}
\item[\csdef{axescolor}] By default, the axes color is \TTT{black}, but
we can change it by redefining the \cs{axescolor} declaration. For example,
\begin{Verbatim}[commandchars=\|\[\]]
\renewcommand{\axescolor}{orange}
\end{Verbatim}

We must use a color name predefined in the package \textsf{xcolor}
or defined by the user (for example, using the \cs{definecolor} command).
\item[\csdef{axesthickness}] Length determining the thickness of axes 
(default \verb+1 pt+).
You can modify it using any command that fixes a length (as \cs{setlength}
or \cs{settowidth}).
\item[\csdef{xunitdivisions}, \csdef{yunitdivisions}] Number of subdivisions of
the unit (in each axis). 
By default, 1. These arguments can also be redefined using
the \cs{renewcommand} command (they must be positive integers).
\end{description}
\begin{exemple}
\renewcommand{\xunitdivisions}{2}
\renewcommand{\yunitdivisions}{3}

\begin{center}
\setlength{\unitlength}{1cm}%
\begin{Picture}(-4,-4)(4,4)
\cartesianaxes(-3.5,-3.5)(3.5,3.5)
\end{Picture}
\end{center}
\end{exemple}
\subsubsection{Axes position}
The coordinate axes (and also tags and cut marks)
are placed by default in the traditional way, on the $y = 0$ (the $x$ axis)
and $x = 0$ (the $y$ axis) lines.
However, sometimes the fact that labels are inside the graphic can be
annoying.\footnote{And produces strange effects when the origin $(0.0)$
is not in the drawing area.}
Alternatively, we can place axes and tags at the 
lower and left sides of the coordinate rectangle.
To choose between these two options we should use the following
declarations:
\begin{description}
\item[\csdef{internalaxes}, \csdef{externalaxes}]
If the \cs{internalaxes} declaration is active, then axes lies
on $y=0$ and $x=0$.

However, if we activate the \cs{externalaxes} declaration, the axes
produced by the instruction
\begin{Verbatim}[commandchars=\|\[\]]
\cartesianaxes(|TIT[x0],|TIT[y0])(|TIT[x1],|TIT[y1])
\end{Verbatim}
lies on $y=\TTT{\TIT{y0}}$ and $x=\TTT{\TIT{x0}}$.

By default, the \cs{internalaxes} declaration is active.
\end{description}
\begin{exemple}
\renewcommand{\xunitdivisions}{2}
\renewcommand{\yunitdivisions}{2}

\begin{center}
\externalaxes
\setlength{\unitlength}{1cm}%
\begin{Picture}(-4,-4)(4,4)
\cartesianaxes(-3.5,-3.5)(3.5,3.5)
\end{Picture}
\end{center}
\end{exemple}

\subsubsection{Tags style}
The numerical tags on the axes are made in math mode.
If you need textual labels, put them in a \cs{mbox} or,
using \package{amsmath}, a \cs{text} box.
We can control the color, attributes and distance to the axes of these tags,
redefining
(with \cs{renewcommand}) the following marks:
\begin{description}
\item[\csdef{axeslabelcolor}] The color of the numerical tags on the axes.
By default, this color is identical to the axes color.
\item[\csdef{axeslabelsize}] Size of numerical tags.
By default, \cs{small}.
\item[\csdef{axeslabelmathversion}]
 Mathversion of numerical tags.
By default, \TTT{normal}.\footnote{Standard \emph{math versions}
are \TTT{normal} and \TTT{bold}, but some packages
define other math versions.}
\item[\csdef{axeslabelmathalphabet}] Mathalphabet of numerical tags.
By default, \cs{mathrm}.
\item[\csdef{axislabelsep}] Distance between tags and cut marks,
measured in \cs{unitlength} units;\footnote{The distance between axes and
tags equals \cs{ticssize}$+$\cs{axislabelsep}.}
by default, \verb+0.1+ (see later the description of \cs{makenotics}).
\end{description}

\subsubsection{Tags position}
Position of tags is controlled by two declarations:
\begin{description}
\item[\cs{xlabelpos\{\TIT{position}\}}]\ttslashindex{xlabelpos}
change the relative position of labels in $x$ axis. 
Admissible values are those allowed in the \TTT{\TIT{position}} 
argument of command \cs{Put} (see subsection~\ref{subsec:put}).
Default is \verb+-90+.
\item[\cs{ylabelpos\{\TIT{position}\}}]\ttslashindex{ylabelpos}
change the relative position of labels in $y$ axis. 
Default is \verb+180+.
\end{description}

\subsubsection{Style of cut marks}
Units (and, optionally, unit fractions) are marked over axes with small
segments,
the style of which is controlled by the following parameters:
\begin{description}
\item[\csdef{ticssize}, \csdef{secundaryticssize}]
These lengths control the size of the tics:
\cs{ticssize} is half the length of main cuts
(by default, \verb+4pt+)
and \cs{secundaryticssize} is half the length of secundary cuts
(by default, \verb+2pt+).
\item[\csdef{ticsthickness}] Thickness of the marks on axes 
(by default, \verb+1pt+).
\item[\csdef{ticscolor}] Color of the marks on axes (by default, \verb+black+).
\end{description}
\begin{exemple}
\renewcommand{\axescolor}{blue}
\setlength{\axesthickness}{3pt}
\renewcommand{\xunitdivisions}{2}
\renewcommand{\yunitdivisions}{3}

\renewcommand{\axeslabelcolor}{teal}
\renewcommand{\axeslabelsize}{\footnotesize}
\renewcommand{\axeslabelmathversion}{bold}
\renewcommand{\axeslabelmathalphabet}{\mathsf}
\renewcommand{\axislabelsep}{0.05}
\xlabelpos{ttl}
\ylabelpos{r}

\setlength{\ticssize}{0.2cm}
\setlength{\secundaryticssize}{0.1cm}
\setlength{\ticsthickness}{2pt}
\renewcommand{\ticscolor}{blue!50}

\begin{center}
\degreesangles
\rotateaxes{-30}
\setlength{\unitlength}{0.75cm}%
\begin{Picture}(-5,-4)(5,4)
\cartesianaxes(-4.5,-3.5)(4.5,3.5)
\end{Picture}
\end{center}
\end{exemple}

\subsubsection{Removing and directly printing cut marks and labels}
\begin{description}
 \item [\csdef{maketics}, \csdef{makenotics}]
 These two declarations determine if
 divisions on the axes should be marked or not.
 By default the \cs{maketics} declaration is active.

If divisions are not marked, the \csdef{axislabelsep}
declaration determines the distance between axes and labels.
\end{description}
\begin{exemple}
\begin{center}
\setlength{\unitlength}{0.75cm}%
\begin{Picture}(-4.5,-2.5)(4.5,2.5)
\makenotics
\cartesianaxes(-4,-2)(4,2)
\end{Picture}
\end{center}
\end{exemple}
\begin{description}
 \item [\csdef{makelabels}, \csdef{makenolabels}] Two declarations
determining whether numerical labels on the axes must appear or not.
By default, the \cs{makelabels} declaration is active.
\end{description}
\begin{exemple}
\begin{center}
\setlength{\unitlength}{0.75cm}%
\begin{Picture}(-4.5,-2.5)(4.5,2.5)
\makenolabels
\cartesianaxes(-4,-2)(4,2)
\end{Picture}
\end{center}
\end{exemple}

Declarations \cs{makenotics} and \cs{makenolabels}
can be useful when you want to show only some specific coordinates, 
when the points to be highlighted on the axes are not integers
and when you need to print labels in some special format. In  this cases 
you can plot tics and/or print labels using the following commands.
\begin{description}
\item [\cs{plotxtic\{\TIT{x-coor}\}}, \cs{plotytic\{\TIT{y-coor}\}}] 
\ttslashindex{plotxtic}\ttslashindex{plotytic}
plot a tic for the given \TIT{x} or \TIT{y} coordinate.
\item [\cs{printxlabel\{\TIT{x-coor}\}\{\TIT{label}\}}, 
       \cs{printylabel\{\TIT{y-coor}\}\{\TIT{label}\}}] 
\ttslashindex{printxlabel}\ttslashindex{printylabel}
print \TIT{label}
for the given \TIT{x} or \TIT{y} coordinate. Labels are printed in math mode.
\item [\cs{printxticlabel\{\TIT{x-coor}\}\{\TIT{label}\}}, 
       \cs{printyticlabel\{\TIT{y-coor}\}\{\TIT{label}\}}] 
plot a tic and print \TIT{label} for the given \TIT{x} or \TIT{y} coordinate.
\end{description}
\begin{exemple}
\begin{center}
\setlength{\unitlength}{1cm}%
\begin{Picture}(-4.5,-0.5)(4.5,3.5)
\makenolabels
\makenotics
\cartesianaxes(-4,0)(4,3)

\plotytic{0.5}
\printylabel{0.5}{1/2}
\printxticlabel{2}{2}

\Polyline(2,0)(2,0.5)(0,0,5)
\thicklines
\SCALEfunction{0.125}{\SQUAREfunction}{\F}
\PlotFunction[3]{\F}{-4}{4}
\end{Picture}
\end{center}
\end{exemple}

Multiple equally spaced tics and/or labels can be drawn simultaneously:
\begin{description}
\item [\cs{plotxtics\{\TIT{firstcoor}\}\{\TIT{incr}\}\{\TIT{bound}\}},
       \cs{plotytics\{\TIT{firstcoor}\}\{\TIT{incr}\}\{\TIT{bound}\}}]
\ttslashindex{plotxtics}\ttslashindex{plotytics}       
plot several (\TIT{x} or \TIT{y}) tics,
from the initial coordinate \TIT{firstcoor}; \TIT{incr} is the distance 
between consecutive tics, and the last tic is not in a position 
greater than \TIT{bound}.
\item [\cs{printxlabels[\TIT{digits}]\{\TIT{firstcoor}\}\{\TIT{incr}\}%
       \{\TIT{bound}\}}, 
       \cs{printylabels[\TIT{digits}]\{\TIT{firstcoor}\}\{\TIT{incr}\}%
       \{\TIT{bound}\}}] 
\ttslashindex{printxlabels}\ttslashindex{printylabels} print several labels,
from the initial coordinate \TIT{firstcoor}; \TIT{incr} is the distance 
between consecutive label positions, 
and the last position is not greater than \TIT{bound}. 
The optional argument \TIT{digits} is the number of decimal digits to be 
printed (by default, numbers are printed with its natural number of decimals).
\item [\cs{printxticslabels[\TIT{digits}]\{\TIT{firstcoor}\}\{\TIT{incr}\}%
          \{\TIT{bound}\}}]\ttslashindex{printxticslabels} 
 plot \TIT{x} tics and labels simultaneously.
\item [\cs{printyticslabels[\TIT{digits}]\{\TIT{firstcoor}\}\{\TIT{incr}\}%
          \{\TIT{bound}\}}]\ttslashindex{printyticslabels}
 plot \TIT{y} tics and labels simultaneously.      
\end{description}
\begin{exemple}
\externalaxes
\setlength{\unitlength}{1cm}
\renewcommand{\axeslabelsize}{\tiny}
\referencesystem(0,0)(1.5,0)(0,2)
\begin{center}
\begin{Picture}(-2.5,-1.5)(2.5,1.5)
\makenotics
\makenolabels
\cartesianaxes(-2.25,-1.25)(2.25,1.25)
\printxticslabels[1]{-2}{0.5}{2.25}
\printyticslabels[4]{-1}{0.25}{1}
\end{Picture}
\end{center}
\end{exemple}
\begin{Exemple}
\setlength{\unitlength}{1cm}
\begin{center}
\begin{Picture}(-7,-2.5)(7,2.5)
{\referencesystem(0,0)(\numberHALFPI,0)(0,1)
\renewcommand{\xunitdivisions}{2}
\renewcommand{\yunitdivisions}{2}
\makenolabels
\renewcommand{\Pictlabelsep}{0.25}
\cartesianaxes(-4.2,-2.2)(4.2,2.2)

\printylabels{-2}{0.5}{2}

\highestlabel{$-3\pi/2$}
\printxlabel{-4}{-2\pi}
\printxlabel{-3}{-3\pi/2}
\printxlabel{-2}{-\pi}
\printxlabel{-1}{-\pi/2}
\printxlabel{1}{\pi/2}
\printxlabel{2}{\pi}
\printxlabel{3}{3\pi/2}
\printxlabel{4}{2\pi}
}
\end{Picture}
\end{center}
\end{Exemple}

\subsection{Cartesian grids}
As an alternative to the \cs{cartesianaxes} command,
we can use \csdef{cartesiangrid},
to better visualize the coordinates:
\begin{Verbatim}[commandchars=\|\[\]]
\cartesiangrid(|begin[math]x0,y0|end[math])(|begin[math]x1,y1|end[math])
\end{Verbatim}
\begin{exemple}
\definecolor{myblue}{cmyk}{1,1,0,0.5}
\renewcommand{\gridcolor}{myblue}
\renewcommand{\secundarygridcolor}{cyan}
\setlength{\gridthickness}{0.5pt}
\setlength{\secundarygridthickness}{0.1pt}
\renewcommand{\xunitdivisions}{5}
\renewcommand{\yunitdivisions}{5}
\renewcommand{\axeslabelsize}{\footnotesize}
\begin{center}
\setlength{\unitlength}{1cm}
\begin{Picture}(-3.5,-2.5)(3.5,2.5)
\cartesiangrid(-3.4,-2.4)(3.4,2.4)
\end{Picture}
\end{center}
\end{exemple}
\begin{exemple}
\definecolor{myblue}{cmyk}{1,1,0,0.5}
\renewcommand{\gridcolor}{myblue}
\renewcommand{\secundarygridcolor}{cyan}
\setlength{\gridthickness}{0.5pt}
\setlength{\secundarygridthickness}{0.1pt}
\renewcommand{\xunitdivisions}{5}
\renewcommand{\yunitdivisions}{5}
\renewcommand{\axeslabelsize}{\footnotesize}
\begin{center}
\setlength{\unitlength}{1cm}
\referencesystem(0,0)(1,0)(0.25,1)
\externalaxes
\begin{Picture}(-4,-3)(4,3)
\cartesiangrid(-3.4,-2.4)(3.4,2.4)
\end{Picture}
\end{center}
\end{exemple}

\subsubsection{Grid style}
Note that, in addition to the parameters outlined above, there are the 
following ones, which control the style of the grid 
(as in previous cases, these parameters are changed
by redefining them with the \cs{renewcommand} declaration,
or using the usual instructions when they are lengths).

\begin{description}
 \item [\csdef{gridcolor}] determines the color of main divisions in the grid
(regardless of the axes color). By default, this color is \verb+gray+.
 \item [\csdef{secundarygridcolor}] determines the color of secundary 
divisions in the grid.
By default, \verb+lightgray+).
\item[\csdef{gridthickness}] thickness of main divisions 
(by default, \verb+0.4pt+).
\item[\csdef{secundarygridthickness}] thickness of secundary divisions
(by default, \verb+0.2pt+).
\end{description}
\subsection{Polar grids}
Finally, instead of Cartesian axes, we can construct a polar grid
(obviously, this option will be interesting when we use polar coordinates).
\ttslashindex{polargrid}
\begin{Verbatim}[commandchars=\|\[\]]
\polargrid{|TIT[radius]}{|TIT[circledivs]}
\end{Verbatim}
(\TTT{\TIT{radius}} and \TTT{\TIT{circledivs}} are, respectively,
the radius and the number of divisions of the circle
(\TTT{\TIT{circledivs}}must be a positive integer).

This command supports the same parameters that \cs{cartesianaxes} and
\cs{cartesiangrid} (when they makes sense), and also the following:
\begin{description}
\item[\csdef{runitdivisions}] Number of radial subdivisions of the unit.
By default, $1$ (it must be a positive integer).
\end{description}
\begin{exemple}
\renewcommand{\runitdivisions}{2}
\setlength{\unitlength}{0.75cm}
\renewcommand{\gridcolor}{magenta}
\begin{center}
\begin{Picture}(-4,-4)(4,4)
\polargrid{3.5}{12}
\end{Picture}
\end{center}
\end{exemple}
\begin{exemple}
\renewcommand{\runitdivisions}{2}
\setlength{\unitlength}{0.75cm}
\renewcommand{\gridcolor}{magenta}
\referencesystem(0,0)(1,-1)(0.5,0.5)
\begin{center}
\begin{Picture}(-3.5,-3.5)(3.5,3.5)
\polargrid{3.5}{12}
\end{Picture}
\end{center}
\end{exemple}
\begin{description}
\item[\csdef{degreespolarlabels}, \csdef{radianspolarlabels}]
Arcs are printed, by default, in  radians. 
If you want angular units mesured in degrees,
use the  \csdef{degreespolarlabels} declaration (obviously,
\csdef{radianspolarlabels} recovers tags in radians).
\end{description}
\begin{exemple}
\begin{center}
\degreespolarlabels
\setlength{\unitlength}{1cm}
\begin{Picture}(-4,-4)(4,4)
\polargrid{3}{24}
\end{Picture}
\end{center}
\end{exemple}
\begin{description}
\item[\csdef{rlabelpos}] Relative position of labels in polar axis.
Admissible values are those allowed in the \TTT{\TIT{position}} 
argument of command \cs{Put} (see subsection~\ref{subsec:put}).
Default is \verb+bbr+.
\end{description}
\begin{exemple}
\begin{center}
\setlength{\unitlength}{1cm}
\begin{Picture}(-4,-4)(4,4)
\rlabelpos{b}
\polargrid{3.5}{10}
\end{Picture}
\end{center}
\end{exemple}


To remove tags on the polar axis and angles you can use the 
\csdef{makenolabels} declaration.

\section[Alternatives to some standard commands]{%
             Alternatives to standard commands
             \cs{put},\cs{multiput}, \cs{line}, and \cs{vector}}
Standard commands used inside the \environ{picture} environment
are not modified by this package
(although if we include these commands in the body of a \environ{Picture}
environment).
In particular, there does not affect the \cs{referencesystem} declaration.
This package introduces similar commands to those which are sensitive to the
active reference system and give us a greater control over their behavior.
These are the instructions described below.

\subsection{Extensions of the \cs{put} command}\label{subsec:put}
 \begin{description}
 \item[\csdef{Put}, \csdef{cPut}, \csdef{rPut}]
\mbox{}

\begin{Verbatim}[commandchars=\|\{\}]
\Put[|TIT{position}](|TIT{x},|TIT{y})|{|TIT{object}|}
\Put*[|TIT{position}](|TIT{x},|TIT{y})|{|TIT{object}|}
\cPut|{|TIT{position}|}(|TIT{x},|TIT{y})|{|TIT{object}|}
\rPut|{|TIT{position}|}(|TIT{x},|TIT{y})|{|TIT{object}|}
\rPut*|{|TIT{position}|}(|TIT{x},|TIT{y})|{|TIT{object}|}
\end{Verbatim}
place the drawing pointer in the point
of  coordinates \verb+(+\TTT{\TIT{x}}\verb+,+\TTT{\TIT{y}}\verb+)+
with respect to the active reference system (which may coincide or not with
the standard system).
These commands differ in the criteria used to determine the precise position
of the object.

Involved parameters are (see below)
\ttslashindex{Pictlabelsep}
\ttslashindex{defaultPut}
\ttslashindex{highestlabel}
\begin{Verbatim}[commandchars=\|\[\]]
\Pictlabelsep|{|TIT[distance]|}
\defaultPut|{c|}/\defaultPut|{r|}
\highestlabel|{|TIT[text]|}
\end{Verbatim}
\medskip

In the following example, the red circle (included as an argument in the
\cs{put} command) is at the point
of standard coordinates $(1,-1)$; however, in the case of the
blue circle, coordinates $(1,-1)$ refer to the active reference system.
\begin{exemple}
\begin{center}
\setlength{\unitlength}{0.75cm}
\referencesystem(0,0)(1,-1)(1,1)
\begin{Picture}(-2.5,-2.5)(2.5,2.5)
\cartesiangrid(-2,-2)(2,2)
\pictcolor{red}
\put(1,-1){\circle*{0.25}}
\pictcolor{blue}
\Put(1,-1){\circle*{0.25}}
\end{Picture}
\end{center}
\end{exemple}

Recall that coordinates can be rectangular or polar, and angles may
be measured in radians or in degrees.
\begin{exemple}
\begin{center}
\setlength{\unitlength}{1cm}
\begin{Picture}(-2.5,-2.5)(2.5,2.5)
\cartesiangrid(-2,-2)(2,2)
\polarreference
\pictcolor{blue}
\Put(1,\numberHALFPI){\circle*{0.25}}
\degreesangles
\pictcolor{red}
\Put(1,180){\circle*{0.25}}
\end{Picture}
\end{center}
\end{exemple}
\subsubsection{Accurate positioning of the graphical object}
The \TTT{\TIT{position}} argument allows us to fix the relative position of
\TTT{\TIT{object}} respect to point \TTT{(\TIT{x},\TIT{y})}.
Note that this argument is optional in \cs{Put} and \cs{Put*},
but mandatory in the other commands we are describing.
The purpose of this parameter is to rationalize the disposition of
objects, especially when they are not strictly graphical objects
(but labels, text boxes or mathematical formulas). In these cases, 
the appropriate choice of coordinates seems a problem that is not well
solved with standard instructions, despite the special syntax of the 
\cs{makebox} command in the \environ{picture} environment. 
For example, in this picture (which we made using only the standard 
\LaTeX{} commands)
\begin{center}
\setlength{\unitlength}{2cm}

\begin{picture}(7,3)(-0.5,-1.5)

\put(0,0){\line(1,0){7}}
\put(0,-1.5){\line(0,1){3}}
\put(0,-1.5){\line(0,-1){0}}
\multiput(1.570796,-0.1)(1.570796,0){4}{\line(0,1){0.2}}
\multiput(-0.1,-1)(0,1){3}{\line(1,0){0.2}}

\qbezier(0,0)(1,1)(1.570796,1)
\qbezier(1.570796,1)(2.141593,1)(3.141593,0)
\qbezier(3.141593,0)(4.141593,-1)(4.712389,-1)
\qbezier(4.712389,-1)(5.283185,-1)(6.283185,0)

\put(-1.570796,0){%
   \qbezier(1.570796,1)(2.141593,1)(3.141593,0)
   \qbezier(3.141593,0)(4.141593,-1)(4.712389,-1)
   \qbezier(4.712389,-1)(5.283185,-1)(6.283185,0)}
\put(4.712389,0){\qbezier(0,0)(1,1)(1.570796,1)}

\put(2.356194,0.707107){$\sin x$}
\put(6.283185,1){$\cos x$}
\put(-0.15,-1){\makebox(0,0)[r]{$-1$}}
\put(-0.15,0){\makebox(0,0)[r]{$0$}}
\put(-0.15,1){\makebox(0,0)[r]{$1$}}
\put(1.570796,-0.15){\makebox(0,0)[t]{$\pi/2$}}
\put(3.141593,-0.15){\makebox(0,0)[t]{$\pi$}}
\put(4.712389,-0.15){\makebox(0,0)[t]{$3\pi/2$}}
\put(6.283185,-0.15){\makebox(0,0)[t]{$2\pi$}}
\end{picture}
\end{center}
we have located numerical labels ($0$, $1$, $\pi$\ldots) at 
\TTT{0.15\cs{unitlength}} of its \emph{natural} position over the axes,
while the reference points of tags
``$\sin x$'' and ``$\cos x$'' are just in points $(3\pi/4,\sin(3\pi/4))$ and 
$(2\pi,1)$, using these instructions:
\begin{Verbatim}
\put(2.356194,0.707107){$\sin x$}
\put(6.283185,1){$\cos x$}
\put(-0.15,-1){\makebox(0,0)[r]{$-1$}}
\put(-0.15,0){\makebox(0,0)[r]{$0$}}
\put(-0.15,1){\makebox(0,0)[r]{$1$}}
\put(1.570796,-0.15){\makebox(0,0)[t]{$\pi/2$}}
\put(3.141593,-0.15){\makebox(0,0)[t]{$\pi$}}
\put(4.712389,-0.15){\makebox(0,0)[t]{$3\pi/2$}}
\put(6.283185,-0.15){\makebox(0,0)[t]{$2\pi$}}
\end{Verbatim}

If we change the value of \cs{unitlength}, then these values become
inappropriate and we need to change several lines of code.
\begin{center}
\setlength{\unitlength}{1cm}

\begin{picture}(7,3)(-0.5,-1.5)

\put(0,0){\line(1,0){7}}
\put(0,-1.5){\line(0,1){3}}
\put(0,-1.5){\line(0,-1){0}}
\multiput(1.570796,-0.1)(1.570796,0){4}{\line(0,1){0.2}}
\multiput(-0.1,-1)(0,1){3}{\line(1,0){0.2}}

\qbezier(0,0)(1,1)(1.570796,1)
\qbezier(1.570796,1)(2.141593,1)(3.141593,0)
\qbezier(3.141593,0)(4.141593,-1)(4.712389,-1)
\qbezier(4.712389,-1)(5.283185,-1)(6.283185,0)

\put(-1.570796,0){%
   \qbezier(1.570796,1)(2.141593,1)(3.141593,0)
   \qbezier(3.141593,0)(4.141593,-1)(4.712389,-1)
   \qbezier(4.712389,-1)(5.283185,-1)(6.283185,0)}
\put(4.712389,0){\qbezier(0,0)(1,1)(1.570796,1)}

\put(2.356194,0.707107){$\sin x$}
\put(6.283185,1){$\cos x$}
\put(-0.15,-1){\makebox(0,0)[r]{$-1$}}
\put(-0.15,0){\makebox(0,0)[r]{$0$}}
\put(-0.15,1){\makebox(0,0)[r]{$1$}}
\put(1.570796,-0.15){\makebox(0,0)[t]{$\pi/2$}}
\put(3.141593,-0.15){\makebox(0,0)[t]{$\pi$}}
\put(4.712389,-0.15){\makebox(0,0)[t]{$3\pi/2$}}
\put(6.283185,-0.15){\makebox(0,0)[t]{$2\pi$}}
\end{picture}
\end{center}

Note that, regarding labels along the $x$ axis, instead of aligning them to a 
fixed distance of this axis, there would be better to align the baselines
($\pi$ and $2\pi$ should go down);
some of these labels should
move slightly to the right or to the left to avoid that it cut the graph.
Finally, the tag ``$\cos x$'' should be vertically centered
(with respect to the curve) and slightly moved to the right.
\medskip

Using the \package{xpicture} package we construct this picture 
in the following way:
\begin{Exemple}
\MULTIPLY{3}{\numberQUARTERPI}{\numberTQPI}
\SIN{\numberTQPI}{\sinTQPI}

\begin{center}
\setlength{\unitlength}{2cm}
\begin{Picture}(-0.5,-1.5)(6.5,1.5)
{\referencesystem(0,0)(\numberHALFPI,0)(0,1)
\makenolabels
\renewcommand{\Pictlabelsep}{0.1}
\highestlabel{$-3\pi/2$}
\cartesianaxes(0,-1.5)(4.25,1.5)

\rPut{l}(0,-1){$-1$}                           % put the y-axis labels at left
\rPut{l}(0,0){$0$}
\rPut{l}(0,1){$1$}
\rPut*{bbl}(1,0){$\pi/2$}                      % put "\pi/2" at bbl
\rPut*{b}(2,0){$\pi$}                          % put "\pi" at bottom
\rPut*{bbr}(3,0){$3\pi/2$}                     % put "3\pi/2" at bbr
\rPut*{b}(4,0){$2\pi$}                         % put "2\pi" at bottom

\rPut*{b}(0,0){\pictcolor{gray}\xLINE(0.75,0)(4.25,0)}} % \baseline of x-labels

\PlotFunction[8]{\COSfunction}{0}{\numberTWOPI}
\PlotFunction[8]{\SINfunction}{0}{\numberTWOPI}

\Put[NE](\numberTQPI,\sinTQPI){$\sin x$}       % put "\sin x" at NorthEast
\Put[E](\numberTWOPI,1){$\cos x$}              % put "\cos x" at East
\end{Picture}
\end{center}
\end{Exemple}
Here we used several tools to draw the graphs of the functions.
But aside from this, commands \cs{Put}, \cs{rPut} and \cs{rPut*} have allowed 
we to determine the logical position of objects in a much more 
reasonable way.\footnote{Regarding to labels on coordinated axes 
a better choice would be to use other specific commands, 
as \cs{printxlabels}. Here we have chosen \cs{rPut} because we are
illustrating this instruction.}

Argument \TTT{\TIT{position}} supports multiple values:
\begin{description}
\item[An integer or decimal number,] determining the angle (in degrees)
where \TTT{\TIT{object}} is placed,
 with respect to the reference point \TTT{(\TIT{x},\TIT{y})}.
\end{description}

\begin{Exemple}
\begin{center}
\setlength{\unitlength}{1cm}
\begin{Picture}(0,-1)(9,1)
\makenolabels
\renewcommand{\axescolor}{lightgray}\renewcommand{\ticscolor}{lightgray}
\cartesiangrid(0,-1)(8,1)
\pictcolor{blue}
\Put[0](0,0){0}
\Put[45](1,0){45}
\Put[90](2,0){90}
\Put[135](3,0){135}
\Put[180](4,0){180}
\Put[225](5,0){225}
\Put[270](6,0){270}
\Put[315](7,0){315}
\Put[360](8,0){360}
\end{Picture}
\end{center}
\end{Exemple}
\begin{description}
\item[Letter \TTT{c}] (from \emph{center}),
which places the center of \TTT{\TIT{object}} at point
\verb+(+\TTT{\TIT{x}}\verb+,+\TTT{\TIT{y}}\verb+)+.
\end{description}
\begin{exemple}
\begin{center}
\setlength{\unitlength}{2cm}
\begin{Picture}(-1,-1)(1,1)
\cartesianaxes(-1,-1)(1,1)
\pictcolor{blue}
\Put[c](0,0){A CENTERED BOX}
\end{Picture}
\end{center}
\end{exemple}
Note that this option is not equivalent to the suppression of the optional 
argument, because in that case
the reference point of \TTT{\TIT{object}} is located
in \verb+(+\TTT{\TIT{x}}\verb+,+\TTT{\TIT{y}}\verb+)+.
\begin{exemple}
\begin{center}
\setlength{\unitlength}{2cm}
\begin{Picture}(-1,-1)(1,1)
\cartesianaxes(-1,-1)(1,1)
\pictcolor{blue}
\Put(0,0){A NONCENTERED BOX}
\end{Picture}
\end{center}
\end{exemple}
\begin{description}
\item[Letters or letter combinations \TTT N, \TTT E, \TTT S, \TTT W,
\TTT{NE}, \TTT{SE}, \TTT{SW}, \TTT{NW},
\TTT{NNE}, \TTT{ENE}, \TTT{ESE}, \TTT{SSE}, \TTT{SSW}, \TTT{WSW}, \TTT{WNW},
\TTT{NNW}]\mbox{}

Abbreviation of \emph{North}, \emph{East}\ldots,  \emph{North-East}\ldots,  
\emph{North-North-East}\ldots

For example, the
\begin{Verbatim}
\Put[NE](0,0){A}
\end{Verbatim}
instruction writes ``\verb+A+''  \emph{at north-east} of point \verb+(0,0)+.
\item[Letters o letter combinations  \TTT t, \TTT  r, \TTT  b, \TTT  l,
 \TTT{tr}, \TTT{br}, \TTT{bl}, \TTT{tl},
 \TTT{ttr}, \TTT{rtr}, \TTT{rbr}, \TTT{bbr}, \TTT{bbl}, \TTT{lbl}, \TTT{ltl},
 \TTT{ttl}]\mbox{}
 
Abbreviation of \emph{top}, \emph{right}\ldots,  \emph{top-right}\ldots,  
\emph{top-top-right}\ldots

For example,
\begin{Verbatim}
\Put[tr](0,0){A}
\end{Verbatim}
writes ``\verb+A+''  \emph{at top and right} of point \verb+(0,0)+.

Parameter \cs{Pictlabelsep} determines the distance between the graphical 
object and the given point.
In the following examples we have made this argument very big to clearly 
appreciate the positioning of objects.
\end{description}
\begin{exemple}
\renewcommand{\Pictlabelsep}{1}
\begin{center}
\setlength{\unitlength}{2.5cm}%

\begin{Picture}(-1.5,-1.5)(1.5,1.5)
\Put[N](0,0){N}
\Put[S](0,0){S}
\Put[E](0,0){E}
\Put[W](0,0){W}
\Put[NE](0,0){NE}
\Put[SE](0,0){SE}
\Put[SW](0,0){SW}
\Put[NW](0,0){NW}
%
\Put[NNE](0,0){NNE}
\Put[ENE](0,0){ENE}
\Put[ESE](0,0){ESE}
\Put[SSE](0,0){SSE}
\Put[SSW](0,0){SSW}
\Put[WSW](0,0){WSW}
\Put[WNW](0,0){WNW}
\Put[NNW](0,0){NNW}
\Put(0,0){\Circle{1}}
\xLINE(-1,0)(1,0)
\xLINE(0,-1)(0,1)
\end{Picture}
\end{center}
\end{exemple}
\begin{exemple}
\renewcommand{\Pictlabelsep}{1}
\begin{center}
\setlength{\unitlength}{2.5cm}%

\begin{Picture}(-1.5,-1.5)(1.5,1.5)
\Put[t](0,0){t}
\Put[r](0,0){r}
\Put[b](0,0){b}
\Put[l](0,0){l}
\Put[tr](0,0){tr}
\Put[br](0,0){br}
\Put[bl](0,0){bl}
\Put[tl](0,0){tl}
\Put[ttr](0,0){ttr}
\Put[rtr](0,0){rtr}
\Put[rbr](0,0){rbr}
\Put[bbr](0,0){bbr}
\Put[bbl](0,0){bbl}
\Put[lbl](0,0){lbl}
\Put[ltl](0,0){ltl}
\Put[ttl](0,0){ttl}
\Put(0,0){%
   \regularPolygon[45]{\numberSQRTTWO}{4}}
\xLINE(-1,0)(1,0)
\xLINE(0,-1)(0,1)
\end{Picture}
\end{center}
\end{exemple}
\end{description}
\paragraph{Rectangular o circular distance?}
Commands \cs{rPut} and \cs{cPut} differ only in the criterion they use
to determine the distance between the reference point and the graphical object.
Command \cs{rPut} places the object (outside of) 
the square centered at the reference point and side \verb+2\Pictlabelsep+, 
while \cs{cPut} places it in the cercle of radius \verb+\Pictlabelsep+
(letters \verb+r+ and \verb+c+ mean, respectively,
a \emph{rectangular} and \emph{circular} layout).%
\footnote{For the mathematicians: command \cs{cPut} uses the euclidean norm 
(or 2-norm), while \cs{rPut} uses the infinite norm.}
Although, for small values of the \cs{Pictlabelsep} parameter,
the difference is subtle and usually not very significant, it is generally best
to use the circular version (because it corresponds to the natural concept of 
distance) and reserve the rectangular version
to objects that are placed on horizontal or vertical lines.
\begin{Exemple}
\begin{center}
\setlength{\unitlength}{1.5cm}
\renewcommand{\Pictlabelsep}{1}

\begin{Picture}(-1.5,-1.5)(2,1.5)
\regularPolygon[45]{\numberSQRTTWO}{4}
\Put(0,0){\circle*{0.1}}
\rPut{45}(0,0){r}
\xLINE(0,0)(0,-1)
\thicklines
\renewcommand{\Pictlabelsep}{0.1}
\xLINE(0,0)(1,1)
\xLINE(0,0)(1,0)
\xtrivVECTOR(0,-1)(1,-1)
\xtrivVECTOR(1,-1)(0,-1)
\rPut{b}(0.5,-1){\footnotesize\textbackslash Pictlabelsep}
\xtrivVECTOR(1,-1)(1,0)
\xtrivVECTOR(1,0)(1,-1)
\rPut{r}(1,-0.5){\footnotesize\textbackslash Pictlabelsep}
\polarreference\degreesangles
\xArc{0.3}{0}{45}
\degreesangles
\Put[22.5](0.3,22.5){$45^{\mathrm o}$}
\end{Picture}
\begin{Picture}(-1.5,-1.5)(2,1.5)
\Put(0,0){\circle*{0.1}}
\cPut{45}(0,0){c}
\Circle{1}
\thicklines
\xLINE(0,0)(\numberCOSXLV,\numberCOSXLV)
\xLINE(0,0)(1,0)
\xtrivVECTOR(0,0)(0,-1)
\xtrivVECTOR(0,-1)(0,0)
\renewcommand{\Pictlabelsep}{0.1}
\rPut{r}(0,-0.5){\footnotesize\textbackslash Pictlabelsep}
\polarreference\degreesangles
\xArc{0.3}{0}{45}
\degreesangles
\Put[22.5](0.3,22.5){$45^{\mathrm o}$}
\end{Picture}
\end{center}
\end{Exemple}

Note that if the commands we use are \cs{rPut} or \cs{cPut}, then the 
positioners
\verb+t, r, tr+\ldots are equivalent to the corresponding \verb+N, E, NE+\ldots
However, the \cs{Put} command choose between rectangular or circular layout
following this criteria:
\begin{itemize}
 \item Positioners of \emph{compass} type (like \verb+NE+) use the circular
layout.
 \item Positioners \verb+t, tr+, et cetera use the rectangular layout.
 \item If the positioner is an angle (a number), it uses a default position
which is set using the \cs{defaultPut} declaration:
\verb+\defaultPut{c}+
determines a circular distance, while
\verb+\defaultPut{r}+
determines the rectangular alternative.
\end{itemize}
\begin{exemple}
\renewcommand{\Pictlabelsep}{1}
\begin{center}
\setlength{\unitlength}{2.5cm}%

\begin{Picture}(-1.5,-1.5)(1.5,1.5)
\defaultPut{c}
\Put[45](0,0){c}
\defaultPut{r}
\Put[45](0,0){r}
\regularPolygon[45]{\numberSQRTTWO}{4}
\Put(0,0){\Circle{1}}
\xLINE(-1,0)(1,0)
\xLINE(0,-1)(0,1)
\end{Picture}
\end{center}
\end{exemple}
\paragraph{Alignment by the baseline}
Starred versions \cs{Put*} and \cs{rPut*} allow us to align by the baseline
objects positioned below the reference point.
To use these commands, user must decide which is the higher object to be 
positioned, and introduce it as an argument of
the \csdef{highestlabel} declaration. For example, typing
\begin{Verbatim}
\highestlabel{\Huge A}
\end{Verbatim}
we reserve a sufficient vertical space to write the character {\Huge A}.

It should be noted that starred versions behave differently
only when the position of the object stands
under the reference point, with positioners
\verb+bbl+, \verb+b+ or \verb+bbr+, or with an appropiate angle
(as \verb+-90+ or \verb+300+); otherwise (including
\verb$S$, \verb$SSW$, et cetera),
the \cs{Put*} and \cs{rPut*} commands are equivalent
to the non-starred commands
 \cs{Put} and \cs{rPut}.
\begin{exemple}
\begin{center}
\setlength{\unitlength}{1cm}

\begin{Picture}(-3.5,-1.5)(3.5,1.5)
\xLINE(-3.5,0)(3.5,0)
\multiPut(-3,-0.1)(1,0){7}{\xLINE(0,0)(0,0.2)}
\highestlabel{\Huge A}
\renewcommand{\Pictlabelsep}{0.2}
\Put*[bbl](-3,0){\small A}
\Put*[b](-2,0){\normalsize A}
\Put*[-100](-1,0){\large A}
\Put*[-90](0,0){\Large A}
\Put*[270](1,0){\LARGE A}
\Put*[300](2,0){\huge A}
\Put*[bbr](3,0){\Huge A}
\Put*[bbl](-3.5,0){%
   \pictcolor{gray}\xLINE(0,0)(7,0)}
\end{Picture}
\end{center}
\end{exemple}
 

When a \environ{Picture} environment starts,
highest label is set to \verb+\normalfont\normalsize$1$+
(i.e., the high of a \emph{normal} $1$).
\subsection{Alternatives to the \cs{multiput} command}
The \package{xpicture} package introduces two families of commands
to generalize the \cs{multiput} command:
\begin{enumerate}
 \item The natural generalization, with all versions,
 \ttslashindex{multiPut}\ttslashindex{multicPut}\ttslashindex{multirPut}
\begin{Verbatim}[commandchars=\|\{\},commentchar=\%]
\multiPut[|TIT{position}](|TIT{x0},|TIT{y0})(|TIT{|(|Delta|)x},%
|TIT{|(|Delta|)y})|{|TIT{n}|}|{|TIT{object}|}
\multiPut*[|TIT{position}](|TIT{x0},|TIT{y0})(|TIT{|(|Delta|)x}%
,|TIT{|(|Delta|)y})|{|TIT{n}|}|{|TIT{object}|}
\multicPut|{|TIT{position}|}(|TIT{x0},|TIT{y0})(|TIT{|(|Delta|)x}%
,|TIT{|(|Delta|)y})|{|TIT{n}|}|{|TIT{object}|}
\multirPut|{|TIT{position}|}(|TIT{x0},|TIT{y0})(|TIT{|(|Delta|)x}%
,|TIT{|(|Delta|)y})|{|TIT{n}|}|{|TIT{object}|}
\multirPut*|{|TIT{position}|}(|TIT{x0},|TIT{y0})(|TIT{|(|Delta|)x}%
,|TIT{|(|Delta|)y})|{|TIT{n}|}|{|TIT{object}|}
\end{Verbatim}
These commands compose \TIT{n} copies of \TTT{\TIT{object}}
in $(\TIT{x0},\TIT{y0})$, $(\TIT{x0}+\Delta x,\TIT{y0}+\Delta y)$,
 $(\TIT{x0}+2\Delta x,\TIT{y0}+2\Delta y)$,\ldots, 
 $(\TIT{x0}+(\TIT n-1)\Delta x,\TIT{y0}+(\TIT n-1)\Delta y)$.
\item A new command group,
\ttslashindex{multiPlot}\ttslashindex{multicPlot}\ttslashindex{multirPlot}
\begin{Verbatim}[commandchars=\|\{\},commentchar=\%]
\multiPlot[|TIT{position}]|{|TIT{object}|}(|TIT{x0},|TIT{y0})(|TIT{x1},%
|TIT{y1})...(|TIT{xn},|TIT{yn})
\multiPlot*[|TIT{position}]|{|TIT{object}|}(|TIT{x0},|TIT{y0})(|TIT{x1},%
|TIT{y1})...(|TIT{xn},|TIT{yn})
\multicPlot|{|TIT{position}|}|{|TIT{object}|}(|TIT{x0},|TIT{y0})(|TIT{x1},%
|TIT{y1})...(|TIT{xn},|TIT{yn})
\multirPlot|{|TIT{position}|}|{|TIT{object}|}(|TIT{x0},|TIT{y0})(|TIT{x1},%
|TIT{y1})...(|TIT{xn},|TIT{yn})
\multirPlot*|{|TIT{position}|}|{|TIT{object}|}(|TIT{x0},|TIT{y0})(|TIT{x1},%
|TIT{y1})...(|TIT{xn},|TIT{yn})
\end{Verbatim}
These commands compose the done object in several positions, that are freely
entered as a list of coordinate pairs.
\end{enumerate}
\begin{exemple}
\begin{center}
\setlength{\unitlength}{1cm}
\referencesystem(0,0)(1,-1)(1,1)
\begin{Picture}(-2.5,-2.5)(2.5,2.5)
\cartesiangrid(-2,-2)(2,2)
\pictcolor{blue}
\multiPut(-2,-2)(1,1){5}{\circle*{0.25}}
\pictcolor{red}
\multiPlot{\circle*{0.25}}(-1,-2)(2,1)(-2,2)
\end{Picture}
\end{center}
\end{exemple}
\begin{exemple}
\begin{center}
\setlength{\unitlength}{1cm}
\referencesystem(0,0)(1,-1)(1,1)
\begin{Picture}(-2.5,-2.5)(2.5,2.5)
\cartesiangrid(-2,-2)(2,2)
\pictcolor{blue}
\multiPut[b](-2,-2)(1,1){5}{\circle*{0.25}}
\pictcolor{red}
\multiPlot[NE]{\circle*{0.25}}(-1,-2)(2,1)(-2,2)
\end{Picture}
\end{center}
\end{exemple}
\subsection{Alternatives to \cs{line} and \cs{vector}}
\begin{description}
\item[\csdef{xLINE}] This command draws line segments:
\begin{Verbatim}[commandchars=\|\[\]]
\xLINE(|TIT[x0],|TIT[y0])(|TIT[x1],|TIT[y1])
\end{Verbatim}
draws the line segment between the two points
\verb+(+\TIT{x0}\verb+,+\TIT{y0}\verb+)+ and
\verb+(+\TIT{x1}\verb+,+\TIT{y1}\verb+)+
(Cartesian or polar coordinates, in the active reference system).
This allows us to draw any segment in any direction.
\item[\csdef{xVECTOR}, \csdef{xtrivVECTOR}] plot arrows:
\begin{Verbatim}[commandchars=\|\[\]]
\xVECTOR(|TIT[x0],|TIT[y0])(|TIT[x1],|TIT[y1])
\xtrivVECTOR(|TIT[x0],|TIT[y0])(|TIT[x1],|TIT[y1])
\end{Verbatim}
draw an arrow between points
\verb+(+\TIT{x0}\verb+,+\TIT{y0}\verb+)+ and
\verb+(+\TIT{x1}\verb+,+\TIT{y1}\verb+)+.
The \cs{xtrivVECTOR} command draw an arrow
the end of which simply consists of a pair of segments
(\setlength{\unitlength}{1cm}%
\begin{Picture}(0,-0.1)(0.5,0.1)\xtrivVECTOR(0,0)(0.5,0)\end{Picture}).
length and aperture of the end of arrow are controled by the instruction
\ttslashindex{arrowsize}
\begin{Verbatim}[commandchars=\|\[\]]
\arrowsize{|TIT[xlen]}{|TIT[ylen]}
\end{Verbatim}
where the two parameters are non-negative numbers:
the first one for the length (in points); second
for the half of the aperture. Default is
\begin{Verbatim}
\arrowsize{5}{2}
\end{Verbatim}
\begin{exemple}
\setlength{\unitlength}{0.75cm}
\referencesystem(0,0)(1,0)(0.25,0.75)
\begin{Picture}(-4.5,-4.5)(4.5,4.5)
\cartesiangrid(-4,-4)(4,4)
\thicklines
\pictcolor{blue}
\xLINE(-4,0)(1,4)
\Put(1,-3){\xLINE(0,0)(3,2)}
\pictcolor{red}
\xtrivVECTOR(0,0)(2,3)
\xtrivVECTOR(0,0)(2,0)
\arrowsize{10}{4}
\xtrivVECTOR(0,0)(-2,-1)

\pictcolor{magenta}
\xVECTOR(-3,-3)(-3,3)
\xVECTOR(-3,-3)(-2,-2)
\end{Picture}
\end{exemple}
\item[\csdef{xline}, \csdef{xvector}, \csdef{xtrivvector}]
draw lines and vectors using the standard \LaTeX{} syntax
(but without any restriction in allowed parameters,
that can be integer or decimal numbers, positive, negative or zero).
\begin{Verbatim}[commandchars=\|\[\]]
\xline(|TIT[x],|TIT[y]){|TIT[size]}
\xvector(|TIT[x],|TIT[y]){|TIT[size]}
\xtrivvector(|TIT[x],|TIT[y]){|TIT[size]}
\end{Verbatim}
\begin{exemple}
\setlength{\unitlength}{0.75cm}
\referencesystem(0,0)(1,0)(0.25,0.75)
\begin{Picture}(-4.5,-4.5)(4.5,4.5)
\cartesiangrid(-4,-4)(4,4)
\thicklines
\pictcolor{blue}
\Put(-4,0){\xline(5,4){5}}
\Put(1,-3){\xline(3,2){3}}
\pictcolor{red}
\Put(0,0){\xtrivvector(2,3){2}}
\xtrivvector(1,0){2}
\arrowsize{10}{4}
\Put(0,0){\xtrivvector(2,1){-2}}

\pictcolor{magenta}
\Put(-3,-3){\xvector(0,1){6}}
\Put(-3,-3){\xvector(1,1){1}}
\end{Picture}
\end{exemple}

If you want to draw only an arrowhead (without any line)
you can use either the
\csdef{zerovector}/\csdef{zerotrivvector}
or \cs{xvector}/\cs{xtrivvector} commands:
\begin{Verbatim}[commandchars=\|\[\]]
\zerovector(|TIT[x],|TIT[y])
\zerotrivvector(|TIT[x],|TIT[y])
\xvector(|TIT[x],|TIT[y]){0}
\xtrivvector(|TIT[x],|TIT[y]){0}
\end{Verbatim}
\end{description}
\subsection{Polygons anf polygonal lines}
The \package{pict2e} and \package{curve2e} packages include
specific instructions for drawing polygonal lines and polygons.
We introduce new versions of these
commands in order to refer to the active reference system.
\begin{description}
\item[\csdef{Polyline}] draws polygonal lines.
Logically, we must pass the list of vertices:
\begin{Verbatim}[commandchars=\|\[\]]
\Polyline(|TIT[x0],|TIT[y0])(|TIT[x1],|TIT[y1])...(|TIT[xn],|TIT[yn])
\end{Verbatim}
\item[\csdef{Polygon}] plots polygons, ie, closed polygonal lines:
\begin{Verbatim}[commandchars=\|\[\]]
\Polygon(|TIT[x0],|TIT[y0])(|TIT[x1],|TIT[y1])...(|TIT[xn],|TIT[yn])
\end{Verbatim}
is equivalent to
\begin{Verbatim}[commandchars=\|\[\],commentchar=\%]
\Polyline(|TIT[x0],|TIT[y0])(|TIT[x1],|TIT[y1])...(|TIT[xn],|TIT[yn])%
(|TIT[x0],|TIT[y0])
\end{Verbatim}

\begin{exemple}
\setlength{\unitlength}{0.75cm}
\referencesystem(0,0)(1,0)(0.25,0.75)
\begin{Picture}(-4.5,-4.5)(4.5,4.5)
\externalaxes
\cartesiangrid(-4,-4)(4,4)
\linethickness{1pt}
\pictcolor{blue}
\Polyline(-2,2)(-3,-1)(0,0)(2,3)(2,2)
\pictcolor{red}
\Polygon(0,0)(1,1)(3,1)(1,-1)
\end{Picture}
\end{exemple}
\item[\csdef{regularPolygon}] draws regular polygons:
\begin{Verbatim}[commandchars=\|\(\)]
\regularPolygon[|TIT(initial angle)]{|TIT(radius)}{|TIT(sides)}
\end{Verbatim}
makes the regular polygon with the given radius and sides.
The optional argument (zero, by default) determines
the slope of the first vertex, always measured in degrees.
\begin{exemple}
\begin{center}
\setlength{\unitlength}{0.5cm}
\begin{Picture}(-7.5,-7.5)(7.5,7.5)
\externalaxes
\cartesiangrid(-7,-7)(7,7)
\pictcolor{blue}
\regularPolygon{1}{5}
\Put(-4,0){\regularPolygon{2}{6}}
\Put(3,3){\regularPolygon{2}{4}}
\Put(-4,-4){\regularPolygon[45]{2}{4}}
\Put(4,-4){\regularPolygon[90]{2.5}{11}}
\Put(-4,4){\regularPolygon[90]{3}{3}}
\end{Picture}
\end{center}
\end{exemple}

\end{description}
\section{Drawing curves}
This section highlights the true potentiality of the \package{xpicture} 
package.
We will describe the instructions that can be used to easily (and effectively) 
represent
several interesting curves: Firstly, conic sections and arcs.
Then, any piecewise regular curve
(including graphs of real variable functions, in rectangular or polar 
coordinates,
and ---in a more general way--- curves defined by parametric equations).
\subsection{Conic sections}
The \package{xpicture} package defines new commands to draw conic sections:
 ellipses, circles, hyperbolas and parabolas.
\subsubsection{Circles}
We can draw the circle of implicit equation $x^2+y^2=r^2$ typing
\ttslashindex{Circle}
\begin{Verbatim}[commandchars=\|\[\]]
\Circle{|TIT[r]}
\end{Verbatim}
Note than the standard command \cs{circle}
requeres the diameter as mandatory argument, while here we must insert the 
radius.
\subsubsection{Ellipses}
To draw the ellipse $\displaystyle\frac{x^2}{a^2}+\frac{y^2}{b^2}=1$ enter the
following instruction:\ttslashindex{Ellipse}
\begin{Verbatim}[commandchars=\|\[\]]
\Ellipse{|TIT[a]}{|TIT[b]}
\end{Verbatim}
\begin{exemple}
\setlength{\unitlength}{0.5cm}
\renewcommand{\axeslabelsize}{\footnotesize}
\begin{Picture}(-5.5,-4.5)(5.5,4.5)
\cartesiangrid(-5,-4)(5,4)
\pictcolor{blue}
\Ellipse{4}{3}
\Circle{2}
\end{Picture}

\referencesystem(0,0)(1,0)(0.5,0.5)
\begin{Picture}(-5.5,-4.5)(5.5,4.5)
\cartesiangrid(-5,-4)(5,4)
\pictcolor{blue}
\Ellipse{4}{3}
\Circle{2}
\end{Picture}
\end{exemple}
\subsubsection{Hyperbolas}
Since the hyperbolas and parabolas are not bounded curves, to define the
portion of the curve that we want to draw  we need to specify the
maximum values for the $x$ and $y$ variables.\ttslashindex{Hyperbola}
\begin{Verbatim}[commandchars=\|\[\]]
\Hyperbola{|TIT[a]}{|TIT[b]}{|TIT[xmax]}{|TIT[ymax]}
\end{Verbatim}
draws the hyperbola
$\displaystyle\frac{x^2}{a^2}-\frac{y^2}{b^2}=1$,
where variables $x$ and $y$ are limited, respectively,
to the $\TTT{[-\TIT{xmax}}, \TTT{\TIT{xmax}]}$ and 
$\TTT{[-\TIT{ymax}}, \TTT{\TIT{ymax}]}$ intervals.
This curve is well defined if the parameter \TTT{\TIT{xmax}}
is greater than \TTT{\TIT{a}}. Otherwise, \package{xpicture} returns an error 
message and does not draw any curve.

In the following example, we show the hyperbola 
$\displaystyle\frac{x^2}{5^2}-\frac{y^2}{2^2}=1$
and its asymptotes,
using the \cs{xLINE} command (these asymptotes are lines $2x=\pm5y$,
passing through $(\pm16,\pm6.4)$).
\begin{Exemple}
\begin{center}
\setlength{\unitlength}{0.5cm}
\begin{Picture}(-17,-9)(17,9)
\renewcommand{\axeslabelsize}{\footnotesize}
\cartesiangrid(-16,-8)(16,8)
\pictcolor{blue}
\Hyperbola{5}{2}{16}{8}
\pictcolor{orange}
\xLINE(16,6.4)(-16,-6.4)
\xLINE(-16,6.4)(16,-6.4)
\end{Picture}
\end{center}
\end{Exemple}

Instructions \csdef{lHyperbola} and \csdef{rHyperbola} draw, respectively,
only the \emph{left} or only the \emph{right} branch of the given hyperbola
(here, is interpreted as \emph{right} branch this one that belongs to positive
values of variable $x$).
\begin{exemple}
\begin{center}
\setlength{\unitlength}{0.5cm}
\begin{Picture}(-5.5,-5.5)(5.5,5.5)
\renewcommand{\axeslabelsize}{\footnotesize}
\cartesiangrid(-5,-5)(5,5)
\pictcolor{red}
\lHyperbola{2}{3}{5}{5}
\pictcolor{blue}
\rHyperbola{2}{3}{5}{5}
\end{Picture}
\end{center}
\end{exemple}
\subsubsection{Parabolas}
Instruction\ttslashindex{Parabola}
\begin{Verbatim}[commandchars=\|\[\]]
\Parabola{|TIT[a]}{|TIT[xmax]}{|TIT[ymax]}
\end{Verbatim}
draw the parabola $x=ay^2$, varying $x$, at most, in the interval
$[0,\TTT{\TIT{xmax}}]$
(if \TTT{\TIT{a}} is positive) or in $[-\TTT{\TIT{xmax}},0]$
(for negative values of \TTT{\TIT{a}}),
and $y$ in $[-\TTT{\TIT{ymax}},\TTT{\TIT{ymax}}]$.
Parameters \TTT{\TIT{xmax}} and \TTT{\TIT{ymax}}
must be positive.
\begin{exemple}
\begin{center}
\setlength{\unitlength}{0.5cm}
\begin{Picture}(-5.5,-5.5)(5.5,5.5)
\cartesiangrid(-5,-5)(5,5)
\pictcolor{blue}
\Parabola{2}{5}{5}
\Parabola{0.2}{5}{5}
\pictcolor{orange}
\Parabola{-2}{5}{5}
\Parabola{-0.2}{5}{5}
\end{Picture}
\end{center}
\end{exemple}
\medskip

All commands drawing conic sections or arcs divide the curve in 
\csdef{defaultplotdivs} pieces (8, by default). To obtain a greather
accuracy, you can redefine this parameter.

\medskip

Note that all these commands draw conic sections centered
at the coordinate origin, so that their
principal axes coincide with the coordinate axes. If we
want to move his
center to any other point, we can do it moving in advance
the origin of coordinates or simply
including the command as an argument of the \cs{Put} command.
\begin{Exemple}
\begin{center}
\setlength{\unitlength}{0.5cm}
\begin{Picture}(-11,-8)(11,8)
\renewcommand{\axeslabelsize}{\footnotesize}
\cartesiangrid(-10,-7)(11,7)
\pictcolor{blue}
\Put(2,3){\Ellipse{4}{3}}
\Put(2,3){\Circle{0.25}}
\pictcolor{orange}
\Put(2,-3){\Hyperbola{5}{2}{9}{3}}
\Put(2,-3){\Circle{0.25}}
\pictcolor{green}
\translateorigin(-10,2)
\Parabola{0.5}{21}{5}
\Circle{0.25}
\end{Picture}
\end{center}
\end{Exemple}
But, if the symmetry axes of our curve are not parallel to the coordinate
axes,\footnote{That is, in mathematical terms,
if the eigenvectors of the underlying quadratic form are not the canonical 
vectors.}
then we will need a rotation of axes.
\begin{Exemple}
\setlength{\unitlength}{0.5cm}
\begin{center}
\begin{Picture}(-10.5,-7.5)(10.5,7.5)
\renewcommand{\axeslabelsize}{\footnotesize}
\cartesiangrid(-10,-7)(10,7)
{%
\pictcolor{blue}
\translateorigin(5,3)
\rotateaxes{\numberSIXTHPI}
\Ellipse{4}{3}
\xLINE(-4,0)(4,0)
\xLINE(0,-3)(0,3)
}
\degreesangles
{%
\pictcolor{orange}
\translateorigin(-3,0)
\rotateaxes{110}
\Hyperbola{3}{2}{6}{4}
\xLINE(-6,-4)(6,4)
\xLINE(6,-4)(-6,4)
}
\pictcolor{green}
\translateorigin(5,-6)
\rotateaxes{72}
\Parabola{1}{4}{3}
\xLINE(0,-2)(0,2)
\xLINE(0,0)(4,0)
\end{Picture}
\end{center}
\end{Exemple}
Note that we made a couple of changes of local reference system (one for each
curve) within the drawing.
We can use the recourse to the change of coordinates also to
draw the hyperbola $\displaystyle\frac{y^2}{a^2}-\frac{x^2}{b^2}=1$ and the
parabola $y=ax^2$.
Note than \verb+\referencesystem(0,0)(0,1)(1,0)+
(or \verb+\symmetrize{\numberQUARTERPI}+)
makes vertical the $x$ axis and horizontal the
$y$ axis.\footnote{We will use this trick later
to plot inverse functions.}
\begin{exemple}
\setlength{\unitlength}{0.5cm}
\begin{center}
\begin{Picture}(-5.5,-5.5)(5.5,5,5)
\renewcommand{\axeslabelsize}{\footnotesize}
\cartesiangrid(-5,-5)(5,5)
\referencesystem(0,0)(0,1)(1,0)
\pictcolor{blue}
\Parabola{0.22}{5}{5}
\pictcolor{red}
\Hyperbola{2}{3}{5}{5}
\end{Picture}
\end{center}
\end{exemple}

\subsection{Arcs (of conic sections)}
The instructions described above allow us to draw whole circles, ellipses
hyperbolas and parabolas. More generally, we can represent any portion of 
these curves, ie, circular, elliptic, hyperbolic and parabolic arcs.
\ttslashindex{xArc}\ttslashindex{circularArc}
\begin{Verbatim}[commandchars=\|\[\]]
\xArc{|TIT[r]}{|TIT[angle1]}{|TIT[angle2]}
\circularArc{|TIT[r]}{|TIT[angle1]}{|TIT[angle2]}
\end{Verbatim}
These two instructions are equivalent.
They draw the arc of the circle centered at $(0,0)$
with radius $\TIT{r}$
and limited by the $\TTT{\TIT{angle1}}$ and $\TTT{\TIT{angle2}}$
angles.
\begin{exemple}
\setlength{\unitlength}{0.5cm}
\begin{center}
\begin{Picture}(-5.5,-5.5)(5.5,5,5)
\renewcommand{\axeslabelsize}{\footnotesize}
\cartesianaxes(-5,-5)(5,5)
\pictcolor{gray}
\circularArc{3}{\numberPI}{\numberTWOPI}
\pictcolor{red}
\xLINE(-2,2)(-2,5)
\xLINE(-2,2)(-5,2)
\degreesangles
\Put(-2,2){\circularArc{1}{90}{180}}
\pictcolor{blue}
\polarreference
\Put(1,30){\xLINE(0,0)(4,30)}
\Put(1,30){\xLINE(0,0)(4,60)}
\Put(1,30){\circularArc{2}{30}{60}}
\end{Picture}
\end{center}
\end{exemple}
\begin{exemple}
\SUBTRACT{\numberGOLD}{1}{\midaB}
\COPY{1}{\midaA}
\ADD{\midaA}{\midaB}{\Mida}
\setlength{\unitlength}{5cm}
\newcommand{\espiral}{%
    \Put(0,0){\begin{Picture}(0,0)(0,0)
      \translateorigin(\midaA,0)
      \pictcolor{red}
      \circularArc{\midaA}{\numberHALFPI}{\numberPI}
      \pictcolor{blue}
      \xLINE(0,0)(0,\midaA)
   \end{Picture}
   }
   \COPY{\midaA}{\Mida}
   \COPY{\midaB}{\midaA}
   \SUBTRACT{\Mida}{\midaA}{\midaB}
   \translateorigin(\Mida,\midaB)
   \changereferencesystem(0,\midaA)(0,-1)(1,0)
}
\renewcommand{\defaultplotdivs}{2}

\begin{center}
\begin{Picture}(0,0)(\numberGOLD,1)
   \Polygon(0,0)(\Mida,0)(\Mida,1)(0,1)
   % Plot 8 circular arcs
   \espiral\espiral\espiral\espiral
   \espiral\espiral\espiral\espiral
\end{Picture}

Golden rectangles and spiral
\end{center}
\end{exemple}
\ttslashindex{ellipticArc}
\begin{Verbatim}[commandchars=\|\[\]]
\ellipticArc{|TIT[a]}{|TIT[b]}{|TIT[angle1]}{|TIT[angle2]}
\end{Verbatim}
This instruction draws the arc of the ellipse centered at
 $(0,0)$ with semiaxes $\TIT{a}$
and $\TIT{b}$, $\frac{x^2}{a^2}+\frac{y^2}{b^2}=1$,
limited by angles $\TTT{\TIT{angle1}}$ and $\TTT{\TIT{angle2}}$.
\begin{exemple}
\setlength{\unitlength}{0.5cm}
\begin{center}
\begin{Picture}(-0.5,-3.5)(5.5,3.5)
\degreesangles
\ellipticArc{2}{3}{-90}{90}
\ellipticArc{5}{3}{-90}{90}
\end{Picture}
\end{center}
\end{exemple}
\ttslashindex{lhyperbolicArc}\ttslashindex{rhyperbolicArc}
\begin{Verbatim}[commandchars=\|\[\]]
\rhyperbolicArc{|TIT[a]}{|TIT[b]}{|TIT[y1]}{|TIT[y2]}
\lhyperbolicArc{|TIT[a]}{|TIT[b]}{|TIT[y1]}{|TIT[y2]}
\end{Verbatim}
Draw the arc (of the right or left branch, respectively)
of the hyperbola
 $\frac{x^2}{a^2}-\frac{y^2}{b^2}=1$ included between $y=\TTT{\TIT{y1}}$ and 
 $y=\TTT{\TIT{y2}}$.
\begin{exemple}
\setlength{\unitlength}{0.5cm}
\begin{center}
\begin{Picture}(-5.5,-5.5)(5.5,5,5)
\renewcommand{\axeslabelsize}{\footnotesize}
\cartesianaxes(-5,-5)(5,5)
\pictcolor{red}
\lhyperbolicArc{2}{3}{-4}{0}
\pictcolor{blue}
\rhyperbolicArc{2}{3}{-2}{5}
\end{Picture}
\end{center}
\end{exemple}
\ttslashindex{parabolicArc}
\begin{Verbatim}[commandchars=\|\[\]]
\parabolicArc{|TIT[a]}{|TIT[y1]}{|TIT[y2]}
\end{Verbatim}
Draw the arc of the parabola
 $x=ay^2$ included between $y=\TTT{\TIT{y1}}$ and $y=\TTT{\TIT{y2}}$.
\begin{exemple}
\setlength{\unitlength}{1cm}
\begin{center}
\begin{Picture}(-2.5,-2.5)(2.5,2,5)
\renewcommand{\axeslabelsize}{\footnotesize}
\cartesianaxes(-2,-2)(2,2)
\pictcolor{red}
\parabolicArc{-2}{-1}{0}
\pictcolor{blue}
\parabolicArc{0.5}{0}{2}
\end{Picture}
\end{center}
\end{exemple}
\subsection{Real variable functions}\label{subsec:real}
The \package{xpicture} package provides us two commands
to draw the graph of a function:
\csdef{PlotFunction} and \csdef{PlotPointsOfFunction}.
\begin{Verbatim}[commandchars=\|\(\)]
\PlotFunction[|TIT(n)]{\|TIT(functionname)}{\|TIT(tzero)}{\|TIT(tone)}
\PlotPointsOfFunction{|TIT(n)}{\|TIT(functionname)}{\|TIT(tzero)}{\|TIT(tone)}
\end{Verbatim}
Note that the parameter $\TTT{\TIT{n}}$ is optional in one of these 
instructions and mandatory in the other one.
In the case of \csdef{PlotFunction},
if we do not use this optional parameter,
a quadratic approximation of the function
\cs{\TIT{functionname}}
in the $[\cs{\TIT{tzero}},\cs{\TIT{tone}}]$ interval is drawn.
\begin{exemple}
\setlength{\unitlength}{1cm}
\begin{Picture}(-2.5,-0.5)(3.5,4.5)
\cartesianaxes(-2,0)(2,4)
\pictcolor{blue}
\PlotFunction{\SQUAREfunction}{-2}{2}
\Put[E](2,4){$f(t)=t^2$}
\end{Picture}
\end{exemple}
Now, this almost never provides a right graphic.
To draw curves with a greater accuracy we should use the parameter,
\TTT{\TIT{n}},
dividing the interval in \TTT{\TIT{n}} subintervals.
\begin{exemple}
\setlength{\unitlength}{1cm}
\CUBE{1.5}{\mymax}
\begin{Picture}(-2,-4)(2,4)
\cartesianaxes(-1.5,-\mymax)(1.5,\mymax)
\pictcolor{blue}
\PlotFunction[8]{\CUBEfunction}{-1.5}{1.5}
\Put[E](1.5,\mymax){$f(t)=t^3$}
\end{Picture}
\end{exemple}

On the other hand, the \csdef{PlotPointsOfFunction} command
plots $\TTT{\TIT{n}}+1$ \emph{points}, uniformly distributed
about the $x$-axis.
\begin{exemple}
\setlength{\unitlength}{1cm}
\CUBE{1.5}{\mymax}
\begin{Picture}(-2,-4)(2,4)
\cartesianaxes(-1.5,-\mymax)(1.5,\mymax)
\pictcolor{blue}
\PlotPointsOfFunction{24}{\CUBEfunction}{-1.5}{1.5}
\Put[E](1.5,\mymax){$f(t)=t^3$}
\end{Picture}
\end{exemple}

By default, \cs{PlotPointsOfFunction} plot \emph{points} as a filled circle
of diameter \verb+0.1\unitlength+. But you can modifie this diameter, by 
redefining the \csdef{pointmarkdiam} parameter.
\begin{exemple}
\setlength{\unitlength}{1cm}
\CUBE{1.5}{\mymax}
\renewcommand{\pointmarkdiam}{0.3}
\begin{Picture}(-2,-4)(2,4)
\cartesianaxes(-1.5,-\mymax)(1.5,\mymax)
\pictcolor{blue}
\PlotPointsOfFunction{24}{\CUBEfunction}{-1.5}{1.5}
\Put[E](1.5,\mymax){$f(t)=t^3$}
\end{Picture}
\end{exemple}

Moreover, you can select another symbol for these points, redefining 
\csdef{pointmark}.
\begin{exemple}
\setlength{\unitlength}{1cm}
\CUBE{1.5}{\mymax}
\renewcommand{\pointmark}{$\diamond$}
\begin{Picture}(-2,-4)(2,4)
\cartesianaxes(-1.5,-\mymax)(1.5,\mymax)
\pictcolor{blue}
\PlotPointsOfFunction{24}{\CUBEfunction}{-1.5}{1.5}
\Put[E](1.5,\mymax){$f(t)=t^3$}
\end{Picture}
\end{exemple}

Naturally, in order to apply these commands the function must be defined.
\package{xpicture}
loads the \packagedef{calculus} package, which
predefines some of the most common elementary functions
and includes several tools to build new ones.
The predefined functions are the following:
\begin{center}
\begin{tabular}{l>{$}l<{$}>{\qquad}l>{$}l<{$}}
 \csdef{ZEROfunction} & f(t)=0 &
 \csdef{ONEfunction}  & f(t)=1    \\
 \csdef{IDENTITYfunction}  & f(t)=t &
 \csdef{RECIPROCALfunction}  & f(t)=1/t \\
 \csdef{SQUAREfunction}  & f(t)=t^2 &
 \csdef{CUBEfunction}  & f(t)=t^3 \\
 \csdef{SQRTfunction}  & f(t)=\sqrt t \\
 \csdef{EXPfunction}  & f(t)=\exp t &
 \csdef{LOGfunction} & f(t)=\log t \\
 \csdef{COSfunction}  & f(t)=\cos t &
 \csdef{SINfunction}  & f(t)=\sin t \\
 \csdef{TANfunction}  & f(t)=\tan t &
 \csdef{COTfunction}  & f(t)=\cot t \\
 \csdef{COSHfunction}  & f(t)=\cosh t &
 \csdef{SINHfunction}  & f(t)=\sinh t \\
 \csdef{TANHfunction}  & f(t)=\tanh t &
 \csdef{COTHfunction}  & f(t)=\coth t \\
 \csdef{HEAVISIDEfunction} & f(t)=\begin{cases}
                              0 & \text{si $t<0$} \\
                              1 & \text{si $t\geq0$}
                          \end{cases}
\end{tabular}
\end{center}

\begin{Exemple}
\setlength{\unitlength}{1cm}
\linethickness{1.5pt}
\centering
\begin{Picture}(-5,-5)(6,5)
\externalaxes\makenotics
\cartesiangrid(-4.5,-4.5)(4.5,4.5)
\pictcolor{red}
\PlotFunction{\IDENTITYfunction}{-4.5}{4.5}
\Put[tr](4.5,4.5){$y=x$}

\DIVIDE{1}{4.5}{\minx}
\pictcolor{magenta}
\PlotFunction[10]{\RECIPROCALfunction}{\minx}{4.5}
\PlotFunction[10]{\RECIPROCALfunction}{-\minx}{-4.5}
\Put[r](4.5,\minx){$y=1/x$}

\SQRT{4.5}{\maxx}
\pictcolor{cyan}
\PlotFunction[10]{\SQUAREfunction}{-\maxx}{\maxx}
\Put[tr](\maxx,4.5){$y=x^2$}

\pictcolor{blue}
\PlotFunction[10]{\CUBEfunction}{-1.6509}{1.6509}
\Put[t](1.6509,4.5){$y=x^3$}
\end{Picture}
\end{Exemple}

\begin{Exemple}
\setlength{\unitlength}{1cm}
\linethickness{1.5pt}
\centering
\begin{Picture}(-7,-4.5)(7,4.5)
{\makenolabels
\changereferencesystem(0,0)(\numberHALFPI,0)(0,1)
\cartesiangrid(-4,-4)(4,4)
\highestlabel{$2\pi$}
\printylabels{-4}{1}{4}
\printxlabel{-4}{-2\pi}
\printxlabel{-2}{-\pi}
\printxlabel{2}{\pi}
\printxlabel{4}{2\pi}}
\pictcolor{red}
\PlotFunction[16]{\COSfunction}{-\numberTWOPI}{\numberTWOPI}
\pictcolor{blue}
\PlotFunction[16]{\SINfunction}{-\numberTWOPI}{\numberTWOPI}
\pictcolor{magenta}
\PlotFunction[6]{\TANfunction}{-1.3258}{1.3258}
\end{Picture}
\end{Exemple}

From these basic functions we can define many others,
using the following \emph{operations}:
\newcommand{\functoper}{%
   \{\cs{\TIT{function1}}\}\{\cs{\TIT{function2}}\}\{\cs{\TIT{newfunction}}\}}
\begin{description}
\item[Constant function:]\mbox{}

\csdef{CONSTANTfunction}\{\TIT{k}\}\{\cs{\TIT{newfunction}}\}

 Example: defining the  $F(t)=5$ function:

\cs{CONSTANTfunction}\{5\}\{\cs{F}\}

\item[Sum function:]\mbox{}

\csdef{SUMfunction}\functoper


Example: defining the $F(t)=t^2+t^3$ function:

\cs{SUMfunction}\{\cs{SQUAREfunction}\}\{\cs{CUBEfunction}\}\{\cs{F}\}

\item[Difference function:]\mbox{}

\csdef{SUBTRACTfunction}\functoper

Example: defining the $F(t)=t^2-t^3$ function:

\cs{SUBTRACTfunction}\cs{SQUAREfunction}\cs{CUBEfunction}\{\cs{F}\}

\item[Product function:]\mbox{}

\csdef{PRODUCTfunction}\functoper

Example: defining the $F(t)=\mathrm e^t\cos t$ function:

\cs{PRODUCTfunction}\cs{EXPfunction}\cs{COSfunction}\{\cs{F}\}

\item[Quotient function:]\mbox{}

\csdef{QUOTIENTfunction}\functoper

Example: defining the $F(t)=\mathrm e^t/\cos t$ function:

\cs{QUOTIENTfunction}\cs{EXPfunction}\cs{COSfunction}\{\cs{F}\}

\item[Composition of two functions:]\mbox{}

\csdef{COMPOSITIONfunction}\functoper

Example: defining the $F(t)=\mathrm e^{\cos t}$ function:

\cs{COMPOSITIONfunction}\cs{EXPfunction}\cs{COSfunction}\{\cs{F}\}

\item[Scaled function:]\mbox{}

\csdef{SCALEfunction}\{\TIT{k}\}\{\cs{\TIT{function}}\}%
   \{\cs{\TIT{newfunction}}\}

Example: defining the $F(t)=3{\cos t}$ function:

\cs{SCALEfunction}\{3\}\cs{COSfunction}\{\cs{F}\}

\item[Scaled variable:]\mbox{}

\csdef{SCALEVARIABLEfunction}\{\TIT{k}\}\{\cs{\TIT{function}}\}%
   \{\cs{\TIT{newfunction}}\}

Example: defining the $F(t)=\cos 3t$ function:

\cs{SCALEVARIABLEfunction}\{3\}\cs{COSfunction}\{\cs{F}\}

\item[Power function:] (exponent enter positiu)\mbox{}

\csdef{POWERfunction}\{\cs{\TIT{function}}\}\{\TIT{n}\}%
   \{\cs{\TIT{newfunction}}\}

Example: defining the $F(t)=t^5$ function:

\cs{POWERfunction}\cs{IDENTITYfunction}\{5\}\{\cs{F}\}

\item[Linear combination:]\mbox{}

\csdef{LINEARCOMBINATIONfunction}\{\TIT{a}\}\{\cs{\TIT{function1}}\}%
  \{\TIT{b}\}\{\cs{\TIT{function2}}\}\{\cs{\TIT{newfunction}}\}

Example: defining the $F(t)=2t-3\cos t$ function:

\cs{LINEARCOMBINATIONfunction}\{2\}\cs{IDENTITYfunction}\{-3\}%
   \cs{COSfunction}\{\cs{F}\}
\end{description}

By combining properly these operations, we can draw graphs of many functions.
Some examples are shown in next pages.
\newpage

First, we will draw the function $f(t)=t^3-2t$,
dividing the interval $[-2,2]$ in ten subintervals.
The simplest way to construct this function is as a linear combination of
$f_1(t)=t^3$ and $f_2(t)=t$.

\begin{exemple}
\LINEARCOMBINATIONfunction
               {1}{\CUBEfunction}
               {-2}{\IDENTITYfunction}
               {\Ffunction}
\begin{center}
\setlength{\unitlength}{1cm}
\begin{Picture}(-2.5,-4.5)(2.5,4.5)
\cartesianaxes(-2,-4)(2,4)
\pictcolor{blue}
\PlotFunction[10]{\Ffunction}{-2}{2}
\Put[rbr](2,4){$f(t)=t^3-2t$}
\end{Picture}
\end{center}
\end{exemple}
\newpage

Graph of $g(t)=t\cos t$. We multiply the identity and the cosine functions:

\begin{Exemple}
\setlength{\unitlength}{0.5cm}
\begin{center}
\begin{Picture}(-11,-11)(11,11)
\cartesianaxes(-10,-10)(10,10)
\PRODUCTfunction{\IDENTITYfunction}{\COSfunction}{\Gfunction}
\pictcolor{red}
\PlotFunction[30]{\Gfunction}{-10}{10}
\end{Picture}
\end{center}
\end{Exemple}
\newpage

Graph of $f(t)=(\cos t)^3$.

\begin{Exemple}
\setlength{\unitlength}{1cm}
\begin{center}
\begin{Picture}(-7,-3)(7,3)
\cartesianaxes(-\numberTWOPI,-2)(\numberTWOPI,2)
\POWERfunction{\COSfunction}{3}{\Ffunction}
\pictcolor{blue}
\PlotFunction[50]{\Ffunction}{-\numberTWOPI}{\numberTWOPI}
\end{Picture}
\end{center}
\end{Exemple}
\newpage

Graph of $g(t)=t\cos t\sin t$.
Note that in this case we have two operations:
First, we define the $f(t)=t \cos t$, multiplying the identity and cosine 
functions; then, we multiply by the sine function.
\begin{Exemple}
\begin{center}
\setlength{\unitlength}{0.75cm}
 \begin{Picture}(-11,-6)(11,6)
\cartesianaxes(-10,-5)(10,5)
\PRODUCTfunction{\IDENTITYfunction}{\COSfunction}{%
                            \Ffunction}
\PRODUCTfunction{\Ffunction}{\SINfunction}{\Gfunction}
\pictcolor{red}
\PlotFunction[40]{\Gfunction}{-10}{10}
\end{Picture}
\end{center}
\end{Exemple}

Graph of $g(t)=\arcsin t$. The \package{calculus} package
not support, for now, the inverse trigonometric functions; but we can plot
these functions (or any other inverse function)
swapping coordinated axes.

\begin{exemple}
\begin{center}
\setlength{\unitlength}{2cm}
\begin{Picture}(-1.5,-2)(1.5,2)
\makenolabels\makenotics
\cartesianaxes
     (-1,-\numberHALFPI)(1,\numberHALFPI)
\printxticslabels{-1}{0.5}{1}
\printyticlabel{-\numberHALFPI}{-\pi/2}
\printyticlabel{-\numberQUARTERPI}{-\pi/4}
\printyticlabel{\numberQUARTERPI}{\pi/4}
\printyticlabel{\numberHALFPI}{\pi/2}
\pictcolor{red}
\symmetrize{\numberQUARTERPI}
\PlotFunction[4]{\SINfunction}
     {-\numberHALFPI}{\numberHALFPI}
\end{Picture}
\end{center}
\end{exemple}
\subsubsection{Polynomial functions}
Although polynomial functions can be easily defined as
linear combinations of power functions,
to facilitate our work, the \package{calculus} package predefines
polynomials of
1, 2, and 3 degrees by these commands:
\cs{newlpoly} (new \emph{linear} polynomial), \cs{newqpoly}
(new \emph{quadratic} polynomial),
and \cs{newcpoly} (new \emph{cubic} polynomial):
\begin{description}
\item[\csdef{newlpoly}\{\cs{\TIT{newfunction}}\}\{\TIT a\}\{\TIT b\}]
stores the
$p(t)=\TTT{\TIT{a}}+\TTT{\TIT{b}}t$
function in the
 \cs{\TIT{newfunction}} command.
\item[\csdef{newqpoly}%
   \{\cs{\TIT{newfunction}}\}\{\TIT a\}\{\TIT b\}\{\TIT c\}]
stores the
$p(t)=\TTT{\TIT{a}}+\TTT{\TIT{b}}t+\TTT{\TIT{c}}t^2$
function in the
\cs{\TIT{newfunction}} command.
\item[\csdef{newcpoly}%
\{\cs{\TIT{newfunction}}\}\{\TIT a\}\{\TIT b\}\{\TIT c\}\{\TIT d\}]
stores the
$p(t)=\TTT{\TIT{a}}+\TTT{\TIT{b}}t+\TTT{\TIT{c}}t^2+\TTT{\TIT{d}}t^3$
function in the
\cs{\TIT{newfunction}} command.
\end{description}
\begin{exemple}
% F(t)=-1+2t
   \newlpoly{\poliF}{-1}{2}
% G(t)=-1+2t+t^2
   \newqpoly{\poliG}{-1}{2}{1}
% H(t)=-1+2t+t^2-0,5t^3
   \newcpoly{\poliH}{-1}{2}{1}{-0.5}

\setlength{\unitlength}{1cm}
\begin{Picture}(-4.5,-5.5)(4.5,5.5)
\cartesianaxes(-4,-5)(4,5)
\pictcolor{blue}
\PlotFunction{\poliF}{-2}{3}
\pictcolor{red}
\PlotFunction{\poliG}{-3.5}{1.5}
\pictcolor{orange}
\PlotFunction[10]{\poliH}{-2}{3.5}
\end{Picture}
\end{exemple}

\subsubsection{Possible errors}
In many cases you get a fairly accurate graph dividing the domain into several 
subintervals.
But an indiscriminate use of this method can produce erroneous results.
For example, if inside a subinterval there is
a discontinuity or a point where the function is not differentiable.
Look at the following example.
\medskip

\begin{exemple}
\SUBTRACTfunction{\SQUAREfunction}{\ONEfunction}
                            {\Ffunction}
\QUOTIENTfunction{\IDENTITYfunction}{\Ffunction}
                            {\Gfunction}

\setlength{\unitlength}{0.5cm}

\begin{Picture}(-8,-6)(8,6)
\def\xunitdivisions{2}
\def\yunitdivisions{2}
\renewcommand{\axeslabelsize}{\scriptsize}
\cartesianaxes(-7,-5)(7,5)
\Put(3,3){%
   $\boxed{\displaystyle g(t)=\frac{t}{t^ 2-1}}$}
\pictcolor{red}
\PlotFunction[10]{\Gfunction}{-7}{7}
\end{Picture}
\end{exemple}

Where is the problem?
Our function is $g(t)=t/(t^2-1)$;
this function has a pair of vertical asymptotes
at $t=\pm1$ (the two zeros of denominator).

We made 10 subdivisions of the $[-7,7]$ interval.
Do, we compute the function in points $-7+(14/10)k=-7+(7/5)k$,
$0\leq k\leq10$, ie,
\[
   -7\quad -\frac{28}{5}\quad -\frac{21}{5}\quad -\frac{14}{5}\quad
    -\frac{7}{5}\quad  0\quad  \frac{7}{5}\quad  \frac{14}{5}\quad
     \frac{21}{5}\quad  \frac{28}{5}\quad 7
\]

Singularities are between $-7/5$ and $0$, and between $0$ and $7/5$,
So, the graph is not correct in these intervals.
\medskip

To avoid this problem, we will
draw the function in three intervals, excluding the points where it is
undefined:
\medskip
\begin{exemple}
\SUBTRACTfunction{\SQUAREfunction}{\ONEfunction}
                            {\Ffunction}
\QUOTIENTfunction{\IDENTITYfunction}{\Ffunction}
                            {\Gfunction}
\renewcommand{\axeslabelsize}{\scriptsize}
\setlength{\unitlength}{0.5cm}
\begin{Picture}(-8,-6)(8,6)
\def\xunitdivisions{2}
\def\yunitdivisions{2}
\cartesianaxes(-7,-5)(7,5)
\pictcolor{red}
\PlotFunction[5]{\Gfunction}{-7}{-1.105}
\PlotFunction[5]{\Gfunction}{-0.905}{0}
\PlotFunction[5]{\Gfunction}{0}{0.905}
\PlotFunction[5]{\Gfunction}{1.105}{7}
\end{Picture}
\end{exemple}

(To determine the ends of the ranges of variation
$\pm1.105$ and $\pm0.905$, we solved the equation
$g(t)=5$, to ensure that asymtotic branches are interrupted
at the border of the drawing area).

\subsubsection{Accurate graphs}
In general, to obtain fairly reliable results we must make
 a careful analysis of the behavior of the function,
determining the points where it is undefined or not differentiable,
 the intervals where it is increasing, its extreme values,
points where graph cuts the coordinate axes and, in general,
 all points where the behavior of
function is significant.
From this information, we can chose the appropriate
drawing intervals.
A careful choice of the partition
subintervals in the domain ensures us
that the graph accurately reflects the behavior of the function.

We will see a couple of examples.
First, we draw the sine function in $[-\pi,\pi]$.
This function ant its derivative have no discontinuities,
but it is convenient to choose a number of partitions
being multiple of $4$, to carefully draw
function at the
$k\pi/2$ points.
In fact, a good choice are 24 subdivisions,
to ensure also the well known values of this function
for angles
multiple of $\pi/6$ and $\pi/4$.
\begin{Exemple}
\setlength{\unitlength}{2cm}%

\highestlabel{\normalfont\normalsize$3\pi/2$}
\begin{center}
\begin{Picture}(-3.5,-1.5)(3.5,1.5)
{\referencesystem(0,0)(\numberHALFPI,0)(0,1)
\makenolabels
\cartesianaxes(-2.2,-1.2)(2.2,1.2)}
\printylabels{-1}{1}{1}
\printxlabel{-\numberPI}{-\pi}
\printxlabel{-\numberHALFPI}{-\pi/2}
\printxlabel{\numberHALFPI}{\pi/2}
\printxlabel{\numberPI}{\pi}
\pictcolor{red}
   \PlotFunction[24]{\SINfunction}{-\numberPI}{\numberPI}
\renewcommand{\axeslabelcolor}{red}
\printxlabel{\numberSIXTHPI}{\pi/6}
\printylabel{0.5}{1/2}
\Polyline(\numberSIXTHPI,0)(\numberSIXTHPI,0.5)(0,0.5)
\end{Picture}
\end{center}
\end{Exemple}

Our second example is more complex. Let's graph the function
\[
f(t)=(t^3/3-t^2/2-2t+3)/3
\]

This function has three roots, at
$t=3/2$ and $t=\pm\sqrt{6}$.
Its derivative, $f'(t)=(t^2-t-2)/3$, equals zero at
$t=-1$ and $t=2$, where the function has, respectively,
a relative maximum and a relative minimum.
 The second derivative, $f''(t)=(2t-1)/3$,
 is zero at $t=1/2$, which is an inflexion point.
Interesting points are, then, the following:
\[
     -\sqrt{6},-1,0,1/2,3/2,2,\sqrt{6}
\]

We will plot this function in the
 $[-3,4]$ interval (because it includes all these points),
 but we divide it as
\[
      [-3,-\sqrt{6}]\cup
      [-\sqrt{6},-1]\cup
      [-1,0]\cup
      [0,1/2]\cup
      [1/2,3/2]\cup
      [3/2,2]\cup
      [2,\sqrt{6}]\cup
      [\sqrt{6},4]
\]
\begin{Exemple}
\SQRT{6}{\SQRTSIX}
\newcpoly{\functionf}{1}{-0.66667}{-0.16667}{0.11111}
\setlength{\unitlength}{2cm}
\begin{center}
 \begin{Picture}(-3.5,-2.5)(4.5,3.5)
\renewcommand{\xunitdivisions}{10}
\renewcommand{\yunitdivisions}{10}
\cartesiangrid(-3,-2)(4,3)
\pictcolor{red}
\PlotFunction{\functionf}{-3}{-\SQRTSIX}
\PlotFunction[4]{\functionf}{-\SQRTSIX}{-1}
\PlotFunction[4]{\functionf}{-1}{0}
\PlotFunction[4]{\functionf}{0}{0.5}
\PlotFunction[4]{\functionf}{0.5}{1.5}
\PlotFunction[4]{\functionf}{1.5}{2}
\PlotFunction[4]{\functionf}{2}{\SQRTSIX}
\PlotFunction{\functionf}{\SQRTSIX}{4}
\functionf{-1}{\tempf}{\tempDf}
\xLINE(-1,0)(-1,\tempf)
\functionf{2}{\tempf}{\tempDf}
\xLINE(2,0)(2,\tempf)
\functionf{0.5}{\tempf}{\tempDf}
\xLINE(0.5,0)(0.5,\tempf)
\end{Picture}
\end{center}
\end{Exemple}

\subsection{Polar coordinates curves}
To draw a curve defined in polar form as $\rho =f(t)$, we must
declare it as a polar curve, using the \csdef{POLARfunction}
declaration: writing
\begin{Verbatim}[commandchars=\|\[\]]
\POLARfunction{\|TIT[functionname]}{\|TIT[polarfunction]}
\end{Verbatim}
we declare the new polar curve \cs{\TIT{polarfunction}}
$\rho=\cs{\TIT{functionname}}(t)$.
For example, the \emph{cardioide} curve, $\rho=1+\cos t$,
can be defined in the following way:
\begin{Verbatim}
\SUMfunction{\ONEfunction}{\COSfunction}{\ffunction} % (y=1 + cos t)
\POLARfunction{\ffunction}{\cardioide}
\end{Verbatim}

Curves defined in such a way can be plotted using the
\csdef{PlotParametricFunction} command,
which syntax is analogous to that of \cs{PlotFunction}.

\begin{exemple}
% Cardioide: r = 1+cos t
\SUMfunction{\ONEfunction}{\COSfunction}
            {\ffunction}
\POLARfunction{\ffunction}{\cardioide}
\begin{center}
\def\runitdivisions{2}
\setlength{\unitlength}{1.5cm}
\begin{Picture}(-2.5,-2.5)(2.5,2.5)
\polargrid{2}{24}
\pictcolor{blue}\linethickness{1pt}
 \PlotParametricFunction[20]{%
         \cardioide}{0}{\numberTWOPI}
\end{Picture}
$\rho=1+\cos\phi$
\end{center}
\end{exemple}

\begin{exemple}
% Eight petal rose: r = cos(4t)
\SCALEVARIABLEfunction{4}{\COSfunction}
                      {\ffunction}
\POLARfunction{\ffunction}{\rose}
\begin{center}
\def\runitdivisions{3}
\MULTIPLY{2}{\numberTWOPI}{\numberFOURPI}
\setlength{\unitlength}{2.5cm}

\begin{Picture}(-1.5,-1.5)(1.5,1.5)
\polargrid{1}{16}
\pictcolor{red}\linethickness{1pt}
\PlotParametricFunction[16]\rose{0}{\numberTWOPI}
\end{Picture}
$\rho=\cos 4\phi$
\end{center}
\end{exemple}

\begin{exemple}
% Archimedean spiral: r=0,5t
\SCALEfunction{0.5}{\IDENTITYfunction}{\ffunction}
\POLARfunction{\ffunction}{\archimedes}

\MULTIPLY{2}{\numberTWOPI}{\numberFOURPI}
\setlength{\unitlength}{0.5cm}
\begin{center}
\begin{Picture}(-7,-7)(7,7)
\pictcolor{red}
\PlotParametricFunction[16]{%
                \archimedes}{0}{\numberFOURPI}
\end{Picture}
$2\rho=\phi$
\end{center}
\end{exemple}

\begin{exemple}
\SCALEVARIABLEfunction{3.2}{\SINfunction}{\ffunction}
\SCALEfunction{0.2}{\ffunction}{\gfunction}
\SUMfunction{\ONEfunction}{\gfunction}{\myfunction}
\POLARfunction{\myfunction}{\Rfunction}
\MULTIPLY{10}{\numberPI}{\numberTENPI}
\setlength{\unitlength}{3cm}
\linethickness{2pt}
\begin{center}
\begin{Picture}(-1.2,-1.2)(1.2,1.2)
\pictcolor{orange}
\PlotParametricFunction[120]\Rfunction{0}{\numberTENPI}
\end{Picture}
$\rho=1+2\sin 3.2\phi$
\end{center}
\end{exemple}
\subsection{Parametrically defined curves}\label{subsec:param}
Polar curves are a particular case of parametrically defined curves,
$x=f(t), y=g(t)$. These curves are declared by the
 \csdef{PARAMETRICfunction} command:
\begin{Verbatim}[commandchars=\|\[\],commentchar=\%]
\PARAMETRICfunction{\|TIT[Xfunction]}{\|TIT[Yfunction]}%
{\|TIT[parametricfunction]}
\end{Verbatim}

Once we have defined it,
to draw this curve, we use the \csdef{PlotParametricFunction} as described 
above.
\begin{Exemple}
\POWERfunction{\IDENTITYfunction}{5}{\xfunction}
\PARAMETRICfunction{\xfunction}{\CUBEfunction}{\myparfunction}
\centering
\setlength{\unitlength}{0.75cm}
\begin{Picture}(-11,-6)(11,6)
\cartesiangrid(-10,-5)(10,5)
\pictcolor{blue}
\PlotParametricFunction[10]{\myparfunction}{-1.5849}{0}
\PlotParametricFunction[10]{\myparfunction}{0}{1.5849}
\Put[E](10,4){$\begin{matrix}x=t^5\\y=t^3\end{matrix}$}
\end{Picture}
\end{Exemple}
\begin{exemple}
% A Lissanjous curve: x=sin 3t, y=sin 4t
\SCALEVARIABLEfunction{3}{\SINfunction}{\ffunction}
\SCALEVARIABLEfunction{4}{\SINfunction}{\gfunction}
\PARAMETRICfunction{\ffunction}{\gfunction}{\myfunction}
\MULTIPLY{10}{\numberPI}{\numberTENPI}
\setlength{\unitlength}{3cm}
\linethickness{2pt}
\begin{center}
\begin{Picture}(-1.2,-1.2)(1.2,1.2)
\pictcolor{red}
\PlotParametricFunction[24]\myfunction{0}{\numberTWOPI}
\end{Picture}

$x=\sin 3t,\ y=\sin 4t$
\end{center}
\end{exemple}

Here, we should also take into account the characteristics of the curve
in order to choose appropriate intervals for
the parameter (typically, the points where the function is not defined,
singularities, cuts with axes,
points where some of the derivatives $x',x'',\ldots$ or $y',y''\ldots$) is 
zero\ldots
In the following example, to represent the curve $x=t^2-1$, $y=t^3-t$,
we see that $x$ or $y$ equals zero when $t$ is
$0$, $1$ or $-1$; the first derivatives $x'=2t$, $y'=3t^2-1$,
in $t=0$ and $t=\pm\sqrt3/3$, and second derivative of $y$ in $t=0$.
Thus, we choose an interval containing these values of $t$, such $[-2.2]$,
and this partition of it:
\[
   [-2,2]=[-2,-1]\cup[-1,-\sqrt3/3]\cup[-\sqrt3/3,0]\cup[0,\sqrt3/3]\cup[\sqrt3/3,1]\cup[1,2]
\]

This same curve was depicted with a single instruction
\cs{PlotParametricFunction} dividing
the interval $[-2.2]$ into five subintervals.
Note that the obtained picture is almost identical, but the fact that
partition not includes zero
conceals the fact that the vertical tangent occurs at the point
 $(-1,0)$.
So, one of the most significant features of the curve is not correctly 
displayed.
\begin{Exemple}
\SUBTRACTfunction{\SQUAREfunction}{\ONEfunction}{\Xpart}
\SUBTRACTfunction{\CUBEfunction}{\IDENTITYfunction}{\Ypart}
\PARAMETRICfunction{\Xpart}{\Ypart}{\myparfunction}
\centering
\setlength{\unitlength}{1cm}
\begin{Picture}(-3.5,-6.5)(3.5,6.5)
\cartesiangrid(-3,-6)(3,6)
\pictcolor{blue}
\PlotParametricFunction\myparfunction{-2}{-1}
\PlotParametricFunction\myparfunction{-1}{-0.57735}
\PlotParametricFunction\myparfunction{-0.57735}{0}
\PlotParametricFunction\myparfunction{0}{0.57735}
\PlotParametricFunction\myparfunction{0.57735}{1}
\PlotParametricFunction\myparfunction{1}{2}
\Put[E](3,6){$\begin{matrix}x=t^2-1\\y=t^3-t\end{matrix}$}
\end{Picture}
\qquad
\begin{Picture}(-3.5,-6.5)(3.5,6.5)
\cartesiangrid(-3,-6)(3,6)
\pictcolor{orange}
\PlotParametricFunction[5]\myparfunction{-2}{2}
\Put[E](3,6){$\begin{matrix}x=t^2-1\\y=t^3-t\end{matrix}$}
\end{Picture}
\end{Exemple}
\subsubsection{The curve of the front page}
To conclude this section we will study in detail the example
of the front page of this manual.
This example shows the power,
while the simplicity of the package \package{xpicture}.

It is the transcendent curve named \emph{butterfly},
\begin{gather*}
        x=\sin t \left(\mathrm e^{\cos t} - 2 \cos 4t 
                       + \sin^5\left(\frac t{12}\right)\right) \\
        y=\cos t \left(\mathrm e^{\cos t} - 2 \cos 4t 
                       + \sin^5\left(\frac t{12}\right)\right)
\end{gather*}

We analyze step by step the code we used:
\begin{itemize}
\item First, we calculated some numbers we'll use later:
\begin{inparaenum}[(a)]
\item $1/12$, that appears in the definition of functions $x$ and $y$;
\item $12\times2\pi$, to plot the curve in $[0,24\pi]$ (twelve laps); and
\item$12\times64$, the number of subdivisions we will use
(64 subintervals for each lap).
\VerbatimInput[numbers=left,firstline=3,lastline=5]{xpicture1.tex}
\end{inparaenum}
\item In the next block we do the important work:
the curve is defined step by step.

\begin{compactitem}
\item Define the function $A(t)=\mathrm e^{\cos t}$
\VerbatimInput[numbers=left,firstline=7,lastline=7]{xpicture1.tex}
\item Define  $B(t)=\cos 4t$
\VerbatimInput[numbers=left,firstline=8,lastline=8]{xpicture1.tex}
\item Define $c(t)=\sin t/12$
\VerbatimInput[numbers=left,firstline=9,lastline=9]{xpicture1.tex}
\item Define $C(t)=\sin^5 t/12$
\VerbatimInput[numbers=left,firstline=10,lastline=10]{xpicture1.tex}
\item Define  $AB(t)=\mathrm e^{\cos t}-2\cos 4t$
\VerbatimInput[numbers=left,firstline=11,lastline=11]{xpicture1.tex}
\item Define $ABC(t)=\mathrm e^{\cos t}-2\cos 4t+\sin^5 t/12$
\VerbatimInput[numbers=left,firstline=12,lastline=12]{xpicture1.tex}
\item Define the $x$ and $y$ functions
\VerbatimInput[numbers=left,firstline=13,lastline=16]{xpicture1.tex}
\item And, finally, we declare the parametric curve:
\VerbatimInput[numbers=left,firstline=17,lastline=17]{xpicture1.tex}
\end{compactitem}

\item Now, the picture composition is trivial
(note the use of constants
\cs{divisions} and \cs{phione} we previously calculated):
\VerbatimInput[numbers=left,firstline=19,lastline=21]{xpicture1.tex}
\end{itemize}

\subsection{Drawing curves from a table of values}
All instructions to draw curves described here use the
\csdef{qCurve} command, which draws quadratic B\'ezier curves:
\begin{Verbatim}[commandchars=\|\[\],commentchar=\%]
\qCurve(|TIT[x0],|TIT[y0])(|TIT[u0],|TIT[v0])(|TIT[x1],|TIT[y1])(|TIT[u1],%
|TIT[v1])
\end{Verbatim}
draw a smooth curve between the points $(\TTT{\TIT{x0}},\TTT{\TIT{y0}})$
and $(\TTT{\TIT{x1}},\TTT{\TIT{y1}})$, with tangent vectors
$(\TTT{\TIT{u0}},\TTT{\TIT{v0}})$ and $(\TTT{\TIT{u1}},\TTT{\TIT{v1}})$,
respectively.
\begin{exemple}
\setlength{\unitlength}{1cm}
\begin{Picture}(-0.5,-0.5)(5.5,5.5)
\cartesianaxes(0,0)(5,5)
\pictcolor{blue}
\qCurve(1,2)(1,2)(4,3)(-1,1)
\pictcolor{gray}
\Put(1,2){\xtrivVECTOR(0,0)(1,2)}
\Put(4,3){\xtrivVECTOR(0,0)(-1,1)}
\Polyline(1,0)(1,2)(0,2)
\Polyline(4,0)(4,3)(0,3)
\end{Picture}
\end{exemple}

The \csdef{PlotQuadraticCurve} command generalizes \cs{qCurve}
to an arbitrary number of points. 
\begin{exemple}
\setlength{\unitlength}{1cm}
\begin{Picture}(-0.5,-0.5)(5.5,3.5)
\cartesianaxes(0,0)(5,3)
\pictcolor{blue}
\PlotQuadraticCurve(0,0)(1,0)%
                   (1,1)(1,2)%
                   (3,2)(-1,1)%
                   (5,2)(0,-1)
\end{Picture}
\end{exemple}
This command supports two alternative syntaxes:
\begin{enumerate}[(a)]
\item
\begin{Verbatim}[commandchars=\|\[\],commentchar=\%]
\PlotQuadraticCurve(|TIT[x0],|TIT[y0])(|TIT[u0],|TIT[v0])(|TIT[x1],|TIT[y1])%
(|TIT[u1],|TIT[v1])...(|TIT[xn],|TIT[yn])(|TIT[un],|TIT[vn])
\end{Verbatim}
draws a curve through the points
$(\TTT{\TIT{x0}},\TTT{\TIT{y0}})$,
 $(\TTT{\TIT{x1}},\TTT{\TIT{y1}})$\ldots
 $(\TTT{\TIT{xn}},\TTT{\TIT{yn}})$
with tangent vectors
$(\TTT{\TIT{u0}},\TTT{\TIT{v0}})$, $(\TTT{\TIT{u1}},\TTT{\TIT{v1}})$\dots
$(\TTT{\TIT{un}},\TTT{\TIT{vn}})$.%
\footnote{This command draws a
quadratic curve between each pair of adjacent points.

The \cs{Curve} command, introduced by the
\package{curve2e} package, does a similar job,
but using cubic approximations, instead of quadratic.}

\begin{exemple}
\setlength{\unitlength}{2cm}
\begin{center}
\begin{Picture}(1,1)(-1,-1)
\pictcolor{red}
\PlotQuadraticCurve(1,0)(1,0)(0,1)(0,1)%
                   (-1,0)(-1,0)(0,-1)(0,-1)%
                   (1,0)(1,0)
\pictcolor{blue}
\referencesystem(0,0)%
                (\numberCOSXLV,\numberCOSXLV)%
                (-\numberCOSXLV,\numberCOSXLV)
\PlotQuadraticCurve(1,0)(1,0)(0,1)(0,1)%
                   (-1,0)(-1,0)(0,-1)(0,-1)%
                   (1,0)(1,0)
\end{Picture}
\end{center}
\end{exemple}
\item
\begin{Verbatim}[commandchars=\|\[\],commentchar=\%]
\PlotQuadraticCurve(|TIT[x0],|TIT[y0]){|TIT[angle0]}(|TIT[x1],|TIT[y1])%
{|TIT[angle1]}...(|TIT[xn],|TIT[yn]){|TIT[anglen]}
\end{Verbatim}
draws a curve through the points
$(\TTT{\TIT{x0}},\TTT{\TIT{y0}})$,
 $(\TTT{\TIT{x1}},\TTT{\TIT{y1}})$\ldots
 $(\TTT{\TIT{xn}},\TTT{\TIT{yn}})$
the inclination angles of which, with respect to the $x$ axis,
are \TTT{\TIT{angle0}}, \TTT{\TIT{angle1}}\dots,
  \TTT{\TIT{angle0}} (always measured in degrees).
\begin{exemple}
\setlength{\unitlength}{2cm}
\begin{center}
\begin{Picture}(1,1)(-1,-1)
\pictcolor{red}
\PlotQuadraticCurve(1,0){0}(0,1){90}
                   (-1,0){180}(0,-1){270}
                   (1,0){360}
\pictcolor{blue}
\referencesystem(0,0)%
                (\numberCOSXLV,\numberCOSXLV)%
                (-\numberCOSXLV,\numberCOSXLV)
\PlotQuadraticCurve(1,0){0}(0,1){90}
                   (-1,0){180}(0,-1){270}
                   (1,0){360}
\end{Picture}
\end{center}
\end{exemple}
\end{enumerate}
With the \cs{PlotQuadraticCurve} command you can approximate any smooth curve
passing through a list of points when you know the tangent vectors.
A particular case, particularly interesting (at least in a calculus course)
is the drawing of the graph a function of real variable knowing a table of 
values of the function and its derivative.
To facilitate this work \package{xpicture}
includes the \csdef{PlotxyDyData} command:
\begin{Verbatim}[commandchars=\|\[\],commentchar=\%]
\PlotxyDyData(|TIT[x0],|TIT[y0],|TIT[Dy0])(|TIT[x1],|TIT[y1],|TIT[Dy1])...%
(|TIT[xn],|TIT[yn],|TIT[Dyn])
\end{Verbatim}
plots the graph of a function $y=f(x)$  passing through points
$(\TTT{\TIT{x0}},\TTT{\TIT{y0}})$,
$(\TTT{\TIT{x1}},\TTT{\TIT{y1}})$\ldots
$(\TTT{\TIT{xn}},\TTT{\TIT{yn}})$
with derivatives $\TTT{\TIT{Dy0}}$, $\TTT{\TIT{Dy1}}$\ldots
$\TTT{\TIT{Dyn}}$.
\begin{exemple}
\setlength{\unitlength}{1cm}
\begin{Picture}(-1,-1)(5.5,5.5)
\cartesianaxes(0,0)(5,5)
\pictcolor{blue}
\PlotxyDyData(0,0,2)(1,1,0)(2,2,3)
                          (3,4,0)(5,1,-2)
\pictcolor{gray}
\Put(0,0){\xtrivVECTOR(0,0)(1,2)}
\Put(1,1){\xtrivVECTOR(0,0)(1,0)}
\Put(2,2){\xtrivVECTOR(0,0)(1,3)}
\Put(3,4){\xtrivVECTOR(0,0)(1,0)}
\Put(5,1){\xtrivVECTOR(0,0)(1,-2)}
\end{Picture}
\end{exemple}
\section{Package options and configuration file}
This package is loaded as usual, using the instruction
\cs{usepackage\{\TIT{list of options}\}\{xpicture\}}.
Then, packages \packagedef{pict2e}, \packagedef{curve2e}, \packagedef{xcolor},
\packagedef{calculator}, and \packagedef{calculus} are automatically loaded.
This package is compatible with any system that supports 
\packagedef{xcolor} and \packagedef{pict2e} packages.

The only specific option for this package is \optiondef{draft},
which disables all the instructions defined in this package, 
replacing each picture set in a \environ{Picture} environment
by a parallelogram circumscribed by a white rectangle (the box that shows
the area reserved for the picture).\footnote{This option is equivalent to
a global use of
the \texttt{\textbackslash draftPictures} declaration.}
This option is very useful throughout the production 
of the document, 
since the composition of the drawings slows considerably
the compilation time. 

All other options are passed directly to packages 
\packagedef{pict2e}, \packagedef{curve2e}, and \packagedef{xcolor}.
The most interesting option (from package \package{pict2e})
is \optiondef{pstarrows}; 
if used, arrowheads in vectors are drawn in PSTricks style (instead of the
standard \LaTeX{} style). 
Do not use the \optiondef{hide} or \optiondef{original}
options (from package \package{pict2e}).

You can include your preferred values for configurable \package{xpicture}
parameters 
(like axes or labels style, radians or degrees measure for angles,
radians or degrees labels in polar grids, et cetera)
using the file \texttt{xpicture.cfg}\ttindex{xpicture.cfg}, because,
if exists, this local configuration file is loaded.
If you want to use it, copy the file 
\texttt{xpicture.cfgxmpl}\ttindex{xpicture.cfgxmpl}
(which is distributed along with package \package{xpicture}),
call your copy as \texttt{xpicture.cfg} and put it in your local
\texttt{texmf} tree.
Initially, this file contains the default values for all parameters, but
you edit it to modify everything agreed.
\section{Compatibility with related packages}
As mentioned earlier, this package loads packages 
\packagedef{pict2e}, \packagedef{curve2e}, \packagedef{xcolor},
\packagedef{calculator}, and \packagedef{calculus}. Every command defined in
these packages works fine within a \environ{Picture} environment. The only
restriction to take in account is that colors must be selected with the
\cs{pictcolor} command, because commands \cs{color} and \cs{textcolor}
may cause the appearance of unwanted spaces. Picture commands defined 
in \packagedef{pict2e} and \packagedef{curve2e} can be freely used 
(had in mind, however, that in this case coordinates 
are interpreted as standard), 
and you can use all the techniques for defining and manipulating colors
from \packagedef{color} and \packagedef{xcolor} packages.

Although guidelines for defining and operating with functions
explained in subsections~\ref{subsec:real}--\ref{subsec:param} 
may be enough to compose a lot of graphics, 
in order to take full advantage of this package you must known
packages \packagedef{calculator} and \packagedef{calculus}
with certain depth. Package \package{calculator} 
will set you free of many tedious calculations.
\medskip

On the other hand, \package{xpicture} is widely compatible with other packages
related to the graphics inclusion, composition or modification.
This fact gives us a lot of flexibility when using them together. 

For example, a picture drawn by \package{xpicture} can include external images 
loaded with packages \packagedef{graphics}/\packagedef{graphicx}, 
and you can also manipulate the whole picture with the aid of these packages.
In a similar way, \texttt{pgf/tikz}\ttindex{pgf}\ttindex{tikz} 
pictures can be included inside a 
\package{xpicture} draw. If you use \LaTeX{} and \TTT{dvips} to compile your 
document, you can combine \package{xpicture} with \packagedef{pstricks}.

\printindex
\end{document}