1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
|
= Asciidoctor PDF Theming Guide
Dan Allen <https://github.com/mojavelinux[@mojavelinux]>
// Settings:
:idprefix:
:idseparator: -
:toc: preamble
:experimental:
ifndef::env-github[:icons: font]
ifdef::env-github[]
:outfilesuffix: .adoc
:!toc-title:
:caution-caption: :fire:
:important-caption: :exclamation:
:note-caption: :paperclip:
:tip-caption: :bulb:
:warning-caption: :warning:
endif::[]
:window: _blank
// Aliases:
:conum-guard-yaml: #
ifndef::icons[:conum-guard-yaml: # #]
ifdef::backend-pdf[:conum-guard-yaml: # #]
:url-fontforge: https://fontforge.github.io/en-US/
:url-fontforge-scripting: https://fontforge.github.io/en-US/documentation/scripting/
////
Topics remaining to document:
* line height and line height length (and what that all means)
* title page layout / title page images (logo & background)
* document that unicode escape sequences can be used inside double-quoted strings
////
[.lead]
The theming system in Asciidoctor PDF is used to control the layout and styling of the PDF file Asciidoctor PDF generates from AsciiDoc.
This document describes how the theming system works, how to define a custom theme in YAML and how to activate the theme when running Asciidoctor PDF.
TIP: The quickest way to create your own theme is to <<Extends,extend the default theme>>.
This not only gives you a set of foundation styles to build on, it also provides a collection of <<Bundled Fonts,bundled fonts>>.
If you want to replace the bundled fonts with your own, you must declare the name and location of each font in the <<Custom fonts,font catalog>>.
To reuse the bundled fonts, you can either extend the default theme and/or redeclare the bundled fonts in the font catalog.
WARNING: If you don't declare your own fonts (or extend the default theme), only the built-in (AFM) fonts provided by the PDF reader will be available.
Using AFM fonts can result in missing functionality and warnings.
See the <<Built-In (AFM) Fonts>> section to learn more about these limitations.
toc::[]
== Language Overview
The Asciidoctor PDF theme language is described using the http://en.wikipedia.org/wiki/YAML[YAML] data format and incorporates many _concepts_ from CSS and SASS.
Therefore, if you have a background in web design, the terminology should be immediately familiar to you.
*Note, however, that the theming system isn't actually CSS.*
Like CSS, themes have both selectors and properties.
Selectors are the component you want to style.
The properties are the style elements of that component that can be styled.
All selector names are implicit (e.g., `heading`), so you customize the theme primarily by manipulating pre-defined property values (e.g., `font-size`).
[NOTE]
====
The theme language in Asciidoctor PDF supports a limited subset of the properties from CSS.
Some of these properties have different names from those found in CSS.
* An underscore (`_`) may be used in place of a hyphen (`-`) in all property names (so you may use `font_family` or `font-family`).
* An underscore (`_`) may be used in place of a hyphen (`-`) in all variable names (so you may use `$base_font_family` or `$base-font-family`).
* Instead of separate properties for font weight and font style, the theme language combines these settings in the `font-style` property (allowed values: `normal`, `bold`, `italic` and `bold_italic`).
* The `align` property in the theme language is roughly equivalent to the `text-align` property in CSS.
* The `font-color` property in the theme language is equivalent to the `color` property in CSS.
====
A theme is described in a YAML-based data format and stored in a dedicated theme file.
YAML is a human-friendly data format that resembles CSS and helps to describe the theme.
The theme language adds some extra features to YAML, such as variables, basic math, measurements and color values.
These enhancements will be explained in detail in later sections.
The theme file must be named _<name>-theme.yml_, where `<name>` is the name of the theme.
_We recommend *not* using the names *base* or *default* so you don't confuse it with one of the built-in themes._
Here's an example of a basic theme file that extends the base theme:
.basic-theme.yml
[source,yaml]
----
page:
layout: portrait
margin: [0.75in, 1in, 0.75in, 1in]
size: Letter
base:
font-color: #333333
font-family: Times-Roman
font-size: 12
line-height-length: 17
line-height: $base-line-height-length / $base-font-size
vertical-spacing: $base-line-height-length
heading:
font-color: #262626
font-size: 17
font-style: bold
line-height: 1.2
margin-bottom: $vertical-spacing
link:
font-color: #002FA7
outline-list:
indent: $base-font-size * 1.5
footer:
height: $base-line-height-length * 2.5
line-height: 1
recto:
right:
content: '{page-number}'
verso:
left:
content: $footer-recto-right-content
----
When creating a new theme, you only have to define the keys you want to override from the base theme, which is loaded prior to loading your custom theme.
All the available keys are documented in <<Keys>>.
The converter uses the information from the theme map to help construct the PDF.
Instead of designing a theme from scratch, you can extend the default theme using the `extends` key as follows:
[source,yaml]
----
extends: default
base:
font-color: #ff0000
----
You can also point the extends key at another custom theme to extend from it.
If you don't want to extend any theme, including the base theme, assign the value `~` to the `extends` key (i.e., `extends: ~`).
WARNING: If you start a new theme from scratch, we strongly recommend defining TrueType fonts and specifying them in the `base` and `literal` categories.
Otherwise, Asciidoctor PDF will use built-in AFM fonts, which can result in missing functionality and warnings.
[TIP]
====
Instead of creating a theme from scratch, another option is to download the https://github.com/asciidoctor/asciidoctor-pdf/blob/master/data/themes/default-theme.yml[default-theme.yml] file from the source repository.
Save the file using a unique name (e.g., _custom-theme.yml_) and start hacking on it.
Alternatively, you can snag the file from your local installation using the following command:
$ ASCIIDOCTOR_PDF_DIR=`gem contents asciidoctor-pdf --show-install-dir`;\
cp "$ASCIIDOCTOR_PDF_DIR/data/themes/default-theme.yml" custom-theme.yml
====
Keys may be nested to an arbitrary depth to eliminate redundant prefixes (an approach inspired by SASS).
Once the theme is loaded, all keys are flattened into a single map of qualified keys.
Nesting is simply a shorthand way of organizing the keys.
In the end, a theme is just a map of key/value pairs.
Nested keys are adjoined to their parent key with an underscore (`_`) or hyphen (`-`).
This means the selector part (e.g., `link`) is combined with the property name (e.g., `font-color`) into a single, qualified key (e.g., `link_font_color` or `link-font-color`).
For example, let's assume we want to set the base (i.e., global) font size and color.
These keys may be written longhand:
[source,yaml]
----
base-font-color: #333333
base-font-family: Times-Roman
base-font-size: 12
----
Or, to avoid having to type the prefix `base-` multiple times, the keys may be written as a hierarchy:
[source,yaml]
----
base:
font-color: #333333
font-family: Times-Roman
font-size: 12
----
Or even:
[source,yaml]
----
base:
font:
color: #333333
family: Times-Roman
size: 12
----
Each level of nesting must be indented by two spaces from the indentation of the parent level.
Also note the presence of the colon (`:`) after each key name.
== Values
The value of a key may be one of the following types:
* String
** Font family name (e.g., Roboto)
** Font style (normal, bold, italic, bold_italic)
** Alignment (left, center, right, justify)
** Color as hex string (e.g., 'ff0000', #ff0000, or '#ff0000')
** Image path
** Enumerated type (where specified)
** Text content (where specified)
* Null (clears any previously assigned value)
** _empty_ (i.e., no value specified)
** null
** ~
* Number (integer or float) with optional units (default unit is points)
* Array
** Color as RGB array (e.g., [51, 51, 51])
** Color CMYK array (e.g., [50, 100, 0, 0])
** Margin (e.g., [1in, 1in, 1in, 1in])
** Padding (e.g., [1in, 1in, 1in, 1in])
* Variable reference (e.g., $base_font_color or $base-font-color)
* Math expression
Note that keys almost always require a value of a specific type, as documented in <<Keys>>.
=== Inheritance
Like CSS, inheritance is a principle feature in the Asciidoctor PDF theme language.
For many of the properties, if a key is not specified, the key inherits the value applied to the parent content in the content hierarchy.
This behavior saves you from having to specify properties unless you want to override the inherited value.
The following keys are inherited:
* font-family
* font-color
* font-size
* font-style
* text-transform
* line-height (currently some exceptions)
* margin-bottom (if not specified, defaults to $vertical-spacing)
.Heading Inheritance
****
Headings inherit starting from a specific heading level (e.g., `heading-h2-font-size`), then to the heading category (e.g., `heading-font-size`), then directly to the base value (e.g., `base-font-size`).
Any setting from an enclosing context, such as a sidebar, is skipped.
****
=== Variables
To save you from having to type the same value in your theme over and over, or to allow you to base one value on another, the theme language supports variables.
Variables consist of the key name preceded by a dollar sign (`$`) (e.g., `$base-font-size`).
Any qualified key that has already been defined can be referenced in the value of another key.
(In order words, as soon as the key is assigned, it's available to be used as a variable).
IMPORTANT: Variables are defined from top to bottom (i.e., in document order).
Therefore, a variable must be defined before it is referenced.
In other words, the path the variable refers to must be *above* the usage of that variable.
For example, once the following line is processed,
[source,yaml]
----
base:
font-color: #333333
----
the variable `$base-font-color` will be available for use in subsequent lines and will resolve to `#333333`.
Let's say you want to make the font color of the sidebar title the same as the heading font color.
Just assign the value `$heading-font-color` to the `$sidebar-title-font-color`.
[source,yaml]
----
heading:
font-color: #191919
sidebar:
title:
font-color: $heading-font-color
----
You can also use variables in math expressions to use one value to build another.
This is commonly done to set font sizes proportionally.
It also makes it easy to test different values very quickly.
[source,yaml]
----
base:
font-size: 12
font-size-large: $base-font-size * 1.25
font-size-small: $base-font-size * 0.85
----
We'll cover more about math expressions later.
==== Custom Variables
You can define arbitrary key names to make custom variables.
This is one way to group reusable values at the top of your theme file.
If you are going to do this, it's recommended that you organize the keys under a custom namespace, such as `brand`.
For instance, here's how you can define your brand colors:
[source,yaml,subs=attributes+]
----
brand:
primary-color: #E0162B {conum-guard-yaml} <1>
secondary-color: '#FFFFFF' {conum-guard-yaml} <2>
alert-color: '0052A5' {conum-guard-yaml} <3>
----
<1> To align with CSS, you may add `+#+` in front of the hex color value to coerce it to a string.
A YAML preprocessor is used to ensure the value is not treated as a comment as would normally be the case in YAML.
<2> You may put quotes around the CSS-style hex value to make it friendly to a YAML editor or validation tool.
<3> The leading `+#+` on a hex value is entirely optional.
However, we recommend that you always use either a leading `+#+` or surrounding quotes (or both) to prevent YAML from mangling the value (for example, 000000 would become 0, so use '000000' or #000000 instead).
You can now use these custom variables later in the theme file:
[source,yaml]
----
base:
font-color: $brand-primary-color
----
=== Math Expressions & Functions
The theme language supports basic math operations to support calculated values.
Like programming languages, multiple and divide take precedence over add and subtract.
The following table lists the supported operations and the corresponding operator for each.
[width=25%]
|===
|Operation |Operator
|multiply
|*
|divide
|/
|add
|+
|subtract
|-
|===
IMPORTANT: Operators must always be surrounded by a space on either side (e.g., 2 + 2, not 2+2).
Here's an example of a math expression with fixed values.
[source,yaml]
----
conum:
line-height: 4 / 3
----
Variables may be used in place of numbers anywhere in the expression:
[source,yaml]
----
base:
font-size: 12
font-size-large: $base-font-size * 1.25
----
Values used in a math expression are automatically coerced to a float value before the operation.
If the result of the expression is an integer, the value is coerced to an integer afterwards.
IMPORTANT: Numeric values less than 1 must have a 0 before the decimal point (e.g., 0.85).
The theme language also supports several functions for rounding the result of a math expression.
The following functions may be used if they surround the whole value or expression for a key.
round(...):: Rounds the number to the nearest half integer.
floor(...):: Rounds the number up to the next integer.
ceil(...):: Rounds the number down the previous integer.
You might use these functions in font size calculations so that you get more exact values.
[source,yaml]
----
base:
font-size: 12.5
font-size-large: ceil($base-font-size * 1.25)
----
=== Measurement Units
Several of the keys require a value in points (pt), the unit of measure for the PDF canvas.
A point is defined as 1/72 of an inch.
If you specify a number without any units, the units defaults to pt.
However, us humans like to think in real world units like inches (in), centimeters (cm), or millimeters (mm).
You can let the theme do this conversion for you automatically by adding a unit notation next to any number.
The following units are supported:
[width=25%]
|===
|Unit |Suffix
|Centimeter
|cm
|Inches
|in
|Millimeter
|mm
|Percentage^[1]^
|%, vw, or vh
|Points
|pt (default)
|===
. A percentage with the % unit is calculated relative to the width or height of the content area.
Viewport-relative percentages (vw or vh units) are calculated as a percentage of the page width or height, respectively.
Currently, percentage units can only be used for placing elements on the title page or for setting the width of a block image.
Here's an example of how you can use inches to define the page margins:
[source,yaml]
----
page:
margin: [0.75in, 1in, 0.75in, 1in]
----
The order of elements in a measurement array is the same as it is in CSS:
. top
. right
. bottom
. left
=== Alignments
The align subkey is used to align text and images within the parent container.
==== Text Alignments
Text can be aligned as follows:
* left
* center
* right
* justify (stretched to each edge)
==== Image Alignments
Images can be aligned as follows:
* left
* center
* right
=== Font Styles
In most cases, whereever you can specify a custom font family, you can also specify a font style.
These two settings are combined to locate the font to use.
The following font styles are recognized:
* normal (no style)
* italic
* bold
* bold_italic
=== Text Transforms
Many places where font properties can be specified, a case transformation can be applied to the text.
The following transforms are recognized:
* uppercase
* lowercase
* none (clears an inherited value)
[CAUTION#transform-unicode-letters]
====
Since Ruby 2.4, Ruby has built-in support for transforming the case of any letter defined by Unicode.
If you're using Ruby < 2.4, and the text you want to transform contains characters beyond the Basic Latin character set (e.g., an accented character), you must install either the `activesupport` or the `unicode` gem in order for those characters to be transformed.
$ gem install activesupport
or
$ gem install unicode
====
// Additional transforms, such as capitalize, may be added in the future.
=== Colors
The theme language supports color values in three formats:
Hex:: A string of 3 or 6 characters with an optional leading `#`, optional surrounding quotes, or both.
RGB:: An array of numeric values ranging from 0 to 255.
CMYK:: An array of numeric values ranging from 0 to 1 or from 0% to 100%.
Transparent:: The special value `transparent` indicates that a color should not be used.
==== Hex
The hex color value is likely most familiar to web developers.
The value must be either 3 or 6 characters (case insensitive) with an optional leading hash (`#`), optional surrounding quotes, or both.
To align with CSS, you may add a `+#+` in front of the hex color value.
A YAML preprocessor is used to ensure the value is not treated as a comment as would normally be the case in YAML.
That same preprocessor will also coerce a primitive value to a string if `color` is the name of the last segment in the key (e.g., `font-color`).
This avoids the problem of 000 becoming 0 (and similar implicit conversions) when the theme file is parsed.
You also may put quotes around the CSS-style hex value to make it friendly to a YAML editor or validation tool.
In this case, the leading `+#+` on a hex value is entirely optional.
Regardless, we recommend that you always use either a leading `+#+` or surrounding quotes (or both) to prevent YAML from mangling the value.
The following are all equivalent values for the color red:
[cols="8*m"]
|===
|#ff0000
|#FF0000
|'ff0000'
|'FF0000'
|#f00
|#F00
|'f00'
|'F00'
|===
Here's how a hex color value appears in the theme file:
[source,yaml]
----
base:
font-color: #ff0000
----
==== RGB
An RGB array value must be three numbers ranging from 0 to 255.
The values must be separated by commas and be surrounded by square brackets.
NOTE: An RGB array is automatically converted to a hex string internally, so there's no difference between ff0000 and [255, 0, 0].
Here's how to specify the color red in RGB:
* [255, 0, 0]
Here's how a RGB color value appears in the theme file:
[source,yaml]
----
base:
font-color: [255, 0, 0]
----
==== CMYK
A CMYK array value must be four numbers ranging from 0 and 1 or from 0% to 100%.
The values must be separated by commas and be surrounded by square brackets.
Unlike the RGB array, the CMYK array _is not_ converted to a hex string internally.
PDF has native support for CMYK colors, so you can preserve the original color values in the final PDF.
Here's how to specify the color red in CMYK:
* [0, 0.99, 1, 0]
* [0, 99%, 100%, 0]
Here's how a CMYK color value appears in the theme file:
[source,yaml]
----
base:
font-color: [0, 0.99, 1, 0]
----
==== Transparent
It's possible to specify no color by assigning the special value `transparent`, as shown here:
[source,yaml]
----
table:
background-color: transparent
----
=== Images
An image is specified either as a bare image path or as an inline image macro as found in the AsciiDoc syntax.
Images in the theme file are currently resolved relative to the value of the `pdf-themesdir` attribute.
(If `pdf-theme` is a path that ends in `.yml`, and `pdf-themesdir` is not set, then the images are resolved relative to the directory of the path specified by `pdf-theme`).
The following image types (and corresponding file extensions) are supported:
* PNG (.png)
* JPEG (.jpg)
* SVG (.svg)
CAUTION: The GIF format (.gif) and BMP format (.bmp) are not supported unless you're using prawn-gmagick.
See https://github.com/asciidoctor/asciidoctor-pdf#supporting-additional-image-file-formats[support for additional image file formats] for details.
Here's how an image is specified in the theme file as a bare image path:
[source,yaml]
----
title-page:
background-image: title-cover.png
----
Here's how the image is specified using the inline image macro:
[source,yaml]
----
title-page:
background-image: image:title-cover.png[]
----
In either case, the image is resolved relative to the value of the `pdf-themesdir` attribute, as previously described.
Like in the AsciiDoc syntax, wrapping the value in the image macro allows you to specify other settings, such as `pdfwidth`, `fit`, and/or `align`.
For example:
[source,yaml]
----
title-page:
logo-image: image:logo.png[width=250,align=center]
----
=== Quoted String
Some of the keys accept a quoted string as text content.
The final segment of these keys is always named `content`.
A content key accepts a string value.
It's usually best to quote the string or use the http://symfony.com/doc/current/components/yaml/yaml_format.html#strings[YAML multi-line string syntax].
Text content may be formatted using a subset of inline HTML.
You can use the well-known elements such as `<strong>`, `<em>`, `<code>`, `<a>`, `<sub>`, `<sup>`, `<del>`, and `<span>`.
The `<span>` element supports the `style` attribute, which you can use to specify the `color`, `font-weight`, and `font-style` CSS properties.
You can also use the `rgb` attribute on the `<color>` element to change the color or the `name` and `size` attributes on the `<font>` element to change the font properties.
If you need to add an underline or strikethrough decoration to the text, you can assign the `underline` or `line-through` to the `class` attribute on any aforementioned element.
Here's an example of using formatting in the content of the menu caret:
[source,yaml]
----
menu-caret-content: " <font size=\"1.15em\"><color rgb=\"#b12146\">\u203a</color></font> "
----
NOTE: The string must be double quoted in order to use a Unicode escape code like `\u203a`.
Additionally, normal substitutions are applied to the value of content keys for <<Running Content (Header & Footer),running content>>, so you can use most AsciiDoc inline formatting (e.g., `+*strong*+` or `+{attribute-name}+`) in the values of those keys.
== Fonts
You can select from <<built-in-afm-fonts,built-in PDF fonts>>, <<bundled-fonts,fonts bundled with Asciidoctor PDF>> or <<custom-fonts,custom fonts>> loaded from TrueType font (TTF) files.
If you want to use custom fonts, you must first declare them in your theme file.
IMPORTANT: Asciidoctor has no challenge working with Unicode.
In fact, it prefers Unicode and considers the entire range.
However, once you convert to PDF, you have to meet the font requirements of PDF in order to preserve Unicode characters.
That means you need to provide a font (at least a fallback font) that contains glyphs for all the characters you want to use.
If you don't, you may notice that characters are missing (usually replaced with a box).
There's nothing Asciidoctor can do to convince PDF to work with extended characters without the right fonts in play.
=== Built-In (AFM) Fonts
The names of the built-in fonts (for general-purpose text) are as follows:
[width=33.33%]
|===
|Font Name |Font Family
|Helvetica
|sans-serif
|Times-Roman
|serif
|Courier
|monospace
|===
Using a built-in font requires no additional files.
You can use the key anywhere a `font-family` property is accepted in the theme file.
For example:
[source,yaml]
----
base:
font-family: Times-Roman
----
However, when you use a built-in font, the characters you can use in your document are limited to the characters in the WINANSI (http://en.wikipedia.org/wiki/Windows-1252[Windows-1252]) code set.
WINANSI includes most of the characters needed for writing in Western languages (English, French, Spanish, etc).
For anything outside of that, PDF is BYOF (Bring Your Own Font).
Even though the built-in fonts require the content to be encoded in WINANSI, _you still type your AsciiDoc document in UTF-8_.
Asciidoctor PDF encodes the content into WINANSI when building the PDF.
WARNING: Built-in (AFM) fonts do not use the <<fallback-fonts,fallback fonts>>.
In order for the fallback font to kick in, you must be using a TrueType font.
.WINANSI Encoding Behavior
****
When using the built-in PDF (AFM) fonts on a block of content in your AsciiDoc document, any character that cannot be encoded to WINANSI is replaced with a logic "`not`" glyph (`¬`) and you'll see the following warning in your console:
The following text could not be fully converted to the Windows-1252 character set:
| <string with unknown glyph>
This behavior differs from the default behavior in Prawn, which is to simply crash.
You'll often see this warning if you're using callouts in your document and you haven't specified a TrueType font in your theme.
To prevent this warning, you need to specify a TrueType font.
When using a TrueType font, you will get no warning for a missing glyph.
That's a consequence of how Prawn works and is outside of Asciidoctor PDF's control.
However, you'll likely see it substituted with a box (guaranteed if you're using one of the bundled fonts).
For more information about how Prawn handles character encodings for built-in fonts, see https://github.com/prawnpdf/prawn/blob/master/CHANGELOG.md#vastly-improved-handling-of-encodings-for-pdf-built-in-afm-fonts[this note in the Prawn CHANGELOG].
****
=== Bundled Fonts
Asciidoctor PDF bundles several fonts that are used by the default theme.
You can also use these fonts in your custom theme by simply declaring them.
These fonts provide more characters than the built-in PDF fonts, but still only a subset of UTF-8 (to reduce the size of the gem).
The family name of the fonts bundled with Asciidoctor PDF are as follows:
http://www.google.com/get/noto/#/family/noto-serif[Noto Serif]::
A serif font that can be styled as normal, italic, bold or bold_italic.
http://mplus-fonts.osdn.jp/mplus-outline-fonts/design/index-en.html#mplus_1mn[M+ 1mn]::
A monospaced font that maps different thicknesses to the styles normal, italic, bold and bold_italic.
Also provides the circuled numbers used in callouts.
http://mplus-fonts.osdn.jp/mplus-outline-fonts/design/index-en.html#mplus_1p[M+ 1p Fallback]::
A sans-serif font that provides a very complete set of Unicode glyphs.
Cannot be styled as italic, bold or bold_italic.
Used as the fallback font in the `default-with-fallback-font` theme.
TIP: If you want to specify the location of custom fonts using the `pdf-fontsdir` attribute, yet still be able to use the bundled fonts, you need to refer to the bundled fonts using the `GEM_FONTS_DIR` token.
To do so, you can either a) prefix the path of the bundled font in the theme file with the segment `GEM_FONTS_DIR` (e.g., `GEM_FONTS_DIR/mplus1p-regular-fallback.ttf`, or b) include `GEM_FONT_DIR` in the value of the `pdf-fontsdir` attribute, separated from the location of your custom fonts by a semi-colon (e.g., `path/to/your/fonts;GEM_FONTS_DIR`).
=== Custom Fonts
The limited character set of WINANSI, or the bland look of the built-in fonts, may motivate you to load your own font.
Custom fonts can enhance the look of your PDF theme substantially.
To start, find the TTF file collection for the font you want to use.
A collection typically consists of all four font styles:
* normal
* italic
* bold
* bold_italic
You'll need all four styles to support AsciiDoc content properly.
_Asciidoctor PDF cannot italicize a font dynamically like a browser can, so the italic styles are required._
In order for a third-party font to work properly with Prawn (and hence Asciidoctor PDF), several modifications are required.
See <<Prepare a Custom Font>> to learn how to prepare your font for use with Asciidoctor PDF.
Once you've obtained the TTF files, put them in the directory inside your project where you want to store the fonts.
It's recommended that you name them consistently so it's easier to type the names in the theme file.
Let's assume the name of the font is https://github.com/google/roboto/tree/master/out/RobotoTTF[Roboto].
Rename the files as follows:
* roboto-normal.ttf (_originally Roboto-Regular.ttf_)
* roboto-italic.ttf (_originally Roboto-Italic.ttf_)
* roboto-bold.ttf (_originally Roboto-Bold.ttf_)
* roboto-bold_italic.ttf (_originally Roboto-BoldItalic.ttf_)
Next, declare the font under the `font-catalog` key at the top of your theme file, giving it a unique key (e.g., `Roboto`).
[source,yaml]
----
font:
catalog:
Roboto:
normal: roboto-normal.ttf
italic: roboto-italic.ttf
bold: roboto-bold.ttf
bold_italic: roboto-bold_italic.ttf
----
You can use the key that you assign to the font in the font catalog anywhere the `font-family` property is accepted in the theme file.
For example, to use the Roboto font for all headings, use:
[source,yaml]
----
heading:
font-family: Roboto
----
When you execute Asciidoctor PDF, specify the directory where the fonts reside using the `pdf-fontsdir` attribute:
$ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir=path/to/fonts document.adoc
You can specify multiple directories by separating the entries with a semi-colon:
$ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir=path/to/fonts;path/to/more-fonts document.adoc
To include the bundled fonts in the search, use the `GEM_FONTS_DIR` token:
$ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir=path/to/fonts;GEM_FONTS_DIR document.adoc
TIP: When Asciidoctor PDF creates the PDF, it only embeds the glyphs from the font that are needed to render the characters present in the document.
Effectively, it subsets the font.
While that saves space taken up by the generated PDF, you may still be storing the full font in your source repository.
To minimize the size of the source font, you can use {url-fontforge}[FontForge] to subset the font ahead of time.
Subsetting a font means remove glyphs you don't plan to use.
Doing so it not a requirement, simply a personal preference.
You can add any number of fonts to the catalog.
Each font must be assigned a unique key, as shown here:
[source,yaml]
----
font:
catalog:
Roboto:
normal: roboto-normal.ttf
italic: roboto-italic.ttf
bold: roboto-bold.ttf
bold_italic: roboto-bold_italic.ttf
Roboto Light:
normal: roboto-light-normal.ttf
italic: roboto-light-italic.ttf
bold: roboto-light-bold.ttf
bold_italic: roboto-light-bold_italic.ttf
----
Text in SVGs will use the font catalog from your theme.
We recommend that you match the font key in your theme file to the name of the font seen by the operating system.
This will allow you to use the same font names (aka families) in both your graphics program and Asciidoctor PDF, thus making them portable.
=== Fallback Fonts
If a TrueType font is missing a character needed to render the document, such as a special symbol, you can have Asciidoctor PDF look for the character in a fallback font.
You only need to specify a single fallback font, typically one that provides a full set of symbols.
If the character isn't found in the fallback font, it will mostly likely be replaced by a box (guaranteed if you're using the bundled fallback font).
IMPORTANT: The fallback font only gets used when the primary font is a TrueType font (i.e., TTF, DFont, TTC).
Any glyph missing from an AFM font is simply replaced with the "`not`" glyph (`¬`).
CAUTION: The `default` theme does not use a fallback font.
However, the built-in `default-with-fallback-font` theme does.
Using the fallback font slows down PDF generation slightly because it has to analyze every single character.
It's use is not recommended for large documents.
Instead, it's best to select primary fonts that have all the characters you need.
Like with other custom fonts, you first need to declare the fallback font.
Let's choose https://github.com/android/platform_frameworks_base/blob/master/data/fonts/DroidSansFallback.ttf[Droid Sans Fallback].
You can map all the styles to a single font file (since bold and italic don't usually make sense for symbols).
[source,yaml]
----
font:
catalog:
Roboto:
normal: roboto-normal.ttf
italic: roboto-italic.ttf
bold: roboto-bold.ttf
bold_italic: roboto-bold_italic.ttf
DroidSansFallback:
normal: droid-sans-fallback.ttf
italic: droid-sans-fallback.ttf
bold: droid-sans-fallback.ttf
bold_italic: droid-sans-fallback.ttf
----
Next, add the key name to the `fallbacks` key under the `font-catalog` key.
The `fallbacks` key accepts an array of values, meaning you can specify more than one fallback font.
However, we recommend using a single fallback font, if possible, as shown here:
[source,yaml]
----
font:
catalog:
Roboto:
normal: roboto-normal.ttf
italic: roboto-italic.ttf
bold: roboto-bold.ttf
bold_italic: roboto-bold_italic.ttf
DroidSansFallback:
normal: droid-sans-fallback.ttf
italic: droid-sans-fallback.ttf
bold: droid-sans-fallback.ttf
bold_italic: droid-sans-fallback.ttf
fallbacks:
- DroidSansFallback
----
TIP: If you are using more than one fallback font, add additional lines to the `fallbacks` key.
Of course, make sure you've configured your theme to use your custom font:
[source,yaml]
----
base:
font-family: Roboto
----
That's it!
Now you're covered.
If your custom TTF font is missing a glyph, Asciidoctor PDF will look in your fallback font.
You don't need to reference the fallback font anywhere else in your theme file.
== Keys
This section lists all the keys that are available when creating a custom theme.
The keys are organized by category.
Each category represents a common prefix under which the keys are typically nested.
TIP: Keys can be nested wherever an underscore (`_`) or hyphen (`-`) appears in the name.
This nested structure is for organizational purposes only.
All keys are flatted when the theme is loaded (e.g., `align` nested under `base` becomes `base-align`).
The converter uses the values of these keys to control how most elements are arranged and styled in the PDF.
The default values listed in this section get inherited from the https://github.com/asciidoctor/asciidoctor-pdf/blob/master/data/themes/base-theme.yml[base theme].
IMPORTANT: The https://github.com/asciidoctor/asciidoctor-pdf/blob/master/data/themes/default-theme.yml[default theme] has a different set of values which are not shown in this guide.
When creating a theme, all keys are optional.
Required keys are provided by the base theme.
Therefore, you only have to declare keys that you want to override.
[#keys-extends]
=== Extends
A theme can extend another theme using the `extends` key.
For example:
[source,yaml]
----
extends: default
base:
font-color: #ff0000
----
The extends key accepts either a single value or an array of values.
Each value is interpreted as a filename.
If the filename equals `default`, it resolves to the location of the default (built-in) theme.
If the filename is absolute, it's used as is.
If the filename begins with `./`, it's resolved as a theme file relative to the current theme file.
Otherwise, the filename is resolved as a theme file in the normal way (relative to the value of the `pdf-themesdir` attribute).
Currently, the base theme is always loaded first.
Then, the files referenced by the extends key are loaded in order.
Finally, the keys in the current file are loaded.
Each time a theme is loaded, the keys are overlaid onto the keys from the previous theme.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
|extends
|String or Array
(default: [])
|extends:
- default
- ./brand-theme.yml
|===
[#keys-role]
=== Role
The keys in the `role` category define custom roles for formatting.
The name of the role is the first subkey level.
The role name may not contain a hyphen or underscore.
The keys under the role are the concrete theming properties.
Here's an example of a role for making text red:
[source,yaml]
----
role:
red:
font-color: #ff0000
----
This role can be used as follows:
[source,asciidoc]
----
Error text is shown in [.red]#red#.
----
Currently, custom roles only apply to inline phrases and only support changing the font properties.
The converter provides several predefined roles.
The `big` and `small` roles map the font size to the $base-font-size-large and $base-font-size-small values, respectively.
These two roles can be redefined.
The `underline` and `line-through` roles add the underline and strikethrough decorations, respectively.
These two roles _can't_ be redefined.
The color roles (e.g., `blue`), which you may be familiar with from the HTML converter, are not mapped by default.
You'll need to define these in your theme if you'd like to make use of them when converting to PDF.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-role]*Key Prefix:* <<key-prefix-role,role-<name>{zwsp}>>
|font-color
|<<colors,Color>> +
(default: _inherit_)
|role:
red:
font-color: #ff0000
|font-family
|<<fonts,Font family name>> +
(default: Courier)
|role:
label:
font-family: M+ 1mn
|font-size
|<<values,Number>> +
(default: _inherit_)
|role:
large:
font-size: 12
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|role:
heavy:
font-style: bold
|===
[#keys-page]
=== Page
The keys in this category control the size, margins and background of each page (i.e., canvas).
We recommended that you define this category before all other categories.
NOTE: The background of the title page can be styled independently of other pages.
See <<Title Page>> for details.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-page]*Key Prefix:* <<key-prefix-page,page>>
|background-color^[1]^
|<<colors,Color>> +
(default: #ffffff)
|page:
background-color: #fefefe
|background-image^[2]^
|image macro^[3]^ +
(default: _not set_)
|page:
background-image: image:page-bg.png[]
|background-image-(recto{vbar}verso)^[2]^
|image macro^[3]^ +
(default: _not set_)
|page:
background-image:
recto: image:page-bg-recto.png[]
verso: image:page-bg-verso.png[]
|initial-zoom
|Fit {vbar} FitH {vbar} FitV +
(default: FitH)
|page:
initial-zoom: Fit
|layout
|portrait {vbar} landscape +
(default: portrait)
|page:
layout: landscape
|margin
|<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>> +
(default: 36)
|page:
margin: [0.5in, 0.67in, 1in, 0.67in]
|margin-inner^[4]^
|<<measurement-units,Measurement>> +
(default: 48)
|page:
margin-inner: 0.75in
|margin-outer^[4]^
|<<measurement-units,Measurement>> +
(default: 24)
|page:
margin-outer: 0.59in
|size
|https://github.com/prawnpdf/pdf-core/blob/0.6.0/lib/pdf/core/page_geometry.rb#L16-L68[Named size^] {vbar} <<measurement-units,Measurement[width,height]>> +
(default: A4)
|page:
size: Letter
|numbering-start-at
|title {vbar} toc {vbar} body +
(default: body)
|page:
numbering-start-at: toc
|===
. To disable the background color for the page, set the value to white (i.e., FFFFFF).
The color keyword `transparent` is not recognized in this context.
. By default, page background images are automatically scaled to fit the bounds of the page (i.e., `fit=contain`) and centered (i.e., `position=center`).
The size of the background image can be controlled using any of the sizing attributes on the image macro (i.e., fit, pdfwidth, scaledwidth, or width).
The position of the background image can be controlled using the `position` attribute.
If the recto (right-hand, odd-numbered pages) or verso (left-hand, even-numbered pages) background is specified, it will be used only for that side.
If you define the keys using the flatten structure (e.g., `page-background-image-recto`), you can also set the default page background image (`page-background-image`), which will then be used as a fallback if a background image isn't specified for a given side.
To disable the background image, use the value `none`.
. Target may be an absolute path or a path relative to the value of the `pdf-themesdir` attribute.
. The margins for `recto` (right-hand, odd-numbered) and `verso` (left-hand, even-numbered) pages are calculated automatically from the margin-inner and margin-outer values.
These margins and used when the value `prepress` is assigned to the `media` document attribute.
[#keys-base]
=== Base
The keys in this category provide generic theme settings and are often referenced throughout the theme file as variables.
We recommended that you define this category after the page category and before all other categories.
NOTE: While it's common to define additional keys in this category (e.g., `base-border-radius`) to keep your theme DRY, we recommend using <<Custom Variables,custom variables>> instead.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-base]*Key Prefix:* <<key-prefix-base,base>>
|align
|<<text-alignments,Text alignment>> +
(default: left)
|base:
align: justify
|border-color
|<<colors,Color>> +
(default: #eeeeee)
|base:
border-color: #eeeeee
// border-radius is variable, not an official key
//|border-radius
//|<<values,Number>>
//|base:
// border-radius: 4
|border-width
|<<values,Number>> +
(default: 0.5)
|base:
border-width: 0.5
|font-color
|<<colors,Color>> +
(default: #000000)
|base:
font-color: #333333
|font-family
|<<fonts,Font family name>> +
(default: Helvetica)
|base:
font-family: Noto Serif
|font-kerning
|normal {vbar} default +
(default: normal)
|base:
font-kerning: none
|font-size
|<<values,Number>> +
(default: 12)
|base:
font-size: 10.5
// font-size-large is a variable, not an official key
//|font-size-large
//|<<values,Number>>
//|base:
// font-size-large: 13
|font-size-min
|<<values,Number>> +
(default: 6)
|base:
font-size-min: $base-font-size * 0.75
// font-size-small is a variable, not an official key
//|font-size-small
//|<<values,Number>>
//|base:
// font-size-small: 9
|font-style
|<<font-styles,Font style>> +
(default: normal)
|base:
font-style: normal
|text-transform^[1]^
|none +
(default: none)
|base:
text-transform: none
|line-height-length^[2]^
|<<values,Number>> +
(default: _not set_)
|base:
line-height-length: 12
|line-height^[2]^
|<<values,Number>> +
(default: 1.15)
|base:
line-height: >
$base-line-height-length /
$base-font-size
|===
. The `text-transform` key cannot be set globally.
Therefore, this key should not be used.
The value of `none` is implicit and is documented here for completeness.
. The `line-height-length` is a pseudo property that's local the theme.
It's often used for computing the `base-line-height` from the base font size and the desired line height size.
For instance, if you set `base-line-height-length`, you can use `$base-line-height-length / $base-font-size` to set the value of `base-line-height`.
[#keys-vertical-spacing]
=== Vertical Spacing
The keys in this category control the general spacing between elements where a more specific setting is not designated.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
|vertical-spacing
|<<values,Number>> +
(default: 12)
|vertical-spacing: 10
|===
[#keys-link]
=== Link
The keys in this category are used to style hyperlink text.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-link]*Key Prefix:* <<key-prefix-link,link>>
|font-color
|<<colors,Color>> +
(default: #0000ee)
|link:
font-color: #428bca
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|link:
font-family: Roboto
|font-size
|<<values,Number>> +
(default: _inherit_)
|link:
font-size: 9
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|link:
font-style: italic
|text-decoration
|none {vbar} underline {vbar} line-through +
(default: none)
|link:
text-decoration: underline
|===
[#keys-literal]
=== (Inline) Literal
The keys in this category are used for inline monospaced text in prose and table cells.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-literal]*Key Prefix:* <<key-prefix-literal,literal>>
|background-color
|<<colors,Color>> +
(default: _not set_)
|literal:
background-color: #f5f5f5
|border-color^[1]^
|<<colors,Color>> +
(default: _not set_)
|literal:
border-color: #cccccc
|border-offset^[2]^
|<<values,Number>> +
(default: 0)
|literal:
border-offset: 2
|border-radius
|<<values,Number>> +
(default: _not set_)
|literal:
border-radius: 3
|border-width
|<<values,Number>> +
(default: $base-border-width)
|literal:
border-width: 0.5
|font-color
|<<colors,Color>> +
(default: _inherit_)
|literal:
font-color: #b12146
|font-family
|<<fonts,Font family name>> +
(default: Courier)
|literal:
font-family: M+ 1mn
|font-size
|<<values,Number>> +
(default: _inherit_)
|literal:
font-size: 12
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|literal:
font-style: bold
|===
. The border is only used if a border color is specified and the border width is not explicitly set to 0.
The border only works properly if the literal phrase does not have nested formatting.
Otherwise, the border will be inherited, producing a less than desirable result.
. The border offset is the amount that the background and border swells around the text.
It does not affect the distance between the formatted phrase and the phrases that surround it.
[#keys-heading]
=== Heading
The keys in this category control the style of most headings, including part titles, chapter titles, sections titles, the table of contents title and discrete headings.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-heading]*Key Prefix:* <<key-prefix-heading,heading>>
|align
|<<text-alignments,Text alignment>> +
(default: $base-align)
|heading:
align: center
|font-color
|<<colors,Color>> +
(default: _inherit_)
|heading:
font-color: #222222
|font-family
|<<fonts,Font family name>> +
(default: $base-font-family)
|heading:
font-family: Noto Serif
// NOTE: heading-font-size is overridden by h<n>-font-size in base theme
//|font-size
//|<<values,Number>> +
//(default: $base-font-size)
//|heading:
// font-size: 18
|font-style
|<<font-styles,Font style>> +
(default: bold)
|heading:
font-style: bold
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|heading:
text-transform: uppercase
|line-height
|<<values,Number>> +
(default: 1.15)
|heading:
line-height: 1.2
|margin-top
|<<measurement-units,Measurement>> +
(default: 4)
|heading:
margin-top: $vertical-spacing * 0.2
|margin-page-top
|<<measurement-units,Measurement>> +
(default: 0)
|heading:
margin-page-top: $vertical-spacing
|margin-bottom
|<<measurement-units,Measurement>> +
(default: 12)
|heading:
margin-bottom: 9.6
|min-height-after
|<<measurement-units,Measurement>> +
(default: $base-font-size * $base-line-height * 1.5)
|heading:
min-height-after: 0.5in
|chapter-break-before
|always {vbar} auto +
(default: always)
|heading:
chapter:
break-before: auto
|part-break-before
|always {vbar} auto +
(default: always)
|heading:
part:
break-before: auto
|part-break-after
|always {vbar} auto +
(default: auto)
|heading:
part:
break-after: always
3+|[#key-prefix-heading-level]*Key Prefix:* <<key-prefix-heading-level,heading-h<n>{zwsp}>>^[1]^
|align
|<<text-alignments,Text alignment>> +
(default: $heading-align)
|heading:
h2-align: center
|font-color
|<<colors,Color>> +
(default: $heading-font-color)
|heading:
h2-font-color: [0, 99%, 100%, 0]
|font-family
|<<fonts,Font family name>> +
(default: $heading-font-family)
|heading:
h4-font-family: Roboto
|font-size^[1]^
|<<values,Number>> +
(default: <1>=24; <2>=18; <3>=16; <4>=14; <5>=12; <6>=10)
|heading:
h6-font-size: $base-font-size * 1.7
|font-style
|<<font-styles,Font style>> +
(default: $heading-font-style)
|heading:
h3-font-style: bold_italic
|text-transform
|<<text-transforms,Text transform>> +
(default: $heading-text-transform)
|heading:
h3-text-transform: lowercase
|margin-top
|<<measurement-units,Measurement>> +
(default: $heading-margin-top)
|heading:
h2-margin-top: $vertical-spacing * 0.5
|margin-page-top
|<<measurement-units,Measurement>> +
(default: $heading-margin-page-top)
|heading:
h2-margin-page-top: $vertical-spacing
|margin-bottom
|<<measurement-units,Measurement>> +
(default: $heading-margin-bottom)
|heading:
h2-margin-bottom: 10
|===
. `<n>` is a number ranging from 1 to 6, representing each of the six heading levels.
. A font size is assigned to each heading level by the base theme.
If you want the font size of a specific level to be inherited, you must assign the value `null` (or `~` for short).
[#keys-title-page]
=== Title Page
The keys in this category control the style of the title page as well as the arrangement and style of the elements on it.
IMPORTANT: The title page is only enabled by default for the book doctype (e.g., `:doctype: book`).
If you want to enable the title page when using a different doctype (such as the article doctype), you must define the `title-page` attribute in the document header (i.e., `:title-page:`).
TIP: The title page can be disabled for the book doctype by setting the `notitle` attribute in the AsciiDoc document header (i.e., `:notitle:`).
(For other doctypes, just don't set the `title-page` attribute).
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-title-page]*Key Prefix:* <<key-prefix-title-page,title-page>>
|align
|<<text-alignments,Text alignment>> +
(default: center)
|title-page:
align: right
|background-color^[1]^
|<<colors,Color>> +
(default: _inherit_)
|title-page:
background-color: #eaeaea
|background-image^[2]^
|image macro^[3]^ +
(default: _not set_)
|title-page:
background-image: image:title.png[]
|font-color
|<<colors,Color>> +
(default: _inherit_)
|title-page:
font-color: #333333
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|title-page:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: _inherit_)
|title-page:
font-size: 13
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|title-page:
font-style: bold
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|title-page:
text-transform: uppercase
|line-height
|<<values,Number>> +
(default: 1.15)
|title-page:
line-height: 1
3+|[#key-prefix-title-page-logo]*Key Prefix:* <<key-prefix-title-page-logo,title-page-logo>>
|align
|<<image-alignments,Image alignment>> +
(default: _inherit_)
|title-page:
logo:
align: right
|image
|image macro^[3]^ +
(default: _not set_)
|title-page:
logo:
image: image:logo.png[pdfwidth=25%]
|top
|Percentage^[4]^ +
(default: 10%)
|title-page:
logo:
top: 25%
3+|[#key-prefix-title-page-title]*Key Prefix:* <<key-prefix-title-page-title,title-page-title>>
|font-color
|<<colors,Color>> +
(default: _inherit_)
|title-page:
title:
font-color: #999999
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|title-page:
title:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: 18)
|title-page:
title:
font-size: $heading-h1-font-size
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|title-page:
title:
font-style: bold
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|title-page:
title:
text-transform: uppercase
|line-height
|<<values,Number>> +
(default: $heading-line-height)
|title-page:
title:
line-height: 0.9
|top
|Percentage^[3]^ +
(default: 40%)
|title-page:
title:
top: 55%
|margin-top
|<<measurement-units,Measurement>> +
(default: 0)
|title-page:
title:
margin-top: 13.125
|margin-bottom
|<<measurement-units,Measurement>> +
(default: 0)
|title-page:
title:
margin-bottom: 5
3+|[#key-prefix-title-page-subtitle]*Key Prefix:* <<key-prefix-title-page-subtitle,title-page-subtitle>>
|font-color
|<<colors,Color>> +
(default: _inherit_)
|title-page:
subtitle:
font-color: #181818
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|title-page:
subtitle:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: 14)
|title-page:
subtitle:
font-size: $heading-h3-font-size
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|title-page:
subtitle:
font-style: bold_italic
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|title-page:
subtitle:
text-transform: uppercase
|line-height
|<<values,Number>> +
(default: $heading-line-height)
|title-page:
subtitle:
line-height: 1
|margin-top
|<<measurement-units,Measurement>> +
(default: 0)
|title-page:
subtitle:
margin-top: 13.125
|margin-bottom
|<<measurement-units,Measurement>> +
(default: 0)
|title-page:
subtitle:
margin-bottom: 5
3+|[#key-prefix-authors]*Key Prefix:* <<key-prefix-authors,title-page-authors>>
|delimiter
|<<quoted-string,Quoted string>> +
(default: ', ')
|title-page:
authors:
delimiter: '; '
|font-color
|<<colors,Color>> +
(default: _inherit_)
|title-page:
authors:
font-color: #181818
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|title-page:
authors:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: _inherit_)
|title-page:
authors:
font-size: 13
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|title-page:
authors:
font-style: bold_italic
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|title-page:
authors:
text-transform: uppercase
|margin-top
|<<measurement-units,Measurement>> +
(default: 12)
|title-page:
authors:
margin-top: 13.125
|margin-bottom
|<<measurement-units,Measurement>> +
(default: 0)
|title-page:
authors:
margin-bottom: 5
3+|[#key-prefix-revision]*Key Prefix:* <<key-prefix-revision,title-page-revision>>
|delimiter
|<<quoted-string,Quoted string>> +
(default: ', ')
|title-page:
revision:
delimiter: ': '
|font-color
|<<colors,Color>> +
(default: _inherit_)
|title-page:
revision:
font-color: #181818
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|title-page:
revision:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: _inherit_)
|title-page:
revision:
font-size: $base-font-size-small
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|title-page:
revision:
font-style: bold
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|title-page:
revision:
text-transform: uppercase
|margin-top
|<<measurement-units,Measurement>> +
(default: 0)
|title-page:
revision:
margin-top: 13.125
|margin-bottom
|<<measurement-units,Measurement>> +
(default: 0)
|title-page:
revision:
margin-bottom: 5
|===
. To disable the background color for the title page, set the value to white (i.e., FFFFFF).
The color keyword `transparent` is not recognized in this context.
. By default, page background images are automatically scaled to fit the bounds of the page (i.e., `fit=contain`) and centered (i.e., `position=center`).
The size of the background image can be controlled using any of the sizing attributes on the image macro (i.e., fit, pdfwidth, scaledwidth, or width).
The position of the background image can be controlled using the `position` attribute.
. Target may be an absolute path or a path relative to the value of the `pdf-themesdir` attribute.
. Percentage unit can be % (relative to content height) or vh (relative to page height).
[#keys-prose]
=== Prose
The keys in this category control the spacing around paragraphs (paragraph blocks, paragraph content of a block, and other prose content).
Typically, all the margin is placed on the bottom.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-prose]*Key Prefix:* <<key-prefix-prose,prose>>
|margin-top
|<<measurement-units,Measurement>> +
(default: 0)
|prose:
margin-top: 0
|margin-bottom
|<<measurement-units,Measurement>> +
(default: 12)
|prose:
margin-bottom: $vertical-spacing
|margin-inner^[1]^
|<<measurement-units,Measurement>> +
(default: $prose-margin-bottom)
|prose:
margin-inner: 0
|text-indent
|<<measurement-units,Measurement>> +
(default: _not set_)
|prose:
text-indent: 18
|===
. Controls the margin between adjacent paragraphs.
Useful when using indented paragraphs.
[#keys-block]
=== Block
The keys in this category control the spacing around block elements when a more specific setting is not designated.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-block]*Key Prefix:* <<key-prefix-block,block>>
//|padding
//|<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>>
//|block:
// padding: [12, 15, 12, 15]
|margin-top
|<<measurement-units,Measurement>> +
(default: 0)
|block:
margin-top: 6
|margin-bottom
|<<measurement-units,Measurement>> +
(default: 12)
|block:
margin-bottom: 6
|===
Block styles are applied to the following block types:
[cols="3*a",grid=none,frame=none]
|===
|
* admonition
* example
* quote
|
* verse
* sidebar
* image
|
* listing
* literal
* table
|===
[#keys-caption]
=== Caption
The keys in this category control the arrangement and style of block captions.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-caption]*Key Prefix:* <<key-prefix-caption,caption>>
|align
|<<text-alignments,Text alignment>> +
(default: left)
|caption:
align: left
|font-color
|<<colors,Color>> +
(default: _inherit_)
|caption:
font-color: #333333
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|caption:
font-family: M+ 1mn
|font-size
|<<values,Number>> +
(default: _inherit_)
|caption:
font-size: 11
|font-style
|<<font-styles,Font style>> +
(default: italic)
|caption:
font-style: italic
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|caption:
text-transform: uppercase
|margin-inside
|<<measurement-units,Measurement>> +
(default: 4)
|caption:
margin-inside: 3
|margin-outside
|<<measurement-units,Measurement>> +
(default: 0)
|caption:
margin-outside: 0
|===
[#keys-code]
=== Code
The keys in this category are used to control the style of literal, listing and source blocks.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-code]*Key Prefix:* <<key-prefix-code,code>>
|background-color
|<<colors,Color>> +
(default: _not set_)
|code:
background-color: #f5f5f5
|border-color
|<<colors,Color>> +
(default: #eeeeee)
|code:
border-color: #cccccc
|border-radius
|<<values,Number>> +
(default: _not set_)
|code:
border-radius: 4
|border-width
|<<values,Number>> +
(default: 0.5)
|code:
border-width: 0.75
|font-color
|<<colors,Color>> +
(default: _inherit_)
|code:
font-color: #333333
|font-family
|<<fonts,Font family name>> +
(default: Courier)
|code:
font-family: M+ 1mn
|font-size
|<<values,Number>> +
(default: 10.8)
|code:
font-size: 11
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|code:
font-style: italic
|line-height
|<<values,Number>> +
(default: 1.2)
|code:
line-height: 1.25
|line-gap^[1]^
|<<values,Number>> +
(default: 0)
|code:
line-gap: 3.8
|padding
|<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>> +
(default: 9)
|code:
padding: 11
3+|[#key-prefix-code-linenum]*Key Prefix:* <<key-prefix-code-linenum,code-linenum>>^[2]^
|font-color
|<<colors,Color>> +
(default: #999999)
|code:
linenum-font-color: #ccc
|===
. The line-gap property is used to tune the height of the background color applied to a span of block text highlighted using Rouge.
. The code-linenum category only applies when using Pygments as the source highlighter.
Otherwise, the style is controlled by the source highlighter theme.
[#keys-callout-numbers]
=== Callout Numbers
The keys in this category are used to control the style of callout numbers (i.e., conums) inside verbatim blocks and in callout lists (colists).
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-conum]*Key Prefix:* <<key-prefix-conum,conum>>
|font-color
|<<colors,Color>> +
(default: _inherit_)
|conum:
font-color: #b12146
|font-family^[1,2]^
|<<fonts,Font family name>> +
(default: _inherit_)
|conum:
font-family: M+ 1mn
|font-size^[2]^
|<<values,Number>> +
(default: _inherit_)
|conum:
font-size: $base-font-size
|font-style^[2]^
|<<font-styles,Font style>> +
(default: _inherit_)
|conum:
font-style: normal
|line-height^[2]^
|<<values,Number>> +
(default: 1.15)
|conum:
line-height: 4 / 3
|glyphs^[2]^
|circled {vbar} filled {vbar} Unicode String ranges +
(default: circled)
|conum:
glyphs: \u0031-\u0039
|===
. Currently, the font must contain the circle numbers starting at glyph U+2460.
. font-family, font-size, font-style, and line-height are only used for markers in a colist.
These properties are inherited for conums inside a verbatim block.
. The font must provide the required glyphs.
The glyphs can be specified as a comma-separated list of ranges, where the range values are Unicode numbers (e.g., \u2460).
[#keys-button]
=== Button
The keys in this category apply to a button reference (generated from the inline button macro).
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-button]*Key Prefix:* <<key-prefix-button,button>>
|background-color
|<<colors,Color>> +
(default: _not set_)
|button:
background-color: #0000ff
|border-color^[1]^
|<<colors,Color>> +
(default: _not set_)
|button:
border-color: #cccccc
|border-offset^[2]^
|<<values,Number>> +
(default: 0)
|button:
border-offset: 1.5
|border-radius
|<<values,Number>> +
(default: 0)
|button:
border-radius: 2
|border-width
|<<values,Number>> +
(default: $base-border-width)
|button:
border-width: 0.5
|content^[3]^
|<<quoted-string,Quoted string>> +
(default: "%s")
|button:
content: "[\u2009%s\u2009]"
|font-color
|<<colors,Color>> +
(default: _inherit_)
|button:
font-color: #ffffff
|font-family
|<<fonts,Font family name>> +
(default: Courier)
|button:
font-family: M+ 1mn
|font-size
|<<values,Number>> +
(default: _inherit_)
|button:
font-size: 12
|font-style
|<<font-styles,Font style>> +
(default: bold)
|button:
font-style: normal
|===
. The border is only used if a border color is specified and the border width is not explicitly set to 0.
. The border offset is the amount that the background and border swells around the text.
It does not affect the distance between the formatted phrase and the phrases that surround it.
. The character sequence `%s` in the content key gets replaced with the button label.
[#keys-key]
=== Key
The keys in this category apply to a key reference (generated from the inline kbd macro).
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-key]*Key Prefix:* <<key-prefix-key,key>>
|background-color
|<<colors,Color>> +
(default: _not set_)
|key:
background-color: #fafafa
|border-color^[1]^
|<<colors,Color>> +
(default: _not set_)
|key:
border-color: #cccccc
|border-offset^[2]^
|<<values,Number>> +
(default: 0)
|key:
border-offset: 1.5
|border-radius
|<<values,Number>> +
(default: 0)
|key:
border-radius: 2
|border-width
|<<values,Number>> +
(default: $base-border-width)
|key:
border-width: 0.375
|separator^[3]^
|<<quoted-string,Quoted string>> +
(default: "+")
|key:
separator: "\u2009+\u2009"
|font-color
|<<colors,Color>> +
(default: _inherit_)
|key:
font-color: #000
|font-family
|<<fonts,Font family name>> +
(default: Courier)
|key:
font-family: $base-font-family
|font-size
|<<values,Number>> +
(default: _inherit_)
|key:
font-size: 10.5
|font-style
|<<font-styles,Font style>> +
(default: italic)
|key:
font-style: normal
|===
. The border is only used if a border color is specified and the border width is not explicitly set to 0.
. The border offset is the amount that the background and border swells around the text.
It does not affect the distance between the formatted phrase and the phrases that surround it.
. The separator is only used for multi-key sequences.
[#keys-menu]
=== Menu
The keys in this category apply to the menu label (generated from the inline menu macro).
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-menu]*Key Prefix:* <<key-prefix-menu,menu>>
|caret-content
|<<quoted-string,Quoted string>> +
(default: " \u203a ")
|menu:
caret-content: ' > '
|===
[#keys-blockquote]
=== Blockquote
The keys in this category control the arrangement and style of quote blocks.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-blockquote]*Key Prefix:* <<key-prefix-blockquote,blockquote>>
|border-width^[1]^
|<<values,Number>> +
(default: 4)
|blockquote:
border-width: 5
|border-color^[1]^
|<<colors,Color>> +
(default: #eeeeee)
|blockquote:
border-color: #eeeeee
|font-color
|<<colors,Color>> +
(default: _inherit_)
|blockquote:
font-color: #333333
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|blockquote:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: _inherit_)
|blockquote:
font-size: 13
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|blockquote:
font-style: bold
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|blockquote:
text-transform: uppercase
|padding
|<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>> +
(default: [6, 12, -6, 14])
|blockquote:
padding: [5, 10, -5, 12]
3+|[#key-prefix-blockquote-cite]*Key Prefix:* <<key-prefix-blockquote-cite,blockquote-cite>>
|font-size
|<<values,Number>> +
(default: _inherit_)
|blockquote:
cite:
font-size: 9
|font-color
|<<colors,Color>> +
(default: _inherit_)
|blockquote:
cite:
font-color: #999999
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|blockquote:
cite:
font-family: Noto Serif
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|blockquote:
cite:
font-style: bold
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|blockquote:
cite:
text-transform: uppercase
|===
. Only applies to the left side.
[#keys-sidebar]
=== Sidebar
The keys in this category control the arrangement and style of sidebar blocks.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-sidebar]*Key Prefix:* <<key-prefix-sidebar,sidebar>>
|background-color
|<<colors,Color>> +
(default: #eeeeee)
|sidebar:
background-color: #eeeeee
|border-color
|<<colors,Color>> +
(default: _not set_)
|sidebar:
border-color: #ffffff
|border-radius
|<<values,Number>> +
(default: _not set_)
|sidebar:
border-radius: 4
|border-width
|<<values,Number>> +
(default: _not set_)
|sidebar:
border-width: 0.5
|font-color
|<<colors,Color>> +
(default: _inherit_)
|sidebar:
font-color: #262626
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|sidebar:
font-family: M+ 1p
|font-size
|<<values,Number>> +
(default: _inherit_)
|sidebar:
font-size: 13
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|sidebar:
font-style: italic
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|sidebar:
text-transform: uppercase
|padding
|<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>> +
(default: [12, 12, 0, 12])
|sidebar:
padding: [12, 15, 0, 15]
3+|[#key-prefix-sidebar-title]*Key Prefix:* <<key-prefix-sidebar-title,sidebar-title>>
|align
|<<text-alignments,Text alignment>> +
(default: center)
|sidebar:
title:
align: center
|font-color
|<<colors,Color>> +
(default: _inherit_)
|sidebar:
title:
font-color: #333333
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|sidebar:
title:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: _inherit_)
|sidebar:
title:
font-size: 13
|font-style
|<<font-styles,Font style>> +
(default: bold)
|sidebar:
title:
font-style: bold
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|sidebar:
title:
text-transform: uppercase
|===
[#keys-example]
=== Example
The keys in this category control the arrangement and style of example blocks.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-example]*Key Prefix:* <<key-prefix-example,example>>
|background-color
|<<colors,Color>> +
(default: #ffffff)
|example:
background-color: #fffef7
|border-color
|<<colors,Color>> +
(default: #eeeeee)
|example:
border-color: #eeeeee
|border-radius
|<<values,Number>> +
(default: _not set_)
|example:
border-radius: 4
|border-width
|<<values,Number>> +
(default: 0.5)
|example:
border-width: 0.75
|font-color
|<<colors,Color>> +
(default: _inherit_)
|example:
font-color: #262626
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|example:
font-family: M+ 1p
|font-size
|<<values,Number>> +
(default: _inherit_)
|example:
font-size: 13
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|example:
font-style: italic
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|example:
text-transform: uppercase
|padding
|<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>> +
(default: [12, 12, 0, 12])
|example:
padding: [15, 15, 0, 15]
|===
[#keys-admonition]
=== Admonition
The keys in this category control the arrangement and style of admonition blocks and the icon used for each admonition type.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-admonition]*Key Prefix:* <<key-prefix-admonition,admonition>>
|column-rule-color
|<<colors,Color>> +
(default: #eeeeee)
|admonition:
column-rule-color: #aa0000
|column-rule-style
|solid {vbar} double {vbar} dashed {vbar} dotted +
(default: solid)
|admonition:
column-rule-style: double
|column-rule-width
|<<values,Number>> +
(default: 0.5)
|admonition:
column-rule-width: 0.5
|font-color
|<<colors,Color>> +
(default: _inherit_)
|admonition:
font-color: #999999
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|admonition:
font-family: Noto Sans
|font-size
|<<values,Number>> +
(default: _inherit_)
|admonition:
font-size: $base-font-size-large
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|admonition:
font-style: italic
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|admonition:
text-transform: none
|padding
|<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>> +
(default: [0, 12, 0, 12])
|admonition:
padding: [0, 12, 0, 12]
3+|[#key-prefix-admonition-label]*Key Prefix:* <<key-prefix-admonition-label,admonition-label>>
|align
|<<text-alignments,Text alignment>> +
(default: center)
|admonition:
label:
align: center
|min-width
|<<measurement-units,Measurement>> +
(default: _not set_)
|admonition:
label:
min-width: 48
|padding^[1]^
|<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>> +
(default: $admonition-padding)
|admonition:
padding: [0, 12, 0, 12]
|vertical-align
|top {vbar} middle {vbar} bottom +
(default: middle)
|admonition:
label:
vertical-align: top
3+|*Key Prefix:* admonition-label, admonition-label-<name>^[2]^
|font-color
|<<colors,Color>> +
(default: _inherit_)
|admonition:
label:
font-color: #262626
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|admonition:
label:
font-family: M+ 1p
|font-size
|<<values,Number>> +
(default: _inherit_)
|admonition:
label:
font-size: 12
|font-style
|<<font-styles,Font style>> +
(default: bold)
|admonition:
label:
font-style: bold_italic
|text-transform
|<<text-transforms,Text transform>> +
(default: uppercase)
|admonition:
label:
text-transform: lowercase
3+|[#key-prefix-admonition-icon]*Key Prefix:* <<key-prefix-admonition-icon,admonition-icon-<name>{zwsp}>>^[2]^
|name
|<icon set>-<icon name>^[3]^ +
(default: _not set_)
|admonition:
icon:
tip:
name: fas-fire
|stroke-color
|<<colors,Color>> +
(default: caution=#bf3400; important=#bf0000; note=#19407c; tip=#111111; warning=#bf6900)
|admonition:
icon:
important:
stroke-color: ff0000
|size
|<<values,Number>> +
(default: 24)
|admonition:
icon:
note:
size: 24
|===
. The top and bottom padding values are ignored on admonition-label-padding.
. `<name>` can be `note`, `tip`, `warning`, `important`, or `caution`.
All icon types must be grouped under a single `icons` category.
In other words, _do not_ declare the `icons` category multiple times.
The subkeys in the icon category cannot be flattened (e.g., `tip-name: far-lightbulb` is not valid syntax).
. Required.
See the `.yml` files in the https://github.com/jessedoyle/prawn-icon/tree/master/data/fonts[prawn-icon repository] for a list of valid icon names.
The prefix (e.g., `fas-`) determines which font set to use.
[#keys-image]
=== Image
The keys in this category control the arrangement of block images.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-image]*Key Prefix:* <<key-prefix-image,image>>
|align
|<<image-alignments,Image alignment>> +
(default: left)
|image:
align: left
|width^[1]^
|<<measurement-units,Measurement>> +
(default: _not set_)
|image:
width: 100%
|border-color^[2]^
|<<colors,Color>> +
(default: _not set_)
|image:
border-color: #cccccc
|border-radius
|<<values,Number>> +
(default: _not set_)
|image:
border-radius: 2
|border-width^[2]^
|<<values,Number>> +
(default: _not set_)
|image:
border-width: 0.5
|border-fit^[3]^
|content {vbar} auto
(default: content)
|image:
border-fit: auto
|===
. Only applies to block images.
If specified, this value takes precedence over the value of the `width` attribute on the image macro, but not over the value of the `pdfwidth` attribute.
. The border is only used if a border color is specified, the border width is specified, the border width is greater than 0, and the `noborder` role is not present.
The border is drawn above the image on the inside of the box reserved for the image.
. The value `auto` means the border should expand to fit the width of the container (i.e., full width) instead of the image.
[#keys-svg]
=== SVG
The keys in this category control the SVG integration.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-image]*Key Prefix:* <<key-prefix-svg,svg>>
|fallback_font_family^[1]^
|<<fonts,Font family name>> +
(default: $base-font-family)
|svg:
fallback_font_family: Times-Roman
|===
. The fallback font family is only used when the font family in the SVG does not map to a known font name from the font catalog.
[#keys-lead]
=== Lead
The keys in this category control the styling of lead paragraphs.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-lead]*Key Prefix:* <<key-prefix-lead,lead>>
|font-color
|<<colors,Color>> +
(default: _inherit_)
|lead:
font-color: #262626
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|lead:
font-family: M+ 1p
|font-size
|<<values,Number>> +
(default: 13.5)
|lead:
font-size: 13
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|lead:
font-style: bold
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|lead:
text-transform: uppercase
|line-height
|<<values,Number>> +
(default: 1.4)
|lead:
line-height: 1.4
|===
[#keys-abstract]
=== Abstract
The keys in this category control the arrangement and style of the abstract.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-abstract]*Key Prefix:* <<key-prefix-abstract,abstract>>
|font-color
|<<colors,Color>> +
(default: $base-font-color)
|abstract:
font-color: #5c6266
|font-size
|<<values,Number>> +
(default: 13.5)
|abstract:
font-size: 13
|font-style
|<<font-styles,Font style>> +
(default: $base-font-style)
|abstract:
font-style: italic
|text-transform
|<<text-transforms,Text transform>> +
(default: $base-text-transform)
|abstract:
text-transform: uppercase
|line-height
|<<values,Number>> +
(default: 1.4)
|abstract:
line-height: 1.4
|padding
|<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>> +
(default: 0)
|abstract:
padding: [0, 12, 0, 12]
3+|[#key-prefix-abstract-title]*Key Prefix:* <<key-prefix-abstract-title,abstract-title>>
|align
|<<text-alignments,Text alignment>> +
(default: center)
|abstract:
title:
align: center
|font-color
|<<colors,Color>> +
(default: $base-font-color)
|abstract:
title:
font-color: #333333
|font-family
|<<fonts,Font family name>> +
(default: $base-font-family)
|abstract:
title:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: $base-font-size)
|abstract:
title:
font-size: 13
|font-style
|<<font-styles,Font style>> +
(default: bold)
|abstract:
title:
font-style: bold
|text-transform
|<<text-transforms,Text transform>> +
(default: $base-text-transform)
|abstract:
title:
text-transform: uppercase
|===
[#keys-thematic-break]
=== Thematic Break
The keys in this category control the style of thematic breaks (aka horizontal rules).
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-thematic-break]*Key Prefix:* <<key-prefix-thematic-break,thematic-break>>
|border-color
|<<colors,Color>> +
(default: #eeeeee)
|thematic-break:
border-color: #eeeeee
|border-style
|solid {vbar} double {vbar} dashed {vbar} dotted +
(default: solid)
|thematic-break:
border-style: dashed
|border-width
|<<measurement-units,Measurement>> +
(default: 0.5)
|thematic-break:
border-width: 0.5
|margin-top
|<<measurement-units,Measurement>> +
(default: 0)
|thematic-break:
margin-top: 6
|margin-bottom
|<<measurement-units,Measurement>> +
(default: $vertical-spacing)
|thematic-break:
margin-bottom: 18
|===
[#keys-description-list]
=== Description List
The keys in this category control the arrangement and style of definition list items (terms and descriptions).
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-description-list]*Key Prefix:* <<key-prefix-description-list,description-list>>
|term-font-style
|<<font-styles,Font style>> +
(default: bold)
|description-list:
term-font-style: italic
|term-spacing
|<<measurement-units,Measurement>> +
(default: 4)
|description-list:
term-spacing: 5
|description-indent
|<<values,Number>> +
(default: 30)
|description-list:
description-indent: 15
|===
[#keys-outline-list]
=== Outline List
The keys in this category control the arrangement and style of outline list items.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-outline-list]*Key Prefix:* <<key-prefix-outline-list,outline-list>>
|indent
|<<measurement-units,Measurement>> +
(default: 30)
|outline-list:
indent: 40
|item-spacing
|<<measurement-units,Measurement>> +
(default: 6)
|outline-list:
item-spacing: 4
|marker-font-color^[1]^
|<<colors,Color>> +
(default: _inherit_)
|outline-list:
marker-font-color: #3c763d
|text-align^[2]^
|<<text-alignments,Text alignment>> +
(default: $base-align)
|outline-list:
text-align: left
|===
. Controls the color of the bullet glyph that marks items in unordered lists and the number for items in ordered lists.
. Controls the alignment of the list text only, not nested content (blocks or lists).
[#keys-ulist]
=== Unordered List
The keys in this category control the arrangement and style of unordered list items.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-ulist-marker]*Key Prefix:* <<key-prefix-ulist-marker,ulist-marker>>
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|ulist:
marker:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: _inherit_)
|ulist:
marker:
font-size: 9
|font-color
|<<colors,Color>> +
(default: $outline-list-marker-font-color)
|ulist:
marker:
font-color: #cccccc
|line-height
|<<values,Number>> +
(default: $base-line-height)
|ulist:
marker:
line-height: 1.5
|===
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-ulist-marker-type]*Key Prefix:* <<key-prefix-ulist-marker-type,ulist-marker-<type>{zwsp}>>^[1]^
|content
|<<quoted-string,Quoted string>>
|ulist:
marker:
disc:
content: "\uf140"
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|ulist:
marker:
disc:
font-family: fas
|font-size
|<<values,Number>> +
(default: _inherit_)
|ulist:
marker:
disc:
font-size: 9
|font-color
|<<colors,Color>> +
(default: _inherit_)
|ulist:
marker:
disc:
font-color: #ff0000
|line-height
|<<values,Number>> +
(default: _inherit_)
|ulist:
marker:
disc:
line-height: 2
|===
. <type> is one of disc, square, circle, checked, unchecked
[#keys-table]
=== Table
The keys in this category control the arrangement and style of tables and table cells.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-table]*Key Prefix:* <<key-prefix-table,table>>
|background-color
|<<colors,Color>> +
(default: transparent)
|table:
background-color: #ffffff
|border-color
|<<colors,Color>> +
(default: #000000)
|table:
border-color: #dddddd
|border-style
|solid {vbar} dashed {vbar} dotted +
(default: solid)
|table:
border-style: solid
|border-width
|<<values,Number>> +
(default: 0.5)
|table:
border-width: 0.5
|caption-side
|top {vbar} bottom +
(default: top)
|table:
caption-side: bottom
|caption-max-width
|fit-content {vbar} none +
(default: fit-content)
|table:
caption-max-width: none
|font-color
|<<colors,Color>> +
(default: _inherit_)
|table:
font-color: #333333
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|table:
font-family: Helvetica
|font-size
|<<values,Number>> +
(default: _inherit_)
|table:
font-size: 9.5
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|table:
font-style: italic
|grid-color
|<<colors,Color>> +
(default: $table-border-color)
|table:
grid-color: #eeeeee
|grid-style
|solid {vbar} dashed {vbar} dotted +
(default: solid)
|table:
grid-style: dashed
|grid-width
|<<values,Number>> +
(default: $table-border-width)
|table:
grid-width: 0.5
3+|[#key-prefix-table-head]*Key Prefix:* <<key-prefix-table-head,table-head>>
//|align
//|<<text-alignments,Text alignment>> +
//(default: _inherit_)
//|table:
// head:
// align: center
|background-color
|<<colors,Color>> +
(default: $table-background-color)
|table:
head:
background-color: #f0f0f0
|border-bottom-color
|<<colors,Color>> +
(default: $table-border-color)
|table:
head:
border-bottom-color: #dddddd
|border-bottom-style
|solid {vbar} dashed {vbar} dotted +
(default: solid)
|table:
head:
border-bottom-style: dashed
|border-bottom-width
|<<values,Number>> +
(default: 1.25)
|table:
head:
border-bottom-width: 1
|font-color
|<<colors,Color>> +
(default: $table-font-color)
|table:
head:
font-color: #333333
|font-family
|<<fonts,Font family name>> +
(default: $table-font-family)
|table:
head:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: $table-font-size)
|table:
head:
font-size: 10
|font-style
|<<font-styles,Font style>> +
(default: bold)
|table:
head:
font-style: normal
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|table:
head:
text-transform: uppercase
3+|[#key-prefix-table-body]*Key Prefix:* <<key-prefix-table-body,table-body>>
|background-color
|<<colors,Color>> +
(default: $table-background-color)
|table:
body:
background-color: #fdfdfd
|stripe-background-color^[1]^
|<<colors,Color>> +
(default: #eeeeee)
|table:
body:
stripe-background-color: #efefef
3+|[#key-prefix-table-foot]*Key Prefix:* <<key-prefix-table-foot,table-foot>>
|background-color
|<<colors,Color>> +
(default: $table-background-color)
|table:
foot:
background-color: #f0f0f0
|font-color
|<<colors,Color>> +
(default: $table-font-color)
|table:
foot:
font-color: #333333
|font-family
|<<fonts,Font family name>> +
(default: $table-font-family)
|table:
foot:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: $table-font-size)
|table:
foot:
font-size: 10
|font-style
|<<font-styles,Font style>> +
(default: normal)
|table:
foot:
font-style: italic
3+|[#key-prefix-table-cell]*Key Prefix:* <<key-prefix-table-cell,table-cell>>
|padding
|<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>> +
(default: 2)
|table:
cell:
padding: 3
3+|[#key-prefix-table-header-cell]*Key Prefix:* <<key-prefix-table-header-cell,table-header-cell>>
//|align
//|<<text-alignments,Text alignment>> +
//(default: $table-head-align)
//|table:
// header-cell:
// align: center
|background-color
|<<colors,Color>> +
(default: $table-head-background-color)
|table:
header-cell:
background-color: #f0f0f0
|font-color
|<<colors,Color>> +
(default: $table-head-font-color)
|table:
header-cell:
font-color: #1a1a1a
|font-family
|<<fonts,Font family name>> +
(default: $table-head-font-family)
|table:
header-cell:
font-family: Noto Sans
|font-size
|<<values,Number>> +
(default: $table-head-font-size)
|table:
header-cell:
font-size: 12
|font-style
|<<font-styles,Font style>> +
(default: $table-head-font-style)
|table:
header-cell:
font-style: italic
|text-transform
|<<text-transforms,Text transform>> +
(default: $table-head-text-transform)
|table:
header-cell:
text-transform: uppercase
|===
. This key only controls the color that is used for stripes.
The appearance of stripes is controlled using the `stripes` table attribute, the `table-stripes` document attribute (since Asciidoctor 2), or the `stripes` document attribute (prior to Asciidoctor 2).
Permitted attribute values are even, odd, all, and none.
Prior to Asciidoctor 2, even rows are shaded by default (e.g., `stripes=even`).
Since Asciidoctor 2, table stripes are not enabled by default (e.g., `stripes=none`).
[#keys-footnotes]
=== Footnotes
The keys in this catagory control the style the list of footnotes at the end of the chapter (book) or document (otherwise).
If the `footnotes-title` attribute is specified, it is styled as a block caption.
The styling of the links is controlled by the global link styles.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-footnotes]*Key Prefix:* <<key-prefix-footnotes,footnotes>>
|font-color
|<<colors,Color>> +
(default: $base-font-color)
|footnotes:
font-color: #cccccc
|font-size
|<<values,Number>> +
(default: 9)
|footnotes:
font-size: 8
|font-style
|<<font-styles,Font style>> +
(default: $base-font-style)
|footnotes:
font-style: italic
|item-spacing
|<<measurement-units,Measurement>> +
(default: 3)
|footnotes:
item-spacing: 5
|margin-top
|<<measurement-units,Measurement>> +
(default: 0)
|footnotes:
margin-top: 10
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|footnotes:
text-transform: lowercase
|===
[#keys-table-of-contents]
=== Table of Contents (TOC)
The keys in this category control the arrangement and style of the table of contents.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-toc]*Key Prefix:* <<key-prefix-toc,toc>>
|font-color
|<<colors,Color>> +
(default: _inherit_)
|toc:
font-color: #333333
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|toc:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: _inherit_)
|toc:
font-size: 9
|font-style
|<<font-styles,Font style>> +
// QUESTION why is the default not inherited?
(default: normal)
|toc:
font-style: bold
|text-decoration
|none {vbar} underline +
(default: none)
|toc:
text-decoration: underline
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|toc:
text-transform: uppercase
|line-height
|<<values,Number>> +
(default: 1.4)
|toc:
line-height: 1.5
|indent
|<<measurement-units,Measurement>> +
(default: 15)
|toc:
indent: 20
|margin-top
|<<measurement-units,Measurement>> +
(default: 0)
|toc:
margin-top: 0
3+|[#key-prefix-toc-level]*Key Prefix:* <<key-prefix-toc-level,toc-h<n>{zwsp}>>^[1]^
|font-color
|<<colors,Color>> +
(default: _inherit_)
|toc:
h3-font-color: #999999
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|toc:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: _inherit_)
|toc:
font-size: 9
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|toc:
font-style: italic
|text-decoration
|none {vbar} underline +
(default: _inherit_)
|toc:
text-decoration: none
|text-transform
|<<text-transforms,Text transform>> +
(default: _inherit_)
|toc:
text-transform: uppercase
3+|[#key-prefix-toc-title]*Key Prefix:* <<key-prefix-toc-title,toc-title>>
|align
|<<text-alignments,Text alignment>> +
(default: $heading-h2-align)
|toc:
title:
align: right
|font-color
|<<colors,Color>> +
(default: $heading-h2-font-color)
|toc:
title:
font-color: #aa0000
|font-family
|<<fonts,Font family name>> +
(default: $heading-h2-font-family)
|toc:
title:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: $heading-h2-font-size)
|toc:
title:
font-size: 18
|font-style
|<<font-styles,Font style>> +
(default: $heading-h2-font-style)
|toc:
title:
font-style: bold_italic
|text-transform
|<<text-transforms,Text transform>> +
(default: $heading-h2-text-transform)
|sidebar:
title:
text-transform: uppercase
3+|[#key-prefix-toc-dot-leader]*Key Prefix:* <<key-prefix-toc-dot-leader,toc-dot-leader>>
|content
|<<quoted-string,Quoted string>> +
(default: '. ')
|toc:
dot-leader:
content: ". "
|font-color^[2]^
|<<colors,Color>> +
(default: _inherit_)
|toc:
dot-leader:
font-color: #999999
|font-style^[2]^
|<<font-styles,Font style>> +
(default: normal)
|toc:
dot-leader:
font-style: bold
|levels^[3]^
|all {vbar} none {vbar} Integers (space-separated) +
(default: all)
|toc:
dot-leader:
levels: 2 3
|===
. `<n>` is a number ranging from 1 to 6, representing each of the six heading levels.
. The dot leader inherits all font properties except `font-style` from the root `toc` category.
. 0-based levels (e.g., part = 0, chapter = 1).
Dot leaders are only shown for the specified levels.
If value is not specified, dot leaders are shown for all levels.
[#keys-running-content]
=== Running Content (Header & Footer)
The keys in this category control the arrangement and style of running header and footer content.
Please note that the running content will _not_ be used unless a) the periphery (header or footer) is configured and b) the height key for the periphery is assigned a value.
CAUTION: If the height of the running content periphery is larger than the page margin, the running content will cover the main content.
To avoid this problem, reduce the height of the running content periphery or make the page margin on that side larger.
[cols="3,4,5l"]
|===
|Key |Value Type |Example
3+|[#key-prefix-running-content]*Key Prefix:* <<key-prefix-running-content,running-content>>
|start-at
|title {vbar} toc {vbar} body +
(default: body)
|running-content:
start-at: toc
3+|[#key-prefix-header]*Key Prefix:* <<key-prefix-header,header>>
|background-color^[1]^
|<<colors,Color>> +
(default: _not set_)
|header:
background-color: #eeeeee
|border-color
|<<colors,Color>> +
(default: _not set_)
|header:
border-color: #dddddd
|border-style
|solid {vbar} double {vbar} dashed {vbar} dotted +
(default: solid)
|header:
border-style: dashed
|border-width
|<<measurement-units,Measurement>> +
(default: $base-border-width)
|header:
border-width: 0.25
|font-color
|<<colors,Color>> +
(default: _inherit_)
|header:
font-color: #333333
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|header:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: _inherit_)
|header:
font-size: 9
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|header:
font-style: italic
|height^[2]^
|<<measurement-units,Measurement>> +
(default: _not set_)
|header:
height: 0.75in
|line-height
|<<values,Number>> +
(default: $base-line-height)
|header:
line-height: 1.2
|padding^[3]^
|<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>> +
(default: 0)
|header:
padding: [0, 3, 0, 3]
|image-vertical-align
|top {vbar} middle {vbar} bottom {vbar} <<measurement-units,Measurement>> +
(default: _not set_)
|header:
image-vertical-align: 4
|sectlevels
|Integer +
(default: 2)
|header:
sectlevels: 3
|text-transform
|<<text-transforms,Text transform>> +
(default: none)
|header:
text-transform: uppercase
|title-style
|document {vbar} toc {vbar} basic +
(default: document)
|header:
title-style: toc
|vertical-align
|top {vbar} middle {vbar} bottom +
(default: middle)
|header:
vertical-align: center
|<side>-columns^[4]^
|Column specs triple +
(default: _not set_)
|header:
recto:
columns: <25% =50% >25%
|<side>-<position>-content^[4,5]^
|<<quoted-string,Quoted string>> +
(default: '\{page-number}')
|header:
recto:
left:
content: '\{page-number}'
3+|[#key-prefix-footer]*Key Prefix:* <<key-prefix-footer,footer>>
|background-color^[1]^
|<<colors,Color>> +
(default: _not set_)
|footer:
background-color: #eeeeee
|border-color
|<<colors,Color>> +
(default: _not set_)
|footer:
border-color: #dddddd
|border-style
|solid {vbar} double {vbar} dashed {vbar} dotted +
(default: solid)
|footer:
border-style: dashed
|border-width
|<<measurement-units,Measurement>> +
(default: $base-border-width)
|footer:
border-width: 0.25
|font-color
|<<colors,Color>> +
(default: _inherit_)
|footer:
font-color: #333333
|font-family
|<<fonts,Font family name>> +
(default: _inherit_)
|footer:
font-family: Noto Serif
|font-size
|<<values,Number>> +
(default: _inherit_)
|footer:
font-size: 9
|font-style
|<<font-styles,Font style>> +
(default: _inherit_)
|footer:
font-style: italic
|height^[2]^
|<<measurement-units,Measurement>> +
(default: _not set_)
|footer:
height: 0.75in
|line-height
|<<values,Number>> +
(default: $base-line-height)
|footer:
line-height: 1.2
|padding^[3]^
|<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>> +
(default: 0)
|footer:
padding: [0, 3, 0, 3]
|image-vertical-align
|top {vbar} middle {vbar} bottom {vbar} <<measurement-units,Measurement>> +
(default: _not set_)
|footer:
image-vertical-align: 4
|sectlevels
|Integer +
(default: 2)
|footer:
sectlevels: 3
|text-transform
|<<text-transforms,Text transform>> +
(default: none)
|footer:
text-transform: uppercase
|title-style
|document {vbar} toc {vbar} basic +
(default: document)
|footer:
title-style: toc
|vertical-align
|top {vbar} middle {vbar} bottom +
(default: middle)
|footer:
vertical-align: top
|<side>-columns^[4]^
|Column specs triple +
(default: _not set_)
|footer:
verso:
columns: <50% =0% <50%
|<side>-<position>-content^[4,5]^
|<<quoted-string,Quoted string>> +
(default: '\{page-number}')
|footer:
verso:
center:
content: '\{page-number}'
|===
. The background color spans the width of the page, as does the border when a background color is specified.
. *If the height is not set, the running content at this periphery is disabled.*
. If the side padding is negative, the content will bleed into the margin of the page.
. `<side>` can be `recto` (right-hand, odd-numbered pages) or `verso` (left-hand, even-numbered pages).
Where the page sides fall in relation to the physical or printed page number is controlled using the `pdf-folio-placement` attribute (except when `media=prepress`, which implies `physical`).
. `<position>` can be `left`, `center` or `right`.
IMPORTANT: If you don't specify a height for either the header or footer key, it effectively disables the content at that periphery.
If you define running header and footer content in your theme (including the height), you can still disable this content per document by setting the `noheader` and `nofooter` attributes in the AsciiDoc document header, respectively.
If content is not specified for the running footer, the page number (i.e., `\{page-number}`) is shown on the left on verso pages and the right on recto pages.
You can disable this behavior by defining the attribute `nofooter` in the AsciiDoc document header or by defining the key `footer-<side>-content: none` in the theme.
TIP: Although not listed in the table above, you can control the font settings (font-family, font-size, font-color, font-style, text-transform) that get applied to the running content in each column position for each page side (e.g., `footer-<side>-<position>-font-color`).
For example, you can set the font color used for the right-hand column on recto pages by setting `footer-recto-right-font-color: 6CC644`.
==== Attribute References
You can use _any_ attribute defined in your AsciiDoc document (such as `doctitle`) in the content of the running header and footer.
In addition, the following attributes are also available when defining the content keys in the footer:
* page-count
* page-number
* document-title
* document-subtitle
* part-title
* chapter-title
* section-title
* section-or-chapter-title
You can also built-in AsciiDoc text replacements like `+(C)+`, numeric character references like `+©+` and inline formatting (e.g., bold, italic, monospace).
Here's an example that shows how attributes and replacements can be used in the running footer:
[source,yaml]
----
header:
height: 0.75in
line-height: 1
recto:
center:
content: '(C) ACME -- v{revnumber}, {docdate}'
verso:
center:
content: $header-recto-center-content
footer:
height: 0.75in
line-height: 1
recto:
right:
content: '{section-or-chapter-title} | *{page-number}*'
verso:
left:
content: '*{page-number}* | {chapter-title}'
----
You can split the content value across multiple lines using YAML's multiline string syntax.
In this case, the single quotes around the string are not necessary.
To force a hard line break in the output, add `{sp}+` to the end of the line in normal AsciiDoc fashion.
[source,yaml]
----
footer:
height: 0.75in
line-height: 1.2
recto:
right:
content: |
Section Title - Page Number +
{section-or-chapter-title} - {page-number}
verso:
left:
content: |
Page Number - Chapter Title +
{page-number} - {chapter-title}
----
TIP: You can use most AsciiDoc inline formatting in the values of these keys.
For instance, to make the text bold, surround it in asterisks (as shown above).
One exception to this rule are inline images, which are described in the next section.
==== Images
You can add an image to the running header or footer using the AsciiDoc inline image syntax.
The image target is resolved relative to the value of the `pdf-themesdir` attribute.
If the image macro is the whole value for a column position, you can use the `position` and `fit` attributes to align and scale it relative to the column box.
Otherwise, the image is treated like a normal inline image, for which you can only adjust the width.
Here's an example of how to use an image in the running header (which also applies for the footer).
[source,yaml,subs=attributes+]
----
header:
height: 0.75in
image-vertical-align: 2 {conum-guard-yaml} <1>
recto:
center:
content: image:footer-logo.png[width=80]
verso:
center:
content: $header-recto-center-content
----
<1> You can use the `footer-vertical-align` attribute to slighly nudge the image up or down.
CAUTION: By default, the image must fit in the allotted space for the running header or footer.
Otherwise, you will run into layout issues.
Adjust the width attribute accordingly using the `pdfwidth` attribute.
Alternatively, you can set the `fit` attribute to `scale-down` (e.g., `fit=scale-down`) to reduce the image size to fit in the available space or `contain` (i.e., `fit=contain`) to scale the image (up or down) to fit the available space.
== Applying Your Theme
After creating a theme, you'll need to tell Asciidoctor PDF where to find it.
This is done using AsciiDoc attributes.
There are three AsciiDoc attributes that tell Asciidoctor PDF how to locate and apply your theme.
pdf-theme (or pdf-style):: The name of the YAML theme file to load.
If the name ends with `.yml`, it's assumed to be the complete name of a file and is resolved relative to `pdf-themesdir`, if specified, otherwise the current directory.
Otherwise, `-theme.yml` is appended to the name to make the file name (i.e., `<name>-theme.yml`) and is resolved relative to `pdf-themesdir`, if specified, otherwise the built-in themes dir.
pdf-themesdir (or pdf-stylesdir):: The directory where the theme file is located.
_Specifying an absolute path is recommended._
+
If you use images in your theme, image paths are resolved relative to this directory.
If `pdf-theme` ends with `.yml`, and `pdf-themesdir` is not specified, then `pdf-themesdir` defaults to the directory of the path specified by `pdf-theme`.
pdf-fontsdir:: The directory or directories where the fonts used by your theme, if any, are located.
Multiple entries must be separated by a semi-colon.
_Specifying an absolute path is recommended._
Let's assume that you've put your theme files inside a directory named `resources` with the following layout:
....
document.adoc
resources/
themes/
basic-theme.yml
fonts/
roboto-normal.ttf
roboto-italic.ttf
roboto-bold.ttf
roboto-bold_italic.ttf
....
Here's how you'd load your theme when calling Asciidoctor PDF:
$ asciidoctor-pdf -a pdf-themesdir=resources/themes -a pdf-theme=basic -a pdf-fontsdir=resources/fonts
If all goes well, Asciidoctor PDF should run without an error or warning.
NOTE: You only need to specify the `pdf-fontsdir` if you're using custom fonts in your theme.
You can skip setting the `pdf-themesdir` attribute and just pass the absolute path of your theme file to the `pdf-theme` attribute.
$ asciidoctor-pdf -a pdf-theme=resources/themes/basic-theme.yml -a pdf-fontsdir=resources/fonts
However, in this case, image paths in your theme won't be resolved properly.
Paths are resolved relative to the current directory.
However, in the future, this may change so that paths are resolved relative to the base directory (typically the document's directory).
Therefore, it's recommend that you specify absolute paths for now to future-proof your configuration.
$ asciidoctor-pdf -a pdf-themesdir=/path/to/resources/themes -a pdf-theme=basic -a pdf-fontsdir=/path/to/resources/fonts
As usual, you can also use build tools like Maven and Gradle to build a themed PDF.
The only thing you need to add to an existing build is the attributes mentioned above.
* https://github.com/asciidoctor/asciidoctor-maven-examples/tree/master/asciidoctor-pdf-with-theme-example[Maven Example]
* https://github.com/asciidoctor/asciidoctor-gradle-examples/tree/master/asciidoc-to-pdf-with-theme-example[Gradle Example]
== Theme-Related Document Attributes
There are various settings in the theme you control using document attributes.
These settings override equivalent keys defined in the theme file, where applicable.
[cols="2,3,6l"]
|===
|Attribute |Value Type |Example
|autofit-option
|flag (default: _not set_)
|:autofit-option:
|chapter-label
|string (default: Chapter)
|:chapter-label: Chapitre
|<face>-cover-image^[1]^
|path^[2]^ {vbar} image macro^[3]^ +
(format can be image or PDF)
|:front-cover-image: image:front-cover.pdf[]
|media
|screen {vbar} print {vbar} prepress
|:media: prepress
|outlinelevels^[10]^
|Integer {vbar} Integer:Integer (default: same as _toclevels_)
|:outlinelevels: 2
|page-background-image^[4]^
|path^[2]^ {vbar} image macro^[3]^
|:page-background-image: image:bg.jpg[]
|page-background-image-(recto{vbar}verso)^[4]^
|path^[2]^ {vbar} image macro^[3]^
|:page-background-image-recto: image:bg-recto.jpg[]
|pagenums^[5]^
|flag (default: _set_)
|:pagenums:
|pdf-page-layout
|portrait {vbar} landscape
|:pdf-page-layout: landscape
|pdf-page-margin
|<<measurement-units,Measurement>> {vbar} <<measurement-units,Measurement[top,right,bottom,left]>>
|:pdf-page-margin: [1in, 0.5in]
|pdf-page-size
|https://github.com/prawnpdf/pdf-core/blob/0.6.0/lib/pdf/core/page_geometry.rb#L16-L68[Named size^] {vbar} <<measurement-units,Measurement[width, height]>>
|:pdf-page-size: 6in x 9in
|pdf-folio-placement
|virtual {vbar} virtual-inverted {vbar} physical {vbar} physical-inverted
|:pdf-folio-placement: physical
|pdf-version
|1.3 {vbar} 1.4 {vbar} 1.5 {vbar} 1.6 {vbar} 1.7 (default: 1.4)
|:pdf-version: 1.7
|pdfmark^[6]^
|flag (default: _not set_)
|:pdfmark:
|text-align^[7]^
|<<text-alignments,Text alignment>>
|:text-align: left
|title-logo-image
|path^[2]^ {vbar} image macro^[3]^
|:title-logo-image: image:logo.png[top=25%, align=center, pdfwidth=0.5in]
|title-page^[8]^
|flag (default: _not set_)
|:title-page:
|title-page-background-image
|path^[2]^ {vbar} image macro^[3]^
|:title-page-background-image: image:title-bg.jpg[]
|toc-max-pagenum-digits^[9]^
|Integer (default: 3)
|:toc-max-pagenum-digits: 4
|===
. `<face>` can be `front` or `back`.
. The path is resolved relative to base_dir.
. The target of the image macro is resolved relative to `imagesdir`.
If the image macro syntax is not used, the value is resolved relative to the base directory, which defaults to the document directory.
. By default, page background images are automatically scaled to fit the bounds of the page (i.e., `fit=contain`) and centered (i.e., `position=center`).
The size of the background image can be controlled using any of the sizing attributes on the image macro (i.e., fit, pdfwidth, scaledwidth, or width).
The position of the background image can be controlled using the `position` attribute.
If the recto (right-hand, odd-numbered pages) or verso (left-hand, even-numbered pages) background is specified, it will be used only for that side.
If a background image isn't specified for a side, the converter will use the default page background image (`page-background-image`), if specified.
To disable the background image for a side, use the value `none`.
. Controls whether the `page-number` attribute is accessible to the running header and footer content specified in the theme file.
Use the `noheader` and `nofooter` attributes to disable the running header and footer, respectively, from the document.
. Enables generation of the http://milan.kupcevic.net/ghostscript-ps-pdf/#marks[pdfmark] file, which contains metadata that is fed to Ghostscript when optimizing the PDF file.
. _(Experimental)_ The `text-align` document attribute is intended as a simple way to toggle text justification.
The value of this attribute overrides the `base-align` key set by the theme.
For more fine-grained control, you should customize using the theme.
. The title page is only enabled by default for the book doctype.
To force the title page to be used for other doctypes, set the `title-page` attribute in the document header.
. If the TOC overlaps the first page of content, increase this number.
. The second number in the value of `outlinelevels` is the number of levels of the outline to expand (e.g., `3:1`).
If the second number is not present, all levels are expanded.
== Publishing Mode
Asciidoctor PDF provides the following features to assist with publishing:
* Double-sided (mirror) page margins
* Automatic facing pages
These features are activated when you set the `media` attribute to `prepress` in the header of your AsciiDoc document or from the CLI or API.
The following sections describe the behaviors that this setting activates.
=== Double-Sided Page Margins
The page margins for the recto (right-hand, odd-numbered) and verso (left-hand, even-numbered) pages are automatically calculated by replacing the side page margins with the values of the `page-margin-inner` and `page-margin-outer` keys.
For example, let's assume you've defined the following settings in your theme:
[source,yaml]
----
page:
margin: [0.5in, 0.67in, 0.67in, 0.67in]
margin-inner: 0.75in
margin-outer: 0.59in
----
The page margins for the recto and verso pages will be resolved as follows:
recto page margin:: [0.5in, *0.59in*, 0.67in, *0.75in*]
verso page margin:: [0.5in, *0.75in*, 0.67in, *0.59in*]
The page margins alternate between recto and verso.
The first page in the document is a recto page.
=== Automatic Facing Pages
When converting the book doctype using the prepress media setting, a blank page will be inserted when necessary to ensure the following elements start on a recto page:
* Title page
* Table of contents
* First page of body
* Parts and chapters
Other "`facing`" pages may be added in the future.
It's possible to disable the automatic facing feature for a given part or chapter.
This can be done by adding the nonfacing option to the section node.
When the nonfacing option is present, the part or chapter title will be placed on the following page.
[source,asciidoc]
----
[%nonfacing]
= Minor Chapter
content
----
For documents that use the article doctype, Asciidoctor PDF incorrectly places the document title and table of contents on their own pages.
This can result in the page numbering and the page facing to be out of sync.
As a workaround, Asciidoctor PDF inserts a blank page, if necessary, to ensure the first page of body content is a recto-facing page.
You can check on the status of this defect by following https://github.com/asciidoctor/asciidoctor-pdf/issues/95[issue #95].
== Source Highlighting Theme
You can define and apply your own source highlighting theme to source blocks when using Rouge as the source highlighter.
This section explains how.
A custom theme for Rouge is defined using a Ruby class.
Start by creating a Ruby source file to define your theme.
Name the file according to the name of your theme and put the file in a folder of your choice (e.g., [.path]_rouge_themes/custom.rb_).
The name of the Ruby class doesn't matter, though it's customary to name it according to the name of the theme as well.
.rouge_themes/custom.rb
[source,ruby]
----
require 'rouge' unless defined? ::Rouge.version
module Rouge; module Themes
class Custom < CSSTheme
name 'custom'
style Comment, fg: '#008800', italic: true
style Error, fg: '#a61717', bg: '#e3d2d2'
style Str, fg: '#0000ff'
style Str::Char, fg: '#800080'
style Num, fg: '#0000ff'
style Keyword, fg: '#000080', bold: true
style Operator::Word, bold: true
style Name::Tag, fg: '#000080', bold: true
style Name::Attribute, fg: '#ff0000'
style Generic::Deleted, fg: '#000000', bg: '#ffdddd', inline_block: true, extend: true
style Generic::Inserted, fg: '#000000', bg: '#ddffdd', inline_block: true, extend: true
style Text, {}
end
end; end
----
Each style declaration accepts the following properties:
* `fg` - sets the foreground (text) color
* `bg` - sets the background color
* `bold` - change the font weight to bold
* `italic` - change the font style to italic
* `underline` - add an underline to the text
* `inline_block` - fill the background color to the height of the line (Asciidoctor PDF only)
* `extend` - extend the background color to the end of the line for a line-oriented match (Asciidoctor PDF only)
Colors are defined using hexidecimal format (e.g., #ff0000 for red).
Use the `Text` token to set the background color of the source block and the default text color.
The complete list of tokens can be found in the https://github.com/jneen/rouge/blob/master/lib/rouge/token.rb[token.rb] file from Rouge.
Refer to the https://github.com/jneen/rouge/tree/master/lib/rouge/themes[bundled themes] to find more examples.
Once you've defined your theme, you need to enable it use it using the `rouge-style` document attribute, which you specify in the document header or via the Asciidoctor CLI or API.
[source,asciidoc]
----
:source-highlighter: rouge
:rouge-style: custom
----
Finally, you need to active your theme by requiring the theme file when you invoke Asciidoctor.
$ asciidoctor -r ./rouge_themes/custom.rb sample.adoc
You should now see that the source code is highlighted to your liking.
For more information about source highlighting with Rouge, refer to the http://rouge.jneen.net/[Rouge project page].
////
== Resources for Extending Asciidoctor PDF
* http://www.sitepoint.com/hackable-pdf-typesetting-in-ruby-with-prawn[Hackable PDF typesetting in Ruby with Prawn]
////
[appendix]
== Preparing a Custom Font
Any TTF font can be used with Prawn--and hence Asciidoctor PDF--without modifications (unless, of course, it's corrupt or contains errors).
However, you may discover that kerning is disabled and certain required glyphs are missing (or replaced with boxes).
To address these problems, you need to prepare the font using a font program such as {url-fontforge}[FontForge].
=== Validate the Font
Before using the font, you may want to check that the font is valid.
To do so, create the following script, which will verify that the TTF font is free from errors.
.validate-font.rb
[source,ruby]
----
require 'ttfunk'
require 'ttfunk/subset_collection'
ttf_subsets = TTFunk::SubsetCollection.new TTFunk::File.open ARGV[0]
(0...(ttf_subsets.instance_variable_get :@subsets).size).each {|idx| ttf_subsets[idx].encode }
----
Run the script on your font as follows:
$ ruby validate-font.rb path/to/font.ttf
If this script fails, the font will not work with Asciidoctor PDF.
To repair it, open the font in FontForge and resave it using menu:File[Generate Fonts...,Generate].
Dismiss any warning dialogs.
Resaving the font in FontForge will usually resolve any errors in the font.
(If not, you may need to find another font, or at least another copy of it).
=== Modifying the Font
To ready your font for use with Asciidoctor PDF, you'll need to modify it using a font program.
We recommend using {url-fontforge}[FontForge].
But don't let this scare you off.
FontForge essentially works like a vector-drawing tool, in which each character is a separate canvas.
You can find a crash course in how to use the program on the FontForge project site.
Here are the modifications you need to apply to a custom font for it to work best with Asciidoctor PDF:
* Convert the font to TTF (only required if the font is not already a TTF, such as an OTF or TTC).
* Add the glyphs for the required characters if missing from the font (optional if using a fallback font).
* Subset the font to exclude unused characters to reduce the file size (optional).
* Save the file using the old-style kern table to activate kerning.
NOTE: Technically, subsetting the font (i.e., removing glyphs) is not required since Prawn only embeds the characters from the font used in the document (i.e., it automatically subsets the font).
However, if you plan to commit the font to a repository, subsetting helps keep the file size down.
Most fonts do not provide glyphs for all the Unicode character ranges (i.e., scripts).
(A glyph is the corresponding vector image for a Unicode character).
In fact, many fonts only include glyphs for Latin (Basic, Supplement, and Extended) and a few other scripts (e.g., Cyrillic, Greek).
That means certain glyphs Asciidoctor PDF relies on may be missing from the font.
Below are the non-Latin characters (identified by Unicode code point) on which Asciidoctor PDF relies that are often missing from fonts.
Unless you're using a fallback font that fills in the missing glyphs, you need to ensure these glyphs are present in your font (and add them if not).
* \u00a0 - no-break space
* \ufeff - zero width no-break space
* \u200b - zero width space (used for line break hints)
* \u000a - line feed character (zero width)
* \u2009 - thin spaced (used in the button UI element)
* \u202f - narrow no-break space (used in the keybinding UI element)
* \u2011 - non-breaking hyphen
* \u2022 - disc (used for first-level unordered list level)
* \u25e6 - circle (used for second-level unordered list level)
* \u25aa - square (used for third-level unordered list level)
* \u2611 - ballot box checked (used for checked list item)
* \u2610 - ballot box unchecked (used for unchecked list item)
* \u2014 - em-dash (used in quote attribute)
* \u203a - single right-pointing quotation mark (used in the menu UI element)
* \u25ba - right pointer (used for media play icon when icon fonts are disabled)
* .notdef - used as the default glyph when a requested character is missing from the font (usually a box)
NOTE: If the .notdef glyph is non-empty (i.e., contains splines), it will be used as the default glyph when the document requests a character that is missing from the font.
Unlike other glyphs, the .notdef glyph is referenced by name only.
It does not have a designated Unicode code point.
If you're preparing a font for use in verbatim blocks (e.g., a listing block), you'll also need this range of characters:
* \u2460 to \u2468 - circled numbers
One way to get these glyphs is to steal them from another font (or from another character in the same font).
To do so, open the other font in FontForge, select the character, press kbd:[Ctrl,c], switch back to your font, select the character again, and press kbd:[Ctrl,v].
You may need to scale the glyph so it fits properly in the art box.
IMPORTANT: If you're copying a non-visible character, be sure to set the width to 0 using menu:Metrics[Set Width...], enter 0 into *Set Width To*, then click btn:[OK].
When you're done, save the font with the old-style kern table enabled.
To do so, select menu:File[Generate Fonts...], click btn:[Options], and make sure only the following options are selected (equivalent to the flags 0x90 + 0x08):
* [x] OpenType
** [x] Old style 'kern'
Then click btn:[Generate] to generate and save the font.
Your font file is now ready to be used with Asciidoctor PDF.
=== Scripting the Font Modifications
Performing all this font modification manually can be tedious (not to mention hard to reproduce).
Fortunately, FontForge provides a {url-fontforge-scripting}[scripting interface], which you can use to automate the process.
In fact, that's what we use to prepare the fonts that are bundled with Asciidoctor PDF.
You can find that FontForge script, the Bash script that calls it, and the Docker image in which it is run in the https://github.com/asciidoctor/asciidoctor-pdf/tree/master/scripts[scripts directory] of this project.
You can use that script as a starting point or reference for your own font preparation / modification script.
|