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
|
\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{}
%% $Id: pst-node-doc.tex 438 2022-01-31 17:45:26Z herbert $
\documentclass[fontsize=11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,headings=small,
headinclude=false,footinclude=false,oneside]{pst-doc}
\listfiles
\input{pst-node}
\let\pstFV\fileversion
%\usepackage[utf8]{inputenc}
\usepackage{pst-plot}
\let\belowcaptionskip\abovecaptionskip
%
\newcommand\xstrut{\vphantom{\tabular{c}Üg\\Üg\endtabular}}
\newcommand\psBox[3][white]{\rput(#2){\rnode{#2}{%
\psframebox[fillcolor=#1]{\xstrut\makebox[3.2cm]{\tabular{c}#3\endtabular}}}}}
\def\bgImage{%
\psscalebox{0.75}{%
\begin{pspicture}(-1,-1)(20,7)
\psset{framearc=0.2,shadow,fillstyle=solid,shadowcolor=black!55}
\psBox[blue!30]{7,6}{politische\\Kommunikation}
\psBox[red!30]{3,4}{interpersonale\\Kommunikation}
\psBox[red!30]{13,4}{massenmediale\\Kommunikation}
\psBox[green!30]{1,2}{starke\\Beziehung}
\psBox[green!30]{5,2}{schwache\\Beziehung}
\psBox[green!30]{9,2}{Fernsehen}
\psBox[green!30]{17,2}{Zeitungen}
\psBox[cyan!30]{7,0}{öffentlich-rechtl.\\Fernsehen}
\psBox[cyan!30]{11,0}{privates\\Fernsehen}
\psBox[cyan!30]{15,0}{Boulevard-\\Zeitungen}
\psBox[cyan!30]{19,0}{Abonnement-\\Zeitungen}
\end{pspicture}
\psset{shadow=false,angleA=-90,angleB=90,linewidth=2pt}
\ncangles{7,6}{3,4}\ncangles{7,6}{13,4}
\ncangles{3,4}{1,2}\ncangles{3,4}{5,2}
\ncangles{13,4}{9,2}\ncangles{13,4}{17,2}
\ncangles{9,2}{7,0}\ncangles{9,2}{11,0}
\ncangles{17,2}{15,0}\ncangles{17,2}{19,0}}
}
\newbox\filebox
\setbox\filebox=\hbox{%
\pspicture(-1,-.5)(1,.7)
\pspolygon[linearc=2pt,shadow,shadowangle=45,xunit=1.1]%
(-1,-.55)(-1,.5)(-.8,.5)(-.8,.65)(-.2,.65)(-.2,.5)(1,.5)(1,-.55)
\endpspicture}
\addbibresource{\jobname.bib}
\lstset{explpreset={pos=l,width=-99pt,overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,rframe={}},
%mathescape,basicstyle=\small\ttfamily
}
\begin{document}
\title{\texttt{pst-node}\\Nodes and node connections%
\\\small v.\pstFV}
%\docauthor{Michael Sharpe\\Herbert Vo\ss}
\author{Timothy Van Zandt\\Michael Sharpe\\Herbert Vo\ss}
\date{\today}
\settitle
\begin{abstract}
This version of \LPack{pst-node} uses the extended keyval handling
of pst-xkey and has a lot of the macros which were recently in
the package \LPack{pstricks-add}. This documentation describes in the first part
the basic node commands and connection from the old PSTricks documentation.
The second part describes only the
new and changed stuff. .
For some copatibility reason you can use the optional argument \Loption{97}
for the package, it loads the version from 1997, which only makes sense
when also running the main package \LPack{pstricks} with this option.
\vfill
\noindent
Thanks to: Marco Daniel; Denis Girou; Thomas Iyer; Rolf Niepraschk; Sebastian Rahtz; Andi Setiawan;
\end{abstract}
\clearpage
\tableofcontents
\clearpage
\part{Basic commands, connections and labels}
\leavevmode
\marginpar{%
\leavevmode\lower 20pt\hbox{%
\hbox to0pt{\hbox to \linewidth{\hss\rnode{file}{\copy\filebox}\hss}\hss}%
\raise 10pt\hbox to \linewidth{\hss\large\bfseries\sffamily pst-node\hss}}}%
The node and node connection macros let you connect information and place
labels, without knowing the exact position of what you are connecting or where
the lines should connect. These macros are useful for making graphs and trees,
mathematical diagrams, linguistic syntax diagrams, and connecting ideas of any
kind. They are the trickiest tricks in PSTricks!
There are three components to the node macros:
\begin{description}
\item[Node definitions] The node definitions let you assign a name and shape
to an object. See Section \ref{S-nodes}.
\item[Node connections] The node connections connect two nodes, identified
by their names. See Section \ref{S-nc}.
\item[Node labels] The node label commands let you affix labels to the node
connections. See Section \ref{S-nodelabels}.
\end{description}
You can use these macros just about anywhere. The best way to position them
depends on the application. For greatest flexibility, you can use the nodes in
a \Lenv{pspicture}, positioning and rotating them with \Lcs{rput}. You can also use
them in alignment environments. \LPack{pst-node} contains a special alignment
environment, \Lenv{psmatrix}, which is designed for positioning nodes in a grid,
such as in mathematical diagrams and some graphs. \Lcs{psmatrix} is described in
Section \ref{S-psmatrix}. \LPack{pst-node} also contains high-level macros for
trees. These are described in the documentation of \LPack{pst-tree}.
But don't restrict yourself to these more obvious uses. For example:
\begin{center}
\rnode{A}{%
\parbox{12cm}{\raggedright
I made the file symbol a node. Now I can draw an
arrow so that you know what I am talking about.}}
\ncarc[nodesep=8pt]{->}{A}{file}
\end{center}
\begin{lstlisting}
\rnode{A}{%
\parbox{4cm}{\raggedright
I made the file symbol a node. Now I can draw an
arrow so that you know what I am talking about.}}
\ncarc[nodesep=8pt]{->}{A}{file}
\end{lstlisting}
%\psset{showNode}
\section[Comparing nodes and coordinates]%
{Comparing nodes and coordinates\footnote{Christoph Bersch on \url{http://tex.stackexchange.com}}}
The crucial point is understanding the difference between a node (A), which is created by \Lcs{pnode},
and a pair of coordinates $(x,y)$:
\begin{itemize}
\item
A coordinate pair, e.g. (1,1) specifies a relative point.
Its position depends on the current environment, whether its surrounded by \Lcs{psdot}\Largr{1,1}
text, or shifted with \Lcs{rput}(2,2)\texttt{\{\Lcs{psdot}(1,1)\}} etc.
\item
A node (A) refers to an absolute, fixed point on the page. This is independent of the environment.
\end{itemize}
The following example resumes this.
\begin{LTXexample}[width=3cm]
\begin{pspicture}[showgrid](2,2)
\rput(1,1){\pnode(1,1){A}}
\psdot(A)
\pnode(1,1){B}
\rput(1,1){\psdot[linecolor=red](B)}
\end{pspicture}
\end{LTXexample}
The black dot is placed at (2,2), because \Lcs{rput} shifts the coordinate pair (1,1),
which is used to define node A. The red dots remains at (1,1) because \Lcs{rput}
has no effect on (B) after its definition:
That's the essence of all node-stuff.
Using \texttt{(!\Lcs{psGetNodeCenter}\{A\} A.x A.y)} is equivalent to (A).
The parameter \Lkeyword{saveNodeCoors} saves the relative coordinates
at the time of the node definition. I.e. adding dots at \texttt{(!N-A.x N-A.y)}
and \texttt{(!N-B.x N-B.y)} in the above example places two dots at
(1,1), which are the coordinate pairs used to define both nodes A and B:
\begin{LTXexample}[width=3cm]
\begin{pspicture}[showgrid, saveNodeCoors](2,2)
\rput(1,1){\pnode(1,1){A}}
\psdot(A)
\pnode(1,1){B}
\rput(1,1){\psdot[linecolor=red](B)}
%
\psdot[dotstyle=+, dotscale=2](!N-A.x N-A.y)
\psdot[dotstyle=x, dotscale=2](!N-B.x N-B.y)
\end{pspicture}
\end{LTXexample}
Resuming this:
\begin{itemize}
\item
Coordinate pairs like (1, 1) or node expressions with \texttt{! N-A.x N-A.y} are relative and
are subject to scaling and translation like with \Lcs{rput}, \Lcs{scale}, \Lcs{translate} and such.
\item
Nodes (A) and node expressions with \Lcs{psGetNodeCenter} are fixed, »immutable« points.
\end{itemize}
\section{Nodes}\label{S-nodes}
Nodes have a name. a boundary and a center.
The center of a node is where node connections point to. The boundary is for
determining where to connect a node connection. The various nodes differ in
how they determine the center and boundary. They also differ in what kind of
visable object they create.
The\XInfoDanger[0]{} name is for refering to the node when making node connections and labels.
You specify the name as an argument to the node commands. The name must
contain only letters and numbers, and must begin with a letter. Bad node names
can cause PostScript errors.
Here are the nodes:
\begin{BDef}
\Lcs{rnode}\OptArg{refpoint}\Largb{name}\Largb{stuff}
\end{BDef}
\Lcs{rnode} puts \Larg{stuff} in a box. The center of the node is \Larg{refpoint}, which
you can specify the same way as for \Lcs{rput}.
\begin{BDef}
\Lcs{Rnode}\Largb{name}\Largb{stuff}
\end{BDef}
\Lcs{Rnode} also makes a box, but the center is set differently. If you align
\Lcs{rnode}'s by their baseline, differences in the height and depth of the nodes
can cause connecting lines to be not quite parallel, such as in the following
example:
\begin{LTXexample}[width=0.4\linewidth]
\Large
\rnode{A}{sp} \hskip 2cm \rnode{B}{Bit}
\ncline{A}{B}
\end{LTXexample}
With \Lcs{Rnode}, the center is determined relative to the baseline:
\begin{LTXexample}[width=0.4\linewidth]
\Large
\Rnode{A}{sp} \hskip 2cm \Rnode{B}{Bit}
\ncline{A}{B}
\end{LTXexample}
You can usually get by without fiddling with the center of the node, but to
modify it you set the
\LKeyword{href=num} or
\LKeyword{vref=dim}
parameters. In the horizontal direction, the center is located fraction
\Lkeyword{href} from the center to the edge. E.g, if \LKeyword{href=-1}, the center is on
the left edge of the box. In the vertical direction, the center is located
distance \Lkeyword{vref} from the baseline. The \Lkeyword{vref} parameter is evaluated each
time \Lcs{Rnode} is used, so that you can use \verb|ex| units to have the distance
adjust itself to the size of the current font (but without being sensitive to
differences in the size of letters within the current font).
The command \Lcs{pnode} creates a zero dimensional node at \Largr{\CAny}.
It
knows an optional argument for an \CAny\ offset, which
expects the two values for $x$ and $y$ separated by a comma:
\begin{BDef}
\Lcs{pnode}\OptArg*{\Largs{\Larga{offset}}}\Largr{\CAny}\Largb{\Larga{node name}}
\end{BDef}
\begin{LTXexample}[width=6cm]
\begin{pspicture}[showgrid](0,-2)(6,2)
\pnode{A}\psdot(A)\uput[90](A){A}
\pnode[0,-2]{B}\psdot(B)\uput[90](B){B}
\pnode(2,0){C}\psdot(C)\uput[90](C){C}
\pnode[1,-2](2,0){D}\psdot(D)\uput[90](D){D}
\pnode[2,2](3.5,0){E}\psdot(E)\uput[90](E){E}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\Lcs{pnodes}\OptArg*{\Largs{\Larga{offset}}}\Largr{coors}\Largb{name}\Largr{coors}\Largb{name}\ldots\\
\Lcs{pnodes}\Largb{name}\Largr{coors}\Largr{coors}\ldots
\end{BDef}
This command is identical to \Lcs{pnode} if it doesn't start with a node name. In this
case it works in another way. See page~\pageref{pnodes} for more information. Instead of
writing
\begin{verbatim}
\pnode(3,1){A}
\pnode(2,4){B}
\end{verbatim}
one can also define the nodes in a short way:
\begin{verbatim}
\pnodes(3,1){A}(2,4){B}
\end{verbatim}
If an optional argument for the offset is used, then it is passes to all nodes.
The command \Lcs{psnode} is a combination of using \Lcs{rput} and \Lcs{rnode}.
\begin{BDef}
\Lcs{psnode}\OptArgs\Largr{\CAny}\Largb{\Larga{node name}}\Largb{\Larga{node contents}}
\end{BDef}
\begin{LTXexample}
\begin{pspicture}[showgrid](0,0)(4,4)
\psnode(0.5,3){A}{Foo}
\psnode(3,0){B}{Bar}
\ncdiag[arm=5mm,angleA=-90,
angleB=90]{->}{A}{B}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\LcsStar{cnode}\OptArgs\Largr{\CAny}\Largb{radius}\Largb{name}
\end{BDef}
This draws a circle. Here is an example with \Lcs{pnode} and \Lcs{cnode}:
\begin{LTXexample}
\begin{pspicture}[showgrid](3,1.25)
\cnode(0,1){.25}{A}
\pnode(3,0){B}
\ncline{<-}{A}{B}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\LcsStar{Cnode}\OptArgs\Largr{\CAny}\Largb{name}
\end{BDef}
This is like \Lcs{cnode}, but the radius is the value of \LKeyword{radius=dim}
This is convenient when you want many circle nodes of the same radius.
\begin{BDef}
\LcsStar{circlenode}\OptArgs\Largb{name}\Largb{stuff}
\end{BDef}
This is a variant of \Lcs{pscirclebox} that gives the node the shape of the
circle.
\begin{BDef}
\LcsStar{cnodeput}\OptArgs\Largb{angle}\Largr{\CAny}\Largb{name}\Largb{stuff}\\
\LcsStar{Cnodeput}\OptArgs\Largb{angle}\Largr{\CAny}\Largb{name}\Largb{stuff}
\end{BDef}
This is a variant of \Lcs{cput} (or \Lcs{Cput}) that gives the node the shape of the
circle. That is, it is like
\begin{lstlisting}
\rput{<angle>}(<x>,<y>){\circlenode{<name>}{<stuff>}}
\rput[radius=...]{<angle>}(<x>,<y>){\Circlenode{<name>}{<stuff>}}
\end{lstlisting}
\begin{BDef}
\LcsStar{ovalnode}\OptArgs\Largb{name}\Largb{stuff}
\end{BDef}
This is a variant of \Lcs{psovalbox} that gives the node the shape of an
ellipse. Here is an example with \Lcs{circlenode} and \Lcs{ovalnode}:
\begin{LTXexample}[width=0.3\textwidth]
\circlenode{A}{Circle} and \ovalnode{B}{Oval}
\ncbar[angle=90]{A}{B}
\end{LTXexample}
\begin{BDef}
\LcsStar{dianode}\OptArgs\Largb{name}\Largb{stuff}
\end{BDef}
This is like \Lcs{diabox}.
\begin{BDef}
\LcsStar{trinode}\OptArgs\Largb{name}\Largb{stuff}
\end{BDef}
This is like \Lcs{tribox}.
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,3)
\rput[tl](0,3){\dianode{A}{Diamond}}
\rput[br](4,0){\trinode[trimode=L]{B}{Triangle}}
\nccurve[angleA=-135,angleB=90]{A}{B}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\LcsStar{dotnode}\OptArgs\Largr{\CAny}\Largb{name}\\
\LcsStar{dotnodes}\OptArgs\Largr{\CAny}\Largb{name}\Largr{\CAny}\Largb{name}\ldots
\end{BDef}
This is a variant of \Lcs{psdot}. For example:
\begin{LTXexample}
\begin{pspicture}(3,2)
\dotnode[dotstyle=triangle*,dotscale=2 1](0,0){A}
\dotnode[dotstyle=+](3,2){B}
\ncline[nodesep=3pt]{A}{B}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\LcsStar{fnode}\OptArgs\Largr{\CAny}\Largb{name}
\end{BDef}
The ``f'' stands for ``frame''. This is like, but easier than, putting a
\Lcs{psframe} in an \Lcs{rnode}.
\begin{LTXexample}
\begin{pspicture}(3,2)
\fnode{A}
\fnode*[framesize=1 5pt](2,2){B}
\ncline[nodesep=3pt]{A}{B}
\end{pspicture}
\end{LTXexample}
There are two differences between \Lcs{fnode} and \Lcs{psframe}:
\begin{itemize}
\item There is a single (optional) coordinate argument, that gives the
\emph{center} of the frame.
\item The width and height of the frame are set by the
\LKeyword{framesize=dim1 `dim2'} parameter. If you omit <dim2>, you get a square frame.
\end{itemize}
%--------------------------------------------------------------------------------------
\section{\nxLcs{psRelNode} and \nxLcs{psDefPSPNodes}}
%--------------------------------------------------------------------------------------
With these macros it is possible to put a node relative to a given line or given
\Lenv{pspicture}-environment. In the frist case the parameters are
the angle and the length factor:
\begin{BDef}
\Lcs{psRelNode}\Largs{P0}\Largs{P1}\Largb{length factor}\Largb{end node name}\\
\Lcs{psDefPSPNodes}
\end{BDef}
The length factor relates to the distance $\overline{P_0P_1}$ and
the end node name must be a valid nodename and shouldn't contain
any of the special PostScript characters. There are two valid
options:
\begin{tabularx}{\linewidth}{@{} l|l| X @{} }
name & default & meaning\\\hline
\Lkeyword{angle} & $0$ & angle between the given line $\overline{P_0P_1}$ and the new one
$\overline{P_0P_{endNode}}$\tabularnewline
\Lkeyword{trueAngle} & \false & defines whether the angle refers to the seen line or to
the mathematical one, which respect the scaling factors
\Lkeyword{xunit} and \Lkeyword{yunit}.
\end{tabularx}
\begin{LTXexample}[width=7cm]
\begin{pspicture}[showgrid](7,6)
\pnode(3,3){A}\pnode(4,2){B}
\psline[nodesep=-3,linewidth=0.5pt](A)(B)
\multido{\iA=0+30}{12}{%
\psRelNode[angle=\iA](A)(B){2}{C}%
\qdisk(C){2pt}
\uput[0](C){\iA}}
\end{pspicture}
\end{LTXexample}
In the second case the new macro \Lcs{psDefPSPNodes} defines nine nodes that corresponds to
nine particular points (namely bottom left, bottom center,
bottom right, center left, center center, center right, top left,
top center, top right) of the \Lenv{pspicture} box.
\begin{LTXexample}[width=6cm,wide=false]
\begin{pspicture}[showgrid](-1,-1)(4,4)
\psDefPSPNodes
\psdots(PSPbl)(PSPbc)(PSPbr)
(PSPcl)(PSPcc)(PSPcr)(PSPtl)(PSPtc)(PSPtr)
\uput[90](PSPbl){PSPbl} \uput[90](PSPbc){PSPbc}
\uput[90](PSPbr){PSPbr} \uput[90](PSPcl){PSPcl}
\uput[90](PSPcc){PSPcc} \uput[90](PSPcr){PSPcr}
\uput[90](PSPtl){PSPtl} \uput[90](PSPtc){PSPtc}
\uput[90](PSPtr){PSPtr}
\end{pspicture}
\end{LTXexample}
The name of the nodes are predefined as:
\begin{lstlisting}[style=syntax]
\psset[pst-PSPNodes]{blName=PSPbl,bcName=PSPbc,brName=PSPbr,
clName=PSPcl,ccName=PSPcc,crName=PSPcr,tlName=PSPtl,tcName=PSPtc,trName=PSPtr}
\end{lstlisting}
and can be modified in the same way.
%I guess you modified the family to have the pstricks-add one so the
%\xkvview would have to be adapted.
\section{Node connections}\label{S-nc}
All the node connection commands begin with \nxLcs{nc}, and they all have the same
syntax:\footnote{%
The node connections can be used with \Lcs{pscustom}. The beginning of the node
connection is attached to the current point by a straight line, as with
\Lcs{psarc}.}$^,$\footnote{%
See page \pageref{S-SpecialCoor} if you want to use the nodes as
coordinates in other PSTricks macros.}
\begin{BDef}
\nxLcs{<nodeconnection>*}\OptArgs\Largb{<arrows>}\Largb{<nodeA>}\Largb{<nodeB>}
\end{BDef}
A line of some sort is drawn from <nodeA> to <nodeB>. Some of the node
connection commands are a little confusing, but with a little experimentation
you will figure them out, and you will be amazed at the things you can do.
When we refer to the \verb|A| and \verb|B| nodes below, we are referring only to the
order in which the names are given as arguments to the node connection
macros.\footnote{%
When a node name cannot be found on the same page as the node connection
command, you get either no node connection or a nonsense node connection.
However, \TeX{} will not report any errors.}
The node connections use many of the usual graphics parameters, plus a few
special ones. Let's start with one that applies to all the node connections:
\LKeyword{nodesep=dim}
\Lkeyword{nodesep} is the border around the nodes that is added for the purpose of
determining where to connect the lines.
For this and other node connection parameters, you can set different values
for the two ends of the node connection. Set the parameter \Lkeyword{nodesepA} for
the first node, and set \Lkeyword{nodesepB} for the second node.
The first two node connections draw a line or arc directly between the two
nodes:
\begin{BDef}
\LcsStar{ncline}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB}
\end{BDef}
This draws a straight line between the nodes. For example:
\begin{LTXexample}
\begin{pspicture}(4,3)
\rput[bl](0,0){\rnode{A}{Idea 1}}
\rput[tr](4,3){\rnode{B}{Idea 2}}
\ncline[nodesep=3pt]{<->}{A}{B}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\LcsStar{ncarc}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB}
\end{BDef}
This connects the two nodes with an arc.
\begin{LTXexample}
\begin{pspicture}[shift=*](3.5,2.5)
\cnodeput(0,0){A}{X}
\cnodeput(3,2){B}{Y}
\psset{nodesep=3pt}
\ncarc{->}{A}{B}
\ncarc{->}{B}{A}
\end{pspicture}
\end{LTXexample}
The angle between the arc and the line between the two nodes is\footnote{%
Rather than using a true arc, \Lcs{ncarc} actually draws a bezier curve. When
connecting two circular nodes using the default parameter values, the curve
will be indistinguishable from a true arc. However, \Lcs{ncarc} is more
flexible than an arc, and works right connecting nodes of different shapes and
sizes. You can set \Lkeyword{arcangleA} and \Lkeyword{arcangleB} separately, and you can
control the curvature with the \Lkeyword{ncurv} parameter, which is described on page
\pageref{p+ncurv}.} \LKeyword{arcangle=angle}
\Lcs{ncline} and \Lcs{ncarc} both determine the angle at which the node
connections join by the relative position of the two nodes. With the next
group of node connections, you specify one or both of the angles in absolute
terms, by setting the
\LKeyword{angle=angle}
(and \Lkeyword{angleA} and \Lkeyword{angleB}) parameter.
You also specify the length of the line segment where the node connection
joins at one or both of the ends (the ``arms'') by setting the
\LKeyword{arm=dim}
(and \Lkeyword{armA} and \Lkeyword{armB}) parameter.
These node connections all consist of several line segments, including the
arms. The value of \Lkeyword{linearc} is used for rounding the corners.
Here they are, starting with the simplest one:
\begin{BDef}
\LcsStar{ncdiag}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB}
\end{BDef}
An arm is drawn at each node, joining at angle \Lkeyword{angleA} or \Lkeyword{angleB},
and with a length of \Lkeyword{armA} or \Lkeyword{armB}. Then the two arms are connected
by a straight line, so that the whole line has three line segments.
For example:
\begin{LTXexample}[width=0.4\textwidth]
\begin{pspicture}(4,3)
\rput[tl](0,3){\rnode{A}{\psframebox{Node A}}}
\rput[br](4,0){\ovalnode{B}{Node B}}
\ncdiag[angleA=-90, angleB=90, arm=.5, linearc=.2]{A}{B}
\end{pspicture}
\end{LTXexample}
You can also set one or both of the arms to zero length. For example, if you
set \LKeyword{arm=0}, the nodes are connected by a straight line, but you get to
determine where the line connects (whereas the connection point is determined
automatically by \Lcs{ncline}. Compare this use of \Lcs{ncdiag} with \Lcs{ncline}
in the following example:
\begin{LTXexample}[width=0.4\textwidth]
\begin{pspicture}[shift=*](4,2.5)
\rput[r](4,1){\ovalnode{R}{Root}}
\cnodeput(1,2){A}{XX}
\cnodeput(1,0){B}{YY}
\ncdiag[angleB=180, arm=0]{<-}{A}{R}
\ncline{<-}{B}{R}
\end{pspicture}
\end{LTXexample}
(Note that in this example, the default value \LKeyword{angleA=0} is used.)
\begin{BDef}
\LcsStar{ncdiagg}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB}
\end{BDef}
\Lcs{ncdiagg} is similar to \Lcs{ncdiag}, but only the arm for node A is drawn.
The end of this arm is then connected directly to node B. Compare
\Lcs{ncdiagg} with \Lcs{ncdiag} when \LKeyword{armB=0}:
\begin{LTXexample}[width=0.4\textwidth]
\begin{pspicture}[shift=*](3.5,1)
\cnode(0,0){12pt}{a}
\rput[l](3,1){\rnode{b}{H}}
\rput[l](3,-1){\rnode{c}{T}}
\ncdiagg[angleA=180,armA=1.5,nodesepA=3pt]{b}{a}
\nbput[npos=1.2]{\texttt{\string\ncdiagg}}
\ncdiag[angleA=180,armA=1.5,armB=0,
nodesepA=3pt]{c}{a}
\naput[npos=1.2]{\texttt{\string\ncdiag}}
\end{pspicture}
\end{LTXexample}
You can use \Lcs{ncdiagg} with \LKeyword{armA=0} if you want a straight line that
joins to node A at the angle you specify, and to node B at an angle that is
determined automatically.
\begin{BDef}
\LcsStar{ncbar}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB}
\end{BDef}
This node connection consists of a line with arms dropping ``down'', at
right angles, to meet two nodes at an angle \Lkeyword{angleA}. Each arm is at least
of length \Lkeyword{armA} or \Lkeyword{armB}, but one may be need to be longer.
\begin{LTXexample}[width=0.4\textwidth]
\rnode{A}{Connect} some \rnode{B}{words}!
\ncbar[nodesep=3pt,angle=-90]{<-**}{A}{B}
\ncbar[nodesep=3pt,angle=70]{A}{B}
\end{LTXexample}
Generally, the whole line has three straight segments.
\begin{BDef}
\LcsStar{ncangle}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB}
\end{BDef}
Now we get to a more complicated node connection. \Lcs{ncangle} typically
draws three line segments, like \Lcs{ncdiag}. However, rather than fixing the
length of arm A, we adjust arm A so that the line joining the two arms meets
arm A at a right angle. For example:
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,3)
\rput[tl](0,3){\rnode{A}{\psframebox{Node A}}}
\rput[br](4,0){\ovalnode{B}{Node B}}
\ncangle[angleA=-90,angleB=90,armB=1cm]{A}{B}
\end{pspicture}
\end{LTXexample}
Now watch what happens when we change \Lkeyword{angleA}:
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,3)
\rput[tl](0,3){\rnode{A}{\psframebox{Node A}}}
\nput[labelsep=0]{-70}{A}{%
\psarcn(0,0){.4cm}{0}{-70}
\uput{.4cm}[-35](0,0){\texttt{angleA}}}
\rput[br](4,0){\ovalnode{B}{Node B}}
\ncangle[angleA=-70,angleB=90,armB=1cm,linewidth=1.2pt]{A}{B}
\nput[labelsep=0]{90}{B}{%
\rput[bl](2pt,1pt){%
\valign{%
\vfil#\vfil\cr
\hbox{\psscaleboxto(.3,.95cm){\}}}\cr%
\hbox{\kern 1pt{\texttt{armB}}}\cr}}}
\ncput[nrot=:U,npos=1]{\psframe[dimen=middle](0,0)(.35,.35)}
\end{pspicture}
\end{LTXexample}
\Lcs{ncangle} is also a good way to join nodes by a right angle, with just two
line segments, as in this example:
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,2)
\rput[tl](0,2){\rnode{A}{\psframebox{Node A}}}
\rput[br](4,0){\ovalnode{B}{Node B}}
\ncangle[angleB=90, armB=0, linearc=.5]{A}{B}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\LcsStar{ncangles}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB}
\end{BDef}
\Lcs{ncangles} is similar to \Lcs{ncangle}, but the length of arm A is fixed by
he \Lkeyword{armA} parameter. Arm A is connected to arm B by two line segments that
eet arm A and each other at right angles. The angle at which they join arm B,
and the length of the connecting segments, depends on the positions of the two
arms. \Lcs{ncangles} generally draws a total of four line segments.\footnote{%
Hence there is one more angle than \Lcs{ncangle}, and hence the \texttt|s| in
\Lcs{ncangles}.}
For example:
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,4)
\rput[tl](0,4){\rnode{A}{\psframebox{Node A}}}
\rput[br](4,0){\ovalnode{B}{Node B}}
\ncangles[angleA=-90, armA=1cm, armB=.5cm, linearc=.15]{A}{B}
\end{pspicture}
\end{LTXexample}
Let's see what happens to the previous example when we change \Lkeyword{angleB}:
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,4)
\rput[tl](0,4){\rnode{A}{\psframebox{Node A}}}
\rput[br](4,0){\ovalnode{B}{Node B}}
\ncangles[angleA=-90, angleB=135, armA=1cm, armB=.5cm,
linearc=.15]{A}{B}
\nput[labelsep=0]{-90}{A}{%
\psarcn(0,0){.4cm}{0}{-90}
\uput{.4cm}[-45](0,0){\texttt{angleA}}
\rput[tr](-2pt,0){%
\valign{%
\vfil#\vfil\cr
\hbox{\texttt{armA}\kern 1pt}\cr
\hbox{\psscaleboxto(.28,.95cm){\{}}\cr\cr}}}
\nput[labelsep=0]{135}{B}{%
\psarc(0,0){.4cm}{0}{133}
\uput{.4cm}[50.5](0,0){\texttt{angleB}}}
\ncput[nrot=:L,npos=2]{\psline(0,-.35)(-.35,-.35)(-.35,0)}
\ncput[npos=3.5]{%
\rput[r](-.8,0){\rnode{arm}{\texttt{armB}}}
\pnode{brak}}%
\ncline[nodesep=3pt]{->}{arm}{brak}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\LcsStar{ncloop}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB}
\end{BDef}
\Lcs{ncloop} is also in the same family as \Lcs{ncangle} and \Lcs{ncangles}, but
now typically 5 line segments are drawn. Hence, \Lcs{ncloop} can reach around
to opposite sides of the nodes. The lengths of the arms are fixed by \Lkeyword{armA}
and \Lkeyword{armB}. Starting at arm A, \Lcs{ncloop} makes a 90 degree turn to the
left, drawing a segment of length
\LKeyword{loopsize=dim}
This segment connects to arm B the way arm A connects to arm B with \Lcs{ncline};
that is, two more segments are drawn, which join the first segment and each
other at right angles, and then join arm B. For example:
\begin{LTXexample}[pos=t]
\vrule width 0pt height 1cm
\rnode{a}{\psframebox{\Huge A loop}}
\ncloop[angleB=180,loopsize=1,arm=.5,linearc=.2]{->}{a}{a}
\ncput[npos=3.5,nrot=:U]{\psline{|<->|}(.5,-.2)(-.5,-.2)}
\nbput[npos=3.5,nrot=:D,labelsep=.35cm]{{\ttfamily loopsize}}
\kern .5cm
\end{LTXexample}
In this example, node A and node B are the same node! You can do this with all
the node connections (but it doesn't always make sense).
Here is an example where \Lcs{ncloop} connects two different nodes:
\begin{LTXexample}[pos=t]
\parbox{3cm}{%
\rnode{A}{\psframebox{\large\textbf{Begin}}}
\vspace{1cm}\hspace*{\fill}
\rnode{B}{\psframebox{\large\textbf{End}}}
\ncloop[angleA=180,loopsize=.9,arm=.5,linearc=.2]{->}{A}{B}}
\ncput[npos=1.5,nrot=:U]{\psline{|<->|}(.45,-.2)(-.45,-.2)}
\nbput[npos=1.5,nrot=:D,labelsep=.35cm]{\texttt{loopsize}}
\kern .5cm
\end{LTXexample}
The next two node connections are a little different from the rest.
\begin{BDef}
\LcsStar{nccurve}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{nodeB}
\end{BDef}
\Lcs{nccurve} draws a bezier curve between the nodes.
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,3)
\rput[bl](0,0){\rnode{A}{\psframebox{Node A}}}
\rput[tr](4,3){\ovalnode{B}{Node B}}
\nccurve[angleB=180]{A}{B}
\end{pspicture}
\end{LTXexample}
You specify the angle at which the curve joins the nodes by setting the
\Lkeyword{angle} (and \Lkeyword{angleA} and \Lkeyword{angleB}) parameter. The distance to the
control points is set with the
\LKeyword{ncurv=num}
(and \Lkeyword{ncurvA} and \Lkeyword{ncurvB}) parameter. A lower number gives a tighter
curve. (The distance between the beginning of the arc and the first control
point is one-half \Lkeyword{ncurvA} times the distance between the two endpoints.)
\begin{BDef}
\LcsStar{nccircle}\OptArgs\OptArg*{\Largb{arrows}}\Largb{nodeA}\Largb{radius}
\end{BDef}
\Lcs{nccircle} draws a circle, or part of a circle, that, if complete, would
pass through the center of the node counterclockwise, at an angle of
\Lkeyword{angleA}.
\begin{LTXexample}
\vrule width 0pt height 1.4cm
\rnode{A}{\textbf{back}}
\nccircle[nodesep=3pt]{->}{A}{.7cm}
\end{LTXexample}
\Lcs{nccircle} can only connect a node to itself; it is the only node
connection with this property. \Lcs{nccircle} is also special because it has an
additional argument, for specifying the radius of the circle.
The last two node connections are also special. Rather than connecting the
nodes with an open curve, they enclose the nodes in a box or curved box. You
can think of them as variants of \Lcs{ncline} and \Lcs{ncarc}. In both cases, the
half the width of the box is
\LKeyword{boxsize=dim}
You have to set this yourself to the right size, so that the nodes fit inside
the box. The \Lkeyword{boxsize} parameter actually sets the \Lkeyword{boxheight} and
\Lkeyword{boxdepth} parameters. The ends of the boxes extend beyond the nodes by
\Lkeyword{nodesepA} and \Lkeyword{nodesepB}.
\begin{BDef}
\LcsStar{ncbox}\OptArgs\Largb{nodeA}\Largb{nodeB}
\end{BDef}
\Lcs{ncbox} encloses the nodes in a box with straight sides. For example:
\begin{LTXexample}[width=5cm]
\begin{pspicture}[shift=*](4,2.5)
\rput[bl](.5,0){\rnode{A}{Idea 1}}
\rput[tr](3.5,2){\rnode{B}{Idea 2}}
\ncbox[nodesep=.5cm,boxsize=.6,linearc=.2,
linestyle=dashed]{A}{B}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\LcsStar{ncarcbox}\OptArgs\Largb{nodeA}\Largb{nodeB}
\end{BDef}
\Lcs{ncarcbox} encloses the nodes in a curved box that is \Lkeyword{arcangleA} away
from the line connecting the two nodes.
\begin{LTXexample}[width=5cm]
\begin{pspicture}[shift=*](4,2.5)
\rput[bl](.5,0){\rnode{A}{1}}
\rput[tr](3.5,2){\rnode{B}{2}}
\ncarcbox[nodesep=.2cm,boxsize=.4,linearc=.4,
arcangle=50]{<->}{A}{B}
\end{pspicture}
\end{LTXexample}
The arc is drawn counterclockwise from node A to node B.
There is one other node connection parameter that applies to all the node
connections, except \Lcs{ncarcbox}:
\LKeyword{offset=dim}
(You can also set \Lkeyword{offsetA} and \Lkeyword{offsetB} independently.) This shifts the
point where the connection joins up by <dim> (given the convention that
connections go from left to right).
There are two main uses for this parameter. First, it lets you make two
parallel lines with \Lcs{ncline}, as in the following example:
\begin{LTXexample}[width=5cm]
\begin{pspicture}[shift=*](3.5,2.5)
\cnodeput(0,0){A}{X}
\cnodeput(3,2){B}{Y}
\psset{nodesep=3pt,offset=4pt,arrows=->}
\ncline{A}{B}
\ncline{B}{A}
\end{pspicture}
\end{LTXexample}
Second, it lets you join a node connection to a rectangular node at a right
angle, without limiting yourself to positions that lie directly above, below,
or to either side of the center of the node. This is useful, for example, if
you are making several connections to the same node, as in the following
example:
\begin{LTXexample}
\rnode{A}{Word1} and \rnode{B}{Word2} and \rnode{C}{Word3}
\ncbar[offsetB=4pt,angleA=-90,nodesep=3pt]{->}{A}{B}
\ncbar[offsetA=4pt,angleA=-90,nodesep=3pt]{->}{B}{C}
\end{LTXexample}
Sometimes you might be aligning several nodes, such as in a tree, and you want
to ends or the arms of the node connections to line up. This won't happen
naturally if the nodes are of different size, as you can see in this example:
\begin{LTXexample}[width=5cm]
\begin{pspicture}[shift=*](3.5,3)
\psset{unit=.9}
\Huge
\cnode(1,3){4pt}{a}
\rput[B](0,0){\Rnode{b}{H}}
\rput[B](2,0){\Rnode{c}{a}}
\psset{angleA=90,armA=1,nodesepA=3pt}
\ncdiagg{b}{a}
\ncdiagg{c}{a}
\end{pspicture}
\end{LTXexample}
%%??? FIXME
If you set the \Lkeyword{nodesep} or \Lkeyword{arm} parameter to a negative value, PSTricks
will measure the distance to the beginning of the node connection or to the
end of the arm relative to the center of the node, rather than relative to the
boundary of the node or the beginning of the arm. Here is how we fix the
previous example:
\begin{LTXexample}[width=5cm]
\begin{pspicture}[shift=*](3.5,3)
\psset{unit=.9}
\Huge
\cnode(1,3){4pt}{a}
\rput[B](0,0){\Rnode{b}{H}}
\rput[B](2,0){\Rnode{c}{a}}
\psset{angleA=90,armA=1,YnodesepA=12pt}
\ncdiagg{b}{a}
\ncdiagg{c}{a}
\end{pspicture}
\end{LTXexample}
Note also the use of \Lcs{Rnode}.
One more parameter trick: By using the \Lkeyword{border} parameter, you can create
the impression that one node connection passes over another.
The node connection commands make interesting drawing tools as well, as an
alternative to \Lcs{psline} for connecting two points. There are variants of
the node connection commands for this purpose. Each begins with \verb|pc| (for
``point connection'') rather than \verb|nc|. E.g.,
\verb|\pcarc{<->}(3,4)(6,9)|
gives the same result as
\begin{lstlisting}
\pnode(3,4){A}
\pnode(6,9){B}
\pcarc{<->}{A}{B}
\end{lstlisting}
Only \Lcs{nccircle} does not have a \nxLcs{pc} variant:
\begin{center}
\addtolength{\tabcolsep}{8pt}
\def\c#1{\Largb{node#1}}
\begin{tabular}{ll}\bottomrule
\emph{Command} & \emph{Corresponds to:}\\\midrule
\Lcs{pcline}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncline}\\
\Lcs{pccurve}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{nccurve}\\
\Lcs{pcarc}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncarc}\\
\Lcs{pcbar}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncbar}\\
\Lcs{pcdiag}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncdiag}\\
\Lcs{pcdiagg}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncdiagg}\\
\Lcs{pcangle}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncangle}\\
\Lcs{pcangles}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncangles}\\
\Lcs{pcloop}\OptArg*{\Largb{arrows}}\c1\c2 & \Lcs{ncloop}\\
\Lcs{pcbox}\c1\c2 & \Lcs{ncbox}\\
\Lcs{pcarcbox}\c1\c2
& \Lcs{ncarcbox}
\end{tabular}
\end{center}
\section{Node connections labels: I}\label{S-nodelabels}
Now we come to the commands for attaching labels to the node connections. The
label command must come right after the node connection to which the label is
to be attached. You can attach more than one label to a node connection, and a
label can include more nodes.
The node label commands must end up on the same \TeX{} page as the node
connection to which the label corresponds.
There are two groups of connection labels, which differ in how they select the
point on the node connection. In this section we describe the first group:
\begin{BDef}
\LcsStar{ncput}\OptArgs\Largb{stuff}\\
\LcsStar{naput}\OptArgs\Largb{stuff}\\
\LcsStar{nbput}\OptArgs\Largb{stuff}
\end{BDef}
These three command differ in where the labels end up with respect to the line:
\begin{tabular}{@{}ll}
\Lcs{ncput} & \emph{on} the line\\
\Lcs{naput} & \emph{above} the line\\
\Lcs{nbput} & \emph{below} the line
\end{tabular}
(using the convention that node connections go from left to right).
Here is an example:
\begin{LTXexample}[width=5cm]
\begin{pspicture}(3.5,1.5)
\cnode(0,0){.5cm}{root}
\cnode*(3,1.5){4pt}{A}
\cnode*(3,0){4pt}{B}
\cnode*(3,-1.5){4pt}{C}
\psset{nodesep=3pt}
\ncline{root}{A}
\naput{above}
\ncline{root}{B}
\ncput*{on}
\ncline{root}{C}
\nbput{below}
\end{pspicture}
\end{LTXexample}
\Lcs{naput} and \Lcs{nbput} use the same algorithm as \Lcs{uput} for displacing
the labels, and the distance beteen the line and labels is \Lkeyword{labelsep} (at
least if the lines are straight).
\Lcs{ncput} uses the same system as \Lcs{rput} for setting the reference
point. You change the reference point by setting the
\LKeyword{ref=ref}
parameter.
Rotation is also controlled by a graphics parameter:
\LKeyword{nrot=rot}
<rot> can be in any of the forms suitable for \Lcs{rput}, and you can also use
the form
\verb|{:<angle>}|
The angle is then measured with respect to the node connection. E.g., if the
angle is \verb|{:U}|, then the label runs parallel to the node connection. Since
the label can include other put commands, you really have a lot of control
over the label position.
The next example illustrates the use \verb|{:<angle>}|, the \Lkeyword{offset} parameter,
and \Lcs{pcline}:
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,2.3)
\pspolygon(0,0)(4,2)(4,0)
\pcline[offset=12pt]{|-|}(0,0)(4,2)
\ncput*[nrot=:U]{Length}
\end{pspicture}
\end{LTXexample}
Here is a repeat of an earlier example, now using \verb|{:<angle>}|:
\begin{LTXexample}[width=5cm]
\begin{pspicture}(3.5,1.5)
\cnode(0,0){.5cm}{root}
\cnode*(3,1.5){4pt}{A}
\cnode*(3,0){4pt}{B}
\cnode*(3,-1.5){4pt}{C}
\psset{nodesep=3pt,nrot=:U}
\ncline{root}{A}
\naput{above}
\ncline{root}{B}
\ncput*{on}
\ncline{root}{C}
\nbput{below}
\end{pspicture}
\end{LTXexample}
The position on the node connection is set by the
\LKeyword{npos=num}
parameter, roughly according to the following scheme: Each node connection has
potentially one or more segments, including the arms and connecting lines.
A number \Lkeyword{npos} between 0 and 1 picks a point on the first segment from node
\verb|A| to \verb|B| (fraction \Lkeyword{npos} from the beginning to the end of the segment),
a number between 1 and 2 picks a number on the second segment, and so on.
Each node connection has its own default value of \Lkeyword{npos}. If you leave the
\Lkeyword{npos} parameter value empty (e.g., \verb|[npos=]|), then the default is
substituted. This is the default mode.
Here are the details for each node connection:
\begin{center}
% \catcode`\@=11\setbox\@tempboxa=\hbox{1.5}%
% \edef\t#1{\noexpand\hbox to \the\wd\@tempboxa{\noexpand\tt\noexpand\hss#1}}
\begin{tabular}{lccc}
\emph{Connection} & \emph{Segments} & \emph{Range} & \emph{Default}\\[2pt]
\Lcs{ncline} & 1 & $0\leq pos\leq 1$ & 0.5\\
\Lcs{nccurve} & 1 & $0\leq pos\leq 1$ & 0.5\\
\Lcs{ncarc} & 1 & $0\leq pos\leq 1$ & 0.5\\
\Lcs{ncbar} & 3 & $0\leq pos\leq 3$ & 1.5\\
\Lcs{ncdiag} & 3 & $0\leq pos\leq 3$ & 1.5\\
\Lcs{ncdiagg} & 2 & $0\leq pos\leq 2$ & 0.5\\
\Lcs{ncangle} & 3 & $0\leq pos\leq 3$ & 1.5\\
\Lcs{ncangles} & 4 & $0\leq pos\leq 4$ &1.5\\
\Lcs{ncloop} & 5 & $0\leq pos\leq 5$ & 2.5\\
\Lcs{nccircle} & 1 & $0\leq pos\leq 1$ & 0.5\\
\Lcs{ncbox} & 4 & $0\leq pos\leq 4$ & 0.5\\
\Lcs{ncarcbox} & 4 & $0\leq pos\leq 4$ & 0.5
\end{tabular}
\end{center}
Here is an example:
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,3)
\rput[tl](0,3){\rnode{A}{\psframebox{Node A}}}
\rput[br](3.5,0){\ovalnode{B}{Node B}}
\ncangles[angleA=-90,arm=.4cm,linearc=.15]{A}{B}
\ncput*{d}
\nbput[nrot=:D,npos=2.5]{par}
\end{pspicture}
\end{LTXexample}
With \Lcs{ncbox} and \Lcs{ncarcbox}\, the segments run counterclockwise, starting
with the lower side of the box. Hence, with \Lcs{nbput} the label ends up
outside the box, and with \Lcs{naput} the label ends up inside the box.
\begin{LTXexample}[width=5cm]
\begin{pspicture}[shift=*](4,2.5)
\rput[bl](.5,0){\rnode{A}{1}}
\rput[tr](3.5,2){\rnode{B}{2}}
\ncarcbox[nodesep=.2cm,boxsize=.4,linearc=.4,
arcangle=50,linestyle=dashed]{<->}{A}{B}
\nbput[nrot=:U]{set}
\nbput[npos=2]{II}
\end{pspicture}
\end{LTXexample}
If you set the parameter
\LKeyword{shortput=none/nab/tablr/tab}
to \Lkeyval{nab}, then immediately following a node connection or another node
connection label you can use \verb|^| instead of \Lcs{naput} and \verb|_| instead of
\Lcs{nbput}.
\begin{LTXexample}[width=5cm]
\begin{pspicture}[shift=*](3.5,1.5)
\cnode(0,0){.5cm}{root}
\cnode*(3,1.5){4pt}{A}
\cnode*(3,-1.5){4pt}{C}
\psset{nodesep=3pt,shortput=nab}
\ncline{root}{A}^{$x$}
\ncline{root}{C}_{$y$}
\end{pspicture}
\end{LTXexample}
You can still have parameter changes with the short \verb|^| and \verb|_| forms. Another
example is given on page~\pageref{nab-example}.
If you have set \Lkeyset{shortput=nab}, and then you want to use a true \verb|^| or \verb|_|
character right after a node connection, you must precede the \verb|^| or \verb|_| by
\verb|{}| so that PSTricks does not convert it to \Lcs{naput} or \Lcs{nbput}.
You can change the characters that you use for the short form with the
\begin{BDef}
\Lcs{MakeShortNab}\Largb{<char1>}\Largb{<char2>}
\end{BDef}
command.\footnote{%
You can also use \Lcs{MakeShortNab} if you want to use \texttt{\textasciicircum} and \texttt{\_} with
non-standard category codes. Just invoke the command after you have made your
\Lcs{catcode} changes.}
The \Lkeyset{shortput=tablr} and \Lkeyset{shortput=tab} options are described on
pages~\pageref{tablr} and \pageref{tab}, respectively.
\section{Node connection labels: II}
Now the second group of node connections:
\begin{BDef}
\LcsStar{tvput}\OptArgs\Largb{stuff}\\
\LcsStar{tlput}\OptArgs\Largb{stuff}\\
\LcsStar{trput}\OptArgs\Largb{stuff}\\
\LcsStar{thput}\OptArgs\Largb{stuff}\\
\LcsStar{taput}\OptArgs\Largb{stuff}\\
\LcsStar{tbput}\OptArgs\Largb{stuff}
\end{BDef}
The difference between these commands and the \verb|\n*put| commands is that these
find the position as an intermediate point between the centers of the nodes,
either in the horizontal or vertical direction. These are good for trees and
mathematical diagrams, where it can sometimes be nice to have the labels be
horizontally or vertically aligned. The \verb|t| stands for ``tree''.
You specify the position by setting the
\LKeyword{tpos=num}
parameter.
\Lcs{tvput}, \Lcs{tlput} and \Lcs{trput} find the position that lies fraction
<tpos> in the \emph{vertical} direction from the upper node to the lower
node. \Lcs{thput}, \Lcs{taput} and \Lcs{tbput} find the position that lies fraction
<tpos> in the \emph{horizontal} direction from the left node to the right
node.
Then the commands put the label on or next to the line, as follows:
\begin{center}
\begin{tabular}{lll}\toprule
\emph{Command} & \emph{Direction} & \emph{Placement}\\\midrule
\Lcs{tvput} & vertical & middle\\
\Lcs{tlput} & vertical & left\\
\Lcs{trput} & vertical & right\\
\Lcs{thput} & horizontal & middle\\
\Lcs{taput} & horizontal & above\\
\Lcs{tbput} & horizontal & below\\\bottomrule
\end{tabular}
\end{center}
Here is an example:
\begin{LTXexample}[pos=t]
\[
\setlength{\arraycolsep}{1.1cm}
\begin{array}{cc}
\Rnode{a}{(X-A)} & \Rnode{b}{A} \\[1.5cm]
\Rnode{c}{x} & \Rnode{d}{\tilde{X}}
\end{array}
\psset{nodesep=5pt,arrows=->} \everypsbox{\scriptstyle}
\ncline{a}{c}\tlput{r} \ncline{a}{b}\taput{u}
\ncline[linestyle=dashed]{c}{d}\tbput{b}
\ncline{b}{d}\trput{s}
\everypsbox{}
\begin{array}{cc}
\rnode{a}{(X-A)} & \rnode{b}{a} \\[1.5cm]
\rnode{c}{x} & \rnode{d}{\tilde{X}}
\end{array}
\psset{nodesep=5pt,arrows=->}\everypsbox{\scriptstyle}
\ncline{a}{c}\nbput{r} \ncline{a}{b}\naput{u}
\ncline[linestyle=dashed]{c}{d}\nbput{b}
\ncline{b}{d}\naput{s}
\]
\end{LTXexample}
On the left is the diagram with \Lcs{tlput}, \Lcs{trput}, \Lcs{tbput} and \Lcs{Rnode},
as shown in the code. On the right is the same diagram, but with \Lcs{naput},
\Lcs{nbput} and \Lcs{rnode}.
These do not have a rotation argument or parameter. However, you can rotate
\Larg{<stuff>} in 90 degree increments using box rotations (e.g., \Lcs{rotateleft}).
If you set \Lkeyset{shortput=tablr}, then you can use the following single-character
abbreviations for the \verb|t| put commands:\label{tablr}
\begin{center}
\begin{tabular}{rl}\toprule
\emph{Char.} & \emph{Short for:}\\\midrule
\rule{0pt}{4ex}
\verb|^| & \Lcs{taput} \\
\verb|_| & \Lcs{tbput} \\
\verb|<| & \Lcs{tlput} \\
\verb|>| & \Lcs{trput}\\\bottomrule
\end{tabular}
\end{center}
You can change the character abbreviations with
\begin{BDef}
\Lcs{MakeShortTablr}\Largb{<char1>}\Largb{<char2>}\Largb{<char3>}\Largb{<char4>}
\end{BDef}
The \verb|t| put commands, including an example of \Lkeyset{shortput=tablr}, will be
shown further when we get to mathematical diagrams and trees.
The\XInfoDanger{~} node macros use \Lcs{pstVerb} and \Lcs{pstverbscale}.
\section{Attaching labels to nodes}
The commands
\begin{BDef}
\LcsStar{nput}\OptArgs\Largb{refangle}\Largb{name}\Largb{stuff}\\
\LcsStar{uput}\OptArg*{\Largb{distance}}\Largs{angle}\OptArg*{\Largb{rotation}}\Largr{name}\Largb{stuff}
\end{BDef}
affixes \Largb{<stuff>} to node \Largb{<name>}. It is positioned distance \Lkeyword{labelsep} from
the node, in the direction \Largb{<refangle>} from the center of the node. The
algorithm is the same as for \Lcs{uput}. If you want to rotate the node, set the
\LKeyword{rot=rot}
parameter, where \Larg{<rot>} is a rotation that would be valid for \Lcs{rput}.%
\footnote{Not to be confused with the \Lkeyword{nput} parameter.}
The position of the label also takes into account the \Lkeyword{offsetA}
parameter. If \Lkeyword{labelsep} is negative, then the distance is from the center
of the node rather than from the boundary, as with \Lkeyword{nodesep}.
Here is how I used \Lcs{nput} to mark an angle in a previous example:
\begin{LTXexample}[width=4cm]
\begin{pspicture}(4,3)
\rput[br](4,0){\ovalnode{B}{Node B}}
\rput[tl](0,3){\rnode{A}{\psframebox{Node A}}}
\nput[labelsep=0]{-70}{A}{%
\psarcn(0,0){.4cm}{0}{-70}
\uput{.4cm}[-35](0,0){\texttt{angleA}}}
\ncangle[angleA=-70,angleB=90,armB=1cm,linewidth=1.2pt]{A}{B}
\ncput[nrot=:U,npos=1]{\psframe[dimen=middle](0,0)(.35,.35)}
\end{pspicture}
\end{LTXexample}
\clearpage%%%%%%%%%%%%%%%%%%%%%%%%%%
For the put macros there are several possibilities:
\begin{LTXexample}[width=7cm]
\begin{pspicture}[showgrid](-0.25,-0.25)(6,5)
\pnodes(0,3){A}(3,1){B}
\psline[showpoints](A)(B)
\uput[-90](A){A}\uput[-90](B){B}
\psline[linestyle=dashed](A)(3,4)
\psline[linestyle=dashed](A)(3,5)
\psline[linestyle=dashed](A)(3,3)
\psline[linestyle=dashed](6,2)
\psline[linestyle=dashed](B)(6,1)
\psarc{->}(0,3){2.5}{0}{(3,1)}
\psarc{->}(3,1){2.5}{0}{(3,1)}
\uput*{1cm}[(B)](A){foo} \uput*{1cm}[(B)](>A){bar}
\end{pspicture}
\end{LTXexample}
\newcommand\object[1][solid]{\psline[linecolor=red,linewidth=1pt,linestyle=#1]{->}(0,1.5)}
\def\Theta{150}
\def\Radius{1.6}
\psset{linestyle=dashed,dash=4pt 1pt,linecolor=cyan}
\subsection{Normal behavior without rotation}
If there are a point $B$ of type node and a point $A$ of any type then
\begin{lstlisting}
\uput{r}[(B)]{0}(A){\object}
\end{lstlisting}
will produce the same effect as
\begin{lstlisting}
\pnode([nodesep=r]{B}A){C}
\rput{0}(C){\object}
\end{lstlisting}
\begin{LTXexample}[width=5.5cm]
\begin{pspicture}[showgrid](-1,-1)(4,6)
\pnodes(2,1){A}(0,0){O}(1,5){B}
\pnode([nodesep=\Radius]{B}A){C}
\pcline(O)(A) \pcline(O)(B) \pcline(A)(B)
\pcline(A)([nodesep=-\Radius]A)\nbput{$r$}
\uput[-135](O){$O$} \uput[-110](A){$A$}
\uput[90](B){$B$} \uput[150](C){$C$}
\pscircle(A){\Radius}
% -------------------------------
\uput{\Radius}[(B)]{0}(A){\object}
%\rput{0}([nodesep=\Radius]{B}A){\object}
\end{pspicture}
\end{LTXexample}
\clearpage%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Normal behavior with rotation}
If there are a point $B$ of type node and a point $A$ of any type then
\begin{lstlisting}
\uput{r}[(B)]{rotangle}(A){\object}
\end{lstlisting}
will produce the same effect as
\begin{lstlisting}
\pnode([nodesep=r,angle=-rotangle]{B}A){R}
\rput{rotangle}(R){\object}
\end{lstlisting}
\begin{LTXexample}[width=5.5cm]
\begin{pspicture}[showgrid](-1,-2)(4,6)
\pnodes(2,1){A}(0,0){O}\pnode(1,5){B}
\pnode([nodesep=\Radius]{B}A){C}
\pnode([nodesep=\Radius,angle=-150]{B}A){R}
% -------------------------------
\pcline(O)(A) \pcline(O)(B) \pcline(A)(B)
\pcline(A)([nodesep=-\Radius]A)
\nbput{$r$} \pcline(A)(R)
\uput[-135](O){$O$} \uput[-110](A){$A$}
\uput[90](B){$B$} \uput[150](C){$C$}
\uput[-45](R){$R$}
%
\pscircle(A){\Radius}
\psarcn[origin={A}]{->}(A){.6}{(B)}{(R)}
\uput{5pt}[30](A){$\theta$}
\psarc[origin={R}]{->}(R){.7}{([offset=1]R)}%
{([offset=1,angle=\Theta]R)}
\uput*{8pt}[160](R){$\theta$}
% -------------------------------
\rput(R){\object[dashed]}
\uput{\Radius}[(B)]{150}(A){\object}
%\rput{\Theta}([nodesep=\Radius,
% angle=-\Theta]{B}A){\object}
\end{pspicture}
\end{LTXexample}
\clearpage%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Special behavior without rotation}
If there are a point $B$ of type node and a point $A$ of any type then
\begin{lstlisting}
\uput{r}[(B)]{0}(>A){\object}
\end{lstlisting}
will produce the same effect as
\begin{lstlisting}
\nodexn{(A)+(B)}{D}
\pnode([nodesep=r]{D}A){C'}
\rput{0}(C'){\object}
\end{lstlisting}
\begin{LTXexample}[width=5.5cm]
\begin{pspicture}[showgrid](-1,-1)(4,7)
\pnodes(2,1){A}(0,0){O}(1,5){B}
\pnode([nodesep=\Radius]{B}A){C}
\nodexn{(A)+(B)}{D}
\pnode([nodesep=\Radius]{D}A){C'}
% -------------------------------
\pcline[ArrowInside=->>](O)(A)
\pcline[ArrowInside=->](O)(B)
\pcline(A)(B)
\pcline(A)([nodesep=-\Radius]A)\nbput{$r$}
\pcline[ArrowInside=->](A)(D)
\pcline[ArrowInside=->>](B)(D)
\uput[-135](O){$O$} \uput[-110](A){$A$}
\uput[90](B){$B$} \uput[150](C){$C$}
\uput[30](C'){$C'$} \uput[45](D){$D$}
%
\pscircle(A){\Radius}
% -------------------------------
\uput{\Radius}[(B)]{0}(>A){\object}
%\rput{0}(C'){\object}
\end{pspicture}
\end{LTXexample}
\clearpage%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Special behavior with rotation}
If there are a point $B$ of type node and a point $A$ of any type then
\begin{lstlisting}
\uput{r}[(B)]{rotangle}(>A){\object}
\end{lstlisting}
will produce the same effect as
\begin{lstlisting}
\nodexn{(A)+(B)}{D}
\pnode([nodesep=r]{D}A){C'}
\rput{rotangle}(C'){\object}
\end{lstlisting}
\begin{LTXexample}[width=5.5cm]
\begin{pspicture}[showgrid](-1,-1)(4,7)
\pnodes(2,1){A}(0,0){O}(1,5){B}
\pnode([nodesep=\Radius]{B}A){C}
\nodexn{(A)+(B)}{D}
\pnode([nodesep=\Radius]{D}A){C'}
% -------------------------------
\pcline[ArrowInside=->>](O)(A)
\pcline[ArrowInside=->](O)(B)
\pcline(A)(B)
\pcline(A)([nodesep=-\Radius]A)
\nbput{$r$}
\pcline[ArrowInside=->](A)(D)
\pcline[ArrowInside=->>](B)(D)
\uput[-135](O){$O$} \uput[-110](A){$A$}
\uput[90](B){$B$} \uput[150](C){$C$}
\uput[30](C'){$C'$} \uput[45](D){$D$}
%
\pscircle(A){\Radius}
\psarc[origin={C'}]{->}(C'){.55}{([offset=1]C')}%
{([offset=1,angle=150]C')}
\uput*{5pt}[170](C'){$\theta$}
% -------------------------------
\rput{0}(C'){\object[dashed]}
\uput{\Radius}[(B)]{150}(>A){\object}
%\rput{150}(C'){\object}
\end{pspicture}
\end{LTXexample}
\psset{linestyle=solid,dash=4pt 1pt,linecolor=black}
\section{Mathematical diagrams and graphs}\label{S-psmatrix}
For some applications, such as mathematical diagrams and graphs, it is useful
to arrange nodes on a grid. You can do this with alignment environments, such
as \TeX's \Lcs{halign} primitive, \LaTeX's \Lenv{tabular} environment, and \AmS-\TeX's
\Lcs{matrix}, but PSTricks contains its own alignment environment that is
especially adapted for this purpose:
\begin{BDef}
\Lcs{psmatrix}\OptArgs \ldots \Lcs{endpsmatrix}
\end{BDef}
Here is an example
\begin{LTXexample}[width=5cm]
$
\psmatrix[colsep=1cm,rowsep=1cm]
& A \\
B & E & C \\
& D &
\endpsmatrix
$
\end{LTXexample}
As an alignment environment, \Lcs{psmatrix} is similar to \AmS-\TeX's
\Lcs{matrix}. There is no argument for specifying the columns. Instead, you can
just use as many columns as you need. The entries are horizontally centered.
Rows are ended by \verb|\\|. \Lcs{psmatrix} can be used in or out of math mode.
Our first example wasn't very interesting, because we didn't make use of the
nodes. Actually, each entry is a node. The name of the node in row <row> and
column \Largb{<col>} is \verb|{<row>,<col>}|, with no spaces. Let's see some node
connections:
\begin{LTXexample}[width=5cm]
$
\psmatrix[colsep=1cm]
& X \\
Y & Z
\endpsmatrix
\everypsbox{\scriptstyle}%
\psset{nodesep=3pt,arrows=->}
\ncline{1,2}{2,1}
\tlput{f}
\ncline{1,2}{2,2}
\trput{g}
\ncline[linestyle=dotted]{2,1}{2,2}
\tbput{h}
$
\end{LTXexample}
You can include the node connections inside the \Lcs{psmatrix}, in the last entry
and right before \Lcs{endpsmatrix}. One advantage to doing this is that
\Lkeyset{shortput=tab} is the default within a \Lcs{psmatrix}.
\begin{LTXexample}
$ \begin{psmatrix}
U \\
& X\times_Z Y & X \\
& Y & Z
\psset{arrows=->,nodesep=3pt}
\everypsbox{\scriptstyle}
\ncline{1,1}{2,2}_{y}
\ncline[doubleline,linestyle=dashed]{-}{1,1}{2,3}^{x}
\ncline{2,2}{3,2}<{q}
\ncline{2,2}{2,3}_{p}
\ncline{2,3}{3,3}>{f}
\ncline{3,2}{3,3}_{g}
\end{psmatrix} $
\end{LTXexample}
You can change the kind of nodes that are made by setting the
\LKeyword{mnode=type}
parameter. Valid types are \Lkeyval{R},
\Lkeyval{r},
\Lkeyval{C},
\Lkeyval{f}, \Lkeyval{p}, \Lkeyval{circle}, \Lkeyval{oval}, \Lkeyval{dia},
\Lkeyval{tri}, \Lkeyval{dot} and \Lkeyval{none},
standing for \Lcs{Rnode}, \Lcs{rnode}, \Lcs{Cnode}, \Lcs{fnode},
\Lcs{pnode}, \Lcs{circlenode}, \Lcs{ovalnode}, \Lcs{dotnode} and no node,
respectively. Note that for circles, you use \Lkeyset{mnode=C} and set the radius
with the \Lkeyword{radius} parameter.
For example:\label{nab-example}
\begin{LTXexample}
\psmatrix[mnode=circle,colsep=1]
& A \\
B & E & C \\
& D &
\endpsmatrix
\psset{shortput=nab,arrows=->,labelsep=3pt}
\small
\ncline{2,2}{2,3}^[npos=.75]{a}
\ncline{2,2}{2,1}^{b}
\ncline{3,2}{2,1}^{c}
\ncarc[arcangle=-40,border=3pt]{3,2}{1,2}%
_[npos=.3]{d}^[npos=.7]{e}
\ncarc[arcangle=12]{1,2}{2,1}^{f}
\ncarc[arcangle=12]{2,1}{1,2}^{g}
\end{LTXexample}
Note that a node is made only for the non-empty entries. You can also specify
a node for the empty entries by setting the
\LKeyword{emnode=type}
parameter.
You can change parameters for a single entry by starting this entry with the
parameter changes, enclosed in square brackets. Note that the changes affect
the way the node is made, but not contents of the entry (use \Lcs{psset} for
this purpose). For example:
\begin{LTXexample}
$ \psmatrix[colsep=1cm]
& [mnode=circle] X \\
Y & Z
\endpsmatrix
\psset{nodesep=3pt,arrows=->}
\ncline{1,2}{2,1}
\ncline{1,2}{2,2}
\ncline[linestyle=dotted]{2,1}{2,2} $
\end{LTXexample}
If you want your entry to begin with a \verb|[| that is not meant to indicate
parameter changes, the precede it by \verb|{}|.
You can assign your own name to a node by setting the
\LKeyword{name=<name>}
parameter at the beginning of the entry, as described above. You can still
refer to the node by \verb|{<row>,<col>}|, but here are a few reasons for giving
your own name to a node:
\begin{itemize}
\item The name may be easier to keep track of;
\item Unlike the \verb|{<row>,<col>}| names, the names you give remain valid
even when you add extra rows or columns to your matrix.
\item The names remain valid even when you start a new \Lcs{psmatrix} that
reuses the \verb|{<row>,<col>}| names.
\end{itemize}
Here a few more things you should know:
\begin{itemize}
\item The baselines of the nodes pass through the centers of the
nodes. \Lcs{psmatrix} achieves this by setting the
\LKeyword{nodealign=true/false}
parameter to \verb|true|. You can also set this parameter outside of \Lcs{psmatrix}
when you want this kind of alignment.
\item You can left or right-justify the nodes by setting the
\LKeyword{mcol=l/r/c}
parameter. \verb|l|, \verb|r| and \verb|c| stand for \verb|left|, \verb|right| and \verb|center|,
respectively.
\item The space between rows and columns is set by the
\LKeyword{rowsep=dim} and
\LKeyword{colsep=dim}
parameters.
\item If you want all the nodes to have a fixed width, set
\LKeyword{mnodesize=dim}
to a positive value.
\item If \Lcs{psmatrix} is used in math mode, all the entries are set in math
mode, but you can switch a single entry out of math mode by starting and
ending the entry with \verb|$|. %$
\item The radius of the \verb|c| \Lkeyword{mnode} (corresponding to \Lcs{cnode}) is set by
the \Lkeyword{radius} parameter.
\item Like in \LaTeX, you can end a row with \verb|\\[<dim>]| to insert an extra
space <dim> between rows.
\item The command \Lcs{psrowhookii} is executed, if defined, at the beginning of
every entry in row \verb|ii| (row 2), and the command \Lcs{pscolhookv} is executed at
athe beginning of every entry in column \verb|v| (etc.). You can use these hooks,
for example, to change the spacing between two columns, or to use a special
\Lkeyword{mnode} for all the entries in a particular row.
\item An entry can itself be a node. You might do this if you want an entry
to have two shapes.
\item If you want an entry to stretch across several (\Largb{<int>}) columns, use the
\begin{BDef}
\Lcs{psspan}\Largb{int}
\end{BDef}
\emph{at the end of the entry}. This is like Plain \TeX's \Lcs{multispan}, or
\LaTeX's \Lcs{multicolumn}, but the template for the current column (the first
column that is spanned) is still used. If you want wipe out the template as
well, use \Lcs{multispan}\Largb{<int>} \emph{at the beginning of the entry} instead.
If you just want to wipe out the template, use \Lcs{omit} before the entry.
\item \Lcs{psmatrix} can be nested, but then all node connections and other
references to the nodes in the \verb|{<row>,<col>}| form for the nested matrix
\emph{must go inside} the \Lcs{psmatrix}. This is how PSTricks decides which
matrix you are referring to. It is still neatest to put all the node
connections towards the end; just be sure to put them before \Lcs{endpsmatrix}.
Be careful also not to refer to a node until it actually appears. The whole
matrix can itself go inside a node, and node connections can be made as
usual. This is not the same as connecting nodes from two different
\Lcs{psmatrix}'s. To do this, you must give the nodes names and refer to them
by these names.
\end{itemize}
\section{Obsolete put commands}
This is old documentation, but these commands will continue to be supported.
There is also an obsolete command \Lcs{Lput} for putting labels
next to node connections. The syntax is
\begin{BDef}
\Lcs{Lput}\Largb{<labelsep>}\Largs{<refpoint>}\Largb{<rotation>}\Largr(<pos>)\Largb{<stuff>}
\end{BDef}
It is a combination of \Lcs{Rput} and \Lcs{lput}, equivalent to
\begin{BDef}
\Lcs{lput}\Largr{<pos>}\Largb{\Lcs{Rput}\Largb{<labelsep>}\Largs{<refpoint>}\Largb{<rotation>}\Largr{0,0}\Largb{<stuff>}}
\end{BDef}
\Lcs{Mput} is a short version of \Lcs{Lput} with no
\verb|{<rotation>}| or \verb|(<pos>)| argument. \Lcs{Lput} and \Lcs{Mput} remain part of
PSTricks only for backwards compatibility.
Here are the node label commands:
\begin{BDef}
\LcsStar{lput}\OptArgs\Largs{refpoint}\Largb{rotation}\Largr{pos}\Largb{stuff}
\end{BDef}
The \verb|l| stands for ``label''. Here is an example illustrating the use of the
optional star and \verb|:<angle>| with \Lcs{lput}, as well as the use of the
\Lkeyword{offset} parameter with \Lcs{pcline}:
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,2.3)
\pspolygon(0,0)(4,2)(4,0)
\pcline[offset=12pt]{|-|}(0,0)(4,2)
\lput*{:U}{Length}
\end{pspicture}
\end{LTXexample}
(Remember that with the \nxLcs{?put} commands, you can omit the coordinate if you
include the angle of rotation. You are likely to use this feature with the
node label commands.)
With \Lcs{lput} and \Lcs{rput}, you have a lot of control over the position of the
label. E.\,g.,
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,2)
\pcline(0,0)(4,2)
\lput{:U}{\rput[r]{N}(0,.4){label}}
\end{pspicture}
\end{LTXexample}
puts the label upright on the page, with right side located .4 centimeters
``above'' the position 0.5 of the node connection (above if the node
connection points to the right). However, the \Lcs{aput} and \Lcs{bput} commands
described below handle the most common cases without \Lcs{rput}.\footnote{%
There is also an obsolete command \Lcs{Lput} for putting labels
next to node connections. The syntax is
\begin{BDef}
\LcsStar{Lput}\Largb{<labelsep>}\Largs{<refpoint>}\Largb{<rotation>}\Largr{<pos>}\Largb{<stuff>}
\end{BDef}
It is a combination of \Lcs{Rput} and \Lcs{lput}, equivalent to
\begin{BDef}
\LcsStar{lput}\Largr{<pos>}\Largb{\Lcs{Rput}\Largb{<labelsep>}\Largs{<refpoint>}\Largb{<rotation>}\Largr{0,0}\Largb{<stuff>}}
\end{BDef}
\Lcs{Mput} is a short version of \Lcs{Lput} with no
\texttt{\{<rotation>\}} or \texttt{(<pos>)} argument. \Lcs{Lput} and \Lcs{Mput} remain part of
PSTricks only for backwards compatibility.}
\begin{BDef}
\LcsStar{aput}\Largs{labelsep}\Largb{angle}\Largr{pos}\Largb{stuff}
\end{BDef}
\Largb{<stuff>} is positioned distance \Lcs{pslabelsep} \emph{above} the node
connection, given the convention that node connections point to the right.
\Lcs{aput} is a node-connection variant of \Lcs{uput}. For example:
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,2)
\pspolygon(0,0)(4,2)(4,0)
\pcline[linestyle=none](0,0)(4,2)
\aput{:U}{Hypotenuse}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\LcsStar{bput}\Largs{labelsep}\Largb{angle}\Largr{pos}\Largb{stuff}
\end{BDef}
This is like \Lcs{aput}, but \Largb{<stuff>} is positioned \emph{below} the node
connection.
It is fairly common to want to use the default position and rotation with
these node connections, but you have to include at least one of these
arguments. Therefore, PSTricks contains some variants:
\begin{BDef}
\Lcs{mput}\Largs{refpoint}\Largb{stuff}\\
\Lcs{Aput}\Largs{labelsep}\Largb{stuff}\\
\Lcs{Bput}\Largs{labelsep}\Largb{stuff}
\end{BDef}
of \Lcs{lput}, \Lcs{aput} and \Lcs{bput}, respectively, that have no angle or
positioning argument. For example:
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,2)
\cnode*(0,0){3pt}{A}
\cnode*(4,2){3pt}{B}
\ncline[nodesep=3pt]{A}{B}
\mput*{1}
\end{pspicture}
\end{LTXexample}
Here is another:
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,2)
\pcline{<->}(0,0)(4,2)
\Aput{Label}
\end{pspicture}
\end{LTXexample}
\clearpage
\part{New commands}
\section{Nodes}
\section{Setting bounding box nodes with \nxLcs{psDefBoxNodes}}
\begin{BDef}
\Lcs{psDefBoxNodes}\Largb{node name}\Largb{text}\\
\end{BDef}
Setting nodes for a bounding box of a given text. There will be 12 nodes defined,
with the name that has the suffixes
\texttt{:tl, :tC, :tr,
:Cl, :C, :Cr,
:Bl, :BC, :Br,
:bl, :bc, :br}. The prefix is always the given node name. The node name shouldn't contain spaces or special
characters, like umlauts or an active \PS\ character, like \texttt{(}.
\lstset{style=code}
\begin{LTXexample}[pos=t,wide,vsep=10mm,preset=\centering,columns=fixed]
\psscalebox{15}{\psDefBoxNodes{Age}{\color{red!50}\sffamily \"Age}}%
\pspolygon[fillstyle=solid,
fillcolor=blue!30,opacity=0.3](Age:tl)(Age:tr)(Age:br)(Age:bl)%
\psline[linestyle=dashed](Age:Bl)(Age:Br)%
\psdots(Age:tl)(Age:tC)(Age:tr)(Age:Cl)(Age:C)(Age:Cr)%
(Age:Bl)(Age:BC)(Age:Br)(Age:bl)(Age:bC)(Age:br)%
\pcline[arrows=<->,linecolor=blue,arrowscale=1.25](Age:tC)(Age:Br)
\uput[180](Age:tl){tl}\uput[180](Age:Cl){Cl}\uput[180](Age:Bl){Bl}\uput[180](Age:bl){bl}
\uput[90](Age:tC){tC} \uput[0](Age:C){C} \uput[0](Age:BC){BC} \uput[-90](Age:bC){bC}
\uput[0](Age:tr){tr} \uput[0](Age:Cr){Cr} \uput[0](Age:Br){Br} \uput[0](Age:br){br}
\end{LTXexample}
\clearpage
%--------------------------------------------------------------------------------------
\section{Relative nodes with \nxLcs{psGetNodeCenter} or \texttt{N-<name>.x|y}}
%--------------------------------------------------------------------------------------
\begin{BDef}
\Lcs{psGetNodeCenter}\Largb{node name}\\
%\Lcs{psGetNodeEdgeA}\Largb{node type}\Largb{node name}
\end{BDef}
This command makes sense only at
the PostScript level. It defines the two variables \Larg{node.x}
and \Larg{node.y} which can be used to define relative nodes. The
following example defines the node \verb+MyNode+ and a second one
relative to the first one, with 4 units left and 4 units up.
\Larg{node} must be an existing node name. Nodes are saved in an own
dictionary with the current transformation matrix, which is reset when
using the macro \Lcs{psGetNodeCenter}.
\begin{LTXexample}[width=5cm]
\begin{pspicture}[showgrid,arrowscale=2](5,5)
\pnode(4.5,0.5){MyNode}
\psdot(MyNode)
\pnode(! \psGetNodeCenter{MyNode}
MyNode.x 4 sub MyNode.y 4 add){MySecondNode}
\psdot(MySecondNode)
\ncline[linecolor=red]{<->}{MyNode}{MySecondNode}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=5cm]
\begin{pspicture}[showgrid](5,5)
\rput(1.5,0.5){\trinode{CN}{NodeA}}
\rput(3.5,2.5){\trinode{EN}{NodeB}}
\pnode(! \psGetNodeCenter{CN}
CN.x 2 add CN.y 1 add ){MyCNode}
\ncline[linecolor=red]{<->}{MyCNode}{EN}
\ncline[linecolor=blue]{<->}{CN}{EN}
\end{pspicture}
\end{LTXexample}
The coordinates of the nodes can also be saved with \Lkeyword{saveNodeCoors} in global defined names
\texttt{N-<name>.x} and \texttt{N-<name>.y}. With the optional argument \Lkeyword{NodeCoorPrefix}, which is
by default empty, the name setting can be changed to \texttt{<NodeCoorPrefix><name>x} and \texttt{<NodeCoorPrefix><name>y}.
The forgoing examples can be simplified if you
do not need the resetting of the transformation matrix:
\begin{LTXexample}[width=5cm]
\begin{pspicture}[showgrid,arrowscale=2,
saveNodeCoors](5,5)
\pnode(4.5,0.5){MyNode}
\psdot(MyNode)
\pnode(! N-MyNode.x 4 sub N-MyNode.y 4 add){MySecondNode}
\psdot(MySecondNode)
\ncline[linecolor=red]{<->}{MyNode}{MySecondNode}
\end{pspicture}
\end{LTXexample}
\bigskip
In the following example it doesn't work because the relative node setting via \Lcs{rput}
is not taken into account.
\begin{LTXexample}[width=5cm]
\begin{pspicture}[showgrid,saveNodeCoors](5,5)
\rput(1.5,0.5){\trinode{CN}{NodeA}}
\rput(3.5,2.5){\trinode{EN}{NodeB}}
\pnode(! N-CN.x 2 add N-CN.y 1 add ){MyCNode}
\ncline[linecolor=red]{<->}{MyCNode}{EN}
\ncline[linecolor=blue]{<->}{CN}{EN}
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\section{Getting node edges with \nxLcs{psGetNodeEdgeA} and \nxLcs{psGetNodeEdgeB}}
%--------------------------------------------------------------------------------------
\begin{BDef}
\Lcs{psGetNodeEdgeA}\Largb{node name}\\
\Lcs{psGetNodeEdgeB}\Largb{node name}\\
\end{BDef}
When two nodes are connected the line often did not use the center of the defined
nodes. Values as \Lkeyword{nodesep} or \Lkeyword{offset} are also taken into account
as a surrounding border of a node. With these new macros one can get the edge coordinates
of two given nodes. The coordinates are saved on \PS side in the values \Larg{node.x}
and \Larg{node.y}.
\begin{LTXexample}[pos=t]
\Huge
\hspace*{4cm}\rnode{B}{Node B}
\vspace{2cm}
\rnode{A}{Node A}
\ncline{A}{B}
\pscircle*[linecolor=blue,opacity=0.4](!\psGetEdgeA{A}{B}){10pt}
\pscircle*[linecolor=blue,opacity=0.4](!\psGetEdgeB{A}{B}){10pt}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\section{\nxLcs{ncdiag} and \nxLcs{pcdiag}}
%--------------------------------------------------------------------------------------
With the new option \Lkeyword{lineAngle} the lines drawn by the \Lcs{ncdiag} macro
can now have a specified gradient. Without this option one has to define the two
arms (which maybe zero) and PSTricks draws the connection between them. Now there
is only a static \Lkeyword{armA}, the second one \Lkeyword{armB} is calculated when an angle
\Lkeyword{lineAngle} is defined. This angle is the gradient of the intermediate line
between the two arms. The syntax of \Lcs{ncdiag} is
\begin{BDef}
\Lcs{ncdiag}\OptArgs\Largb{node A}\Largb{node B}\\
\Lcs{pcdiag}\OptArgs\Largs{node A}\Largs{node B}
\end{BDef}
\begin{tabularx}{\linewidth}{l|X}
name & meaning\\\hline
\Lkeyword{lineAngle} & angle of the intermediate line segment. Default is 0, which is the same
than using \Lcs{ncdiag} without the \Lkeyword{lineAngle} option.\tabularnewline
\end{tabularx}
\begin{LTXexample}[width=5.5cm]
\begin{pspicture}(5,6)
\circlenode{A}{A}\quad\circlenode{C}{C}%
\quad\circlenode{E}{E}
\rput(0,4){\circlenode{B}{B}}
\rput(1,5){\circlenode{D}{D}}
\rput(2,6){\circlenode{F}{F}}
\psset{arrowscale=2,linearc=0.2,%
linecolor=red,armA=0.5, angleA=90,angleB=-90}
\ncdiag[lineAngle=20]{->}{A}{B}
\ncput*[nrot=:U]{line I}
\ncdiag[lineAngle=20]{->}{C}{D}
\ncput*[nrot=:U]{line II}
\ncdiag[lineAngle=20]{->}{E}{F}
\ncput*[nrot=:U]{line III}
\end{pspicture}
\end{LTXexample}
The \Lcs{ncdiag} macro sets the \Lkeyword{armB} dynamically to the calculated value. Any
user setting of \Lkeyword{armB} is overwritten by the macro. The \Lkeyword{armA} could be set to
a zero length:
\begin{LTXexample}[width=4.5cm]
\begin{pspicture}(4,3)
\rput(0.5,0.5){\circlenode{A}{A}}
\rput(3.5,3){\circlenode{B}{B}}
{\psset{linecolor=red,arrows=<-,arrowscale=2}
\ncdiag[lineAngle=60,%
armA=0,angleA=0,angleB=180]{A}{B}
\ncdiag[lineAngle=60,%
armA=0,angleA=90,angleB=180]{A}{B}}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=4.5cm]
\begin{pspicture}(4,3)
\rput(1,0.5){\circlenode{A}{A}}
\rput(4,3){\circlenode{B}{B}}
{\psset{linecolor=red,arrows=<-,arrowscale=2}
\ncdiag[lineAngle=60,
armA=0.5,angleA=0,angleB=180]{A}{B}
\ncdiag[lineAngle=60,
armA=0,angleA=70,angleB=180]{A}{B}
\ncdiag[lineAngle=60,
armA=0.5,angleA=180,angleB=180]{A}{B}}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=4.5cm]
\begin{pspicture}(4,5.5)
\cnode*(0,0){2pt}{A} \cnode*(0.25,0){2pt}{C}
\cnode*(0.5,0){2pt}{E}\cnode*(0.75,0){2pt}{G}
\cnode*(2,4){2pt}{B} \cnode*(2.5,4.5){2pt}{D}
\cnode*(3,5){2pt}{F} \cnode*(3.5,5.5){2pt}{H}
{\psset{arrowscale=2,linearc=0.2,
linecolor=red,armA=0.5, angleA=90,angleB=-90}
\pcdiag[lineAngle=20]{->}(A)(B)
\pcdiag[lineAngle=20]{->}(C)(D)
\pcdiag[lineAngle=20]{->}(E)(F)
\pcdiag[lineAngle=20]{->}(G)(H)}
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\section{\nxLcs{ncdiagg} and \nxLcs{pcdiagg}}
%--------------------------------------------------------------------------------------
This is nearly the same as \Lcs{ncdiag} except that
\Lkeyword{armB}=0 and the \Lkeyword{angleB} value is computed by the
macro, so that the line ends at the node with an angle like a
\Lcs{pcdiagg} line. The syntax of \Lcs{ncdiagg}/\Lcs{pcdiagg}
is
\begin{BDef}
\Lcs{ncdiag}\OptArgs\Largb{node A}\Largb{node B}\\
\Lcs{pcdiag}\OptArgs\Largs{node A}\Largs{node B}
\end{BDef}
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,6)
\psset{linecolor=black}
\circlenode{A}{A}\quad\circlenode{C}{C}\quad%
\circlenode{E}{E}
\rput(0,4){\circlenode{B}{B}}
\rput(1,5){\circlenode{D}{D}}
\rput(2,6){\circlenode{F}{F}}
{\psset{arrowscale=2,linearc=0.2,
linecolor=red,armA=0.5, angleA=90}
\ncdiagg[lineAngle=-160]{->}{A}{B}
\ncput*[nrot=:U]{line I}
\ncdiagg[lineAngle=-160]{->}{C}{D}
\ncput*[nrot=:U]{line II}
\ncdiagg[lineAngle=-160]{->}{E}{F}
\ncput*[nrot=:U]{line III}}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=5cm]
\begin{pspicture}(4,6)
\psset{linecolor=black}
\cnode*(0,0){2pt}{A} \cnode*(0.25,0){2pt}{C}
\cnode*(0.5,0){2pt}{E}\cnode*(0.75,0){2pt}{G}
\cnode*(2,4){2pt}{B} \cnode*(2.5,4.5){2pt}{D}
\cnode*(3,5){2pt}{F} \cnode*(3.5,5.5){2pt}{H}
{\psset{arrowscale=2,linearc=0.2,
linecolor=red,armA=0.5, angleA=90}
\pcdiagg[lineAngle=20]{->}(A)(B)
\pcdiagg[lineAngle=20]{->}(C)(D)
\pcdiagg[lineAngle=20]{->}(E)(F)
\pcdiagg[lineAngle=20]{->}(G)(H)}
\end{pspicture}
\end{LTXexample}
The only catch for \Lcs{ncdiagg} is that you need the right
value for \Lkeyword{lineAngle}. If the node connection is on the wrong
side of the second node, then choose the corresponding angle,
e.\,g.: if $20$ is wrong then take $-160$, which differs by $180$.
\begin{LTXexample}[width=4cm]
\begin{pspicture}(4,1.5)
\circlenode{a}{A}
\rput[l](3,1){\rnode{b}{H}}
\ncdiagg[lineAngle=60,angleA=180,armA=.5,nodesepA=3pt,linecolor=blue]{b}{a}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=4cm]
\begin{pspicture}(4,1.5)
\circlenode{a}{A}
\rput[l](3,1){\rnode{b}{H}}
\ncdiagg[lineAngle=60,armA=.5,nodesepB=3pt,linecolor=blue]{a}{b}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=4cm]
\begin{pspicture}(4,1.5)
\circlenode{a}{A}
\rput[l](3,1){\rnode{b}{H}}
\ncdiagg[lineAngle=-120,armA=.5,nodesepB=3pt,linecolor=blue]{a}{b}
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\section{\nxLcs{ncbarr}}
%--------------------------------------------------------------------------------------
This has the same behaviour as \Lcs{ncbar}, but has 5 segments
and all are horizontal ones. This is the reason why \Lkeyword{angleA}
must be $0$ or alternatively $180$. All other values are set to
$0$ by the macro. The intermediate horizontal line is symmetrical
to the distance of the two nodes.
\begin{BDef}
\Lcs{ncbarr}\OptArgs\Largb{node A}\Largb{node B}\\
\end{BDef}
\begin{LTXexample}[width=3.5cm]
\psset{arrowscale=2}%
\circlenode{X}{X}\\[1cm]
\circlenode{Y}{Y}
\ncbarr[angleA=0,arrows=->,arrowscale=2]{X}{Y}
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\psset{arrowscale=2}%
\ovalnode{X}{Xxxxx}\\[1cm]
\circlenode{Y}{Yyyy}
\ncbarr[angleA=180,arrows=->,arrowscale=2,linecolor=red]{X}{Y}
\end{LTXexample}
\begin{LTXexample}[width=3.5cm]
\psset{arrowscale=2}%
\ovalnode{X}{Xxxxx}\\[1cm]
\circlenode{Y}{Yyyy}
\ncbarr[angleA=20,arm=1cm,arrows=->,arrowscale=2]{X}{Y}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\section{\nxLcs{psLNode} and \nxLcs{psLCNode}}
%--------------------------------------------------------------------------------------
\Lcs{psLNode} interpolates the Line $\overline{AB}$ by the given value and sets a node at this
point. The syntax is
%
\begin{BDef}
\Lcs{psLNode}\Largs{P1}\Largs{P2}\Largb{value}\Largb{node name}\\
\Lcs{psLCNode}\Largs{P1}\Largb{value 1}\Largs{P2}\Largb{value 2}\Largb{node name}
\end{BDef}
\begin{LTXexample}[width=5cm]
\begin{pspicture}(5,5)
\psgrid[subgriddiv=0,griddots=10]
\psset{linecolor=red}
\psline{o-o}(1,1)(5,5)
\psLNode(1,1)(5,5){0.75}{PI}
\qdisk(PI){4pt}
\psset{linecolor=blue}
\psline{o-o}(4,3)(2,5)
\psLNode(4,3)(2,5){-0.5}{PII}
\qdisk(PII){4pt}
\end{pspicture}
\end{LTXexample}
\bigskip
The \Lcs{psLCNode} macro builds the linear combination of the two given
vectors and stores the end of
the new vector as a node. All vectors start at $(0,0)$, so a \Lcs{rput} maybe
appropriate. The syntax is
\begin{LTXexample}[width=5cm]
\begin{pspicture}[showgrid](5,3)
\psset{linecolor=black}
\psline[linestyle=dashed]{->}(3,1.5)
\psline[linestyle=dashed]{->}(0.375,1.5)
\psset{linecolor=red}
\psline{->}(2,1)\psline{->}(0.5,2)
\psLCNode(2,1){1.5}(0.5,2){0.75}{PI}
\psline[linewidth=2pt]{->}(PI)
\psset{linecolor=black}
\psline[linestyle=dashed](3,1.5)(PI)
\psline[linestyle=dashed](0.375,1.5)(PI)
\end{pspicture}
\end{LTXexample}
%--------------------------------------------------------------------------------------
\section{\nxLcs{nlput} and \nxLcs{psLDNode}}
%--------------------------------------------------------------------------------------
\Lcs{ncput} allows you to set a label relative to the first node
of the last node connection. With \Lcs{nlput} this can be done
absolute to a given node. The syntax is different to the other
node connection macros. It uses internally the macro
\Lcs{psLDNode} which places a node absolute to two given points,
starting from the first one.
\begin{BDef}
\Lcs{nlput}\OptArgs\Largr{A}\Largr{B}\Largb{distance}\Largb{text}\\
\Lcs{psLDNode}\OptArgs\Largr{A}\Largr{B}\Largb{distance}\Largb{node name}
\end{BDef}
\begin{LTXexample}[width=5cm]
\begin{pspicture}(5,2)
\pnode(0,0){A}
\pnode(5,2){B}
\ncline{A}{B}
\psLDNode(A)(B){1.5cm}{KN}\qdisk(KN){2pt}
\nlput[nrot=:U](A)(B){1cm}{Test}
\nlput[nrot=:D](A)(B){2cm}{Test}
\nlput[nrot=:U](A)(B){3cm}{Test}
\nlput(A)(B){4cm}{Test}
\end{pspicture}
\end{LTXexample}
\section{Extensions}
\subsection{Node definitions}
All macros in this section are connected in one way or other with the
construction or deployment of
one or more nodes of type \Lcs{pnode}, which is to say in effect,
named points. For the remainder of this section, node always means \Lcs{pnode}.
Nodes are one of
the most powerful features of pstricks---the ``trickiest tricks'' in the words of
its originator. If used without appropriate caution, they can produce PostScript errors
that can be difficult to track down. For example, suppose you have defined a node \texttt{A}
by \verb|\pnode(1,1){A}|, and then, a little later, you want to move the node a bit to the
right, and you write \verb|\pnode([nodesep=.5cm]A){A}|. On processing the file you will
see an error message from ghostscript: \Lps{stackunderflow}\verb| in --exch--|.
The lesson is: you may not assign a node name if a node by that name is involved
explicitly in its definition. To reassign a node name safely, you have to write instead something like
\begin{verbatim}
\pnode([nodesep=.5cm]A){Atemp}
\pnode(Atemp){A}
\end{verbatim}
This problem afflicts a number of other node-forming macros based on a \Lcs{pnode} construction, as most are.
Nodes are more complicated than they appear. Each node is stored not only with a recipe
for finding its coordinates, but also with the coordinate system in effect when it was
defined. Part of the retrieval process involves modifying the coordinates if necessary
so that they represent the same point on the page even if the coordinate system has
changed. This is important, but has some unexpected consequences. Normally, the simplest
way to translate an object is with \Lcs{rput}.
\begin{verbatim}
\pnode(1,1){P}% define P as (1,1)
\rput(2,3){\psdot{P}}% places dot at original P=(1,1)
\end{verbatim}
is different from
\begin{verbatim}
\rput(2,3){\pnode(1,1){P}\psdot{P}}
% places dot at (1,1)+(2,3)
\end{verbatim}
Effectively, \Lcs{rput} and \Lcs{uput} are not useful for translating previously
defined nodes, but they are useful for defining new nodes relative to fixed positions.
The new macros in this section
are of several kinds: (i) utility macros, some used
internally by the package and some of general use; (ii) macros that manipulate one or
more nodes to produce other nodes; (iii) constructions intended to be used with nodes and
node sequences. By a node sequence is meant one or more nodes having a common root name
followed by an index---eg, P0 P1 P2 ... P5 is a node sequence with root name P. It is
easy to define such node sequences using the \Lcs{multido} macro, or using one of a
number of macros in this section.
\subsection{Node expressions}
A number of macros in the package (eg, \Lcs{psxline}) permit the use of node expressions,
by which is meant an expression like
\begin{verbatim}
.25(1,3)+.333(2;90)-1.2([nodesep=.5cm]Q)
\end{verbatim}
which specifies a linear combination of points (the items enclosed in parentheses)
specified in any manner acceptable to \Lcs{SpecialCoor}.
%The items themselves cannot
%themselves be node expressions, as they are not acceptable to \Lcs{SpecialCoor}.
Node expressions are handled by \Lcs{nodexn}, which calls the macros \Lcs{hasparen} and
\Lcs{parsenodexn} to do the real work. If you write code that needs to be able to handle node expressions, you use
\begin{BDef}
\Lcs{nodexn}\Largb{expr}\Largb{nodename}
\end{BDef}
which returns a node \verb|<nodename>| once \verb|<expr>| has been fully parsed. It is safe to
reuse a node name, as in
\begin{verbatim}
\nodexn{(P)+.5(1,2)}{P}
\end{verbatim}
The following macros amount to special cases of node expressions.
\begin{BDef}
\Lcs{AtoB}\Largr{A}\Largr{B}\Largb{C}
\end{BDef}
defines a node by name C essentially as B-A, as vectors. It is safe to use
\Lcs{AtoB}\verb|(Q)(P){P}| and \Lcs{AtoB}\verb|(Q)(P){Q}|.
\begin{BDef}
\Lcs{AplusB}\Largr{A}\Largr{B}\Largb{C}
\end{BDef}
defines node by name C essentially as A+B, as vectors. It is safe to use
\Lcs{AplusB}\verb|(Q)(P){P}| and \Lcs{AplusB}\verb|(Q)(P){Q}|.
\begin{BDef}
\Lcs{midAB}\Largr{A}\Largr{B}\Largb{C}
\end{BDef}
defines node by name C essentially as $(A+B)/2$, as vectors. It is safe to use \Lcs{midAB}\verb|(Q)(P){P}|
and \Lcs{midAB}\verb|(Q)(P){Q}|.
\begin{LTXexample}[width=.35\textwidth]
\begin{pspicture}[showgrid](-.5,-.5)(2.5,2.5)
\psset{arrows=->,arrowscale=1.5}
\pnode(2,1){P}\pnode(.5,1){Q}
\AtoB(Q)(P){QP}
\AplusB(Q)(P){R}
\psline(0,0)(P)\uput[-45](P){P}
\psline(0,0)(Q)\uput[135](Q){Q}
\psline(0,0)(QP)\uput[-70](QP){QP}
\psline(0,0)(R)\uput[160](R){R}
\psline[linestyle=dashed](Q)(P)
\psline[linestyle=dashed](Q)(R)
\psline[linestyle=dashed](P)(R)
\end{pspicture}
\end{LTXexample}
\subsection{The main macros}
\begin{BDef}
\Lcs{normalvec}\Largr{coords}\Largb{nodename}
\end{BDef}
For example,
\begin{verbatim}
\normalvec(P){P}\normalvec(2;30){Q}
\end{verbatim}
first redefines the node \texttt{P} as a node whose vector interpretation is of the same
length as the original \texttt{P}, but rotated 90 degrees. The second instance has the
same effect as \Lcs{pnode}\verb|(2;120){Q}|.
\begin{BDef}
\Lcs{curvepnode}\Largb{tval}\Largb{expression in t}\Largb{nodename}
\end{BDef}
For example,
\begin{verbatim}
\curvepnode{1}{cos(t) | sin(t)}{P}
\end{verbatim}
sets a node named \texttt{P} at \verb|(cos(1), sin(1))| and a node named \texttt{Ptang}
which represents a unit vector in the tangent direction to the curve at \texttt{P}.
The expression in \texttt{t} in this case is algebraic, which is detected automatically by the macro.
\begin{LTXexample}[width=.35\textwidth]
\begin{pspicture}[showgrid](-.5,-.5)(2.5,2)
\def\exnA{cos(t) | sin(t)}
\psparametricplot[algebraic]{0}{2}{\exnA}
\curvepnode{1}{\exnA}{D}
\psdot(D)\uput[45](D){D}
\end{pspicture}
\end{LTXexample}
\vspace{2pc}
\begin{BDef}
\Lcs{psparnode}\Largb{t}\Largb{expression in t}\Largb{<nodename>}
\end{BDef}
is called by the command \Lcs{curvename} if the expression is PostScript, not algebraic.
\begin{BDef}
\Lcs{algparnode}\Largb{t}\Largb{expression in t}\Largb{nodename}
\end{BDef}
is called by the command \Lcs{curvename} if the expression is algebraic, not PostScript.
\begin{BDef}
\Lcs{curvepnodes}\Largb{tmin}\Largb{tmax}\Largb{expr. in t}\Largb{nodeRoot}
\end{BDef}
Uses current setting of plotpoints (default 50) to define a node sequence of points along the curve. Eg,
\begin{verbatim}
\curvepnodes[plotpoints=100]{0}{1}{t+t^2 | Ex(-t)}{P}
\end{verbatim}
sets nodes \texttt{P0 .. P99} at equally spaced \texttt{t} values along the curve,
and assigns the macro \Lcs{Pnodecount} to 99, the highest index. The expression in \texttt{t}
may be either algebraic or PostScript, and is handled automatically. The values
\verb|<tmin>, <tmax>| may be expressed using PostScript---eg, \verb|{Pi neg}{PiDiv2}|.
\begin{LTXexample}[width=.35\textwidth]
\begin{pspicture}[showgrid](-.5,-.5)(2.5,3)
\def\exnB{t+t^2 | 2*Ex(-t)}
\psset{plotpoints=100}
\psparametricplot[algebraic]{0}{1}{ \exnB }
\curvepnodes{0}{1}{ \exnB }{Q}
\psdot(Q50)\uput[75](Q50){Q50}
\psdot(Q99)\uput[75](Q99){Q99}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\Lcs{fnpnode}\Largb{xval}\Largb{expression in x}\Largb{nodename}
\end{BDef}
sets a single node on the graph. Eg,
\begin{verbatim}
\fnpnode{.5}{x x 1 add mul 2 div}{P}
\end{verbatim}
declares the node P at the point x=0.5 on the graph. It has the same effect as
\begin{verbatim}
\pnode(!/x 0.5 def x x x 1 add mul 2 div}){P}
\end{verbatim}
If your expression in \texttt{t} is algebraic, you must specify the keyword \texttt{algebraic}, as in
\Lcs{fnpnode}\verb|[algebraic]{0.5}{x*(x+1)/2}{P}|.
\begin{LTXexample}[width=.35\textwidth]
\begin{pspicture}[showgrid](-.5,-.5)(2.5,3)
\def\exnC{x x 1 add mul 2 div}
\psplot{0}{2}{\exnC}
\fnpnode{0.5}{\exnC}{R}
\psdot(R)\uput[-45](R){R}
\end{pspicture}
\end{LTXexample}
\vspace{2pc}
\begin{BDef}
\Lcs{fnpnodes}\Largb{xmin}\Largb{xmax}\Largb{expression in x}\Largb{nodeRoot}
\end{BDef}
Is similar to \Lcs{curvenodes}, but for the graph of a function. The keyword \Lkeyword{algebraic}
must be specified if your expression is indeed algebraic.
\begin{LTXexample}[width=.35\textwidth]
\begin{pspicture}[showgrid](-.5,-.5)(2.5,3)
\def\exnD{x x 1 add mul 2 div}
\psplot{0}{2}{\exnD}
\fnpnodes[plotpoints=10]{0}{2}{\exnD}{A}
\psdot(A4)\uput[-45](A4){A4}
\end{pspicture}
\end{LTXexample}
\vspace{2pc}
\begin{BDef}
\Lcs{shownode}\Largr{P}
\end{BDef}
is a debugging tool, which displays in the console window the coordinates of node P.
This will not appear until the final stage of processing the PostScript file. You will
get a PostScript error if the node you specify is undefined.
\begin{BDef}
\Lcs{getnodelist}\Largb{node root name}\Largb{next command}
\end{BDef}
is useful in writing pstricks macros, where there is a list of parenthesized coordinates
to be read and turned into a node sequence, following which \verb|<next command>| is followed.
\label{pnodes}
\begin{BDef}
\Lcs{pnodes}\Largb{P}\Largr{1,2}\Largr{2;3}\ldots
\end{BDef}
is effectively \Lcs{getnodelist}\Largb{P}\Largb{}\verb|(1,2)(2;3)...|, just a quick way to
turn a list of coordinates into a node sequence P0 P1 ...
\begin{BDef}
\Lcs{psnline}\OptArgs\Largb{arrows}\Largr{coors}\Largb{name}
\end{BDef}
for example, expects that there are nodes named P3..P8, and gives the same result as
\begin{verbatim}
\psline[linewidth=1pt]{->}(P3)(P4)(P5)(P6)(P7)(P8)
\end{verbatim}
\begin{LTXexample}[width=.35\textwidth]
\begin{pspicture}[showgrid,algebraic](-.5,-.5)(2.5,2)
\pnodes{B}(.1,.1)(1;10)(*2 {x^2/4})(0,1.4)
%definesuP0..P3--now join them
\psnline[arrowscale=2]{-D>}(0,3){B}
\end{pspicture}
\end{LTXexample}
\vspace{2pc}
\begin{BDef}
\Lcs{psnpolygon}\OptArgs\Largb{arrows}\Largr{coors}\Largb{name}
\end{BDef}
for example, expects that there are nodes named P3..P8, and gives the same result as
\begin{verbatim}
\pspolygon[linewidth=1pt]{->}(P3)(P4)(P5)(P6)(P7)(P8)
\end{verbatim}
Conversion between any angle unit and degree unit
%\makeatletter
%\def\pst@par{}
%\makeatother
\begin{LTXexample}[pos=t,vsep=1cm]
\begin{pspicture}[showgrid=b](-2,-2)(2,2)
\def\N{9 }%
\degrees[\N]
\curvepnodes[plotpoints=\numexpr\N+1]{0}{\N AnytoDeg}{t dup cos exch sin}{C}
\psnpolygon(0,\numexpr\Cnodecount-1){C}
\foreach \i in {0,1,...,\numexpr\Cnodecount-1}{%
\uput{6pt}[\i]{!\i\space 90 DegtoAny sub}(C\i){\psline{->}(0,12pt)}}
\end{pspicture}
\end{LTXexample}
Conversion between any angle unit and radian unit
\begin{LTXexample}[pos=t,vsep=1cm]
\begin{pspicture}[showgrid=b](-2,-2)(2,2)
\def\N{9 }%
\degrees[\N]
\curvepnodes[plotpoints=\numexpr\N+1]{0}{\N AnytoRad}{cos(t)|sin(t)}{D}
\psnpolygon(0,\numexpr\Dnodecount-1){D}
\foreach \i in {0,1,...,\numexpr\Dnodecount-1}{%
\uput{6pt}[\i]{!\i\space Pi 2 div RadtoAny sub}(D\i){\psline{->}(0,12pt)}}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\Lcs{psncurve}\OptArgs\Largb{arrows}\Largr{coors}\Largb{name}
\end{BDef}
for example, expects that there are nodes named P3..P8, and gives the same result as
\begin{verbatim}
\pscurve[linewidth=1pt]{->}(P3)(P4)(P5)(P6)(P7)(P8)
\end{verbatim}
\begin{LTXexample}[width=.35\textwidth]
\begin{pspicture}[showgrid,algebraic](-.5,-.5)(2.5,2)
\pnodes{P}(.1,.1)(1;10)(*2 {x^2/4})(0,1.4)
%defines P0..P3--now join them
\psncurve[arrowscale=2]{-D>}(0,3){P}
\end{pspicture}
\end{LTXexample}
\vspace{2pc}
\begin{LTXexample}[width=.35\textwidth]
\begin{pspicture}[showgrid,algebraic](-.5,-.5)(2.5,2)
\pnodes{P}(.1,.1)(1;10)(*2 {x^2/4})(0,1.4)
%defines P0..P3--now join them
\psnccurve[arrowscale=2]{-D>}(0,3){P}
\end{pspicture}
\end{LTXexample}
\vspace{2pc}
\begin{BDef}
\Lcs{psLCNodeVar}\Largr{node A}\Largr{node B}\Largr{factorA,factorB}\Largb{node name}
\end{BDef}
is similar to \Lcs{psLCNode},
and provides a means of forming a linear combination of two nodes, thought of as vectors. Where
\begin{verbatim}
\psLCNode(A){a}(B){b}{C}
\end{verbatim}
effectively makes \verb|C=aA+bB|,
\begin{verbatim}
\psLCNodeVar(A)(B)(a,b){C}
\end{verbatim}
\begin{sloppypar}
does the same, but the third argument \verb|(a,b)| may be specified in any form acceptable
to \Lcs{SpecialCoor}. (With \Lcs{psLCNode}, each coefficient may be specified in PostScript code.)
One other difference is that \Lcs{psLCNodeVar} allows the reuse of a node name in place. For example,
it is possible to write
\end{sloppypar}
\begin{verbatim}
\psLCNodeVar(A)(B)(2,3){A}% symbol A reassigned
\end{verbatim}
where the equivalent in \Lcs{psLCNode} will lead to a PostScript error. Since \Lcs{AtoB} and \Lcs{AplusB}
are defined using \Lcs{psLCNodeVar}, they also allow node name reuse: \Lcs{AtoB}\verb|(Q)(P){P}| is legal.
\begin{BDef}
\Lcs{psRelNodeVar}\Largr{node A}\Largr{node B}\Largr{radius;angle}\Largb{node name}
\end{BDef}
is similar to \Lcs{psRelNode}, and provides a means of scaling and rotating a line segment AB about A. The effect of
\begin{verbatim}
\psRelNodeVar(A)(B)(2;30){C}
\end{verbatim}
is the same as
\begin{verbatim}
\psRelNode[angle=30](A)(B){2}{C}
\end{verbatim}
\begin{sloppypar}
but the third argument (2;30) may be specified in any form acceptable to \Lcs{SpecialCoor},
while specifying the angle argument in \Lcs{psRelNode} using PostScript is not possible.
Note that \Lcs{psRelNodeVar}\verb|(0,0)(A)(B){C}| may be interpreted as defining \texttt{C} to
be the complex product of \texttt{A} and \texttt{B}.
\end{sloppypar}
\begin{LTXexample}[width=5cm]
\begin{pspicture}[showgrid](-.5,-.5)(3.5,3)
\pnode(0,.5){P}\pnode(1.5,.75){Q}
\psRelNodeVar(P)(Q)(2;20){R}
\psline(Q)(P)\uput[-45](P){P}
\uput[-70](Q){Q}
\psline(P)(R)\uput[-70](R){R}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\Lcs{psRelLineVar}\Largr{node A}\Largr{node B}\Largr{radius;angle}\Largb{node name}
\end{BDef}
stands to \Lcs{psRelLine} as \Lcs{psRelNodeVar} stands relative to \Lcs{psRelNode}.
\Lcs{psRelLine}\verb|Var(A)(B)(a;b){C}| defines the node \texttt{C}, and, in addition, draws the line segment \texttt{AC}.
\begin{BDef}
\Lcs{rhombus}\Largb{edge length}\Largr{A}\Largb{B}\Largb{C}\Largb{D}
\end{BDef}
computes the two remaining vertices C, D given two opposing vertices A, B
of a rhombus with specified edge length. It does not draw the rhombus, which
could be handled easily by \Lcs{psline}. Internally, \Lcs{rhombus} uses
\Lcs{psRelNodeVar}.
\begin{BDef}
\Lcs{psrline}\Largr{P}\Largr{Q}\ldots
\end{BDef}
is like \Lcs{psline}, but drawing a line starting at (P), with successive
increments (Q)... It has the same options as\Lcs{psline}.
\begin{LTXexample}[width=.35\textwidth]
\begin{pspicture}[showgrid](-.5,-.5)(3.5,3)
\pnode(0,.5){P}\pnode(1,1){Q}
\psrline{->}(P)(Q)(2;20)
\uput[-45](P){P}
\end{pspicture}
\end{LTXexample}
\begin{BDef}
\Lcs{psxline}\Largr{basept}\Largb{nodexpr1}\Largb{nodexpr2}
\end{BDef}
The \texttt{x} here stands for expression. The idea is that one builds a
line from \verb|<basept>+<nodexpr1>| to \verb|<basept>+<nodexpr2>|.
\begin{LTXexample}[width=.35\textwidth]
\begin{pspicture}[showgrid](-.5,-.5)(3.5,4)
\def\pfn{t | t^2/4}
\psparametricplot[algebraic]{0}{3.5}{\pfn}
\curvepnode{2}{\pfn}{P}% sets P, Ptang
\normalvec(Ptang){Q}\uput[-45](P){P}
\psxline[linecolor=red]{<->}(P){-(Ptang)}{1.5(Ptang)}
\psxline[linecolor=blue]{->}(P){}{.5(Q)}%can use } for {(0,0)}
\end{pspicture}
\end{LTXexample}
\vspace{2pc}
\begin{BDef}
\Lcs{polyIntersections}\Largb{Name1}\Largb{Name2}\Largr{A}\Largr{B}\Largb{P}\ldots\\
\Lcs{polyIntersections}\Largb{Name1}\Largb{Name2}\Largr{A}\Largr{B}\Largb{P}\Largb{n}\\
\end{BDef}
is the most complicated macro in the collection. It has two forms.
\begin{verbatim}
\polyIntersections{<Name1>}{<Name2>}(A)(B)(1,2)(3;30)(6,5)...
\end{verbatim}
defines the polyline \verb|L=(1,2)(3;30)(6,5)...|, and computes the two points of
intersection closest to \texttt{A} in each direction with the directed line starting at
A heading toward B. The first intersection point in the positive direction is named
\verb|<Name1>|, and the first intersection point in the opposite direction (from A)
is named \verb|<Name2>|. If one or other of these intersections is empty, the nodes are
set to remote points on the line \texttt{AB}. The effect of the line joining the constructed
nodes depends on the location of \texttt{A} and \texttt{B} relative to \texttt{L}, with two cases worth noting.
\begin{itemize}
\item if \texttt{L} is closed and if \texttt{A, B} are interior to one of its components, the
resulting line extends across that component of \texttt{L}, and contains \texttt{AB}.
\item If \texttt{L} is simple and closed, one of \texttt{A, B} is inside and the other outside,
the resulting line segment will contain \texttt{A} but not \texttt{B}.
\end{itemize}
\begin{verbatim}
\polyIntersections{<Name1>}{<Name2>}(A)(B){P}{n}
\end{verbatim}
has exactly the same effect as
\begin{verbatim}
\polyIntersections{<Name1>}{<Name2>}(A)(B)(P0)(P1)...(Pn)
\end{verbatim}
assuming \verb|P0...Pn| to be previously defined nodes.
\begin{LTXexample}[width=.375\textwidth]
\begin{pspicture}[showgrid](-.5,-.5)(3.5,3)
\pnodes{P}(0,.5)(3,.5)(2.5,2)(.5,2.5)(0,.5)
\pnode(1,1.1){A}\pnode(2,1.5){B}
\polyIntersections{N1}{N2}(A)(B){P}{4}
\psnline(0,4){P}
\psdots(A)(B)\psline(N1)(N2)
\uput[-60](A){A}\uput[-60](B){B}
\uput[0](N1){N1}\uput[-180](N2){N2}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=.375\textwidth]
\begin{pspicture}[showgrid](-.5,-.5)(3.5,3)
\pnodes{P}(0,.5)(3,.5)(2.5,2)(.5,2.5)(0,.5)
\pnode(1,1.1){A}\pnode(2,3){B}
\polyIntersections{N1}{N2}(A)(B){P}{4}
\psnline(0,4){P}
\psdots(A)(B)\psline(N1)(N2)
\uput[-60](A){A}\uput[-60](B){B}
\uput[90](N1){N1}\uput[-90](N2){N2}
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[width=.375\textwidth]
\begin{pspicture}[showgrid](-.5,-.5)(3.5,3)
\def\fn{1.5+sin(t)+.4*sin(2*t)%
| 1+cos(t)+.2*cos(2*t)+.2*sin(4*t)}%
\pnode(1,1.1){A}\pnode(2,1.2){B}
\psset{plotpoints=100}
\psparametricplot[algebraic]{0}{6.283}{\fn}
\curvepnodes{0}{6.283}{\fn}{Z}
\polyIntersections{N1}{N2}(A)(B){Z}{99}
\psdots(A)(B)\psline(N1)(N2)
\uput[-60](A){A}\uput[-60](B){B}
\uput[0](N1){N1}\uput[220](N2){N2}
\end{pspicture}
\end{LTXexample}
\vspace{1pc}
\begin{LTXexample}[width=.375\textwidth]
\begin{pspicture}[showgrid](-.5,-.5)(3.5,3)
\def\fn{1.5+sin(t)+.4*sin(2*t)%
| 1+cos(t)+.2*cos(2*t)+.2*sin(4*t)}%
\pnode(.8,.6){A}\pnode(2.5,-.5){B}
\psset{plotpoints=100}
\psparametricplot[algebraic]{0}{6.283}{\fn}
\curvepnodes{0}{6.283}{\fn}{Z}
\polyIntersections{N1}{N2}(A)(B){Z}{99}
\psdots(A)(B)\psline(N1)(N2)
\uput[90](A){A}\uput[-60](B){B}
\uput[70](N1){N1}\uput[180](N2){N2}
\end{pspicture}
\end{LTXexample}
\vspace{1pc}
\begin{LTXexample}[width=.375\textwidth]
\begin{pspicture}[showgrid](-.5,-.5)(3.5,3)
\pnodes{P}(0,.5)(3,.5)(2.5,2)(.5,2.5)(0,.5)
\pnode(1,1.1){A}\pnode(2,1.5){B}
\polyIntersections{N1}{N2}(A)(B){P}{3}
\psnline(0,3){P}
\psdots(A)(B)
\psclip{\psframe[linestyle=none](-.5,-.5)(3.5,2.5)}
\psline(N1)(N2)\endpsclip
\uput[-60](A){A}\uput[-60](B){B}
\uput[0](N1){N1}\uput[-180](N2){N2}
\end{pspicture}
\end{LTXexample}
\vspace{1pc}
\begin{LTXexample}[width=.375\textwidth]
\begin{pspicture}[showgrid](-.5,-.5)(3.5,3)
\def\func{x+sin(2*x)}
\psplot[algebraic]{0}{3.14}{\func}
\fnpnodes[algebraic]{0}{3.14}{\func}{P}
\pnode(.6,.8){A} \pnode(1.5,1.1){B}
\polyIntersections{N1}{N2}(A)(B){P}{49}
\psdots(A)(B)
\uput[-90](A){A}\uput[-90](B){B}
\psline(N1)(N2)
\psset{linestyle=dashed}
\psline(N1)(N1 | 0,0)
\psline(N2)(N2 | 0,0)
\uput[70](N1){N1}\uput[170](N2){N2}
\end{pspicture}
\end{LTXexample}
\vspace{1pc}
\begin{BDef}
\Lcs{ArrowNotch}\Largb{<NodeName>}\Largb{<nodeindex>}\Largb{<direction>}\Largb{<Notch>}
\end{BDef}
takes as inputs the root name of the node sequence, the index at which the arrow
tip is to be drawn, and the direction (one of \verb+>,<+) of the arrow. It then
constructs the notch as a node with name \verb|<Notch>|. The arrowhead may then be
drawn with a command like \Lcs{psline}\verb|{->}(N)(P3)|, assuming the tip was to be \texttt{P3}
and the notch was \texttt{N}. Keep in mind that the macro takes its settings for linewidth,
arrowscale, etc from the current values, so it is generally preferable to include them
in a \Lcs{psset} before drawing the curve and calling \Lcs{ArrowNotch}.
(Alternatively, they may be included as optional settings in \Lcs{ArrowNotch}.)
The first example below shows a case where the native arrow direction is not
good. The second shows how to make a version using \Lcs{ArrowNotch}. Notice that the minimum and maximum
parameter values in the second example had to be modified to keep the curve
from protruding near the end arrowheads.
\Lcs{ArrowNotch} is a computationally expensive macro (quadratic in \texttt{plotpoints}) designed to
improve the placement of arrows on curves in those cases (high curvature, large values of
linewidth, arrowscale, etc) where the native arrow direction is not optimal. The macro
depends on the construction of a node sequence, say \texttt{P0..Pn}, of samples of the curve
(eg, with \Lcs{curvepnodes}) from which it computes the position of the notch of the arrow
so that, when drawn, the arrow notch will be located on the curve in all cases. It operates
with only two particular arrow shapes---those arrows specified with either
\verb|->| or \verb|-D>|, or their reverses.
\begin{LTXexample}[width=.375\textwidth]
\def\fn{1.5+1.5*cos(t) | 1+sin(t)}
\psset{linewidth=2pt,arrowscale=3}
\begin{pspicture}(0,0)(3.5,3)
\psparametricplot[algebraic,arrows=<->]{PiDiv2 neg}{Pi}{\fn}
\end{pspicture}
\end{LTXexample}
\vspace{1pc}
\begin{LTXexample}[width=.375\textwidth]
\def\fn{1.5+1.5*cos(t) | 1+sin(t)}
\psset{linewidth=2pt,arrowscale=3}
\begin{pspicture}(0,0)(3.5,3)
\curvepnodes{PiDiv2 neg}{Pi}\fn{P}%create P0..P49
\ArrowNotch{P}{0}{<}{Q}
\ArrowNotch{P}{49}{>}{R}
\ArrowNotch[arrowscale=1.5]{P}{27}{>}{S}
\psparametricplot[algebraic]{-1.47}{2.95}{\fn}
\psline{->}(Q)(P0)
\psline{->}(R)(P49)
\psline[arrowscale=1.5]{->}(S)(P27)
\end{pspicture}
\end{LTXexample}
\section{Reading external data and save it as nodes}
\begin{BDef}
\Lcs{saveDataAsNodes}\Largb{<data>}\Largb{<Nodeprefix>}
\end{BDef}
The macro \Lcs{saveDataAsNodes} allows to read $x|y$ values from an external data file
and save the coordinates in nodes named \texttt{<Nodeprefix>i>} where $i$ is the nodecounter,
starting at 0. The last loop index is saved in the counter \Lctr{psLoopIndex} and the last
node is saved as \nxLenv{<Nodeprefix>Last}
\begin{filecontents*}{node.data}
12 12
12 13
13 15
15 15
15 13
13 12
12 10
10 8
8 8
8 10
\end{filecontents*}
\begin{LTXexample}[pos=t]
\begin{pspicture}(6.5,6.5)(16.5,16.5)
\psaxes[axesstyle=frame,ticksize=0 9cm,tickcolor=black!20,Ox=7,Oy=7](7,7)(16,16)
\saveDataAsNodes{node.data}{N}
\psset{radius=2.5mm,arrows=->,arrowscale=1.5,nodesep=2.7mm,linewidth=1.3pt}
\Cnodeput[linecolor=red]{0}(N0){foo}{0}
\multido{\iA=1+1,\iB=0+1}{\the\psLoopIndex}{%
\Cnodeput{0}(N\iA){foo}{\iA}\ncline{N\iB}{N\iA}}
\ncline[linecolor=blue,linestyle=dashed]{N8}{N3}
\ncline[linecolor=red,linestyle=dashed]{N0}{NLast}
\end{pspicture}
\end{LTXexample}
\clearpage
\section{List of all optional arguments for \texttt{pst-node}}
\xkvview{family=pst-node,columns={key,type,default}}
\nocite{*}
\RaggedRight
\printbibliography
\printindex
\end{document}
https://tex.stackexchange.com/questions/102558/how-do-we-explain-the-behavior-of-rput-psgetnodecenter-and-savenodecoors/163411#163411
|