1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
|
% \iffalse meta-comment
%<*internal>
\begingroup
\input docstrip.tex
\keepsilent
\preamble
______________________________________________________
The TOPtesi package
Copyright (C) 2014 Claudio Beccari
All rights reserved
License information appended
\endpreamble
\postamble
Copyright 2005-2014 Claudio Beccari
Distributable under the LaTeX Project Public License,
version 1.3c or higher (your choice). The latest version of
this license is at: http://www.latex-project.org/lppl.txt
This work is "author-maintained"
This work consists of this file toptesi.dtx, a README file
and the derived files:
toptesi.cls, toptesi.sty, topfront.sty, topcommand.sty,
toptesi.cfg, and the English documentation toptesi.pdf.
Furthermore the bundle contains the documentation source
file toptesi-it-xetex.tex and the derived file
toptesi-it-xetex.pdf.
The toptesi-example.tex source file is just an example
that shows how to use the various commands; by commenting
or uncommenting certain source lines it is possible to
typeset different kind of theses and their front pages.
The topfront-example.tex source file is an example of how
to produce just the title page with toptesi and the external
package frontespizio.
The toptesi.cfg file is a sample of a local configuration
file that can be freely edited and modified.
By running pdflatex on toptesi.dtx the user gets the class,
sty and cfg files and the English documentation file in
pdf format.
The documentation file toptesi-it-xetex.pdf is in Italian;
its source file is another example of how to use toptesi.
\endpostamble
\askforoverwritefalse
\generate{\file{toptesi.cls}{\from{toptesi.dtx}{class}}
\file{toptesi.sty}{\from{toptesi.dtx}{topsty}}
\file{topcoman.sty}{\from{toptesi.dtx}{topcmn}}
\file{topfront.sty}{\from{toptesi.dtx}{topfrn}}
\file{toptesi.cfg}{\from{toptesi.dtx}{topcfg}}
}
\def\tmpa{plain}
\ifx\tmpa\fmtname\endgroup\expandafter\bye\fi
\endgroup
%</internal>
%
% Copyright 1989--2013 Claudio Beccari
%
% This file is part of the TOPtesi bundle
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
%
% This file has the LPPL maintenance status "author-maintained".
%
% The list of all files belonging to the TOPtesi bundle is
% given in the file `manifest.txt'.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the self unpacking file toptesi.dtx
% which is part of the distribution.
%
% \fi
%
% \iffalse
%<*driver>
\documentclass{ltxdoc}
\ProvidesFile{toptesi.dtx}[2014/11/02 v.5.83 Documented TeX file for
the TOPtesi bundle]
\GetFileInfo{toptesi.dtx}
\title{The TOPtesi bundle}
\date{\fileversion\space--- \filedate}
\author{Claudio Beccari}
\usepackage{metalogo,multicol}
\def\prog#1{\textsf{#1}}
\def\pack#1{\textsf{\slshape#1}}
\begin{document}\errorcontextlines=9
\maketitle
\begin{multicols}{2}
\tableofcontents
\end{multicols}
\setlength\hfuzz{20pt}
\DocInput{toptesi.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{2870}
%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%
% \begin{abstract}
% This file describes the TOPtesi bundle; it is a set of files designed to
% typeset a university final report that in Italian is generally
% called ``tesi''; it was originally developed at the Technical University
% of Turin (Politecnico di Torino) but it was adapted for typesetting theses in any
% Italian university. Well\dots\ since the Erasmus student mobility is very
% extended and many Italian students participate in the so called \textit{double degree}
% programs, their theses, or whatever they are called in other countries,
% may be typeset so as to comply also with the host university rules; therefore this
% set of files has the ambition to be suited for typesetting theses in any university
% in the world\dots\ This ambition can't be fulfilled, though, because of the complexity
% of the title page (and possibly of the legal page) requirements. This version is
% experimentally compliant with the \XeLaTeX\ and the \LuaLaTeX\ programs. Up to now
% the few conflicts that have been spotted have been solved with suitable corrections
% or additions. The most important feature with \XeLaTeX\ is that the option pdfa
% cannot be used any more, because it resorts to a compilation with pdf\LaTeX;
% the typesetting engine \XeTeX\ does not produce directly any PDF output but
% a modified, extended DVI output, that is immediately converted into a PDF file
% through xdvipdfmx, a special version of the conversion program. Another minor
% \XeLaTeX\ feature is that it cannot fully exploit the typesetting facilities
% of the microtype package, but the wide choice of OpenType fonts replaces almost
% completely such missing features.
% \end{abstract}
%
% \section{Introduction}
% The TOPtesi bundle contains a certain number of files, specifically
% \begin{enumerate}
% \item a class file \texttt{toptesi.cls} to be used as the main document class; the main
% document may be any of a certain number of reports that in Italy
% are called with various names: ``monografia'', ``monografia di laurea'',
% ``tesi di laurea'', ``tesi di laurea specialistica'', ``tesi di laurea
% magistrale'', ``tesi di dottorato'', ``dissertazione di dottorato'', and so on.
% All these documents have in common the fact that they all conclude a period of
% university education. Moreover since they may conclude a double degree university
% program, they may receive foreign names such as, for example, ``Projet de fin d'\'etudes'', ``Master thesis'', and the like.
% \item An extension package \texttt{toptesi.sty} that contains most of the code
% for the real typesetting; it might be used as an extension to the report class file,
% although this use is discouraged.
% \item A second extension package \texttt{topfront.sty} that contain the commands
% and the typesetting macros for the title page; this file may be used as an
% independent extension package to be added to, say, the report class file for
% typesetting just the title page; this file might be used as a template for setting
% up the title page fixed information in languages different from Italian.
% This package is part of the bundle, but it is loaded automatically only if
% the user did not specify the class option |usefrontespizio|; if this option
% is specified the user is free to use whotever other external package s/he
% prefers in order to typeset the tile page; in this case we suggest to use
% the package |frontespizio| and we address the user to its documentation.
% \item A third extension package \texttt{topcoman.sty} that defines a certain number
% of user commands suitable for typesetting technical matters.
% \item Previous version of this bundle contained also the logos of a certain number of
% universities; these logos are not distributed anymore because of legal constraints.
% Every one who is working on his/her degree course final report must retrieve the
% logo of his/her university, but s/he should pay attention to use it according
% to the rules and limitations of the university.
% \item A documentation file \texttt{toptesi-it-xetex.pdf} written in Italian
% where every feature is explained in detail; essential information is given
% in this English documentation. The source file of the documentation
% \texttt{toptesi-it-xetex.tex} may be used as a sample or template for
% typesetting one's thesis with XeLaTeX.
% \end{enumerate}
%
% The above files are complemented with a configuration file that any user may
% customise at will; these customisations make it easy to configure the
% bundle so as to make it suitable for another language; in facts the
% \textsf{babel} and \textsf{polyglossia} packages contain localisations
% for many languages, but such localizations deal with the standard infix
% \LaTeX\ names and phrases and do not cope with the thesis title page requirements.
% This customisation is usable only if Non |usefrontespizio| option had been
% declared to the class.
%
% TOPtesi was specifically conceived for typesetting theses with the \LaTeX\ mark-up,
% and initially it was using the \textsf{tex} typesetting engine; later on this engine
% was substantially substituted by the \textsf{pdftex} engine, which was capable
% of direct output of PDF files. Since about 2006 the typesetting engine \XeTeX\
% is available; the most important feature of this engine is its capability
% of using OpentType fonts, among which those that are available to the
% operating system of the specific platform where the document is being typeset.
% For what concerns theses this might be of essential importance when the thesis
% deals with specific languages that use different scripts (Greek, Russian,
% Bulgarian, Chinese, Japanese, Korean, Hebrew, Arabic, Farsi, Thai, and so on).
%
% This version of TOPtesi has been tested with \XeLaTeX. Some conflicts have
% been spotted and solved; may be there are still hidden ones, so that feedback
% from users is particularly welcome. The only main drawback still present
% when running \XeLaTeX\ is the fact that this program cannot still
% \emph{directly} produce the output file in PDF format, although it
% automatically transforms its specific output file into PDF format. This
% implies that the specific \textsf{pdftex} features required to produce
% a PDF/A compliant output PDF file suitable for long term archiving cannot
% be used. But with some attention the PDF file output by \XeLaTeX\ may be
% converted to PDF/A by using the program \prog{ghostscript}.
%
% \section{User commands}
% The \texttt{toptesi.cls} is basically an extension of the standard class
% \texttt{report.cls}; it redefines the page typesetting grid, the headers
% and the footers, and the title page layout and commands. \texttt{toptesi.cls}
% does not set such crazy settings as ``double spaced'' text; it is intended
% to typeset the thesis with the quality of a \LaTeX\ well typeset document,
% not as a typewriter written one.
%
% Theses very often are full of specialised material: formulas, diagrams and pictures,
% texts written in non latin alphabets, special symbols for philological mark-up, and
% the like; a common typewriter would not be suitable and the quality of the contents
% requires professional typesetting; this is why I strongly believe that instructions
% on typesetting styles that refer to the ``gone by times'' of mechanical typewriters
% should be banned.
%
% At the same time the class allows to typeset theses on any paper format;
% nowadays, in facts, Universities are requesting theses in smaller formats
% than A4 or letter paper. With smaller paper sizes the layout changes
% automatically, but the title page might require some more attention. The
% default paper size is A4, but the user can seta any paper size among those
% accepted by the |report| standard class. If the |usefrontespizio| option
% was specified and the package |frontepsizio| was loaded by the user, it
% is necessary to remind that it can easily create pretty nice title pages, but only
% either on A4 paper or on a paper format that mimics that of the famous book
% \emph{Elements of typographic style} by Robert Bringhurst; this is so at
% least with |frontespizio|'s version 1.4a of 2011/09/21 or earlier.
%
% Therefore if you want to typeset your thesis while typesetting the title
% page by means of the functionalities of package |frontespizio| you have
% to follow carefully how to use that package's options in the proper way
% as to bypassa the two fixed formats that it can produce; May be when you
% happen to use the TOPtesi bundle, the author of |frontespizio| has already
% extended his package in order to let it recognise the various paper formats
% used for the rest of the thesis. See also the Italian documentation contained
% in the document |toptesi-it-xetex.pdf|.
%
% Most new commands refer themselves to the information that should be typeset
% in the title page; some class options specify special stylistic page details;
% the rest is simple and traditional \LaTeX\ mark-up as it is implemented in
% the \LaTeX\ kernel and in the report document class. If \XeLaTeX\ has to be
% used, some essential preamble specific commands are to be used, but essentially
% the body of the thesis has the same mark-up.
%
% \subsection{Class options}
% The class accepts all the options accepted by the |report| document class
% plus the ones defined here:
% \begin{description}\def\Item[#1]{\item[\texttt{#1}]}
%
% \Item[chapterbib] Allows to typeset a list of references at the end
% of each chapter and the bibliography items are numbered with a \emph{chapter.item}
% indication. This implies a manual build up of each end-of-chapter bibliography
% by means off a specific |thebibliography| environment. This works may be
% avoided if the user relies on the various packages already available in any
% complete \TeX\ system distribution and the facilities offered by packages
% such as \pack{biblatex} and sorting end formatting engines such as \prog{biber}.
%
% \Item[classica] Specifies a general modification of certain details that are
% supposed to be more adequate in the humanities fields; specifically this option
% lets old style numbers to be used for certain numerical pieces of information;
% some variations are also introduced in the title page.
%
% \Item[cucitura] In two sided printing it is better to move the
% typesetting grid towards the outer edges so as to cope with the thesis binding
% that is generally not made up by sewing together a number of signatures;
% the default outer displacement is fixed to~7mm, but it can be customized by means
% of a proper entry in the configuration file or by an explicit command in the preamble.
%
% \Item[14pt] Extends the normal size choice to 14 points; it is appreciated
% in various fields of humanities, but I would discourage this use in a technical
% thesis, where 10 point perhaps is too small, but 11 point or 12 point typesetting
% may be adequate.
%
% \Item[autoretitolo] This option modifies the left hand (even numbered) pages
% in two side typesetting; normally the even numbered page headings contain
% the chapter title, while the odd numbered ones contain the current section title.
% If the \texttt{classica} option has been specified, then with this option it is
% possible to have even numbered headings contain the author's name and the thesis
% title, while the odd numbered ones contain the chapter title. Since the thesis
% title might be too long to fit in the header together with the author's name,
% the |\title| macro as been modified so as to accept an optional short title,
% similarly to the sectioning commands.
%
% \Item[oldstyle] Also this option works only if \texttt{classica} had already been
% specified; it typesets several numerical data with the old style numbers.
%
% \Item[usefrontespizio] allows the user to load a different package for
% creating and typesetting the title page; of course if this option is
% specified, the native package |topfront| is not loaded, and the commands
% described in the next section are not available. On the opposite commands available
% with the chosen package become available, while possible package conflicts are
% eliminated at the root.
%
% \Item[noTOPfront] is basically equivalent to the previous option; both
% options set up the |\ifTOPfront| switch that is more mnemonic than the long
% (actually not defined) |\iffrontespizio| one; if it was defined, |\iffrontespizio|
% would be true when |\ifTOPfront| is false.
% \end{description}
%
% \subsection{Title page commands}
% Note: Skip this section if you decide to load an external package for
% the title~page. Notice also that if you want to load an external package for
% typesetting the title page, you should load it \emph{after} specifying
% the input encoding you use for your text files.\bigskip
%
% \noindent The user must specify a certain number of commands in order to have the
% title page contain all the required information. It must be specified that
% most of these commands may be used in the configuration file so as to avoid repeating
% the same data for different ``reports''; well, a university student might write a
% bachelor's ``monografia'', then a master thesis and finally a doctoral dissertation;
% why should s/he repeat his/her name, the name of the institution, and so on?
%
% All the user commands for the title page redefine default values or strings;
% therefore if none of the required information is given, the default values and strings
% are typeset, possibly with hilarious results\dots
%
% Since most users are supposed to be Italian, the user commands are mostly in Italian;
% the following description gives their names and meanings; every command receives one
% argument; only the command |\title| accepts an optional argument according to the usual
% \LaTeX\ syntax:
% \[
% \makebox[0pt]{%
% \texttt{\char92}\emph{command}\relax
% \texttt{[}\emph{opt\_arg}\texttt{]}\relax
% \texttt{\char123}\emph{req\_arg}\texttt{\char125}\relax
% }
% \]
% \begin{description}
% \def\cs#1{\texttt{\char92#1}}
% \def\Item[#1]{\item[\normalfont\cs{#1}]}
% \Item[frontespizio] is the actual command that typesets the title page and
% this command uses all the information that is passed
% to it by means of the following commands.
% \Item[monografia] sets the bachelor's report style and retrieves its title
% \Item[titolo] gets the master or PhD thesis title and an optional thesis short title
% \Item[sottotitolo] gets the thesis subtitle if any
% \Item[materia] gets the name of the subject the thesis deals with
% \Item[Materia] alias for \cs{materia}
% \Item[direttore] gets the name of the Doctoral School Director
% \Item[coordinatore] gets the name of the Doctoral School Coordinator
% \Item[QualificaDirettore] gets the phrase that describes the director or coordinator
% official position; by using the command \cs{direttore} the
% default phrase
% ``Direttore della Scuola di Dottorato'' is printed above the
% ``director's'' name;
% if \cs{coordinatore} is used the default phrase ``Coordinatore della
% Scuola di Dottorato'' is printed instead.
% If neither one is applicable or a description
% in another language is required, this macro is available for
% specifying such position.
% \Item[relatore] gets the name of the thesis first supervisor
% \Item[secondorelatore] gets the name of the second supervisor
% \Item[terzorelatore] gets the name of the third supervisor; it is assumed that the
% number of supervisors never exceeds three.
% \Item[tutore] gets the name of the doctorate tutor; there is no difference
% with regards to the \cs{relatore}, but the default phrase
% ``Tutore'' is printed above this person's name.
% \Item[TutorName] gets the phrase that describes the tutor position, possibly
% in a different language.
% \Item[AdvisorName] gets the string that qualifies the supervisor(s); the default string
% is ``Relatore:'' or ``Relatori:'' for the plural;
% in another language this command is used to define the string,
% say, ``Supervisors:'' if the thesis has been supervised
% by more than one person.
% \Item[CoAdvisorName] gets the string that qualifies the co-supervisor(s); the default
% string is ``Correlatore:'' or ``Correlatori:'' in the plural; this
% command may be used to define the string, say, ``Corapporteur:'' in a
% French Projet de fin d'\'etudes.
% \Item[candidato] gets the name of the male author
% \Item[candidata] gets the name of the female author
% \Item[secondocandidato] gets the name of the second male author
% \Item[secondacandidata] gets the name of the second female author
% \Item[terzocandidato] gets the name of the third male author
% \Item[terzacandidata] gets the name of the third female author; most often the thesis
% author is just one person; but there are some institutions where group
% final works are accepted; it is assumed that the group does not contain
% more than three authors. The specification of the gender allows the
% software to determine the correct labelling phrase in the proper
% gender and proper number.
% For different languages there might be no difference in gender but
% there is a difference in the plural ending.
% \Item[CandidateName] gets the string that describes the student status in a foreign
% language or even in Italian; the default string is ``Candidato:'' (with
% colons) adjusted to masculine or feminine, singular or plural; with the
% option \texttt{classica} the string becomes ``Laureando:''; in other
% languages it is necessary to specify this string in the proper gender
% and number.
% \Item[sedutadilaurea] gets the date of the final exam, or presentation, or defense
% of the thesis; if this date is omitted the default date is the current
% month and year in Italian.
% \Item[esamedidottorato] an alias for \cs{sedutadilaurea} to be used for doctoral
% dissertations.
% \Item[ciclodidottorato] gets the roman numeral that specifies the doctoral cycle.
% \Item[CycleName] redefines the string that expresses the name of the doctoral cycle;
% by default this is ``ciclo'' but this command is useful to set the
% name in a different language.
% \Item[corsodilaurea] gets the proper name of the degree course; the phrase that
% describes the degree course is specified, if necessary, with the
% following command; with this one you specify just, say,
% ``Electrical Engineering''
% \Item[CorsoDiLaureaIn] gets the generic name of the degree course, for example
% ``Bachelor Degree in\textvisiblespace''
% \Item[TesiDiLaurea] gets the generic phrase that describes the thesis; by default it is
% ``Tesi di Laurea''; in English one might set it to ``Master Thesis''.
% \Item[NomeMonografia] gets the phrase that describes the bachelor's report; by default
% it is ``Monografia di Laurea''. In some Italian universities it might
% be called ``Tesi di Laurea'', so that the master thesis should be given
% another qualification, for example ``Tesi di Laurea Magistrale''.
% \Item[NomeDissertazione] gets the phrase that describes the doctoral thesis;
% by default it is ``Tesi di Dottorato''.
% \Item[InName] infix strings often require adjusting of the prepositions; this macro
% gets the preposition that stands for ``in'' (the default). In German
% it might become ``auf''.
% \Item[NomeAnnoAccademico] defines the infix string that stands for ``Academic year''.
% This macro is defined only if the option \texttt{classica} is in force;
% after all the command |\annoaccademico| is defined only with that
% option.
% \Item[logosede] specifies the name of the file or the files that contain the university
% logos; no default is defined; rather a warning message is issued if no
% name is given or the file is missing, but typesetting goes on without
% the inclusion of any logo. a list of logos can be specified, useful
% when a thesis is carried on in a multiple University environment
% such as, for example, in a double degree Erasmus
% program; or under the Erasmus Mundus program. The ``string'' of
% logos is scaled properly so that they may fit in the |\textwidth|.
% \Item[setbindingcorrection] sets up the length to displace the text block to the
% external margin so as to have a wider internal margin to accommodate
% the binding correction. Its argument is not optional and is used to
% modify the default correction of 7\,mm.
% \Item[retrofrontespizio] with its argument, made up one or several paragraphs, defines
% what should be printed on the verso of the title page, generally named
% ``copyright page''; if this command is specified with an empty
% text or if it is not used at all, no copyright page is assumed.
% \end{description}
%
% Since the infix strings are all memorised into control sequences and for each of
% them it is possible to use a defining command, all strings can be modified at will,
% so that there is no difficulty to localise the package in another language;
% this comes particularly handy for the Erasmus students on double degree programs.
%
% As a final remark notice that the commands for typesetting the title page and the
% copyright page are contained in the package \texttt{topfront.sty}, which can be used
% as an autonomous extension to the \texttt{report} document class. One could easily
% typeset either just the title page with a separate \TeX\ source file so as to test the
% completeness of the commands and coherence of the configuration file, or for just
% printing the isolated title and copyright pages (if any).
%
% \subsection{Typesetting commands}
% The bundle and the TOPtesi document class accept all \LaTeX\ commands provided by
% the \LaTeX\ \texttt{kernel}, the \texttt{report} document class, and the
% \texttt{graphicx} extension package, besides those provided by the \texttt{babel}
% package.
% If the source thesis file is being typeset by means of \XeLaTeX\ the \texttt{babel}
% package is not loaded; in its place the \texttt{polyglossia} package is loaded that
% should implement in \XeLaTeX\ most of the functionality provided by \texttt{babel} to
% \LaTeX. ``Most'' means that not all the functionality is available, therefore it's
% better to consult the documentation of \texttt{polyglossia} before using its built
% in commands.
%
% With this respect it must be underlined that the Italian and English languages are
% specified by default, the Italian one being the default language. An initial
% specification of |\selectlanguage{english}| sets the English language as the default.
% Should a student typeset the thesis in French by means of \textsf{pdflatex}, it
% would be necessary to specify the option \texttt{french} among the \emph{class}
% options, and then start the document by specifying |\selectlanguage{french}|.
% But the user should pay attention to use \texttt{babel} in the proper way:
% \begin{enumerate}
% \item Due to the way \LaTeX\ classes load the requested files, and to the fact that the
% \texttt{babel} package has already been loaded by the \texttt{toptesi} class, the user
% cannot reload it with a different list of language options; therefore the latter
% language options \emph{must be specified} as global class options; so if the thesis has
% to be typeset, for example, in French, is is necessary to do the following:
%\begin{verbatim}
%\documentclass[...,french,...]{toptesi}
%...
%\begin{document}
%\selectlanguage{french}
%\end{verbatim}
% But if the thesis should be typeset in French by means of \XeLaTeX, then it i perfectly
% legal to specify the auxiliary language in this way:
%\begin{verbatim}
%\documentclass[...]{toptesi}
%\setotherlanguage{french}
%...
%\begin{document}
%\selectlanguage{french}
%\end{verbatim}
% \item With the 2010 \TeX\ system distributions, both \TeX Live and MiKTeX, all known
% (to \LaTeX) language hyphenation rules are preloaded; with other less up to date
% \TeX\ system distributions this might not be true. With both distributions also the
% languages hyphenation rules known to \XeLaTeX\ are all preloaded.
% Remember that \texttt{babel} and \texttt{polyglossia} macros select the language
% typesetting rules, but hyphenation is activated only if the program format file has
% been generated with the pertinent language hyphenation rules. You can check this
% detail by reading the first dozen lines of your thesis \texttt{.log} file; there
% the list of all language hyphenation rules that are available in the format file is
% being shown.
% While (American) English is the default and almost any \emph{basic} distribution
% of the \TeX\ system has several preloaded languages, it is more likely that French is
% preloaded while Italian is not. Complete distributions don't exhibit this flaw.
%
% Should the required language(s) be missing, the user is forced to read his/her
% distribution instructions, so as to find out how to configure his/her system so as to
% consider the languages s/he wants to work with, and finally s/he must recreate the
% format files.
% The user is invited to carefully investigate on these fine points and to properly
% configure the system; it would be very upsetting to use fine software for producing a
% perfectly typeset thesis that, unfortunately, has wrong hyphenation points! Luckily
% enough, recent distributions of the \TeX\ system have all the known hyphenation rules
% preloaded; in any case even older distributions have available command-line commands
% or graphical user interfaces that make it easy to perform the tasks of changing the
% list of preloaded hyphenation rules and rebuilding all the format files, moving them
% to the proper places.
% \end{enumerate}
%
% The TOPtesi bundle adds very little to the user commands; nevertheless the package
% \texttt{topcoman.sty}, that is part of this bundle and is automatically loaded, defines
% some useful commands for typesetting technical matters in such a way as to fulfil the
% ISO regulations.
% Some of these commands are already defined with the \texttt{babel} Italian option,
% but if your thesis is written in different languages it may happen that such
% commands are not available any more when you select another language; with the
% presence of the definitions contained in \texttt{topcoman.sty} such useful commands
% remain available with every language. The \texttt{polyglossia} package does not
% produce any useful additional command for writing in a ISO compliant way, therefore
% the macros contained in the \texttt{topcoman.sty} package come very handy.
%
% The following description specifies these particular commands.
% \begin{description}
% \def\Item[#1]{\item[\normalfont\texttt{\char92#1}]}
% \Item[DeclareSlantedCapitalGreekLetters] does exactly what its name
% means: it changes the definitions of the mathematical capital Greek letters so that
% they are typeset in ``italics''; they are in effects taken from the math
% italic alphabet, instead of the default roman one. This option is useful with \LaTeX,
% while with \XeLaTeX\ it is unnecessary due to the larger set of math alphabets and math
% font commands that are available with proper UNICODE math fonts.
% %
% \Item[ensuremath] should be already defined in the \LaTeX\ kernel;
% should one still be using an obsolete version, this command gets
% available anyhow.
% %
% \Item[ohm] typesets an upright capital omega even if the capital Greek
% letters are in italics; another good point is that |\ohm| can be used also
% in text mode.
% %
% \Item[ped] inserts a subscript in upright type; the ISO regulations
% require the use of italics for physical or mathematical quantities, and
% upright type for anything that is not a variable, from the names of
% functions (such as sin, cos, log, etc.), to the indices that contain
% information on something that is not variable. This means that $V_i$
% requires an italic index to imply that the object $V$ is the $i$-th in
% a set, while, say, $V_{\mathrm{max}}$ indicates the maximum value of the
% variable $V$. This command |\ped| may be used both in math and in text mode.
% %
% \Item[ap] similarly |\ap| inserts an apex in upright type, both in math
% and in text mode.
% %
% \Item[unit] sets the unit of measure close to the numerical measure by
% inserting a non breakable thin space and by setting the units of
% measure in upright type; this works both in math and text mode. Of
% course it is necessary to input the |\unit| command without intervening
% spaces in the source file; it's necessary to typeset, say,
% |35\unit{km}| and to avoid to input \verb*+35 \unit{km}+. This command,
% as it is defined, conflicts with the definition of the homonymous
% command |\unit| as defined by the \texttt{unitsx} package, but since
% this latter package is necessarily input \emph{after}
% \texttt{topcomand.sty} is read, the last definition is the one in
% force, therefore if one wishes to use the \texttt{unitsx} package s/he
% should not encounter any inconsistencies.
% %
% \Item[micro] sets the decimal prefix $\mu$ in typesetting units of
% measure.
% %
% \Item[gradi] sets the small circle that defines the sexagesimal degrees, for
% example $35^\circ$; it may be used also for the celsius degrees by writing in the
% source file, say, |35\unit{\gradi C}| in order to get
% $35\,^\circ\mathrm{C}$.
% %
% \Item[gei] inserts the imaginary unit in upright type with the
% ``spelling'' used by the technologists: ``j''. This command may be
% redefined, of course, but this strange name is due to the fact that
% nowadays the letter ``j'' in Italian is called with the English name
% (much shorter than the traditional Italian name ``i~lunga'') and the
% indicated spelling ``gei'' is the phonetic Italian rendering of the
% English word. The imaginary unit is not a variable, and the ISO regulations
% require it is typed with an upright serifed font, just as operators are.
% %
% \Item[eu] inserts the Napier number symbol ``e'' in upright type; since
% this entity is not a variable, but it is a mathematical constant, the
% ISO regulations require it to be written in upright type. The ISO regulations require
% the upright type for ``e'' and any mathematical constant, but
% the electron charge $e$ is typeset in math italics because this physical
% ``constant'', not a mathematical one. \XeTeX\ allows to typeset upright Greek letters,
% so there is the facility to typeset an upright ``pi'' (the number) to be distinguished
% from an slanted ''pi'' (the angle).
% %
% \Item[listing] requires for its argument the name of a file and typesets it in verbatim
% mode; this command is very useful for typesetting the listings of the programs that
% were written for the thesis; for best results it is recommended that the source
% program has lines not longer than 80 characters. There exists an external package
% \texttt{listings}, that the user might want to load, that does a similar work in
% a more professional and configurable way; this package simpler command might be
% preferable for its simplicity, but of course it is not compulsory.
% \end{description}
%
% All these commands are defined into the separate package \texttt{topcoman.sty}
% that might be used as an independent extension package with any document class.
%
% \section{PDF format suitable for archiving}
% This section in general does not apply if the thesis is typeset by means of \XeLaTeX,
% because the typesetting engine in this case cannot directly produce a PDF formatted
% output file. For this reason the option \texttt{pdfa}, that shall be described
% shortly, should not specified to the class |toptesi|; at the same time if this
% option is specified, but the thesis is typeset by means of \XeLaTeX, the effects
% of this options are be disabled.
%
% Politecnico di Torino as well as many other Italian and foreign universities are
% moving towards archiving theses in electronic format, specifically in the PDF one. The
% problem of course is: ``Will it be possible to read the archived documents, say, fifty
% years from now?''
%
% This essential question has been answered by the International Standards Organisation
% (ISO) that in 2005 published the regulation ISO~19005-1. This regulation defines a
% PDF variant suitable for archiving, named PDF/A, that has two sub-formats
% distinguished as PDF/A-1a, and PDF/A-1b. The `a' sub-format is more exacting, while
% the `b' one is less stringent. Recently ISO has published an upgrade to these
% regulations, but here we stick to the older ones, that are a sub set of the newer ones,
% and for which suitable software is available.
%
% The requirements for the `a' sub-format imply not only those imposed on the `b' one,
% but also that all characters are conforming to UNICODE and that the logical structure
% of the document be maintained. The requirements for the `b' sub-format are that the
% document must be reproducible without modifications exactly as it was at the moment
% of archiving. Both sub-formats must contain \emph{metadata} that are searchable even
% without decompressing the normally compressed PDF file, and that contain information
% useful for archive maintenance; among these informations, of course, the PDF/A
% category the document belongs to, the document title, the authors, and few other
% optional information, such as the keywords that ease up library searches.
%
% Since version 1.40, the program \texttt{pdflatex} is capable of producing PDF/A-1b
% conforming files, provided that some attention is put into the manipulation of the
% source file of the thesis. With the distribution of the 2008 version of the \TeX\
% system, the executable \texttt{pdflatex} has version number 1.40.9 (or higher)
% and is capable of producing PDF/A-1b files.
%
% The particular attention needed to avoid problems with the PDF/A certification is
% summarised as follows:
% \begin{enumerate}
% \item The preliminary essential requirement is that the \texttt{pdflatex} engine used
% to typeset the thesis be sufficiently recent to support the PDF/A requirements. It's
% better to have the most recent distribution of the \TeX\ system installed on your PC.
% Do not try to typeset the thesis with the `old' \LaTeX; you \emph{must} process the
% input thesis file(s) with \texttt{pdflatex} or with \prog{xelatex}; in the following,
% no specific check will be made in order to verify if you are actually using
% \texttt{pdflatex}. If you really need to use the `old' \LaTeX, you get a DVI
% file and you need to transform it with |dvips| into a PS file; at this point you
% have lost the possibility of exploiting the internal commands of |pdflatex| version
% 1.40.9 or later. You can still produce a PDF/A final document, but you have to
% transform it by means of |ghostscript|; read the |ghostscript| (version 8.61 or later)
% documentation file |ps2pdf.html| in order to find out how to produce the correct PS
% to PDF/A transformation. A procedure similar to this one is available when the
% thesis is typeset by means of \XeLaTeX, and produces valid results provided some
% caution is exercised when using fonts.
%
% \item Your up-to-date complete \TeX\ distribution should contain the package
% \textsf{pdfx}; if it does not, upgrade your \TeX\ system complete distribution.
%
% \item Install in the main \texttt{pdfx} directory a good version of a color model
% profile file, such as, for example, \texttt{ECI-RGB-V1.0.icc} (see the download
% page of the site \texttt{www.eci.org}).
%
% \item If your thesis main file, the one you run your \texttt{pdflatex} on, is named,
% say, \texttt{JohnSmithMasterThesis.tex}, prepare in the same directory another file
% named \texttt{JohnSmithMasterThesis.xmpdata} that contains the \emph{metadata}
% relative to the thesis; pay attention to follow the stringent syntax described and
% exemplified in the \textsf{pdfx} documentation. A minimal set of \emph{metadata}
% example would be the following one:
% \begin{verbatim}
% \Title{Experiments in Trichotetratomy}
% \Author{John Smith}
% \end{verbatim}
% Keywords require a specific XML style format that can be examined in the package
% documentation.
%
% \item Some mathematical symbol commands obtained from the standard \LaTeX\ set-up
% and the standard mathematical fonts require some patching that is already included
% in this \texttt{TOPtesi} bundle; but it is not excluded that with other fonts similar
% patches might be requested. The UNICODE math fonts used by \XeLaTeX\ do not require any
% patch, but unfortunately its PDF byproduct is not PDF/A compliant (it must be converted
% by means of \prog{ghostscript}).
%
% \item Use only PNG and JPEG images with RGB color profiles.
%
% \item If you include PDF images that contain some text, be sure that the fonts for
% this text are completely embedded in the included file. Should the PDF file come
% from an external drawing program be sure to configure that program so that it embeds
% all the fonts used in the image. If you don't succeed, open the PDF file with
% the free program \texttt{inkscape} and save it back in PDF format; the missing fonts
% will be replaced with their traced outlines and this will not disturb the PDF/A
% conformity.
%
% \item Verify your final PDF file with a suitable program and do not give up doing the
% necessary corrections or modifications while the verification program keeps saying
% that this or that is not conforming to the PDF/A specification. A suitable program
% is the Preflight plug-in of Adobe Acrobat Professional version 8 or later, but this,
% although the most authoritative, is a commercial program; probably your university
% has special facilities for this task.
%
% \item If you use \prog{xelatex} for typesetting your thesis, you have to accompany your
% master file with another one that contains the metadata and other necessary
% information.
% Be sure to call this auxiliary file has the masterfile name glued with |-def.ps|; so if
% your mastefile is named \texttt{JohnSmithMasterThesis.tex}, name this auxiliary file as
% \texttt{JohnSmithMasterThesis-def.ps} and fill in the necessary metadata and other
% technical information into this file in the lines marked with |% Customize|. Then run
% the \prog{ghostscript} program with the proper name (different for Windows or UNIX-like
% platforms) with the proper input parameters and options. There are strong chances that
% if you follow the general recommendations shown here and in the document
% |toptesi-it-xetex.pdf| file, the output file will be PDF/A compliant.
%\end{enumerate}
%
% Let's warn you: if you are using Adobe Reader X (or later), this program will open
% a PDF file beginning with an information header claiming that the file is PDF/A
% compliant; maybe it's true, but do not trust this information too much, at least don't
% believe that this information is a ``certification'' of the PDF/A compliance. I have
% seen files with this comforting information that did not pass the Preflight test!
%
% Up to today the realisation of PDF/A conforming files sets forth several problems
% that are of great concern for the large Institutions that have thousands of documents
% a year to archive; it is not a question implied in the free nature of the
% \prog{pdflatex} and \prog{xelatex} programs, that, on the opposite, according to my
% experience have a very high rate of success in producing PDF/A compliant documents.
% If you stick to the default \TeX\ system Type~1 256-glyph, or to the UNICODE encoded
% otf or ttf fonts and use this patched version of \texttt{TOPtesi} you should be able
% to avoid most problems.
%
% \StopEventually{} ^^A qui si puo' mettere una bibliografia
%
% \section{Documented code}
% \subsection{The class code}
%
% Here begins the usual machinery for stating the required \TeX\ format
% and for sharing some code between the driver and the class part of the code, since they are
% supposed to carry the same date and version number, besides the description string.
% \iffalse
%<*class>
% \fi
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{toptesi}%
[2014/11/02 v.5.83 Class for typesetting university theses]
% \end{macrocode}
%
% The class itself is very simple since it requires just the \texttt{report} document
% class and some packages with some default options. All options specified for the
% \texttt{toptesi} class are passed on to the \texttt{report} class; the |a4paper|
% option is made the default, but the user can call the class with any valid
% \LaTeX\ paper size. According to the \LaTeX\ machinery of option passing,
% the |\ExecuteOption| command assures that |a4paper| is the default size,
% but it is not being used if another paper size code is specified to the class.
% The same holds true for the other class options, except for the encoding code
% string because their passing machinery does not hold true for the \pack{inputenc}
% package; therefore this package is not loaded any more as it was in previous
% versions\footnote{Thanks to Enrico Gregorio who pointed out this feature.}
% of the class. On the opposite if another language is specified in the list of
% \pack{toptesi} class options, this language would be appended to the \pack{babel}
% package default options and, beware!, it would become the default language.
% \begin{macrocode}
\DeclareOption{a4paper}{\PassOptionsToClass{\CurrentOption}{report}}
\DeclareOption{titlepage}{\PassOptionsToClass{\CurrentOption}{report}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ExecuteOptions{a4paper,titlepage}
\ProcessOptions\relax
\LoadClass{report}
\RequirePackage{ifxetex}
\ifxetex
\RequirePackage{fontspec}
\RequirePackage{polyglossia}
\setmainlanguage{italian}
\setotherlanguage{english}
\renewcommand*{\iflanguage}[1]{\ifnum\the\language=\csname l@#1\endcsname
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
\else
\RequirePackage[english,italian]{babel}
\fi
\RequirePackage{toptesi}
%
% \end{macrocode}
% \iffalse
%</class>
% \fi
% \subsection{The \texttt{toptesi.sty} code}
% The greatest part of the \texttt{toptesi} class code is saved into a separate file
% partly for backward compatibility reasons (before version 3.x \texttt{toptesi} was just
% an extension to the \texttt{report} class) and partly because it might be used as a
% stand alone package, although, take notice, it might conflict with the \texttt{book}
% class code and certainly it is incompatible with the \texttt{article} class. This
% package must contain its own \TeX\ format declaration and might have different
% version and subversion numbers compared to the class file and the other invoked
% packages that are part of the same bundle.
%
% \iffalse
%<*topsty>
% \fi
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{toptesi}%
[2014/11/02 v.5.83 Extension for toptesi.cls]%
% \end{macrocode}
%
% We start with defining the debugging macros; these trace commands and macros
% are the usual ones I use for debugging. I know the \texttt{trace} package is supposed
% to be much better, but I am used to these ones.
% \begin{macrocode}
\def\TRON{\tracingcommands \tw@ \tracingmacros \tw@}
\def\TROFF{\tracingcommands\z@ \tracingmacros \z@}
\let\TROF\TROFF
% \end{macrocode}
% Now we define the specific package macros: \texttt{classica} and \texttt{trieste}
% are identical; the use of \texttt{trieste} is discouraged, but this option is
% maintained for backward compatibility.
% The option \texttt{14pt} is for choosing a normal size of 14pt; the class option
% file \texttt{size14.clo} is distributed with the \pack{extsizes} package and
% is already included in any complete distribution of the major \TeX\ system ones;
% in previous versions of this bundle there was a specific option class file for
% this large size, but with the latest complete distributions available, there
% is no chance that the existing option file is missing.
%
% \texttt{chapterbib} allows to set a list of references at the end of each chapter.
%
% For the options some boolean variables are
% defined and the option definitions set them to the value ``true''.
% \begin{macrocode}
\newif\if@utoretitolo \@utoretitolofalse
\newif\if@ldstyle \@ldstylefalse
\newif\if@xivpt \@xivptfalse
\newif\ifT@Pfrontespizio \T@Pfrontespiziofalse
\newif\ifTOPfront \TOPfronttrue
% \end{macrocode}
%
% A binding correction is established; its default value is parametrised to
% the paper dimensions, even if this correction should actually not depend
% on the aper size; the paper flexibility at the spine margin should be
% independent from its width; nevertheless large sizes allow for larger
% default corrections. In any case the user can override this setting by
% using the specific command |\setbindingcorrection|. The recommendation
% to the user is to not exaggerate with this correction. The options
% |usefrontespizio| and |noTOPfront| are synonymous; the latter one should be
% preferred to the former one.
% \begin{macrocode}
\newlength\T@Pbinding\setlength\T@Pbinding{7mm}
\def\setbindingcorrection#1{\T@Pbinding=#1}
\newif\if@binding \@bindingfalse
\newif\ifT@Ppdfa \T@Ppdfafalse
\newif\ifchapterbibliography \chapterbibliographyfalse
\newif\ifclassica \classicafalse
\DeclareOption{cucitura}{\@bindingtrue}
\DeclareOption{14pt}{\@xivpttrue}
\DeclareOption{chapterbib}{\chapterbibliographytrue}
\DeclareOption{trieste}{\classicatrue}% Just for backwards compatibility
\DeclareOption{classica}{\classicatrue}
\DeclareOption{autoretitolo}{\ifclassica\@utoretitolotrue\fi}
\DeclareOption{oldstyle}{\ifclassica\@ldstyletrue\fi}
\DeclareOption{pdfa}{\T@Ppdfatrue}
\DeclareOption{usefrontespizio}{\T@Pfrontespiziotrue\TOPfrontfalse}
\DeclareOption{noTOPfront}{\T@Pfrontespiziotrue\TOPfrontfalse}
%
\ProcessOptions\relax
% \end{macrocode}
% The \texttt{graphicx} package is loaded by default; it is required for inserting the
% university logo(s); if the user forgets that this package has already been loaded
% nothing dramatic happens, because the |\usepackage| and |\RequirePackage| macros
% perform the necessary tests in order to avoid reloading the same packages again
% and again.
% \begin{macrocode}
\RequirePackage{graphicx}
\RequirePackage{etoolbox}
\if@xivpt\input{size14.clo}\fi
% \end{macrocode}
%
% The |\texheight| is parametrised to the paper height and adjusted so as to
% contain an integer number of normal text lines. A new dimension is defined
% to hold the actual value of the inner/spine margin.
%
% \begin{macrocode}
\newlength\interno
\textheight 0.7\paperheight
\divide\textheight by \baselineskip
\multiply\textheight by \baselineskip
\advance\textheight by \topskip
% \end{macrocode}
% The inner margin is parametrised to the paper width, but a small correction
% is made if the extra size of 14pt is chosen. Also |\footskip| is parametrised
% to the paper height in a slightly different way when the large |14pt| size is chosen.
% \begin{macrocode}
\ifx\f@size\@xivpt
\setlength\interno{\dimexpr\paperwidth/6}
\footskip=1,5\baselineskip
\else
\setlength\interno{\dimexpr\paperwidth/7}
\footskip=2\baselineskip
\fi
% \end{macrocode}
% The convenience of holding the spine margin width in a dimensional register
% becomes really useful now in order to define the other text body grid dimensions.
% Without binding correction the inner and outer margin are chosen equal, but
% the grid is moved outwards if the binding correction option is specified.
% \begin{macrocode}
\oddsidemargin=\dimexpr\interno-1in\relax
\evensidemargin=\oddsidemargin
\marginparwidth\interno
\advance\marginparwidth-2.5\marginparsep
\AtBeginDocument{%
\if@binding
\PackageInfo{TOPtesi}{Margin width recalculation}
\PackageInfo{TOPtesi}{Before:\MessageBreak
oddsidemargin\space\space \the\oddsidemargin\MessageBreak
evensidemargin\space \the\evensidemargin}
\advance\oddsidemargin \T@Pbinding
\advance\evensidemargin -\T@Pbinding
\advance\marginparwidth -\T@Pbinding
\PackageInfo{TOPtesi}{After:\MessageBreak
oddsidemargin\space\space \the\oddsidemargin\MessageBreak
evensidemargin\space \the\evensidemargin}
\fi}
\textwidth=\dimexpr\paperwidth-2\interno\relax
% \end{macrocode}
%
% We now establish the page style. We start by setting to ``empty'' the tokens that
% keep the left and the right marks; we define a box so as to set the headers
% inside this box; we redefine also the plain page styles; it is actually a leftover
% from the previous versions when the page number was set at the foot in bold face,
% but we leave it here without the bold face specification, so that in future versions
% folios may be redefined in a common way with the other page styles.
% Notice that in all page styles folios are always in the footers.
% By defining |\lapagina| to be equivalent to |\thepage| we can later on
% redefine |\lapagina| the way we like; we actually do so with the option
% \texttt{classica}.
% \begin{macrocode}
\def\lapagina{\thepage}
\mark{{}{}}
\newbox\@intesta
%
\def\ps@plain{\let\@mkboth\@gobbletwo
\def\@oddfoot{\null\hfill {\scshape\lapagina}\hfill \null}\def\@oddhead{}
\def\@evenhead{}\let\@evenfoot\@oddfoot}
% \end{macrocode}
% Other page styles are defined in a different way according to the choice of
% one side or two side printing. In any case the header is set without capitalisation
% as it happens in all the default document classes, and it is underlined at a fixed
% distance from the base line. If the chapter or section heading exceed the
% |\textwidth| a warning is issued so as to invite the user to exploit the
% sectioning commands optional short argument.
% \begin{macrocode}
\if@twoside
\def\ps@headings{\let\@mkboth\markboth%
\def\@oddfoot{\null\hfill {\scshape\lapagina} \hfill\null}
\let\@evenfoot\@oddfoot
%
\def\@evenhead{\setbox\@intesta\hbox{\footnotesize\slshape
\leftmark}%
\ifdim\wd\@intesta>\textwidth \headWarn{\chapter}\fi%
\underline{\makebox[\textwidth]{\footnotesize\slshape
\strut\leftmark}}}%
\def\@oddhead{\setbox\@intesta\hbox{\footnotesize\slshape
\rightmark}%
\ifdim\wd\@intesta>\textwidth \headWarn{\section}\fi%
\underline{\makebox[\textwidth]{\footnotesize\slshape
\strut\rightmark}}}%
\def\chaptermark##1{\markboth{\thechapter\ -- ##1}{}}
\def\sectionmark##1{\markright{\ifnum\c@secnumdepth>\z@
\thesection\ -- \fi ##1}}}
\else
\def\ps@headings{\let\@mkboth\markboth
\def\@oddfoot{\null\hfill {\scshape\lapagina} \hfill\null}
\def\@evenfoot{}
\def\@oddhead{\setbox\@intesta\hbox{\footnotesize\slshape
\rightmark}%
\ifdim\wd\@intesta>\textwidth \headWarn{\chapter}\fi%
\underline{\makebox[\textwidth]{\footnotesize\slshape
\strut\rightmark}}}%
\def\chaptermark##1{\markright{\thechapter\ -- ##1}}}
\fi
\def\headWarn#1{\PackageWarning{toptesi}{%
THE HEADING IS TOO LONG\MessageBreak
Use the optional argument of command \string#1\MessageBreak
See the LaTeX Handbook (1994) on section C.4.1\MessageBreak}}
% \end{macrocode}
% It is also necessary to redefine the format of the unnumbered chapter entries
% in the table of contents so as to have page numbers in small caps.
% \begin{macrocode}
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak
\hb@xt@\@pnumwidth{\hss\unless\ifxetex\normalfont\fi\scshape{#2}}\par
\penalty\@highpenalty
\endgroup
\fi}
% \end{macrocode}
% The various tables of contents or figures or tables require some boolean variables to
% be defined; in facts, although the ISO regulations require that every technical report
% contains the list of figures and/or tables, in Italy theses rarely contain these lists;
% after all: is a thesis a technical report? We require also some other boolean variables
% to handle the difference between front matter and main matter; this differences are
% already defined in the \texttt{book} document class, but not in the \texttt{report}
% one.
% \begin{macrocode}
\newif\iffigurespage
\newif\iftablespage
\newif\ifnumeriromani
\newif\iffrontmatter
% \end{macrocode}
% The |\frontmatter| and |\mainmatter| commands are defined and at the beginning
% of the document the default situation of front matter is established.
% \begin{macrocode}
\def\frontmatter{\clearpage\ps@plain\pagenumbering{roman}%
\numeriromanitrue\frontmattertrue\@openrightfalse\c@secnumdepth=-2}
\def\mainmatter{\if@twoside\@openrighttrue\fi
\numeriromanifalse\frontmatterfalse\c@secnumdepth=2
\clearpage\ps@headings\pagenumbering{arabic}%
}
\AtBeginDocument{\frontmatter}
% \end{macrocode}
% The main matter is automatically established with the first |\chapter| command issued
% by the user; this means that every command that starts a section at the ``chapter''
% level within the front matter must be executed without an explicit call to |\chapter|.
%
% By default we set to false the boolean variables that control the typesetting of the
% list of figures and the list of tables.
% \begin{macrocode}
\figurespagefalse
\tablespagefalse
% \end{macrocode}
%
% Before going further on, we redefine the |\cleardoublepage| command so that
% it uses by default the plain page style, but it can be set to any other style.
% \begin{macrocode}
\let\ps@blank\ps@plain
\newcommand*\blankpagestyle[1]{\expandafter\let\expandafter\blank@ps\csname ps@#1\endcsname}
\renewcommand\cleardoublepage[1][blank]{\clearpage\ifodd\value{page}\else
\if@twoside\if@openright
\clearpage\null\thispagestyle{#1}\clearpage\fi\fi\fi}
% \end{macrocode}
%
% We have to define the front matter sectioning names |\sommario| and |\ringraziamenti|
% so as to remain in the front matter.
% \begin{macrocode}
\def\sommario{%
\iffrontmatter\else\frontmattertrue\fi
\chapter*{\summaryname}%
\addcontentsline{toc}{chapter}{\summaryname}%
}
%
\def\ringraziamenti{%
\iffrontmatter\else\frontmattertrue\fi
\chapter*{\acknowledgename}%
\addcontentsline{toc}{chapter}{\acknowledgename}%
}
% \end{macrocode}
% The strings |\summaryname| and |\acknowledgename| are not defined in any
% language option to \texttt{babel}. Default definitions are given below, but the user
% must define new names for localising the package in a language different from
% Italian and English.
%
% We have to modify the |\chapter| and |\part| commands so that as the user
% first issues one of these commands the typesetting style is switched to that
% of the main matter. Actually it is not necessary to redefine the whole
% commands, but just those of the unstarred versions. In facts the starred
% chapter commands to typeset the Summary and the Acknowledgements chapters,
% as defined above, are regularly typeset in the style of the front matter,
% opening on any page (even or odd) and numbered with small caps roman numerals.
% \begin{macrocode}
%\renewcommand\chapter{%
% \iffrontmatter\mainmatter\fi
% \if@openright\cleardoublepage\else\clearpage\fi
% \thispagestyle{plain}%
% \global\@topnum\z@
% \@afterindentfalse
% \secdef\@chapter\@schapter}
\def\@chapter[#1]#2{\iffrontmatter\mainmatter\fi
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter}#1}%
\else
\addcontentsline{toc}{chapter}{#1}%
\fi
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
\@makechapterhead{#2}%
\@afterheading
\fi}
%
%\renewcommand\part{%
% \iffrontmatter\mainmatter\fi
% \if@openright\cleardoublepage\else\clearpage\fi
% \thispagestyle{empty}%
% \if@twocolumn\onecolumn\@tempswatrue\else\@tempswafalse\fi
% \null\vfil
% \secdef\@part\@spart}
\def\@part[#1]#2{\iffrontmatter\mainmatter\fi
\ifnum \c@secnumdepth >-2\relax
\refstepcounter{part}%
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
\else
\addcontentsline{toc}{part}{#1}%
\fi
\markboth{}{}%
{\centering
\interlinepenalty \@M
\normalfont
\ifnum \c@secnumdepth >-2\relax
\huge\bfseries \partname\nobreakspace\thepart
\par
\vskip 20\p@
\fi
\Huge \bfseries #2\par}%
\@endpart}
% \end{macrocode}
% At the same time we have to make sure that |\tableofcontents|,
% |\listoftables| and |\listoffigures| do not exit from the front matter style.
% We assume these commands are issued while in front matter, the default at the begin
% document step, so we have to avoid to use starred or un-starred |\chapter| commands.
% \begin{macrocode}
\renewcommand\tableofcontents{%
\if@twocolumn\@restonecoltrue\onecolumn\else\@restonecolfalse\fi
\if@openright\cleardoublepage\else\clearpage\fi
\global\@topnum\z@
\@afterindentfalse
\@schapter{\contentsname}%
\@starttoc{toc}%
\clearpage
\if@restonecol\twocolumn\fi
}
\renewcommand\listoffigures{%
\if@twocolumn\@restonecoltrue\onecolumn\else\@restonecolfalse\fi
\if@openright\cleardoublepage\else\clearpage\fi
\global\@topnum\z@
\@afterindentfalse
\@schapter{\listfigurename}
\@mkboth{\listfigurename}{\listfigurename}%
\@starttoc{lof}%
\clearpage
\if@restonecol\twocolumn\fi
}
\renewcommand\listoftables{%
\if@twocolumn\@restonecoltrue\onecolumn\else\@restonecolfalse\fi
\if@openright\cleardoublepage\else\clearpage\fi
\global\@topnum\z@
\@afterindentfalse
\@schapter{\listtablename}%
\@mkboth{\listtablename}{\listtablename}%
\@starttoc{lot}%
\clearpage
\if@restonecol\twocolumn\fi
}
% \end{macrocode}
% We need to define |\indici| that typesets the table of contents and, optionally,
% the lists of tables and/or figures while assuring that the front matter style is used for
% typesetting.
% \begin{macrocode}
\def\indici{%
\iffrontmatter\else\frontmattertrue\fi
\tableofcontents
\iftablespage
{\addvspace{10pt}
\let\saveaddvspace=\addvspace
\def\addvspace##1{}
\listoftables
\let\addvspace=\saveaddvspace}
\fi
\iffigurespage
{\addvspace{10pt}
\let\saveaddvspace=\addvspace
\def\addvspace##1{}
\listoffigures
\let\addvspace=\saveaddvspace}
\fi
}
% \end{macrocode}
%
% Command |\onecolumn| is not actually necessary; it simply overrides the possible
% misused option \texttt{twocolumn} in the opening document class statement;
% no thesis should be typeset in double column.
% \begin{macrocode}
\onecolumn
% \end{macrocode}
%
% Here come some declarations for vertical justification and for avoiding an hyphenated
% word at the bottom of a page
% \begin{macrocode}
\if@twoside
\flushbottom
\else
\ifx\@xivpt\f@size
\raggedbottom
\else
\flushbottom
\fi
\fi
\brokenpenalty=10000
% \end{macrocode}
%
% Here comes a questionable command and/or environment; good typesetting
% requires the baseline skip to be proportioned to the font size, generally it is some 10--20\%
% larger than the font size. In some reasonable instances a largeer or a smaller baseline skip
% might be required; the \LaTeX\ kernel allows to use the |\linespread| command;
% in the previous versions of this bundle a command |\interlinea| and an environment
% \texttt{interlinea} were defined so as to allow setting the line spread factor.
% The experience has shown that students tend to use this command so as to typeset a poor
% and thin thesis on more pages. Well, every instrument can be judiciously or maliciously used;
% this is one of those double sided instruments.
% \begin{macrocode}
\def\interlinea#1{\linespread{#1}\selectfont}
\def\endinterlinea{\par}
% \end{macrocode}
% But whatever might be the current line spread factor within figures and tables we reset
% this factor to the unit value; floating bodies do not belong to this or that section
% of text where a different spread factor might be reasonable.
% \begin{macrocode}
\def \@floatboxreset {%
\reset@font
\linespread{1}%
\normalsize
\@setminipage
}
% \end{macrocode}
% Since we are at it we define the floating bodies placing parameters; not only the
% values ``here'', ``top of the page'' and ``bottom of the page'', that we set as default ones
% leaving to the user to explicitly specify the ``page of floats'', but also the numerical and
% geometrical parameters that control the float placements.
% These geometrical parameters are critical and everybody has his/her own ideas of
% what are the best values for them. According to my experience these parameters work quite well
% but I would not suggest them for every kind of typewritten document.
% In particular the zero value for the text fraction appears strange, but students have the
% tendency to create large figures (more than large tables) and these tend to clog the figure
% queue. A 100\% space for the top of page figures and a requirement of 0\% text allows large
% floats to exit the queue provided they do not exceed the text height.
% \begin{macrocode}
\def\fps@figure{htb} \def\fps@table{htb}
%
\setcounter{topnumber}{2}
\def\topfraction{1}
\setcounter{bottomnumber}{1}
\def\bottomfraction{.5}
\setcounter{totalnumber}{3}
\def\textfraction{0}
\def\floatpagefraction{0}
\setcounter{dbltopnumber}{2}
\def\dbltopfraction{1}
\def\dblfloatpagefraction{0}
% \end{macrocode}
% One command that the default definition does not satisfy me very much is the |\caption|
% command; actually it is the internal |\@makecaption| macro that performs the job. The point
% is that I prefer a narrower justified caption rather than a caption where the last line is just
% a short word or the right segment of an hyphenated word. If one sets the
% |\finalhyphendemerits| counter to an incredibly high value, one might succeed
% in avoiding hyphenation in the last word of a caption; but this might lead
% to a very loose typesetting of the caption paragraph, especially
% if the horizontal box that contains it hardly exceeds the caption width.
% I initially set the caption width (a new length) to the overall text width diminished by 3em;
% then if the caption text, inclusive of the caption type string and number, is shorter than
% the text width it is typeset as centered text; if it exceeds the text width
% it is set as a justified paragraph whose line width equals the established caption width;
% but in any case the last line of the paragraph is measured and if it is shorter than one third
% of the caption width, this width is shortened a little bit and the paragraph is set again
% with this shortened caption width; in order to be sure that one iteration is
% sufficient, the shrinking of the caption width must be computed according to
% the number of lines the paragraph occupies.
%
% In order to count the number of lines the caption paragraph occupies it is
% necessary to recall that the first line occupies a vertical space that equals
% |\topskip| while the other lines occupy a vertical space equal to
% |\baselineskip|; the latter one is generally larger than |\topskip| therefore
% the integer division of the height of the vertical box divided by the
% |\baselineskip| is truncated to count a line less than the true value.
% In our case if the caption does not stay in one line, its text is typeset in a
% vertical box with a line spread of 0.95 so as to make the caption a little
% more compact than the regular text.
% The baseline skip is a little shorter than the regular one, but it should
% still exceed the default |\topskip|; when we first typeset the caption in a
% vertical box we strip off the last line
% and we must remember the presence of this line in our arithmetics.
% If the length of the stripped last line is longer that one third of the
% caption width, then the vertical box is recomposed by restacking the
% individual lines, but if this last line is shorter than one third of the
% caption width, this width is recomputed in this way: let $N-1$ be the number
% of lines obtained with the integer division, i.e.\ one line less than those
% actually contained in the vertical box. Let $x$ be the initial caption
% width and $x_2$ the last line width; let $y$ be the new caption width; then
% the total length of the caption of width $x$ is $Nx+x_2$ and this should be
% distributed over $N+1$ lines; if we obtained the new caption width $y$ by
% dividing the total length by $N+1$ we should be able to typeset the whole
% caption with all the lines of equal length. This does not actually take place
% because the new lines do not necessarily contain the same amount of inter word
% space, some words might have been hyphenated in a different way, and so on.
% Moreover we do not want a caption that barely exceeds the length of
% |\captionwidth| to be retyped into a two line caption width that is about one half
% of the width of the other captions. Therefore we allow for some white space in
% the last line by computing the new caption width with the following formula
% \[ y=\frac{(N+0.5)x + x_2}{N+1} \]
% \begin{macrocode}
\newdimen\captionwidth
\long\def\@makecaption#1#2{%
\begingroup
\small \parskip\z@ \parindent\z@
\finalhyphendemerits 100000\relax
\linespread{0.95}\selectfont
\vskip \abovecaptionskip
\captionwidth=\hsize
\advance\captionwidth-3em
\setbox0 \hbox{#1.\quad#2}%
\ifdim\wd0>\hsize
\setbox1 \vbox{\hsize=\captionwidth
\unhbox0\par\global\setbox2\lastbox}%
\setbox2\hbox{\unhbox2}%
\ifdim\wd2<0.333333\captionwidth
\count255=\ht1 \advance\count255 \dp1
\divide\count255\baselineskip
\advance\count255\@ne
\@tempdima=\wd2
\advance\@tempdima \count255\captionwidth
\advance\@tempdima 0.5\captionwidth
\advance \count255\@ne
\divide \@tempdima \count255
\captionwidth=\@tempdima
\setbox0 \vbox{\hsize\captionwidth
#1.\quad#2}
\else
\setbox2\hbox to\captionwidth{\unhbox2 \hfill}%
\setbox0\vbox{\unvbox1\box2}%
\fi
\fi
\makebox[\hsize]{\box0}%
\endgroup
}
% \end{macrocode}
%
% The option \texttt{chapterbib} requires a redefinition of the \texttt{thebibliogrpahy}
% environment in case a separate reference list is required for every chapter.
% The point is that for this task the reference key must contain also the
% chapter number; the rest is simply a redefinition of the environment that behaves
% differently according to the chosen option. In any case the bibliography goes to the
% table of contents as a unnumbered chapter or section.
% \begin{macrocode}
\def\redef@bibitem{\def\@bibitem##1{\item\if@filesw
\immediate\write\@auxout
{\string\bibcite{##1}{\thechapter.\the\c@enumi}}\fi\ignorespaces}}
%
\def\thebibliography#1{%
\ifchapterbibliography\section*{\bibname}\relax
\if@twoside\markright{\bibname}\fi
\addcontentsline{toc}{section}{\bibname}\relax
\redef@bibitem
\list{[\thechapter.\arabic{enumi}]}{%
\settowidth\labelwidth{[\thechapter.#1]}\leftmargin\labelwidth
\advance\leftmargin\labelsep\itemsep\z@ plus 1pt\parsep\z@
\usecounter{enumi}}
\else
\chapter*{\bibname}\relax
\@mkboth{\bibname}{\bibname}\relax
\addcontentsline{toc}{chapter}{\bibname}\relax
\list{[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep\itemsep\z@ plus 1pt\parsep\z@
\usecounter{enumi}}
\fi
\def\newblock{\hskip .11em plus .33em minus -.07em}
\sloppy
\sfcode`\.=1000\relax}
\let\endthebibliography=\endlist
% \end{macrocode}
%
% For what regards footnotes nothing is changed except resetting the
% line spread to one, in case the current value is different.
% \begin {macrocode}
\long\def\@footnotetext#1{\insert\footins{\linespread{1}\footnotesize
\interlinepenalty\interfootnotelinepenalty
\splittopskip\footnotesep
\splitmaxdepth \dp\strutbox \floatingpenalty \@MM
\hsize\columnwidth \@parboxrestore
\edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}%
\@makefntext{\rule{\z@}{\footnotesep}\ignorespaces#1\strut}}}
% \end{macrocode}
%
% These last heterogeneous definitions are partly important and partly residues of
% the good old times of MS-DOS v.3 when a Ctrl-Z character would be placed at the
% end of files. It's a long time that such version is not being used, but some
% old time files might still be around.
%
% The cryptic code that redefines the comma in math mode establishes that this
% character is a normal math character, instead of a math punctuation mark. Actually the
% code that defines the mathematical active comma is a new addition that lets the comma
% perform correctly in its double function (decimal separator and punctuation mark). The
% only point where this code fails is when a list of numbers is typeset: When a numeric list
% must be typeset, such as, for example, $\forall i=0,\,1,\,2,\,3, n$, in the source code
% a space \emph{must} be inserted after every punctuating comma while no space follows a
% decimal comma: for example \verb*+$\forall i=0, 1, 2, 3,n$+. The space before the |n| is
% not necessary (but it wouldn't hurt) because |n| is not recognized as a digit, therefore
% the ``intelligent'' comma inserts the necessary space by itself.
%
% \begin{macrocode}
\DeclareMathSymbol{\virgola}{\mathpunct}{letters}{"3B}
\DeclareMathSymbol{\virgoladecimale}{\mathord}{letters}{"3B}
\AtBeginDocument{\mathcode`\,=\string"8000}
{\catcode `,=\active \gdef,{\futurelet\let@token\m@thcomma}}
\def\m@thcomma{\let\@tempB\virgola
\@tfor\@tempA:=0123456789\do{%
\expandafter\ifx\@tempA\let@token\let\@tempB\virgoladecimale
\@break@tfor\fi}\@tempB}
%
\catcode`\^^Z=10
\topmargin 0pt
% \end{macrocode}
%
% The TOPtesi bundle contains two new chapter like sections activated with
% the commands |\sommario| and |\ringraziamenti| respectively. The infix strings
% that start these sections depend on the used language.
%
% Because of this it is necessary to extend the list of infix string definitions provided
% the |\captions|$\langle$\texttt{language}$\rangle$ macros defined by the language description
% files of \texttt{babel} or of \texttt{polyglossia}; for this purpose we define a macro for
% adding new items for these two new sectioning commands. This macro receives three arguments:
% the first is the babel language name, the second is the string for the summary name, and
% finally the third is the string for the acknowledgements name; everything is contained within
% a group and only the relevant captions macro is globally redefined. The token register `0' is
% normally for scratch usage, but the fact that its value is restored upon exiting the
% group provides the necessary protection against an involuntary reassignment
% to this register. At the same time if a specific language option was not
% specified, a warning message is issued, but compilations goes on any way
% without the sectioning string names. For being sure no other undefined error
% messages are issued, the |\summaryname| and |\acknowledgename| are let to
% |\empty|.
% \begin{macrocode}
\let\summaryname\empty
\let\acknowledgename\empty
\newcommand*\ExtendCaptions[3]{{%
\@ifundefined{captions#1}{%
\PackageWarning{toptesi}{Language option #1 not specified\MessageBreak
Skipping any redefinition\MessageBreak}%
}{%
\expandafter\let\expandafter\@tempA\csname captions#1\endcsname
\toks0=\expandafter{\@tempA%
\def\summaryname{#2}%
\def\acknowledgename{#3}}%
\expandafter\xdef\csname captions#1\endcsname{\the\toks0}%
}}}%
% \end{macrocode}
% For Italian and English there are no problems; we provide immediately these extensions
% by means of the newly available macro:
% \begin{macrocode}
\ExtendCaptions{italian}{Sommario}{Ringraziamenti}
\ExtendCaptions{english}{Summary}{Acknowledgements}
% \end{macrocode}
% In facts the \texttt{babel} options for Italian and English have already been loaded by
% default; therefore both caption macros |\captionsitalian| and |\captionsenglish| are
% already defined and can be freely extended. For any other language the corresponding
% language option must be entered in the class opening statement, otherwise a warning
% is issued but compilation is not stopped. Therefore if, for example, the user wants
% to write the thesis in Spanish, the thesis main file shall start like this:
% \begin{verbatim}
% \documentclass[...,spanish]{toptesi}
% \ExtendCaptions{spanish}{Resumen}{Agradecimientos}
% ...
% \begin{document}
% \selectlanguahe{spanish}
% ...
% \end{verbatim}
% and the rest of the thesis will be typeset correctly in Spanish. Remember
% that Italian is the default language and nothing is necessary for setting up
% the Italian defaults. If English is desired, then after |\begin{document}| is
% is necessary to specify the default language; for ease of use the following
% macros are defined so they can be used instead of the lengthy \texttt{babel}
% command; after the beginning of the document it is then possible to specify
% |\inglese| or |\english|, and the default language turns into English.
% These shorthand commands can be alternated so as to switch from one language
% to the other; nevertheless remember that there are more correct ways to
% switch languages with the \texttt{babel} commands without changing
% the infix strings.
% \begin{macrocode}
\def\italiano{\selectlanguage{italian}}%
\def\english{\selectlanguage{english}}%
\let\inglese\english
% \end{macrocode}
% At the beginning of the document the following commands are executed;
% the general macro |\italiano| sets the summary and the acknowledgements
% names in Italian, as the default language; and the |\@chapapp| macro is
% redefined so as to agree with the default language. If a different
% default language is desired, we recall it again, it is necessary to do
% the following:
% \begin{enumerate}
% \item specify |\english| \emph{after} the |\begin{document}| statement,
% if English is supposed to be the default language, or
% \item specify the language name, other than Italian or English, among
% the class options; use the |\ExtendCaptions| macro for extending the
% list of sectioning commands infix strings as explained above;
% specify with |\selectlanguage| the new language as the default one
% \emph{after} the |\begin{document}| statement;
% \item if XeLaTeX is being used for typesetting it suffices to specify
% in the preamble the name of the other language to be used, by means
% of the |setotherlanguage| command, and to define the summary and
% acknowledgments names in the same way as with pdf\/\LaTeX; the same
% must be done at the beginning of the document to declare the new
% language a the default one.
% \end{enumerate}
% \begin{macrocode}
\AtBeginDocument{%
\italiano
\renewcommand\@chapapp{\chaptername}%
}
% \end{macrocode}
%
% At last the subsidiary and independent packages \texttt{topcoman} and
% \texttt{topfront} are requested for input the former is loaded only if
% at the |documentclass| level the option |usefrontespizio| has NOT been
% declared. For using XeLaTeX as the
% typesetting engine it's necessary to load such packages at the ``begin
% document'' step, so that all a the other settings, especially fonts
% are already established. May be it should be better done also when
% using pdf\/\LaTeX\ as the typesetting engine, even if the past experience
% has not shown any inconvenience.
% \begin{macrocode}
\ifxetex
\AtBeginDocument{%
\unless\ifT@Pfrontespizio
\RequirePackage{topfront}
\fi
\RequirePackage{topcoman}%
}
\else
\unless\ifT@Pfrontespizio
\RequirePackage{topfront}
\fi
\RequirePackage{topcoman}%
\fi
% \end{macrocode}
%
% Last but not least, here come the specifications for the PDF/A-1b format. First of
% all the patches to the macros |\not| and |\mapstochar| that produce problems with
% the format, because they have a declared width of 0\,pt; this is no problem for
% \texttt{latex} or \texttt{pdflatex}, but it is a problem for the PDF/A format.
% Therefore these commands must be replaced by equivalent ones that do not use zero-width
% glyps. For |\not|, another slash can be used, but in order to have it the right size
% in all math typesetting modes it is necessary to have a different command for
% every mode; this is achieved with the |\mathchoice| primitive as such:
% \begin{macrocode}
\ifxetex\else
\renewcommand*\not{\mathrel{\mathchoice%
{\rlap{$\displaystyle\mkern2.5mu\mathnormal{/}$}}%
{\rlap{$\textstyle\mkern2.5mu\mathnormal{/}$}}%
{\rlap{$\scriptstyle\mkern2.5mu\mathnormal{/}$}}%
{\rlap{$\scriptscriptstyle\mkern2.5mu\mathnormal{/}$}}%
}}
% \end{macrocode}
% Actually the zero-width property of the slash must be simulated with a zero-width box
% but within this box it is necessary to specify the typesetting style of the math
% mode material.
%
% A similar trick is used to patch the |\mapstochar| command but no other glyph was
% found suitable for substituting the original one; therefore we had to make it up
% with the |picture| environment:
% \begin{macrocode}
\renewcommand\mapstochar{\mathrel{\mathchoice
{\displaystyle\unitlength=0.0555\fontdimen6\font
\picture(0,0)\put(1,1.5){\linethickness{0.72\unitlength}%
\line(0,1){6}}\endpicture}
{\textstyle\unitlength=0.0555\fontdimen6\font
\picture(0,0)\put(1,1.5){\linethickness{0.72\unitlength}%
\line(0,1){6}}\endpicture}
{\scriptstyle\unitlength=0.0555\fontdimen6\font
\picture(0,0)\put(1,0.55){\linethickness{0.61\unitlength}%
\line(0,1){5}}\endpicture}
{\scriptscriptstyle\unitlength=0.0555\fontdimen6\font
\picture(0,0)\put(1,0.2){\linethickness{0.56\unitlength}%
\line(0,1){4}}\endpicture}
}}\fi
% \end{macrocode}
% The above patches are introduced irrespective of using \texttt{pdflatex} for producing
% a PDF/A compliant file; one might need to produce a traditional PDF file, or even a
% DVI file, to be converted to the PS format, in order to possibly further transform
% it to PDF/A by means of \texttt{ghostscript} (see the details in the
% \texttt{ps2pdf.html} file belonging to the \texttt{ghostscript} documentationx). The
% patches are avoided if XeLaTeX is being used with the UNICODE math definitions.
%
% Finally, if the class option |pdfa| was specified, we load the |pdfx.sty| file
% with the suitable option for typesetting a (hopefully) PDF/A conforming file.
% We must remember that |pdfx.sty| on turn loads
% the |hyperref.sty| file with the necessary |pdfa| option. The user, therefore does
% not need to reload that package, but is free to configure it through the
% |\hypersetup| command arguments right at the beginning of the thesis main file.
%
% Nevertheless if \XeLaTeX\ is being used to typeset the document, loading of the package
% |pdfx| is skipped; at the same time the |hyperref| package is being loaded anyhow
% just because the |pdfa| option was specified, but at least the |pdfa| option is
% specified, so that even if it's necessary to resort to |ghostscript| in order to
% produce a PDF/A compliant file, at least the hyperlinks to external sites are suitably
% ``sterilized''.
% \begin{macrocode}
\ifT@Ppdfa
\unless\ifxetex
\RequirePackage[a-1b]{pdfx}
\else
\RequirePackage{hyperref}
\fi
\fi
% \end{macrocode}
%
% \subsection{The \texttt{classica} option}
% As mentioned above, the \texttt{classica} option was devised in order to cope with
% theses in humanities and the specifications came from Paolo Ciacchi, a student of
% the University of Trieste, who was preparing a master thesis in classical Greek
% philology. The necessity of the large normal size derived from the necessity of
% having clear mark-up signs among the myriad signs philologists use, that sometimes
% let me believe that the philological mark-up requires typesetting environments
% similar to the mathematical ones, since the material to be typeset does not form
% linear sequences, as in plain text, but bi-dimensional structures as in mathematics.
%
% The other requirements involve the title page and I agreed to implement them, since
% they are likely to be useful for other universities as well; the effort for
% localising this bundle makes this point less stringent compared to the previous
% versions, but there are other layout fine points that cannot be solved with a simple
% substitution of infix strings.
%
% The singular and plural masculine and feminine strings for ``candidate'' are redefined.
% For other languages the configuration file comes in handy.
% \begin{macrocode}
\ifTOPfront
\ifclassica
\def\Candidato{Laureando}
\def\Candidata{Laureanda}
\def\Candidati{Laureandi}
\def\Candidate{Laureande}
\fi\fi
% \end{macrocode}
%
% Since theses in humanities may end up to occupy several volumes (classically
% ``tomo'' in Italian means ``volume'', although the latter spelling is valid
% also in Italian with the same meaning but appears to be neglected by the
% humanists; in English ``tome'' indicates a ``large book''; in Italian the
% meaning nuance of ``tomo'' is a little different because it is used to
% indicate the volumes into which a large typeset work is divided; the
% humanists, as usual, know well their words and use them properly!) a
% mechanism is set up to create a different title page for each volume;
% we need a volume counter and a command to start each volume; the
% |\frontespizio| macro typesets the real title page and we have already
% seen that it can print the volume ordinal. The localisation allows to
% change the infix string that is going to be printed. When several tomes
% are involved, instead of using the |\frontespizio| macro, use the |\tomo|
% one, that provides to stepping up the volume counter before actually
% printing the new tome title page.
% \begin{macrocode}
\newcounter{tomo}
\newcommand*{\tomo}{\clearpage\stepcounter{tomo}\frontespizio}
% \end{macrocode}
% Folios as well are to be redefined and also the page styles require a redefinition so as
% to being able to use old style numbers. The macro |\lapagina| (it's not a case the this
% macro name is the direct translation of ``the page'') contains the folio number; if it is
% in roman numerals nothing happens, but if the old style numbers are required the folio is
% surrounded by the proper macros so as to expand the folio macro before typesetting it in
% old style. The page style does not need an actual redefinition, because the original
% definition in file \texttt{toptesi.sty} already uses |\lapagina| as the typeset folio
% indicator.
% \begin{macrocode}
\renewcommand*{\lapagina}{%
\ifnumeriromani
\thepage
\else
\if@ldstyle
\expandafter\oldstylenums\expandafter{\thepage}%
\else
\thepage
\fi
\fi
}
% \end{macrocode}
% But we actually have to redefine the page style for the new headings because the
% \texttt{classica} option changes completely the left and the right headers depending on
% the option \texttt{autoretitolo}; in this case the left header contains the candidate's
% name a a short version of the thesis title, while the right heading contains the chapter
% (short) title; if this option is not in force, headings appear as usual. The redefinition
% of the \texttt{headings} page style is made only if this option is in force. In case of
% two side printing where the left head and the right head are different, the left heading
% contains the author name and the short title name; if there are other authors the first
% author name is printed followed by ``et al.''; if the over all header string exceeds the
% text width, a message is printed so as to induce the user to make use of the optional
% |\titolo| argument, the one that is supposed to contain the short title. In the right
% heading there is the chapter title; again if the header turns out to bee too wide, a
% message is issued to the user.
%
% More complicated things are done when typesetting on one side; in facts the author name
% (possibly followed by ``et al.'') and the short thesis title are typeset on the left
% of the only header while the chapter title is typeset on the right; in the unlikely
% situation where these two elements separated by at least 2em of white space do not exceed
% the text width, they are printed, but if they do, as it is likely to happen, then my
% suggestion would be not to use the \texttt{autoretitolo} option, but if the user
% absolutely wants this layout, then the author's name, possibly followed by ``et al.'', and
% the short thesis title are set in a vertical box; the same happens for the chapter title
% in another box; these texts are set with ragged margins on the center, and finally these
% boxes are set one next to the other with an intermediate glob of infinitely stretchable
% glue, and finally set in the header box with a rule underneath the two of them. The result
% might be barely acceptable if both vertical boxes do not exceed two lines and no words
% have to be hyphenated, but in general I believe it is an ugly layout; the user is warned!
% \begin{macrocode}
\if@utoretitolo
\if@twoside
%
\renewcommand*{\ps@headings}{\let\@mkboth\markboth%
\def\@oddfoot{\null \hfill \textbf{\lapagina} \hfill \null}%
\let\@evenfoot\@oddfoot
%
\def\@evenhead{%
\setbox\@intesta\hbox{\unless\ifxetex\latintext\fi
\footnotesize\strut\textsc{%
\@author\ifx\@secondauthor\empty\else\ et al.\fi: \@stitle}%
}%
\ifdim\wd\@intesta>\textwidth\headwrn{\titolo}\fi
\underline{\makebox[\textwidth]{\box\@intesta}}}%
\def\@oddhead{\unless\ifxetex\latintext\fi
\setbox\@intesta\hbox{%
\footnotesize\strut\textsl{\rightmark}}%
\ifdim\wd\@intesta>\textwidth \headWarn{\section}\fi%
\underline{\makebox[\textwidth]{\box\@intesta}}}%
\def\chaptermark##1{\markright{\thechapter\ -- ##1}{}}%
\def\sectionmark##1{}}%
\else
\renewcommand*{\ps@headings}{\let\@mkboth\markboth
\def\@oddfoot{\null \hfill \textbf{\lapagina}\hfill \null}%
\let\@evenfoot\empty\let\@evenhead\empty
\def\@oddhead{{\setbox\z@\hbox{\unless\ifxetex\latintext\fi\footnotesize
\textsc{%
\@author\ifx\@secondauthor\empty\else\ et al.\fi: \@stitle}}%
\setbox\tw@\hbox{\unless\ifxetex\latintext\fi\footnotesize\textsl{\rightmark}}%
\dimen@=2em\advance\dimen@\wd\z@\advance\dimen@\wd\tw@
\ifdim\dimen@<\textwidth \relax
\else
\setbox\z@\vbox{\hsize.48\textwidth\parindent\z@\raggedright
\unless\ifxetex\latintext\fi\footnotesize\textsc{%
\@author\ifx\@secondauthor\empty\else\ et al.\fi: \@stitle
}}%
\setbox\tw@\vbox{\hsize.48\textwidth\parindent\z@\raggedleft
\unless\ifxetex\latintext\fi\footnotesize\textsl{\rightmark}}%
\fi
\setbox\@intesta\vbox to\z@{%
\vss\hbox to\textwidth{\strut\box\z@\hfill\box\tw@}}%
\underline{\box\@intesta}}}%
\def\chaptermark##1{\markright{\thechapter\ -- ##1}}}
\fi
\fi
% \end{macrocode}
% Here |\annoaccademico| is defined that typesets the infix string corresponding to
% ``Anno accademico'' followed by the year range in old style numbers (irrespective
% of the \texttt{oldstyle} option); localization commands are provided so as
% to set a different string, possibly through the configuration file. In order to set
% an adequate en-dash between the old style numbers a new definition is given that
% takes care to set the dash at a height above the base line that copes the specific
% shape of the old style numbers.
% \begin{macrocode}
\newcommand*\NomeAnnoAccademico[1]{\gdef\AnnoAccademico{#1}}
\@ifundefined{AnnoAccademico}{\gdef\AnnoAccademico{Anno accademico}}{}
%
\def\annoaccademico#1{\ifclassica
\def\@submitdate{{\large\textsc{\AnnoAccademico}} {\Large\s@tanno#1!}}
\else
\PackageWarning{toptesi}{\string\annoaccademico\space is usable only
when the\MessageBreak
`classica' option is in force}%
\def\@submitdate{\AnnoAccademico\ #1 --- Needs `classica' option}
\fi}
\def\s@tanno#1-#2!{\oldstylenums{#1\EnDash#2}}
\def\EnDash{{\settowidth{\dimen@}{\large\sc I}%
\setbox\tw@\hbox{2}\dimen\tw@.5\ht\tw@\advance\dimen\tw@-.5\dp\tw@
\dimen4\dimen\tw@\advance\dimen4by.0385ex\relax
\advance\dimen\tw@-.0385ex\relax
\makebox[1.5\dimen@]{%
\vrule\@width\dimen@\@height\dimen4\@depth-\dimen\tw@}}}
% \end{macrocode}
% The footnote rule separator is also longer that the default one. Dealing with notes
% the footnote separator is also changed as well as the footnote skip. But the humanists
% like to have also unnumbered notes within numbered ones, as if they were two separate
% sets; of course specialized extensions are available on CTAN, but as a poor man solution
% the command |\nota| was introduced that inserts a note with a symbol as a note mark;
% the symbol \emph{must} be a mathematical symbol as the dagger or the double dagger;
% by default it is the asterisk. At the same time the default definition of the
% mathematical
% asterisk is that of a binary operator; I have experienced that the note symbol gets a
% better positioning if it is used as an ordinary symbol through |\mathord|. This
% is why its math code is redefined. A final unusual request was to be able to put a blank
% unnumbered note, as a (rather wide) note separator. The command |\NoteWhiteLine| has to
% be used at the end of the text of the preceding note.
% \begin{macrocode}
\renewcommand\footnoterule{%
\kern-6\p@
\hrule\@width.4\columnwidth
\kern5.6\p@}
\setlength\footnotesep{12\p@}
\setlength{\skip\footins}{24\p@ \@plus 4\p@ \@minus 2\p@}
\newcommand*\nota[1][\mathord{*}]{%
\xdef\@thefnmark{\ensuremath{\m@th#1}}\@footnotemark\@footnotetext
}
\newcommand*{\NoteWhiteLine}{\par\vspace*{-.3\baselineskip}}
% \end{macrocode}
%
% The humanists asked me to create some other simple macros: one for skipping a whole page,
% without header and footer; another to compose a dedication page; a third one for
% typesetting a page with one or more witty sentences. The first request has a trivial
% solution, but at least |\paginavuota| is much shorter to type in that its expansion.
%
% The environments \texttt{dedica} for the dedication, and \texttt{citazioni} for the witty
% sentences are almost identical; both typeset their content with a reduced text width, half
% of the normal one; this column is typeset on the right of the page. The \texttt{dedica}
% environment is supposed to be used in the front matter, while the witty sentence
% environment may be used anywhere. The dedication is typeset in |\Large| font size and in
% italics; if the author wants a different size and/or a different shape s/he must specify
% it at the beginning of the dedication. The \texttt{citazioni} environment typesets its
% material with the default font shape series and size, so the author has to specify any
% change s/he desires. These three commands, though, are available irrespective of the
% \texttt{classica} option, so that they can be used also for theses outside the humanities
% fields.
%
% \begin{macrocode}
\newcommand*\paginavuota{\clearpage\thispagestyle{empty}\null\clearpage}
%
\newenvironment{dedica}{\clearpage
\if@twoside
\ifodd\c@page\else\thispagestyle{empty}\null\clearpage\fi
\fi
\thispagestyle{empty}%
\list{}{\labelwidth\z@
\leftmargin.5\textwidth
\parindent\z@
\raggedright\LARGE\itshape}\item[]
}{%
\endlist\clearpage
}
%
\newenvironment{citazioni}{%
\clearpage\thispagestyle{empty}
\list{}{\labelwidth\z@
\leftmargin.5\textwidth
\parindent\z@
\raggedright}\item[]
}{%
\endlist\clearpage
}
% \end{macrocode}
% \iffalse
%</topsty>
% \fi
%
% \subsection{The \texttt{topfront.sty} code}
% This file is input by \texttt{toptesi}, version 5.x, but it can be used as an
% independent extension package.
%
% It contains all the definition for the composition of just the title page
% along the style requirements of \texttt{toptesi}, version 5.x.
% It makes use of an optional configuration file where the user can define
% a lot of default information and all the infix language dependent strings
% that are peculiar to this title page.
%
% This file specifies that it requires the \LaTeXe\ format and identifies itself. Since the
% package might be used to extend the performances of other classes, this package does not
% specify any input encoding, assuming that the calling class already provided this
% information.
% \iffalse
%<*topfrn>
% \fi
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{topfront}[2014/11/02 v.5.83 Title page for TOPtesi]
% \end{macrocode}
% Per l'uso di topfront come pacchetto autonomo bisogna verificare che l'opzione |classica|
% corrisponda ad una impostazione corretta di |\ifclassica|; siccome questo |\if| è definito
% in |toptesi.sty|, qui bisogna verificarne l'esistenza, e se del caso impostare il valore
% |false|. Per la verifica
% In oder to use |topfront| as a stand-alone extension package it is necessary to verify if the |classica| option corresponds to a valid setting of |\ifclassica|; since this test is defined in the main |toptesi| package, here we need to verify its existance, and in case to set its value to |false|. This implies two points: we need a powerful macro package to test a ``switch'', and when this |topfront| package is used as a stand-alone one, the settings of the |classica| options are not available.
% \begin{macrocode}
\@ifpackageloaded{etoolbox}{}{\RequirePackage{etoolbox}}
\ifcsundef{ifclassica}{%
\newif\ifclassica
\classicafalse
}{}
% \end{macrocode}
%
% For the title page we need a special style, in order to put some information
% in the header and some other in the footer, without actually changing the
% page layout, except for centering the grid horizontally in the page.
% The headers, due to a specific request of Politecnico di Torino, is to have
% the university logo(s) in the header; other universities maintain their
% logo(s) in the lower part of the page as it was done all the time in the
% past. We need some device to switch positions to the logos, without
% actually changing the page layout. Since the logo(s) are sort of large,
% the header must smash the header contents, so as to avoid any modification
% of the position and size of the other parts of the page. The |TPT@logobox|
% box is being defined later on and the |\logosede| command takes care of
% filling it up. Besides these devices, the |\frontepsizio| command accepts
% an optional asterisk, so that by setting the asterisk in the source file,
% as in |\frontespizio*|, the page styles are switched.
% \begin{macrocode}
\def\headstrut{\vrule \@depth4\p@ \@height\z@ \@width\z@}
\def\ps@titlepage{\let\@mkboth\@gobbletwo
\def\@oddfoot{\vbox to 0.05\paperheight{\vss
\hbox to\hsize{\hfil{\Large{\@submitdate}}\hfil}}}%
\let\@evenfoot\@oddfoot
\def\@oddhead{
\vbox to\headheight{\vss
\hbox to\textwidth{%
\headstrut\hfil
\raisebox{3\baselineskip}{\usebox\TPT@logobox}\hfil\null%
}%
\vss
}%
}%
\let\@evenhead\@oddhead
\def\chaptermark##1{}\def\sectionmark##1{}%
}
% \end{macrocode}
%
% Similarly a different title page style for typesetting the logos in the
% lower half of the page is defined; since it is the only style usable
% with the |classica| option, we call it the |classica| page style:
% \begin{macrocode}
\def\ps@classica{\let\@mkboth\markboth
\def\@oddhead{\vbox{%
\hbox to \hsize{\hfill {\LARGE \@ateneo}\hfill}%
\ifclassica
\hbox to \hsize{\hfil\vrule\@width\z@
\@height2ex\vrule\@height1.4\p@\@depth-\p@\@width50mm\hfil}%
\fi
}}%
\def\@oddfoot{\vbox to \dimexpr\paperheight/20\relax{\vss
\ifclassica
\hbox to \hsize{\hfil\raisebox{-.3ex}[\z@][\z@]{%
\vrule\@height-2.6\p@\@depth3\p@\@width\dimexpr\textwidth/3}\hfil}%
\fi
\hbox to\hsize{\hfill{\Large{\@submitdate}}\hfill}}%
}%
\let\@evenhead\@oddhead
\let\@evenfoot\@oddfoot
}%
% \end{macrocode}
%
% The title page information depends on the type of ``thesis'' that is being
% typeset. The following commands specify the kind of information that is
% going to be typeset. Some boolean variables are automatically set by the
% commands in order to change some formatting depending on the kind of thesis.
% For languages that distinguish feminine from masculine adjectives or
% qualifications some automatic machinery is set up in order to format some
% infix strings in a way that copes with the singular or plural forms; in
% particular when there is a multitude of authors (maximum three) of different
% gender the adjectives or qualifications are set masculine plurals, while
% when there is just one author or the authors are of the same gender the
% adjectives or qualifications are set according to number and gender.
% All this is done by setting or resetting the truth value associated to
% the boolean variable \texttt{femminile}. The boolean variable
% \texttt{dottorato} controls the PhD thesis format, while the other
% variable \texttt{laureatriennale} controls the formatting of the
% bachelor's degree report. All other theses are treated as master theses,
% and in all cases the appropriate infix string is typeset in the title page:
% \begin{macrocode}
\newif\iffemminile
\newif\ifdottorato \dottoratofalse
\newif\iflaureatriennale \laureatriennalefalse
% \end{macrocode}
%
%
% The thesis title is specified by means of the following commands; |\monografia|,
% the name of the bachelors degree final report, sets also the corresponding
% boolean variables and redefines the command |\titolo| so as to avoid
% duplications and inconsistencies; of course something might still be inconsistent
% if the commands are given in the wrong order.
%
% |\titolo| accepts an optional argument, the ``short title'', more or less
% as the standard sectioning commands; this is due to the fact that with the
% class option \texttt{autoretitolo} the thesis title is written together
% with the author's name in the even side headings; if the thesis full title
% is too long it produces overfull headlines with ugly results; a short title
% may solve the inconvenience. The |\sottotitolo| command is another way
% to maintain a short title; all the supplementary title information may be
% typeset in the subtitle.
% \begin{macrocode}
\def\monografia#1{\global\laureatriennaletrue
\global\dottoratofalse
\global\def\titolo##1{\PackageWarning{toptesi}%
{Il titolo e' gia' stato impostato con
il comando \string\monografia}}%
\gdef\@title{#1}}
\let\@stitle\empty
\newcommand*{\titolo}[2][]{{\def\@tempA{#1}%
\ifx\@tempA\empty\gdef\@stitle{#2}\else\gdef\@stitle{#1}\fi
\gdef\@title{#2}}}
\def\sottotitolo#1{\gdef\@subtitle{#1}}
% \end{macrocode}
%
% The |\materia| or its alias |\Materia| are used to specify the
% subject of the thesis; as a silly example a set of commands that reflect
% this subtle difference might be the following:
% \begin{verbatim}
% \materia{Applied Tetratricotomy}
% \titolo{The tetratricotomy of blond hair}
% \sottotitolo{Accurate measurements of the four fourths
% of tetratricotomized blond hair}
%\end{verbatim}
% and the title page, for example, will contain something like this:\\[\bigskipamount]
% \begin{minipage}{\textwidth}\centering
% {\Large Master Thesis\\ in\\ Applied Tetratricotomy\par}\bigskip
% {\huge The tetratricotomy of blond hair\par}\bigskip
% {\large Accurate measurements of the four fourths\\
% of tetratricotomized blond hair}
% \end{minipage}\bigskip
% \begin{macrocode}
\let\@materia\empty
\def\Materia#1{\def\@materia{#1}}\let\materia\Materia
% \end{macrocode}
%
% Things get more complicated for doctoral theses; in general there is no supervisor;
% at most if a professor is assigned to supervise or control the doctoring's work
% this may be called in whatever mode but here we assume his name is input
% with the command |\tutore| even if ``tutor'' does not appear as the best choice;
% in any case in Italian ``tutore'' does not have the same meaning as the English ``tutor''.
% Most Doctoral Schools require to name the School's director or
% coordinator instead of the tutor. This is why this person's name can be introduced with
% |\direttore| or |\coordinatore|; the actual label printed over this person
% name is ``Direttore'' or ``Coordinatore'' but it can be changed with
% |\QualificaDirettore|.
% \begin{macrocode}
\newif\ifDirettore \Direttorefalse
\def\tutore#1{\gdef\@tutore{#1}}
\def\direttore{\Direttoretrue\relatore}%
\def\coordinatore{\Direttorefalse\relatore}%
\def\QualificaDirettore#1{\gdef{#1}}
% \end{macrocode}
%
% For ``normal'' theses we may have from one to three supervisors and from
% one to three authors; not all universities accept a multitude of supervisors
% and/or authors of the same thesis, but some do; this is why this bundle
% accepts up to three names for each category.
% The |\second...| commands set the plural forms of the labels printed above
% the name lists. For the candidates there are different commands to input
% ladies or gentlemen names; according to the masculine (ending in `o') or feminine
% (ending in `a') commands, the appropriate truth values are assigned to the
% boolean variable \texttt{femminile} and the labels are set accordingly.
%
% Notice that in the case of bachelor degree final report no supervisor name is printed
% even if one or more supervisor names are specified. This must be kept in mind in order
% to avoid surprises in finding missing information in the title page. Further on, there
% are suggestions for circumventing this fact.
% \begin{macrocode}
\def\relatore#1{\gdef\@principaladviser{#1}}
\def\secondorelatore#1{\gdef\@secondadviser{#1}}
\def\terzorelatore#1{\gdef\@thirdadviser{#1}}
\def\candidato#1{\gdef\@author{#1}\femminilefalse}
\def\candidata#1{\gdef\@author{#1}\femminiletrue}
\def\secondocandidato#1{\gdef\@secondauthor{#1}\femminilefalse}
\def\secondacandidata#1{\gdef\@secondauthor{#1}}
\def\terzocandidato#1{\gdef\@thirdauthor{#1}\femminilefalse}
\def\terzacandidata#1{\gdef\@thirdauthor{#1}}
% \end{macrocode}
%
% The next set of macros is used to typeset the ``date'' of the thesis defense or
% presentation or whatever is done for the final exam. The macro is sort of complicated
% because the input format for this ``date'' may vary from a single year, to a year range,
% to a month and year specification so that different actions must be taken; if the option
% \texttt{classica} is in force\footnote{This option cannot be active if this extension
% package is used to extend a document class other than \texttt{toptesi}.}
% then the formatting of the ``date'' may be still different. This command is aliased with
% |\esamendidottorato| which literally means ``defense of the doctoral dissertation'';
% nevertheless both commands refer to a simple date in one of those formats.
%
% |\getseduta| splits the date into its two components, month and year; if the argument
% is a single string without intervening spaces, the first one is the string
% itself and the second is empty; this emptiness may be tested and in case the date
% formatting is modified accordingly. In particular if the string is a single spaceless
% one, this string is assigned to |\@submitdate|; otherwise a different treatment is made
% according to the fact that \texttt{classica} is in force; if \texttt{classica} is not
% in force the total string, including spaces, is assigned to |\@submitade|. If
% \texttt{classica} is in force, |\s@dutaTrieste| is called with the whole string. On turn
% |\s@dutaTrieste| verifies if the date should be typeset with old style numbers or in the
% usual way; in the latter case the whole string is assigned to |\@submitdate|; in the
% former one the year part may be either a single year or a year range; this separation is
% tested by splitting the year part across one dash; if the dash is present the extremes
% of the year range are assigned to |\1| and |\2|, otherwise the year part is a single
% year. If a single year is given this is simply typeset with old style numbers and the
% appropriate commands are assigned to the |\@submitdate| control sequence. If a year
% range is given, this year range is also typeset with old style numbers, and the dash
% is executed with a regular en-dash surrounded with white space.
%
% \begin{macrocode}
\def\sedutadilaurea#1{\getseduta#1 !}
\def\getseduta#1 #2!{%
\def\@tempA{#2}%
\ifx\@tempA\empty
\def\@submitdate{#1}%
\else
\unless\ifclassica
\def\@submitdate{#1 #2}%
\else
\s@dutaTrieste#1 #2!%
\fi
\fi
}%
\def\s@dutaTrieste#1 #2!{%
\if@ldstyle
\s@paranumeri#2-!%
\ifx\2\empty
\edef\@submitdate{\noexpand#1 \noexpand\oldstylenums{#2}}%
\else
\s@paranumeri#2!%
\edef\@submitdate{\noexpand#1
\noexpand\oldstylenums{\1} -- \noexpand\oldstylenums{\2}}%
\fi
\let\1\undefined
\let\2\undefined
\else
\def\@submitdate{#1 #2}%
\fi
}
\def\s@paranumeri#1-#2!{\def\1{#1}\def\2{#2}}%
\let\esamedidottorato\sedutadilaurea
% \end{macrocode}
%
% The next macros are used to assign strings to some literal information
% to be typeset in the title page. |\ciclodidottorato| requires an uppercase roman numeral
% (in Italy), but it can accept anything that can precede the infix word ``cycle''.
% Macros |\corsodilaurea| and |\corsodidottorato| specify the degree course qualification;
% You would specify just ``Elettronica'', for example, and the package will
% write in the title page ``Corso di Laurea in Elettronica''. The infix part may be changed
% depending on the default language and the configuration file.
%
% |\scuoladidottorato| gets the name of the PhD School; |\ateneo| gets the the generic name
% of the university; |\nomeateneo| gets the proper name of the university. In Italy
% Universities are generally named after the city they are in; in large cities where there
% are several universities, each one of them has a proper name. For example the generic
% name might be ``Universit\`a di Roma'' and the proper name might be ``La Sapienza''.
% |\facolta| may receive an optional argument that is the uppercase roman numeral specific
% of the faculty and a compulsory argument that corresponds to the type of faculty; for
% example, with |\facolta[II]{Ingegneria}| the package typesets in the title page ``II
% Facolt\`a di Ingengeria''; if the optional argument is not specified, no roman numeral
% is typeset; the infix string \verb*+Facolt\`a di + may be changed with the configuration
% file depending on the default language. It might be necessary to define another name
% in place of ``Facolt\`a di~'', since with recent bills, the administrative structure of
% all Italian universities has been changed and the activities formally assigned to the
% Faculties may be now the responsibility of other structures that may have different
% names in different universities. If the internal command defined by |\FacoltaDi|
% is empty, no name is printed at all and the title page will not have any indication
% of a particular faculty or other educational structure. Therefore the Degree Course
% name, specified with |\corsodilaurea| should be always specified. The alias
% commands |\StrutturaDidattica| and |\struttura| are defined as equivalent
% commands to |\FacoltaDi| and |\facolta| respectively.
%
% Finally |\logosede| gets the name of the graphic file that contains the information
% relative to the university logo; it may receive also a comma separated list of logo file
% names, as it might be necessary when a thesis is developed in a multiple university
% environment. If such logo file is not available, the user does not specify this command;
% if the thesis is typeset on smaller paper size than A4 or letter, it would be much
% better to avoid inserting one or more logos in the title page; this is
% particularly important when using A5 paper size. Nevertheless this decision is
% left to the user and this package neither controls this fact nor outputs any warning.
% If the user uses this command to insert one or more university logo files
% but some file is not available, the usual \texttt{graphicx} package warning is issued
% but compilation goes on without the missing logo.
%
% The treatment of one or more logo files requires some extra
% commands and control sequences suitable to store temporary data or to specify style
% parameters: one is the name of a save box; another is the default spacing between the
% logos in the typeset page; the third is the height of the logos. The default spacing
% may be set with the help of the macro |\setlogodistance| -- notice that the default
% value is |3em|, and if a different distance is desired, it should not be much larger
% or much smaller than the default one; the default logo height is specified as an
% optional command to the |\logosede| command, while the default size is given by the
% |\interno| length; This length is specified in the main |toptesi| package in order to
% compute the typesetting grid, so that id the |topfront| package is used by itself with
% other classes, thee xistence of the |\inteno| control sequence is tested and if it is
% undefined, then and only then id defined in this package and assigned a default value.
% The save box name is just for internal workings and does not require any customization.
% The analysis and processing to the possible list of logo file names is done through the
% usual means of the delimited argument extraction of the single names from the list; the
% ``string'' of logos is then composed in a save box; as the list has been completely
% processed, the box is measured; if its width is shorter than the |\textwidth| it is
% typeset without further processing; if it's larger, on the opposite, the box gets scaled
% down so that its width equals the |\textwidth|.
%
% The |\tutoreaziendale| macro is the last title page addition; several students, who work
% on their thesis or final project in a company, want to have the company supervisor name
% printed in the title page; this does not preclude expressing the student's deepest thanks
% in the acknowledgements section, but it does not harm to name this person also in the
% title page.
%
% Eventually the |\retrofrontespizio| command, that by default is empty, allows to typeset
% a copyright page; the argument of this command is in total responsibility of the user
% who must write it in the thesis main language; the user can specify from zero to
% several paragraphs, separated by the vertical spaces s/he thinks best; the argument
% by default is typeset at the bottom of the text block of the copyright page. The user
% can specify any pertinent space at the bottom of his/her argument, so as to set the
% text in the position s/he likes best.
% In order to handle the copyright page in the proper way we need to test if its
% definition is empty or blank so we need the powerful advanced macros of the package
% |etoolbox| that has already been loaded by this package or by the main |toptesi| one.
% \begin{macrocode}
\def\ciclodidottorato#1{\gdef\@ciclo{#1 \@cyclename}}%
\def\corsodilaurea#1{\global\dottoratofalse\gdef\@corso{#1}}
\def\corsodidottorato#1{\global\dottoratotrue\global\laureatriennalefalse
\gdef\@corso{#1}}
\def\scuoladidottorato#1{\global\dottoratotrue\global\laureatriennalefalse
\gdef\@phdschool{#1}}
\def\ateneo#1{\gdef\@ateneo{\expandafter\uppercase{\expandafter #1}}}
\def\nomeateneo#1{\gdef\@nomeat{\expandafter\uppercase{\expandafter #1}}}
\newcommand\facolta[2][]{\gdef\@facname{#2}\gdef\@facnumber{#1}}
\let\struttura\facolta
\newlength{\TPT@logospace}\TPT@logospace=3em\relax
\newsavebox{\TPT@logobox}
\newdimen\TPT@logoheight
\newcommand*\setlogodistance[1]{\TPT@logospace=#1}
\providecommand*{\@logosede}{}
\ifcsundef{interno}{%\
\newlength\interno
\setlength\interno{\dimexpr\paperwidth/7}}{}
\newcommand\logosede[2][\interno]{\def\@logosede{#2}\TPT@logoheight=#1\relax
\ifcsvoid{@logosede}{\sbox{\TPT@logobox}{}}{\begin{lrbox}{\TPT@logobox}\expandafter\fillup@TCP@logobox\@logosede,!}}
\def\fillup@TCP@logobox#1,#2!{%
\ifblank{#1}{\end{lrbox}\ifdim\wd\TPT@logobox>\textwidth
\sbox\TPT@logobox{\resizebox{\textwidth}{!}{\box\TPT@logobox}}\fi}%
{\def\@logosede{#2}%
\includegraphics[height=\TPT@logoheight]{#1}\hskip\TPT@logospace
\expandafter\fillup@TCP@logobox\@logosede,!}}
\newcommand\printloghi{\unless\ifvoid\TPT@logobox\usebox{\TPT@logobox}\fi}
%\newcommand\printloghi{\ifdefvoid{\@logosede}{}{%
%\begin{lrbox}{\TPT@logobox}\hskip\TPT@logospace
% \expandafter\@printloghi\@logosede,!}}
%
%\def\@printloghi#1,#2!{%
%\ifblank{#1}{\hskip\TPT@logospace\end{lrbox}\vspace*{\bigskipamount}%
%\leavevmode
%\ifdim\wd\TPT@logobox<\textwidth \box\TPT@logobox
%\else\resizebox{\textwidth}{!}{\box\TPT@logobox}%
%\fi}{\def\@logosede{#2}%
%\includegraphics[height=\TPT@logoheight]{#1}\hskip\TPT@logospace
% \expandafter\@printloghi\@logosede,!}}
\def\tutoreaziendale#1{\gdef\@tutoreaziendale{#1}}
\newcommand\retrofrontespizio[1]{\long\gdef\@retrofrontespizio{#1}}
% \end{macrocode}
%
% The following commands are user commands that modify the infix strings
% according to the language used and to the specifications of the actual
% university. All these commands can be put in the configuration file so as to
% specify what is desired as a default.
% If these commands are specifically used to redefine something before issuing
% the |\frontespizio| command, the command that actually typesets the title
% page, the new definitions override the configuration ones.
%
% \begin{description}
% \def\Item[#1]{\item[\normalfont\texttt{\char92#1}]
% sets or changes the string}
% \Item[FacoltaDi] ``Facolt\`a di'' in, say, ``Faculty of''
% \Item[DottoratoIn] ``Dottorato in'' in, say, ``PhD in''
% \Item[CorsoDiLaureaIn] ``Corso di Laurea in'' in, say, ``Master of Science in''
% \Item[TesiDiLaurea] ``Tesi di Laurea'' in, say, ``Tesi di Laurea Magistrale''
% \Item[NomeMonografia] ``Monografia di Laurea'' in, say, ``Tesi di Laurea''
% \Item[NomeDissertazione] ``Dissertazione'' in, say, ``PhD dissertation''
% \Item[InName] ``in'' in, say, ``auf''
% \Item[CandidateName] ``Candidato'' in, say, ``Laureando''
% \Item[AdvisorName] ``Relatore'' in, say, ``Supervisors''
% \Item[CoAdvisorName] ``Correlatore'' in, say, ``Corapporteur''
% \Item[NomeTutoreAziendale] ``Supervisore aziendale'' in, say, ``XYZ Company Supervisor''
% \Item[TutorName] ``Tutore'' in, say, ``Supervisor''
% \Item[CycleName] ``ciclo'' in, say, ``cycle''
% \Item[NomePrimoTomo] ``Tomo primo'' in, say, ``First volume''
% \Item[NomeSecondoTomo] ``Tomo secondo'' in, say, ``Second volume''
% \item[NomeTerzoTomo] ``Tomo terzo'' in, say, ``Third volume''
% \item[NomeQuartoTomo] ``Tomo quarto'' in, say, ``Fourth volume''
% \end{description}
% In the above description the first string is generally the default one, while the second
% string is just an example of the corresponding string to be set in another language or
% to be changed in Italian. The last four commands clearly show the difficulty of localizing
% language strings: it is necessary to localize the whole phrase, because of the position of
% the adjectives.
% \begin{macrocode}
\newcommand\FacoltaDi[1]{\gdef\@faculty{#1}}
\let\StrutturaDidattica\FacoltaDi
\newcommand\DottoratoIn[1]{\gdef\@PhDname{#1}}
\newcommand\CorsoDiLaureaIn[1]{\gdef\@laureaname{#1}}
\newcommand\TesiDiLaurea[1]{\gdef\@TesiDiLaurea{#1}}
\newcommand\NomeMonografia[1]{\gdef\@monografia{#1}}
\newcommand\NomeDissertazione[1]{\gdef\@dissertazione{#1}}
\newcommand\InName[1]{\gdef\@InName{#1}}
\newcommand\CandidateName[1]{\gdef\@nomecandidato{#1}}
\newcommand\AdvisorName[1]{\gdef\Relatore{#1}\gdef\Relatori{#1}}
\newcommand\CoAdvisorName[1]{\gdef\Correlatore{#1}\gdef\Correlatori{#1}}
\newcommand\TutorName[1]{\gdef\Tutore{#1}}
\newcommand\NomeTutoreAziendale[1]{\gdef\@tutoreaziendalename{#1}}
\newcommand\CycleName[1]{\gdef\@cyclename{#1}}
\newcommand\NomePrimoTomo[1]{\gdef\PrimoTomo{#1}}
\newcommand\NomeSecondoTomo[1]{\gdef\SecondoTomo{#1}}
\newcommand\NomeTerzoTomo[1]{\gdef\TerzoTomo{#1}}
\newcommand\NomeQuartoTomo[1]{\gdef\QuartoTomo{#1}}
\newcommand\IDN{\\\quad matricola:\space}
% \end{macrocode}
%
% Now we can read the configuration file if it exists; in any case what is possibly
% defined or redefined in the configuration file must not be redefined in the following
% Lines and this is why everything is subject to the test |\@ifundefined|. Most default
% definitions are simply ``blank''; the others are in Italian. All of them, except the
% supervisor and candidate strings may be individually redefined in the configuration
% file or in the preamble. Those that cannot be redefined such as the four ``candidate''
% strings may be actually redefined through the single |\CandidateName| that should be
% used in a language depended way and with the correct number and gender once for all.
% The four endings in the Italian strings allow to exercise the correct selection only
% for Italian; a specific test is made inside the |\frontespizio| command; because of
% this the same machinery cannot be used, say, for French but may be in the future this
% feature is resolved in a proper way. The same is true for the supervisor and the
% co-supervisor strings that may be changed once for all with |\AdvisorName| and
% |\CoAdvisorName|.
% \begin{macrocode}
\IfFileExists{\jobname.cfg}{\input{\jobname.cfg}}%
{\IfFileExists{toptesi.cfg}{\input{toptesi.cfg}}{}}
%
\@ifundefined{@cyclename}{\def\@cyclename{ciclo}}{}
\@ifundefined{@title}{\def\@title{}}{}
\@ifundefined{@author}{\def\@author{}}{}
\@ifundefined{@principaladviser}{\def\@principaladviser{}}{}
\@ifundefined{@secondadviser}{\def\@secondadviser{}}{}
\@ifundefined{@thirdadviser}{\def\@thirdadviser{}}{}
\ifcsundef{@PhDdirector}{%
\ifDirettore\def\@PhDdirector{Direttore del corso di dottorato}\else
\def\@PhDdirector{Coordinatore del corso di dottorato}\fi}{}
\@ifundefined{@tutore}{\def\@tutore{}}{}
\@ifundefined{@secondauthor}{\def\@secondauthor{}}{}
\@ifundefined{@thirdauthor}{\def\@thirdauthor{}}{}
%
\@ifundefined{@nomerelatore}{\def\@nomerelatore{}}{}
\@ifundefined{@nomecandidato}{\def\@nomecandidato{}}{}
\@ifundefined{Candidato}{\def\Candidato{Candidato}}{}
\@ifundefined{Candidata}{\def\Candidata{Candidata}}{}
\@ifundefined{Candidati}{\def\Candidati{Candidati}}{}
\@ifundefined{Candidate}{\def\Candidate{Candidate}}{}
\@ifundefined{Relatore}{\def\Relatore{Relatore}}{}
\@ifundefined{Relatori}{\def\Relatori{Relatori}}{}
\@ifundefined{Correlatore}{\def\Correlatore{Correlatore}}{}
\@ifundefined{Correlatori}{\def\Correlatori{Correlatori}}{}
\@ifundefined{Tutore}{\def\Tutore{Tutore}}{}
\@ifundefined{@tutoreaziendale}{\def\@tutoreaziendale{}}{}
\@ifundefined{@tutoreaziendalename}%
{\def\@tutoreaziendalename{Supervisore Aziendale}}{}
\@ifundefined{@retrofrontespizio}{\def\@retrofrontespizio{}}{}
\@ifundefined{@subtitle}{\def\@subtitle{}}{}
%
\@ifundefined{@corso}{\def\@corso{}}{}
\@ifundefined{@ciclo}{\def\@ciclo{}}{}
\@ifundefined{@ateneo}{\def\@ateneo{POLITECNICO DI TORINO}}{}
\@ifundefined{@nomeat}{\def\@nomeat{}}{}% Nome proprio dell'ateneo
\@ifundefined{@facolta}{\def\@facname{}}{}
\@ifundefined{@facnumber}{\def\@facnumber{}}{}
\@ifundefined{@faculty}{\def\@faculty{}}{}
%
\@ifundefined{PrimoTomo}{\def\PrimoTomo{Tomo primo}}{}
\@ifundefined{SecondoTomo}{\def\SecondoTomo{Tomo secondo}}{}
\@ifundefined{TerzoTomo}{\def\TerzoTomo{Tomo terzo}}{}
\@ifundefined{QuartoTomo}{\def\QuartoTomo{Tomo quarto}}{}
% \end{macrocode}
% If the final exam date is not given the default value is the current month and the
% current year typeset in Italian; therefore the user is strongly requested to enter
% a date either with the |\sedutadilaurea| or the |\esamedidottorato| commands. The
% university logo command has already been defined empty as its default value.
% \begin{macrocode}
\@ifundefined{@submitdate}{\def\@submitdate{\ifcase\the\month\or%
Gennaio\or Febbraio\or Marzo\or Aprile\or Maggio\or Giugno\or
Luglio\or Agosto\or Settembre\or Ottobre\or Novembre\or Dicembre\fi
\space \the\year}}{}
%
\@ifundefined{@TesiDiLaurea}{\def\@TesiDiLaurea{Tesi di Laurea}}{}
\@ifundefined{@phdschool}{\def\@phdschool{SCUOLA DI DOTTORATO}}{}
\@ifundefined{@PhDname}{\def\@PhDname{Dottorato in }}{}
\@ifundefined{@laureaname}{\def\@laureaname{Corso di Laurea in }}{}
\@ifundefined{@dissertazione}{\def\@dissertazione{Tesi di Dottorato}}{}
\@ifundefined{@monografia}{\def\@monografia{Monografia di Laurea}}{}
\@ifundefined{@InName}{\def\@InName{in}}{}
% \end{macrocode}
%
% Finally we have the real macro |\frontespizio|, the real macro that actually
% typesets the title page. Actually the macro starts with some tests in order
% to decide if logos have to be set on topo or in the lower half of the title
% page; if the |classica| option has been set, the logos can be typeset only
% in the lower half of the title page, else the procedure tests if the
% |\frontespizio command| is followed by the asterisk. The macro |\fr@ntespizio|
% is the one that is invoked after such tests; it starts with the selection
% of the title page style; the local redefinition of the
% \texttt{myheadings} page style or a new |titlepage| page style; with the former one
% the university name goes into the header, while the exam date goes into the footer;
% with the latter style, on the opposite, the university logo(s) go in the header,
% while the Exam date remains in the footer. In this way the information that must
% be typeset on the title page is not crunched in too little a space and the overall
% text bounding box assumes a shape similar to that of the page.
%
% Everything is closed within a group so all definitions remain local.
% \begin{macrocode}
\newif\iftopTPTlogos
\def\frontespizio{%
\ifbool{classica}{\topTPTlogosfalse}{% else
\@ifstar{\topTPTlogosfalse}{\topTPTlogostrue}}%
\fr@ntespizio}
\def\fr@ntespizio{%
\begingroup
\iftopTPTlogos
\thispagestyle{titlepage}
\else
\thispagestyle{classica}
\fi
% \end{macrocode}
%
% We want also the title page to be set in the middle of the page irrespective of
% the binding correction; so we assign the average of the two side margins to each margin.
% \begin{macrocode}
\oddsidemargin=\dimexpr(\oddsidemargin+\evensidemargin)/2\relax
\evensidemargin \oddsidemargin
% \end{macrocode}
%
% The |\null| command inserts a void horizontal box into the vertical list;
% it is useful to act as a block against which the vertical glue pushes for
% setting the subsequent material. The normal font is chosen in case preceding
% commands did change the font characteristics.
% \begin{macrocode}
\null\setcounter{page}{1}%
\normalfont
% \end{macrocode}
% The generic university name should already be in the header either in the logo
% or in the header text; but in spite of this we test if the university generic
% name macro is void, if it contains something, then we typeset also the generic
% name; some candidates might obey to university regulations require the name
% of the university be at the top, just under the logo. The switch |\ifcsvoid|
% is true if |@ateneo| is empty or blank, false otherwise
% \begin{macrocode}
\iftopTPTlogos
\ifcsvoid{@ateneo}{}{%
{\centering\LARGE \@ateneo\par}\bigskip
}
\fi
% \end{macrocode}
%if it is non blank
% the first thing
% we set in the page is the university proper name and some vertical glue.
% \begin{macrocode}
\ifx\@nomeat\empty \else
{%
\centering
{\Large \@nomeat}\par}\vfill
\fi
% \end{macrocode}
% Then the faculty name comes next; but for the doctoral school it uses the doctoral
% school name entered with |\scuoladidottorato|, otherwise it inserts the faculty
% ordinal number or prefix and name already entered with the optional and required
% arguments of |\facolta|.
% \begin{macrocode}
\begin{center}
{\rmfamily\mdseries
\ifdottorato
\large \@phdschool\par\medskip
\else
\ifcsvoid{@faculty}{}{%
\LARGE\ifx\@facnumber\empty\else\@facnumber\space\fi
\@faculty\@facname\par\medskip
}
\fi
}%
% \end{macrocode}
% Further specification: it inserts the field of the PhD research or the degree course
% name; it inserts a line such as, for example, ``Philosophy Degree in Applied
% Tetratricotomy~--~XVI~cycle'' or ``Master of Science in Applied Tetratricotomy''.
% \begin{macrocode}
\ifcsvoid{@corso}{}{{\large
\ifdottorato
\@PhDname\@corso\ifx\@ciclo\empty\else~--~\@ciclo\fi
\else
\@laureaname\@corso
\fi
\par}}
\end{center}
% \end{macrocode}
% It now centers the name of the report, be it ``Doctoral Dissertation'' or ``Master
% Thesis'' or whatever; in case the command |\materia| was used, it then centers
% the area which the thesis deals with.
% \begin{macrocode}
\vspace{\stretch{0.2}}
\begin{center}
\LARGE
\ifdottorato
\@dissertazione%
\else
\iflaureatriennale
\@monografia%
\else
\@TesiDiLaurea%
\fi
\fi
\ifx\empty\@materia\else
\\\@InName\\\@materia
\fi
\end{center}
% \end{macrocode}
%
% Next comes the real title entered with |\titolo| or |\monografia| and the possible
% subtitle.
% \begin{macrocode}
\vspace{\stretch{0.2}}
\begin{center}
{\huge\bfseries \baselineskip=0.95em plus 1pt
\@title \par}
\end{center}
% \end{macrocode}
% con l'eventuale sottotitolo:
% \begin{macrocode}
\unless\ifx\@subtitle\empty
\begin{center}%
\large\textrm{\@subtitle}\par
\end{center}%
\fi
% \end{macrocode}
% If the option \texttt{classica} is in force the thesis might be divided in several
% volumes; theses in humanities apparently are often oversized. In this case the
% |\frontespizio| command may be given at the beginning of every volume and the
% counter \texttt{tomo} is stepped up; the volume number is therefore printed in
% each title page; the infix string may be redefined as it was shown above.
% \begin{macrocode}
\ifclassica
\ifnum\value{tomo}>\z@
\par\bigskip
\noindent\makebox[\textwidth]{%
\large\textbf{%
\ifcase\c@tomo%
\or \PrimoTomo%
\or \SecondoTomo%
\or \TerzoTomo%
\or \QuartoTomo%
\else
\PackageWarning{toptesi}{%
Counter tomo equals \the\c@tomo\MessageBreak
We never considered a thesis might get
divided in more than four volumes}%
\fi}}%
\fi
\vspace{1em}
\fi
\par
% \end{macrocode}
% Going down in the title page, now comes the optional insertion of the university
% logo(s);``optional'' in both meanings: lone or more university logos are not generally
% required in a thesis, and in case it depends if the logo(s) have to be put in the
% header or here.
% This is a simple task since the |\logosede| already defined the contents to the box
% |\TPT@logobox|, and this was done either with % an explicit command |\logosede|
% with its argument in the preamble, or with a specific line in the configuration file.
% If such box |\TPT@logobox| is void, the already defined |\printloghi| macro does
% not do anything.
% \begin{macrocode}
\unless\iftopTPTlogos
{\centering \printloghi\par}\fi
% \end{macrocode}
%
% The final task is to typeset the possible supervisors' names, the candidates' names
% and all the rest of the bureaucratical terms. We have to distinguish between a bachelor
% degree report that is not supposed to have a supervisor, from the doctoral dissertation
% where we do not indicate the supervisor, but the School Director, and the master thesis
% where there might be one or more supervisors; with the \texttt{classica} option in force
% no label is printed over the supervisor's name, unless there is a plurality of
% supervisors.
% \begin{macrocode}
\vfill
\iflaureatriennale
\let\@nomerelatore\empty
\else
\ifdottorato
\edef\@nomerelatore{\@PhDdirector}%
\else
\ifcsvoid{@principaladviser}{}{%
\def\@nomerelatore{\Relatore}}
\unless\ifclassica
\ifcsvoid{@secondadviser}{}{%
\def\@nomerelatore{\Relatori}}%
\fi
\fi
\fi
% \end{macrocode}
% Similarly the label names for the exam candidates are chosen; in Italian such
% names are infix strings that are selected according the gender and the number;
% if these labels have to be set in a different language it is necessary to define
% one string that has to be selected by the user according to number and gender.
% The label for the PhD candidate is left empty.
% \begin{macrocode}
\ifdottorato
\let\@nomecandidato\empty
\else
\iflanguage{italian}{%
\iffemminile
\def\@nomecandidato{\Candidata}%
\else
\def\@nomecandidato{\Candidato}%
\fi
\ifcsvoid{@secondauthor}{}{%
\iffemminile
\def\@nomecandidato{\Candidate}%
\else
\def\@nomecandidato{\Candidati}%
\fi}
}{}%
\fi
% \end{macrocode}
%
% For the supervisor(s) and of the candidate(s) name(s) a different approach
% is used for each one of the three categories of theses. If a bachelor degree
% report is dealt with, the name of the \emph{only} candidate is centered and
% written in caps-and-small-caps.
% \begin{macrocode}
\iflaureatriennale
\begin{center}%
\large\mdseries\textsc{\@author}
\end{center}%
% \end{macrocode}
% For doctoral and master theses two virtual boxes (actually macros) are filled
% up so as to align the supervisor name(s) and, in a second virtual box,
% the candidate name(s). The label is set in the first line with proper number
% and gender; in the second line the first name, and in the subsequent lines,
% if there are any, the other names. These virtual boxes actually contain a tabular
% environment each; these environments shall be actually typeset when these virtual
% box macros are executed. If the \texttt{classica} option is in force no label is
% set over the principal advisor name, but a label is set over the co-advisor name(s).
% The type size is also a little different for the \texttt{classica} option. The
% |\protect| command is used to protect the names in case they contain accent macros
% that might be expanded at the wrong moment.
% The candidate name(s) are typeset in another nested tabular environment of two
% lines when the user typesets the entry in such a way:
%\begin{verbatim}
%\candidato{Mario Rossi \IDN 123456}
%\end{verbatim}
% where if just the name is used or the command |\IDN| is omitted but the
% the ID number is entered, the whole string is written in one line without
% any label before e the ID number; if, on the other side, the |\IDN| command
% is redefined as not to produce a new line and the ID number is entered, the
% latter is typeset in a new line after the candidate's name. By default the
% |\IDN| macro is defined as:
%\begin{verbatim}
%\newcommand{\IDN}{\\\quad matricola:\space}
%\end{verbatim}
% but with |\renewcommand| the user can redefine it as s/he prefers, in
% particular by changing the Italian name into a proper English one, may be
% simply `ID'. It is necessary to recall that the ID number must be entered
% only if required by the University regulations; il must not be typeset in
% the title page just because it is possible to do it. If no number is entered,
% the |\IDN| must not be used.
% \begin{macrocode}
\else
% Per laurea e dottorato con relatori e correlatori...
\def\BoxRelatori{%
\begin{tabular}[t]{l}%
\hbox{\ifclassica\else\large\fi
\textbf{\protect\@nomerelatore}}\\[.6ex]
\hbox{\large\textrm{\protect\@principaladviser}}%
\ifx\@secondadviser\empty \else
\ifclassica
\ifx\@thirdadviser\empty
\ifx\@secondadviser\empty\else
\\[1.5ex]\textbf{\Correlatore:}%
\fi
\else
\\[1.5ex]\textbf{\Correlatori:}%
\fi
\fi
\\[.6ex]\hbox{{\large\textrm{\protect\@secondadviser}}}%
\fi
\ifx\@thirdadviser\empty \else
\\[.6ex] \hbox{{\large\textrm{\protect\@thirdadviser}}}%
\fi
\end{tabular}%
}%
% \end{macrocode}
% A similar approach is taken for the candidate name(s),although for code
% clarity I prefer to define two secondary macros in order to format the
% other candidates names and ID in the clearer way.
% \begin{macrocode}
\def\print@secondocandidato{\\\relax
\hbox{\large\tabular{@{}l@{}}\@secondauthor\endtabular}}
\def\print@terzocandidato{\\\relax
\hbox{\large\tabular{@{}l@{}}\@thirdauthor\endtabular}}
\def\BoxCandidati{%
\begin{tabular}[t]{l}%
\hbox{\unless\ifclassica\large\fi
\textbf{\protect\@nomecandidato}}\\[.6ex]
\hbox{\large\tabular{@{}l@{}}\@author\endtabular}%
\ifcsvoid{@secondauthor}{}{\print@secondocandidato}%
\ifcsvoid{@thirdauthor}{}{\print@terzocandidato}%
\end{tabular}%
}%
% \end{macrocode}
% The real typesetting of these name lists takes place now; if the thesis is
% referred to the PhD school one type of layout is used, otherwise the default
% master thesis layout is used; remember that the bachelor degree case has
% already taken place. For the doctoral dissertation the doctoral candidate name
% is typeset centered in one line by itself and everything else is set 3em below
% into a three column table extended to the |\hsize|, the first line containing
% the person labels and the second line containing the true names. The central
% column is used just for spacing, but it does not contain anything.
% \begin{macrocode}
\ifdottorato
\begin{center}\large
\textbf{\@author}\\[3em]
{\normalsize
\begin {tabular*}{\hsize}{@{\extracolsep{\fill}}ccc}
\ifcsvoid{@tutore}{}{\textbf{\Tutore}}
&\relax&
\ifcsvoid{@principaladviser}{}{\textbf{\@nomerelatore}}
\\
\ifcsvoid{@tutore}{}{\@tutore}
&\relax&
\ifcsvoid{@principaladviser}{}{\@principaladviser}
\end{tabular*}
}%
\end{center}
\else
% \end{macrocode}
% For the master thesis the two virtual boxes are set one besides the other but
% skewed so that to the right or, respectively, to the left of every name there
% is enough space for the signature. With the \texttt{classica} option in force
% the two boxes are simply aligned.
% \begin{macrocode}
\unless\ifclassica
\begin{flushleft}%
\BoxRelatori
\end{flushleft}\par\vspace*{-1.5\baselineskip}
\begin{flushright}%
\BoxCandidati
\end{flushright}%
\else
\noindent
\makebox[\textwidth]{\BoxRelatori\hfill\BoxCandidati}\par
\fi
\fi
\fi
% \end{macrocode}
% The final item is the optional name of the company supervisor.
% \begin{macrocode}
\ifcsvoid{@tutoreaziendale}{}{%
\vfill\vfill
{\centering \textbf{\@tutoreaziendalename}\\[.6ex]
\@tutoreaziendale\par}}
% \end{macrocode}
% All the material now is on the page; we put some more vertical glue and handle the
% copyright page; then we close the page sending it to the output file; the final
% |\endgroup| closes the |\begingroup| that was set at the beginning of this long macro.
% In order to handle the copyright page, we test if the internal definition of the
% copyright page text is empty; in this case no copyright page should be output, and
% a |\creadoublepage| works fine in both one and two side printing; I the copyright page
% text is not empty, after the shipping out of the title page, we set the copyright page
% text flush bottom with the text block, and then we ship out also this copyright page.
% \begin{macrocode}
\par\clearpage
\ifcsvoid{@retrofrontespizio}{}%
{\null\vfill\pagestyle{empty}\@retrofrontespizio\par\clearpage}%
\endgroup}
% \end{macrocode}
% \iffalse
%</topfrn>
% \fi
%
% \subsection{A sample configuration file}
% The following code generates a simple configuration file that the user
% can change at will; it can be used as a template for generating a really
% personal configuration file.
% \iffalse
%<*topcfg>
% \fi
% \begin{macrocode}
%%
%%================================================================
%% This file is the only file of the TOPtesi bundle that the user
%% can modify without restrictions in order to customize the
%% contents of this configuration file to his/her needs. The user
%% can add or remove lines, comment or uncomment lines, change the
%% arguments to the macros, add definitions and so on.
%% A better use of this file consists into copying it to another
%% file to be named as the thesis main file and with extension
%% .cfg; This bundle will try to read "\jobname.cfg"; if this file
%% does not exist, it looks for toptesi.cfg and if this further
%% does not exist, it does nothing. This means that the provided
%% file toptesi.cfg is to be used preferably as a model, not to
%% be used directly.
%%================================================================
%%
\ateneo{Politecnico di Torino}
\facolta{}% nessun nome di default
\FacoltaDi{}% non viene scritta nessuna indicazione per la facoltà
%%\DottoratoIn{Corso di dottorato in }
\CorsoDiLaureaIn{Corso di Laurea in }
\TesiDiLaurea{Tesi di Laurea Magistrale}
%%\NomeMonografia{Monografia di Laurea}
%%\NomeDissertazione{Tesi di Dottorato}
\InName{in}
%%\TutorName{Tutore}
%%\CycleName{ciclo}
%%\retrofrontespizio{Questo testo è soggetto alla Creative Commons Licence}
% \end{macrocode}
% \iffalse
%</topcfg>
% \fi
%
% \subsection{The \texttt{topcoman.sty} code}
% This file may be used as an independent extension package for the \texttt{report}
% document class, and possibly for other classes
% \iffalse
%<*topcmn>
% \fi
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e} % lavora solo con LaTeX 2e
\ProvidesPackage{topcoman}%
[2014/11/02 v.5.83 Additional commands for the TOPtesi bundle]
% \end{macrocode}
% The new command |\DeclareSlantedCapitalGreekLetters| optionally sets the capital
% Greek letters in math mode with the glyphs taken from the math italic fonts, not from
% the math roman fonts, at is is by default; some persons prefer to use both symbols with
% different meanings, so this command lets them do so. This may be useful unless the XeTeX
% typesetting engine is used; in facts the Unicode math defines specific commands for setting
% any Latin or Greek mathematical letter in any possible font shape and series.
% \begin{macrocode}
\RequirePackage{ifxetex}
\ifxetex\else
\newcommand*\DeclareSlantedCapitalGreekLetters{%
\mathchardef\Gamma="7100
\mathchardef\Delta="7101
\mathchardef\Theta="7102
\mathchardef\Lambda="7103
\mathchardef\Xi="7104
\mathchardef\Pi="7105
\mathchardef\Sigma="7106
\mathchardef\Upsilon="7107
\mathchardef\Phi="7108
\mathchardef\Psi="7109
\mathchardef\Omega="710A
}\fi
% \end{macrocode}
% The |\ensuremath| command is defined in the \LaTeX\ kernel from a certain version on;
% should the user employ a really old \LaTeXe\ implementation this definition
% supplies the missing one. Should the |babel| package not be loaded, then we provide the
% useful command |\textormath| provided by |babel|. We define the text version of the
% subscript and ensure also that the |textcomp| package is loaded; of course it it's already
% loaded the |\RequirePackage| command performs the necessary tests and possibly does not load
% anything.
% \begin{macrocode}
\providecommand{\ensuremath}[1]{\ifmmode#1\else$#1$\fi}%
\providecommand\textormath{}
\renewcommand{\textormath}{\ifmmode\expandafter\@secondoftwo\else
\expandafter\@firstoftwo\fi}
\providecommand*\textsubscript{\raisebox{-0.5ex}}
\ifxetex\else
\RequirePackage{textcomp}
\fi
% \end{macrocode}
% The following commands may be already defined; should they be missing they are supplied
% here. The greatest part of them is already defined in the Italian option to the
% \texttt{babel} language if the thesis is typeset with \textsf{pdflatex} that loads that
% package; these commands are not predefined if the thesis is typeset with \XeLaTeX\ that does
% not load the \texttt{babel} package; but remember; this package may be used as a stand alone
% one, without the initial call by the \texttt{toptesi} document class, so that the language
% Italian might be undefined.
% \begin{macrocode}
\providecommand{\ohm}{\textormath{\textohm}{\mathrm{\Omega}}}
\providecommand{\ped}[1]{\textormath{\textsubscript{#1}}{_{\mathrm{#1}}}}
\providecommand{\ap}[1]{\textormath{\textsuperscript{#1}}{^{\mathrm{#1}}}}
\providecommand{\unit}[1]{\ensuremath{{\mathrm{\,#1}}}}
\providecommand{\gei}{\ensuremath{{\mathop{\mathrm{j}}\nolimits}}}
\providecommand{\eu}{\ensuremath{{\mathop{\mathrm{e}}\nolimits}}}
\providecommand{\micro}{\textormath{\textmu}{\ifxetex\mathup{μ}\else
\ifx\muup\undefined\mu\else\muup\fi\fi}}
\providecommand{\gradi}{\textormath{\textdegree}{^\circ}}
% \end{macrocode}
%
% The next set of definitions are used to list a program file. There are better
% packages to perform this task in the CTAN archives. This set of macros has the
% advantage that is very short and light on the computer memory; nevertheless it
% performs its duty pretty well. The font face is the typewriter one; the font
% size is chosen so as to allow approximately 80 characters in the text width of
% the thesis. It respects the possible indentation tabs (ASCII code 9) by
% inserting the correct amount of typewriter spaces so as to align every line to
% the correct boundary which is ``zero modulo eight''. If the program file
% contains some form feed ASCII characters (ASCII code 12), this \TeX\ code
% inserts a new page command. The code may appear strange, and it does because
% it makes heavy use of the dirty tricks of appendix~D of the \TeX\-book.
% for Wahat concern the macro |\obeyspaces| (already defined in the \LaTeXe\
% kernel) we had to change it in order to abolish a conflict with package |ABC|
% used to typeset music. The latter package is about 15 years younger than
% |topcoman|, so it should be this latter package duty to avoid conflicts with
% pre existing packages; on the opposite we accepted the suggestion of Enrico
% Gregorio, the author of |ABC| whom we thank very much, because his package
% is much more complicated than this one, so that the conflict is avoided
% more easily by correcting |topcoman|.
% \begin{macrocode}
\def\listing#1{\par\begingroup
\programma \input #1 \endgroup}
\def\uncatcodespecials{\def\do##1{\catcode`##1=12}\dospecials}
\def\programma{\ttfamily\footnotesize \parindent 0pt
\def\par{\leavevmode\egroup\box0\endgraf}
\catcode`\`=\active \catcode`\^^I=\active \catcode`\^^L=\active
\obeylines \uncatcodespecials \obeyspaces
\begingroup\lccode`~=`\ \lowercase{\endgroup\global\let~}\ %
\everypar{\startbox}}
% \end{macrocode}
% The above code does the whole work, but the alignment to the tab stops and the
% new page command associated to the form feed ASCII character are done with the
% following definitions.
% \begin{macrocode}
\newdimen\tabwidth
\setbox0=\hbox{\ttfamily\footnotesize\space}
\tabwidth=8\wd0
\def\startbox{\setbox0=\hbox\bgroup}
%{\obeyspaces\global\let =\space}
{\catcode`\`=\active \gdef`{\relax\lq}}
{\catcode`\^^I=\active
\gdef^^I{\leavevmode\egroup \dimen0=\wd0
\divide\dimen0 by\tabwidth
\multiply\dimen0 by\tabwidth
\advance\dimen0 by\tabwidth
\wd0=\dimen0 \box0 \startbox}}
{\catcode`\^^L=\active \global\let^^L\newpage}
% \end{macrocode}
%
% Remember that the comma as a decimal separator is required for all languages except English.
% If you use they package outside TOPtesi, but as an extension of other packages, it's up to
% you to define an ``intelligent comma'' macro or to load either the |icomma.sty| or the
% |nccomma.sty| package that defines such a macro: the |icomma| package defines the comma as
% a mathematical active character that recognizes the subsequent token as a space token so as
% to insert a punctuation comma; |nccomma| behaves more or less as the macro defined in
% TOPtesi and recognizes digits so as to use a decimal comma.
%
% The following commands are used to write the ``lower case'' roman numerals with the
% small-caps; in order to avoid complications with missing fonts or math environments we make
% sure to typeset these numerals with script size capitals; this solution is not probably the
% best one but it works; it typesets these roman numerals with the current font; in TOPtesi
% roman numerals are used only for folios, but in order to be compliant with the package
% |hyperref|, I avoided using this new macro for folios; in other situations there are no more
% any problems with the choice of font shapes and series. We need a robust command in order to
% set the script math size
% \begin{macrocode}
\DeclareRobustCommand*{\simulatedSC}[1]{%
{\check@mathfonts\fontsize{\sf@size}{\f@baselineskip}\selectfont#1}}%
% \end{macrocode}
%
% A user, Antonio Mele, suggested and requested the possibility of having
% the figure and table name inserted automatically when the |\ref|command is
% issued. For single citations the solution works fine, but for range
% references it does not work. In Italian the name must be lower case while in
% other languages, specifically in English, the name has a capital initial.
% Since this feature might be handy in certain circumstances and annoying in
% other ones, this feature can be turned on and off at will with the enabling
% and disabling commands. By default the feature is disabled.
% \begin{macrocode}
\def\ft@figure{\iflanguage{italian}{\MakeLowercase{\figurename}}%
{\figurename}~}
\def\ft@table{\iflanguage{italian}{\MakeLowercase{\tablename}}%
{\tablename}~}
%
\newcommand*\EnableFigTabNames{%
\let\p@figure\ft@figure\let\p@table\ft@table}
\newcommand*\DisableFigTabNames{%
\let\p@figure\empty\let\p@table\empty}
%
\DisableFigTabNames
% \end{macrocode}
% \iffalse
%</topcmn>
% \fi
%
%
% \Finale
% \endinput
%
|