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
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
|
%\CheckSum{3344}
%
%\iffalse
% Tell the \LaTeX\ system who we are and write an entry on the
% transcript.
%<*dtx>
\ProvidesFile{frenchb.dtx}
%</dtx>
% \changes{v2.1d}{2008/05/04}{Argument of \cs{ProvidesLanguage} changed
% from `french' to `frenchb', otherwise \cs{listfiles} prints
% no date/version information. The bug with \cs{listfiles}
% (introduced in v.~1.5!), was pointed out by Ulrike Fischer.}
%<ldf>\ProvidesLanguage{frenchb}
%\ProvidesFile{frenchb.dtx}
%<*!lua>
[2016/05/14 v3.2c French support from the babel system]
%</!lua>
%<*internal>
\iffalse
%</internal>
%<*lua>
--
-- File `frenchb.lua' generated from frenchb.dtx [2016/05/14 v3.2c]
--
-- Copyright © 2014-2016 Daniel Flipo
-- <daniel (dot) flipo (at) free (dot) fr>
-- License LPPL: see frenchb.ldf.
--
%</lua>
%<*internal>
\fi
%</internal>
%<*dtx>
%%
%% File `frenchb.dtx'
%</dtx>
%<*ldf>
%%
%% File `frenchb.ldf'
%</ldf>
%<*dtx|ldf>
%% Babel package for LaTeX version 2e
%% Copyright © 1996 - 2016
%% by Daniel Flipo <daniel (dot) flipo (at) free (dot) fr>
%%
%</dtx|ldf>
%<*dtx>
%% This file is part of the babel system, it provides the source
%% code for the French language definition file.
%%
%</dtx>
%<*filedriver>
\documentclass[a4paper]{ltxdoc}
\usepackage[left=42mm,right=42mm,top=40mm,bottom=40mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{array,textcomp}
\usepackage{bera}
\usepackage[pdftex,dvipsnames]{xcolor}
\def\PrintMacroName#1{%
\strut\MacroFont\color{Sepia}\normalsize\string#1}
\usepackage[expansion=true,protrusion=true]{microtype}
\def\ColorArg{\color{PineGreen}}
\usepackage{url}
\usepackage[colorlinks,urlcolor=blue,unicode]{hyperref}
\newcommand*\babel{\textsf{babel}}
\newcommand*\frenchb{\textsf{babel-french}}
\newcommand*\Lopt[1]{\texttt{#1}}
\newcommand*\opt[1]{\texttt{#1}}
\newcommand*\file[1]{\texttt{#1}}
\newcommand*\cls[1]{\texttt{#1}}
\newcommand*\pkg[1]{\texttt{#1}}
\newcommand*\env[1]{\texttt{#1}}
\newcommand*\fbo[1]{\texttt{\ColorArg #1}}
\newcommand*\fbsetup[1]{\cs{frenchbsetup\{\fbo{#1}\}}}
\renewcommand*\descriptionlabel[1]{%
\hspace\labelsep \normalfont \fbo{#1}}
\providecommand*\eTeX{\leavevmode\hbox{$\varepsilon$}-\TeX}
\makeatletter
\newcommand*{\FBguillspace}{\penalty\@M\hskip.8\fontdimen2\font
plus.3\fontdimen3\font
minus.8\fontdimen4\font}
\makeatother
\hyphenation{Lua-TeX Lua-LaTeX Xe-LaTeX}
\lefthyphenmin=2 \righthyphenmin=3
\RecordChanges
\AtEndDocument{%
\clearpage
\section{Change History}%
\GlossaryPrologue{}%
\PrintChanges
}
\begin{document}
\sffamily
\setlength{\parindent}{0pt}
\GetFileInfo{frenchb.dtx}
\begin{center}
\textbf{\Large A Babel language definition file for French}\\[2mm]^^A\]
\textbf{\large frenchb.dtx \fileversion, \filedate}\\[3mm]^^A\]
Daniel Flipo\\
\texttt{daniel.flipo@free.fr}
\end{center}
\vspace{2\baselineskip}
\thispagestyle{empty}
\tableofcontents
\clearpage
\DocInput{frenchb.dtx}
\end{document}
%</filedriver>
%\fi
%
% \section{The French language}
%
% The file \file{\filename}\footnote{The file described in this
% section has version number \fileversion\ and was last revised on
% \filedate.}, defines all the language definition macros for the
% French language.
%
% Customisation for the French language is achieved following the
% book ``Lexique des règles typographiques en usage à
% l'Imprimerie Nationale'' troisième édition (1994),
% ISBN-2-11-081075-0.
%
% First version released: 1.1 (May 1996) as part of
% \babel-3.6beta. Version~2.0a was released in February 2007 and
% version~3.0a in February 2014.
%
% \frenchb{} has been improved using helpful suggestions from many
% people, mainly from Jacques André, Michel Bovani, Thierry Bouche,
% Vincent Jalby and Denis Bitouzé. Thanks to all of them!
%
% \LaTeX-2.09 is no longer supported.
% This new version (3.x) has been designed to be used only with
% \LaTeXe{} and Plain formats based on TeX, pdfTeX, LuaTeX or XeTeX
% engines.
%
% Changes between version 3.0 and \fileversion{} are listed in
% subsection~\ref{ssec-changes} p.~\pageref{ssec-changes}.
%
% An extensive documentation is available in French here:\\
% \url{http://daniel.flipo.free.fr/frenchb}
%
% \subsection{Basic interface}
%
% In a multilingual document, some typographic rules are language
% dependent, i.e.\ spaces before `high punctuation' (|:| |;| |!|
% |?|) in French, others modify the general layout (i.e.\ layout of
% lists, footnotes, indentation of first paragraphs of sections) and
% should apply to the whole document.
%
% \frenchb{} takes account of \babel's \emph{main language} defined
% as the \emph{last} option at \babel's loading. When French is
% not \babel's main language, \frenchb{} does not alter the general
% layout of the document (even in parts where French is the current
% language): the layout of lists, footnotes, indentation of first
% paragraphs of sections are not customised by \frenchb.
%
% When French is loaded as the last option of \babel, \frenchb{}
% makes the following changes to the global layout, \emph{both in
% French and in all other languages}\footnote{%
% For each item, hooks are provided to reset standard
% \LaTeX{} settings or to emulate the behavior of former versions
% of \frenchb{} (see command \fbsetup{},
% section~\ref{ssec-custom} p.~\pageref{ssec-custom}).}:
% \begin{enumerate}
% \item the first paragraph of each section is indented
% (\LaTeX{} only);
% \item the default items in itemize environment are set to `---'
% instead of `\textbullet', and all vertical spacing and glue
% is deleted; it is possible to change `---' to something else
% (`--' for instance) using \fbsetup{} (see
% section~\ref{ssec-custom} p.~\pageref{ssec-custom});
% \item vertical spacing in general \LaTeX{} lists is
% shortened;
% \item footnotes are displayed ``à la française''.
% \item the separator following the table or figure number in
% captions is printed as `~--~' instead of `:~'; for changing
% this see~\ref{sssec-captions} p.~\pageref{sssec-captions}.
% \end{enumerate}
%
% Regarding local typography, the command |\selectlanguage{french}|
% switches to the French language\footnote{%
% \cs{selectlanguage\{francais\}} and
% \cs{selectlanguage\{frenchb\}} are no longer supported.},
% with the following effects:
% \begin{enumerate}
% \item French hyphenation patterns are made active;
% \item `high punctuation' characters (|:| |;| |!| |?|)
% automatically add correct spacing in French; this is
% achieved using callbacks in Lua(La)TeX or `XeTeXinterchar'
% mechanism in Xe(La)TeX; with TeX'82 and pdf(La)TeX these
% four characters are made active in the whole document;
% \item |\today| prints the date in French;
% \item the caption names are translated into French
% (\LaTeX{} only). For customisation of caption names see
% section~\ref{sssec-captions} p.~\pageref{sssec-captions}.
% \item the space after |\dots| is removed in French.
% \end{enumerate}
%
% Some commands are provided by \frenchb{} to make typesetting
% easier:
% \begin{enumerate}
% \item French quotation marks can be entered using the commands
% |\og| and |\fg| which work in \LaTeXe and Plain\TeX,
% their appearance depending on what is available to draw
% them; even if you use \LaTeXe{} \emph{and} |T1|-encoding,
% you should refrain from entering them as
% |<<~French quotation~>>|: |\og| and |\fg| provide
% better horizontal spacing (controlled by |\FBguillspace|).
% If French quote characters are available on your keyboard,
% you can use them, to get proper spacing in \LaTeXe{} see
% option \fbo{og=«, fg=»} p.~\pageref{option-og-fg}.
%
% |\og| and |\fg| can be used outside French, they typeset
% then English quotes `` and ''.
%
% A new command |\frquote{}| has been added in version~3.1 to
% enter French quotations. |\frquote{|\textit{texte}|}| is
% equivalent to |\og| \textit{texte} |\fg{}| for short
% quotations. For quotations spreading over more than one
% paragraph, |\frquote| will add at the beginning of every
% paragraph of the quotation either an opening French
% guillemet («), or a closing one (») depending on option
% \fbo{EveryParGuill=open} or \fbo{=close}, see
% p.~\pageref{everyparguill}.\label{frquote}
%
% |\frquote| is recommended to enter embedded quotations ``à la
% française'', several variants are provided through options:
% \begin{itemize}
% \item with LuaTeX based engines, every line of the inner
% quotation will start with a French opening or closing
% guillemet (« or »)
% depending on option \fbo{EveryLineGuill=open} (default) or
% \fbo{=close} unless you explicitly set
% \fbo{EveryLineGuill=none}, then |\frquote{}| will behave
% as with non-LuaTeX engines;
% \item with all other engines, the inner quotation is
% surrounded by double quotes (``\textit{texte}'') unless
% option \fbo{InnerGuillSingle=true}, then a) the inner
% quotation is printed as
% \guilsinglleft\FBguillspace\textit{texte}\FBguillspace
% \guilsinglright{} and b) if the inner quotation
% spreads over more than one paragraph, every paragraph
% included in the inner quotation starts with
% a \guilsinglleft{} or a \guilsinglright, depending on
% option \fbo{EveryParGuill=open} or \fbo{close}.
% \end{itemize}
% A starred variant |\frquote*| is meant for inner quotations
% which end together with the outer one: using |\frquote*| for
% the inner quotation will print only one closing quote
% character (the outer one) as recommended by the French
% `Imprimerie Nationale'.
%
% \item A command |\up| is provided to typeset superscripts like
% |M\up{me}| (abbreviation for ``Madame''), |1\up{er}| (for
% ``premier''). Other commands are also provided for
% ordinals: |\ier|, |\iere|, |\iers|, |\ieres|, |\ieme|,
% |\iemes| (|3\iemes| prints 3\textsuperscript{es}).
% All these commands take advantage of real superscript
% letters when they are available in the current font.
%
% \item Family names should be typeset in small capitals and never
% be hyphenated, the macro |\bsc| (boxed small caps) does
% this, e.g., |L.~\bsc{Lamport}| will print the same as
% |L.~\mbox{\textsc{Lamport}}|. Note that composed names
% (such as Dupont-Durant) may now be hyphenated on explicit
% hyphens, this differs from \frenchb~v.~1.x.
%
% \item Commands |\primo|, |\secundo|, |\tertio| and |\quarto|
% print 1\textsuperscript{o}, 2\textsuperscript{o},
% 3\textsuperscript{o}, 4\textsuperscript{o}.
% |\FrenchEnumerate{6}| prints 6\textsuperscript{o}.
% \item Abbreviations for ``Numéro(s)'' and ``numéro(s)''
% (N\textsuperscript{o} N\textsuperscript{os}
% n\textsuperscript{o} and n\textsuperscript{os}~)
% are obtained via the commands |\No|, |\Nos|, |\no|, |\nos|.
%
% \item Two commands are provided to typeset the symbol for
% ``degré'': |\degre| prints the raw character and
% |\degres| should be used to typeset temperatures (e.g.,
% ``|20~\degres C|'' with an nobreak space), or for
% alcohols'' strengths (e.g., ``|45\degres|'' with \emph{no}
% space in French).
%
% \item In math mode the comma has to be surrounded with
% braces to avoid a spurious space being inserted after it,
% in decimal numbers for instance (see the \TeX{}book p.~134).
% The command |\DecimalMathComma| makes the comma be an
% ordinary character \emph{in French only} (no space added);
% as a counterpart, if |\DecimalMathComma| is active, an
% explicit space has to be added in lists and intervals:
% |$[0,\ 1]$|, |$(x,\ y)$|. |\StandardMathComma| switches
% back to the standard behaviour of the comma.
%
% \item A command |\nombre| was provided in 1.x versions to easily
% format numbers in slices of three digits separated either
% by a comma in English or with a space in French; |\nombre|
% is now mapped to |\numprint| from \file{numprint.sty}, see
% \file{numprint.pdf} for more information.
%
% \item \frenchb{} has been designed to take advantage of the
% \pkg{xspace} package if present: adding
% |\usepackage{xspace}| in the preamble will force macros like
% |\fg|, |\ier|, |\ieme|, |\dots|, \dots, to respect the
% spaces you type after them, for instance typing
% `|1\ier juin|' will print `1\textsuperscript{er} juin'
% (no need for a forced space after |1\ier|).
% \end{enumerate}
%
% \subsection{Customisation}
% \label{ssec-custom}
%
% Customisation of \frenchb{} relies on command \fbsetup{},
% options are entered using the \file{keyval} syntax.
% The command \fbsetup{} is to appear in the preamble only
% (after loading \babel).
%
% \subsubsection[\textbackslash frenchbsetup{}]
% {\fbsetup{options}}
% \label{sssec-frenchbsetup}
%
% \vspace{.5\baselineskip}
% \fbsetup{ShowOptions} prints all available options to
% the \file{.log} file, it is just meant as a remainder of the
% list of offered options. As usual with \file{keyval} syntax,
% boolean options (as \fbo{ShowOptions}) can be entered as
% \fbo{ShowOptions=true} or just \fbo{ShowOptions}, the
% \fbo{=true} part can be omitted.
%
% \vspace{.5\baselineskip}
% The other options are listed below. Their default value is
% shown between braces, sometimes followed be a `\texttt{*}'.
% The `\texttt{*}' means that the default shown applies when
% \frenchb{} is loaded as the \emph{last} option of \babel{}
% ---\babel's \emph{main language}---, and is toggled otherwise.
% \begin{description}
% \item [StandardLayout=true (false*)] forces \frenchb{} not to
% interfere with the layout: no action on any kind of lists,
% first paragraphs of sections are not indented (as in English),
% no action on footnotes. This option can be used to avoid
% conflicts with classes or packages which customise lists or
% footnotes.
% \item [GlobalLayoutFrench=false (true*)] should no longer be
% used; it was intended to emulate, when French is the main
% language, what prior versions of \frenchb{} (pre-2.2) did:
% lists, and first paragraphs of sections would be displayed
% the standard way in other languages than French, and ``à la
% française'' in French. Note that the layout of footnotes is
% language independent anyway (see below \fbo{FrenchFootnotes}
% and \fbo{AutoSpaceFootnotes}).
% \item [ReduceListSpacing=false (true*)]; \frenchb{} reduces the
% values of the vertical spaces used in the \emph{all} list
% environments in French (this includes itemize, enumerate,
% description, but also abstract, quote, quotation and verse and
% possibly others). Setting this option to \fbo{false}
% reverts to the standard settings of the \env{list}
% environment.
% \item [ListOldLayout=true (false)]; starting with version~2.6a,
% the layout of lists has changed regarding leftmargins' sizes
% and default itemize label (`---' instead of `--' up to~2.5k).
% This option, provided for backward compatibility, displays
% lists as they were up to version~2.5k.
% \item [CompactItemize=false (true*)]; should no longer be used
% (kept only for backward compatibility), it is replaced by the
% next two options.
% \item [StandardItemizeEnv=true (false*)]; \frenchb{} redefines
% the \env{itemize} environment to suppress any vertical space
% between items of \env{itemize} lists in French and customises
% left margins. Setting this option to \fbo{false} reverts to
% the standard definition of \env{itemize}.
% \item [StandardEnumerateEnv=true (false*)]; starting with
% version~2.6 \frenchb{} redefines the \env{enumerate} and
% \env{description} environments to make left margins match those
% of the French version of \env{itemize} lists. Setting this
% option to \fbo{false} reverts to the standard definition of
% \env{enumerate} and \env{description}.
% \item [StandardItemLabels=true (false*)] when set to \fbo{true}
% this option prevents \frenchb{} from changing the labels in
% \env{itemize} lists in French.
% \item [ItemLabels=\cs{textbullet}, \cs{textendash},
% \cs{ding\{43\}},...(\cs{textemdash}*)];\\
% when \fbo{StandardItemLabels=false} (the default), this option
% enables to choose the label used in French \env{itemize} lists
% for all levels. The next four options do the same but each
% one for a specific level only. Note that the example
% |\ding{43}| requires |\usepackage{pifont}|.
% \item [ItemLabeli=\cs{textbullet}, \cs{textendash},
% \cs{ding\{43\}},...(\cs{textemdash}*)]
% \item [ItemLabelii=\cs{textbullet}, \cs{textendash},
% \cs{ding\{43\}},...(\cs{textemdash}*)]
% \item [ItemLabeliii=\cs{textbullet}, \cs{textendash},
% \cs{ding\{43\}},..(\cs{textemdash}*)]
% \item [ItemLabeliv=\cs{textbullet}, \cs{textendash},
% \cs{ding\{43\}},...(\cs{textemdash}*)]
% \item [StandardLists=true (false*)] forbids \frenchb{} to
% customise any kind of list. Try the option \fbo{StandardLists}
% in case of conflicts with classes or packages that customise
% lists too. This option is just a shorthand setting all four
% options \fbo{ReduceListSpacing=false},
% \fbo{StandardItemizeEnv=true}, \fbo{StandardEnumerateEnv=true}
% and \fbo{StandardItemLabels=true}.
% \item [IndentFirst=false (true*)]; set this option to \fbo{false}
% if you do not want \frenchb{} to force indentation of the
% first paragraph of sections. When French is the main language,
% this option applies to all languages.
% \item [FrenchFootnotes=false (true*)] reverts to the standard
% layout of footnotes. By default \frenchb{} typesets leading
% numbers as `1.\hspace{.5em}' instead of `$\hbox{}^1$', but
% has no effect on footnotes numbered with symbols (as in the
% |\thanks| command). Two commands |\StandardFootnotes|
% and |\FrenchFootnotes| are available to change the layout of
% footnotes locally; |\StandardFootnotes| can help when some
% footnotes are numbered with letters (inside minipages for
% instance).
% \item [AutoSpaceFootnotes=false (true*)]; by default \frenchb{}
% adds a thin space in the running text before the number or
% symbol calling the footnote. Making this option \fbo{false}
% reverts to the standard setting (no space added).
% \item [FrenchSuperscripts=false (true)]; then
% |\up=\textsuperscript|. % (option added in version 2.1).
% Should only be made \fbo{false} to recompile documents written
% before 2008 without changes: by default |\up| now relies on
% |\fup| designed to produce better looking superscripts.
% \item [AutoSpacePunctuation=false (true)]; in French, the user
% \emph{should} input a space before the four characters `|:;!?|'
% but as many people forget about it (even among native French
% writers!), the default behaviour of \frenchb{} is to
% automatically typeset nobreak spaces the width of which is
% either |\FBthinspace| (defauts to thin space) before `|;|'
% `|!|' `|?|' or |\FBcolonspace| (defauts to |\space|) before
% `|:|'; the defaults follow the French `Imprimerie Nationale's
% recommendations. This is convenient in most cases but can lead
% to addition of spurious spaces in URLs, in MS-DOS paths or in
% timetables (10:55), except if they are typed in |\texttt| or
% verbatim mode. When the current font is a monospaced
% (typewriter) font, no spurious space is added in that case%
% \footnote{Unless option \fbo{OriginalTypewriter} is set,
% \cs{ttfamily} is redefined in French to switch off space
% tuning, see below.},
% so the default behaviour of of \frenchb{} in that area should
% be fine in most circumstances.
%
% Choosing \fbo{AutoSpacePunctuation=false} will ensure that
% a proper space is added before `|:;!?|' \emph{if and only
% if} a (normal) space has been typed in. Those who are unsure
% about their typing in this area should stick to the default
% option and use the provided |\NoAutoSpacing| command
% inside a group in case an unwanted space is added by \frenchb{}
% (i.e.\ |{\NoAutoSpacing 10:55}|).
% \item [ThinColonSpace=true (false)] changes the inter-word
% unbreakable space added before the colon `:' to a thin space,
% so that the same amount of space is added before any of the
% four `high punctuation' characters. The default setting is
% supported by the French `Imprimerie Nationale'.
% \item [OriginalTypewriter=true (false)] leaves the original
% definitions of |\ttfamily| and |\texttt{}| unchanged.
% \item [LowercaseSuperscripts=false (true)]; by default \frenchb{}
% inhibits the uppercasing of superscripts (for instance when
% they are moved to page headers). Making this option
% \fbo{false} will disable this behaviour (not recommended).
% \item [PartNameFull=false (true)]; when true, \frenchb{} numbers
% the title of |\part{}| commands as ``Première partie'',
% ``Deuxième partie'' and so on. With some classes which
% change the |\part{}| command (AMS classes do so), you could
% get ``Première partie~1'', ``Deuxième partie~2'' in the toc;
% when this occurs, this option should be set to
% \fbo{false}, part titles will then be printed as ``Partie I'',
% ``Partie II''.
% \item [CustomiseFigTabCaptions=false (true*)]; when \fbo{false}
% the default separator (colon) is used instead of
% |\CaptionSeparator|. Anyway, \frenchb{} makes sure that the
% colon will be typeset with proper preceeding space in French.
% \item [OldFigTabCaptions=true (false)] is to be used when
% figures' and tables' captions must be typeset as with pre~3.0
% versions of \frenchb{} (with |\CaptionSeparator| in French and
% colon otherwise). Intended for standard \LaTeX{} classes only.
% \item [SmallCapsFigTabCaptions=false (true*)]; when set to
% \fbo{false}, |\figurename| and |\tablename| will be printed in
% French captions as ``Figure'' and ``Table'' instead of being
% printed in small caps (the default).
% \item [SuppressWarning=true (false)]; can be turned to \fbo{true}
% if you are bored with \frenchb's warnings.
% \item [INGuillSpace=true (false)] resets the dimensions of spaces
% after opening French quotes and before closing French quotes to
% the French `Imprimerie Nationale' standards (inter-word space).
% \frenchb's default setting produces slightly narrower spaces
% with lesser stretchability.
% \item [EveryParGuill=open, close, none (open)]; sets whether
% an opening quote (\texttt{«}) or a closing one (\texttt{»}) or
% nothing should be printed by |\frquote{}| at the beginning of
% every parapraph in case of a level 1 (outer) quotation
% spreading over more than one parapraph. This option is also
% considered for level 2 (inner) quotations to decide between
% \texttt{\guilsinglleft} and \texttt{\guilsinglright} when
% \fbo{InnerGuillSingle=true} (see below). \label{everyparguill}
% \item [EveryLineGuill=open, close, none (open in LuaTeX, none
% otherwise)]; with engines other than LuaTeX this
% option is set to \fbo{none} which means that nothing will be
% printed at the beginning of every line of inner quotations,
% trying to set this option will issue a warning in the
% \file{.log} file.
%
% With LuaTeX based engines, this option is set to \fbo{open} by
% default, it ensures that a `«' followed by proper
% kern will be repeated at the beginning of every line in case an
% embedded (inner) quotation spreads over more than one line
% (provided that both outer and inner quotations are entered with
% |\frquote{}|). Set this option to \fbo{close} if you want
% a `»' instead of a `«'.
% \item [InnerGuillSingle=true (false)];
% if \fbo{InnerGuillSingle=false} (default), inner quotations
% entered with |\frquote{}| start with~\texttt{``} and end
% with~\texttt{''}.
% If \fbo{InnerGuillSingle=true}, \texttt{\guilsinglleft} and
% \texttt{\guilsinglright} are used instead of British double
% quotes. Please note that this option only makes
% sense when \fbo{EveryLineGuill=none}.
% \item [og=«, fg=»]; when guillemets characters are available on
% the keyboard (through a compose key for instance), it is nice
% to use them instead of typing |\og| and |\fg|. This option
% tells \frenchb{} which characters are opening and closing
% French guillemets (they depend on the input encoding), then
% you can type either \label{option-og-fg}
% \texttt{« guillemets »} or \texttt{«guillemets»} (with or
% without spaces) to get properly typeset French quotes.
% This option works with LuaLaTeX and XeLaTeX; with pdfLaTeX it
% requires \file{inputenc} to be loaded with a proper encoding:
% 8-bits encoding (latin1, latin9, ansinew, applemac,\dots) or
% multi-byte encoding (utf8, utf8x).
% \end{description}
%
% \textbf{Options' order} -- Please remember that options are read
% in the order they appear in the \fbsetup{} command.
% Someone wishing that \frenchb{} leaves the layout of lists
% and footnotes untouched but caring for indentation of first
% paragraph of sections should choose\\
% \fbsetup{StandardLayout,IndentFirst} to get the expected
% layout. The reverse order
% \fbsetup{IndentFirst,StandardLayout} would lead to option
% \fbo{IndentFirst} being overwritten by \fbo{StandardLayout}.
%
% \subsubsection{Captions}
% \label{sssec-captions}
%
% Caption names can be customised in French using the simplified
% syntax introduced by \babel~3.9, for instance:
% |\def\frenchproofname{Preuve}|.
% The older syntax |\addto\captionsfrench{\def\proofname{Preuve}}|
% still works. Keep in mind that \emph{only} |french| can be used to
% redefine captions, even if \babel{}'s option was entered as
% |francais| or |frenchb|.
%
% When French is the main language, by default (see below)
% \frenchb{} changes the separator (colon) used in figures' and
% tables' captions \emph{for all languages} to |\CaptionSeparator|
% which defaults to ` -- ' and can be redefined in the preamble with
% |\renewcommand*{\CaptionSeparator}{...}|.
%
% When French is not the main language, the colon is preserved for
% all languages but \frenchb{} makes sure that a proper space is
% typeset before it.
%
% Three new options are provided: if \fbo{CustomiseFigTabCaptions} is
% set to \fbo{false} the colon will be used as separator in all
% languages, with a proper space before the colon in French.
% The second option, \fbo{OldFigTabCaptions}, can be set to \fbo{true}
% to print figures' and tables' captions as they were with versions
% pre~3.0 of \frenchb{} (using |\CaptionSeparator| in French and
% colon in other languages); this option only makes sense with the
% standard \LaTeX{} classes \cls{article}, \cls{report} and
% \cls{book}.
% The last option, \fbo{SmallCapsFigTabCaptions}, can be set to
% \fbo{false} to typeset |\figurename| and |\tablename| in French as
% ``Figure'' and ``Table'' rather than in small caps (the default).
%
% \subsection{Hyphenation checks}
% \label{ssec-hyphen}
%
% Once you have built your format, a good precaution would be to
% perform some basic tests about hyphenation in French.
% For \LaTeXe{} I suggest this:
% \begin{itemize}
% \item run |pdfLaTeX| on the following file, with the encoding
% suitable for your machine (\textit{my-encoding} will be |latin1|
% for Unix machines, |ansinew| for PCs running~Windows,
% |applemac| or |latin1| for Macintoshs, or |utf8|\dots\\[3mm]^^A\]
% |%%% Test file for French hyphenation.|\\
% |\documentclass{article}|\\
% |\usepackage[|\textit{my-encoding}|]{inputenc}|\\
% |\usepackage[T1]{fontenc} % Use LM fonts|\\
% |\usepackage{lmodern} % for French|\\
% |\usepackage[frenchb]{babel}|\\
% |\begin{document}|\\
% |\showhyphens{signal container \'ev\'enement alg\`ebre}|\\
% |\showhyphens{signal container événement algèbre}|\\
% |\end{document}|
% \item check the hyphenations proposed by \TeX{} in your log-file;
% in French you should get with both 7-bit and 8-bit encodings\\
% \texttt{si-gnal contai-ner évé-ne-ment al-gèbre}.\\
% Do not care about how accented characters are displayed in the
% log-file, what matters is the position of the `|-|' hyphen
% signs \emph{only}.
% \end{itemize}
% If they are all correct, your installation (probably) works fine,
% if one (or more) is (are) wrong, ask a local wizard to see what's
% going wrong and perform the test again (or e-mail me about what
% happens).\\
% Frequent mismatches:
% \begin{itemize}
% \item you get |sig-nal con-tainer|, this probably means that the
% hyphenation patterns you are using are for US-English, not for
% French;
% \item you get no hyphen at all in \texttt{évé-ne-ment}, this
% probably means that you are using CM fonts and the macro
% |\accent| to produce accented characters.
% Using 8-bits fonts with built-in accented characters avoids
% this kind of mismatch.
% \end{itemize}
%
% \subsection{Changes}
% \label{ssec-changes}
%
% \subsubsection*{What's new in version 3.2?}
%
% The handling of footnotes has been redesigned for the
% \cls{beamer}, \cls{memoir} and koma-script classes.
% The layout of footnotes ``à la française'' should be unchanged
% but footnotes' customisations offered by these classes
% (i.e.\ font or color changes) are now available even when option
% \fbo{FrenchFootnotes} is \fbo{true}.
%
% A long standing bug regarding the \pkg{xspace} package has been
% fixed: |\xspace| has been moved up from the internal command
% |\FB@fg| to |\fg|; |\frquote{}| now works properly when the
% \pkg{xspace} package is loaded.
%
% Version 3.2b is the first one designed to work with LuaTeX
% v.~0.95 as included in TeXLive 2016 (LuaTeX's new glue node
% structure is not compatible with previous versions).
%
% \textbf{Warning to Lua(La)TeX users:} starting with version~3.2b
% the lua code included in \file{frenchb.lua} will \emph{not work}
% on older installations (TL2015 f.i.), so \frenchb{} reverts to
% active characters while handling high punctuation with LuaTeX
% engines older than 0.95!
% The best way to go is to upgrade to TL2016 or equivalent asap.
% Xe(La)TeX and pdf(La)TeX users can safely use \frenchb{} v.~3.2b
% and later on older installations too.
%
% Tne internals of commands |\NoAutoSpacing|, |\ttfamilyFB|,
% |\rmfamilyFB| and |\sffamilyFB| have been completely redesigned
% in version~3.2c, they behave now consistently with all engines.
%
% \subsubsection*{What's new in version 3.1?}
%
% New command |\frquote{}| meant to enter French quotations,
% especially long ones (spreading over several paragraphs) and/or
% embedded ones. see p.~\pageref{frquote} for details.
%
% \subsubsection*{What's new in version 3.0?}
%
% Many deep changes lead me to step \frenchb's version number
% to~3.0a:
% \begin{itemize}
% \item \babel{}~3.9 is required now to process
% \file{frenchb.ldf}, this change allows for cleaner definitions
% of dates and captions for the Unicode engines LuaTeX and
% XeTeX and also provides a simpler syntax for end-users, see
% section~\ref{sssec-captions} p.\pageref{sssec-captions}.
% \item \fbsetup{} options management has been completely
% reworked; two new options added.
% \item Canadian French didn't work as a normal \babel's dialect,
% it should now; btw. the French language should now be loaded
% as \Lopt{french}, \emph{not as} \Lopt{frenchb} or
% \Lopt{francais} and preferably as a \emph{global} option of
% |\documentclass|. Some tolerance still exists in v3.0, but
% do not rely on it.
% \item \frenchb{} no longer loads \file{frenchb.cfg}:
% customisation should definitely be done using \fbsetup{}
% options.
% \item Description lists labels are now indented; set
% |\listendentFB=0pt| to get the former layout.
% \item The last but not least change affects the (recent)
% LuaTeX-based engines, (this means version 0.76 as included in
% TL2013 and up): active characters are no longer used in French
% for `high punctuation'%
% \footnote{The current \frenchb{} version requires LuaTeX
% v.~0.95 as included in TL2016, see above.}.
% Functionalities and user interface are unchanged.
%
% Many thanks to Paul Isambert who provided the basis for the
% lua code (see his presentation at GUT'2010) and kindly
% reviewed my first drafts suggesting significant improvements.
%
% Please note that this code, still experimental, is likely to
% change until LuaTeX itself has reached version~1.0.
% \end{itemize}
%
% Starting with version~3.0c, \frenchb{} no longer customises
% lists with the \cls{beamer} class and offers a new option
% (\fbo{INGuillSpace}) to follow French `Imprimerie Nationale'
% recommendations regarding quotes' spacing.
%
% \StopEventually{}
%
% \changes{v2.6c}{2013/05/20}{Dummy file frenchb.cfg is no longer
% generated from frenchb.dtx.}
%
% \clearpage
% \newgeometry{left=53mm,right=25mm}
%
% \section{The code}
%
% \subsection{Initial setup}
%
% \changes{v2.1d}{2008/05/02}{Argument of \cs{ProvidesLanguage} changed
% above from `french' to `frenchb' (otherwise \cs{listfiles} prints
% no date/version information). The real name of current language
% (french) as to be corrected before calling \cs{LdfInit}.}
%
% \iffalse
%<*ldf>
% \fi
%
% \changes{v3.0a}{2014/02/28}{Support for options frenchb, francais,
% canadien, acadian changed.}
%
% If \file{frenchb.ldf} was loaded with \babel{}'s options
% \Lopt{francais} or \Lopt{frenchb}, we make it behave as if
% \Lopt{french} was specified.
% In Plain formats, \texttt{@} catcode is not `letter'.
% \begin{macrocode}
\chardef\atcatcode=\catcode`\@
\catcode`\@=11\relax
\def\bbl@tempa{francais}
\ifx\CurrentOption\bbl@tempa
\let\l@francais\l@french
\def\captionsfrancais{\captionsfrench}
\def\datefrancais{\datefrench}
\def\extrasfrancais{\extrasfrench}
\def\noextrasfrancais{\extrasfrench}
\def\CurrentOption{french}
\fi
\def\bbl@tempa{frenchb}
\ifx\CurrentOption\bbl@tempa
\let\l@frenchb\l@french
\def\captionsfrenchb{\captionsfrench}
\def\datefrenchb{\datefrench}
\def\extrasfrenchb{\extrasfrench}
\def\noextrasfrenchb{\extrasfrench}
\def\CurrentOption{french}
\fi
\catcode`\@=\atcatcode \let\atcatcode\relax
% \end{macrocode}
%
% \changes{v3.0a}{2014/02/19}{\cs{LdfInit} checks \cs{datefrench}
% instead of \cs{captionsfrench} to avoid a conflict with
% papertex.cls which loads datetime.sty.}
%
% The macro |\LdfInit| takes care of preventing that this file is
% loaded more than once, checking the category code of the
% \texttt{@} sign, etc.
%
% \begin{macrocode}
\LdfInit\CurrentOption\captionsfrench
% \end{macrocode}
%
% \changes{v3.0c}{2014/03/30}{No need to define \cs{l@french} as
% \cs{lang@french}, babel.def (3.9j) takes care for this.}
%
% Make sure that |\l@french| is defined (possibly as 0).
% \file{babel.def} now (3.9i) defines |\l@<languagename>| also for
% eTeX, LuaTeX and XeTeX formats which set |\lang@<languagename>|.
% \begin{macrocode}
\def\FB@nopatterns{%
\ifx\l@nohyphenation\@undefined
\edef\bbl@nulllanguage{\string\language=0}%
\adddialect\l@french0
\else
\adddialect\l@french\l@nohyphenation
\edef\bbl@nulllanguage{\string\language=nohyphenation}%
\fi
\@nopatterns{French}}
\ifx\l@french\@undefined
\FB@nopatterns
\fi
% \end{macrocode}
%
% \changes{v2.1d}{2008/05/04}{Avoid warning ``\cs{end} occurred
% when \cs{ifx} ... incomplete'' with LaTeX-2.09.}
%
% \begin{macro}{\ifLaTeXe}
% No support is provided for late \LaTeX-2.09: issue a warning
% and exit if \LaTeX-2.09 is in use. Plain is still supported.
% \begin{macrocode}
\newif\ifLaTeXe
\let\bbl@tempa\relax
\ifx\magnification\@undefined
\ifx\@compatibilitytrue\@undefined
\PackageError{frenchb.ldf}
{LaTeX-2.09 format is no longer supported.\MessageBreak
Aborting here}
{Please upgrade to LaTeX2e!}
\let\bbl@tempa\endinput
\else
\LaTeXetrue
\fi
\fi
\bbl@tempa
% \end{macrocode}
% \end{macro}
%
% \changes{v3.0a}{2014/02/15}{In Plain, provide a substitute for
% \cs{PackageWarning} and \cs{PackageInfo}.}
%
% Let's provide a substitute for |\PackageError|, |\PackageWarning|
% and |\PackageInfo| not defined in Plain:
% \begin{macrocode}
\def\fb@error#1#2{%
\begingroup
\newlinechar=`\^^J
\def\\{^^J(frenchb.ldf) }%
\errhelp{#2}\errmessage{\\#1^^J}%
\endgroup}
\def\fb@warning#1{%
\begingroup
\newlinechar=`\^^J
\def\\{^^J(frenchb.ldf) }%
\message{\\#1^^J}%
\endgroup}
\def\fb@info#1{%
\begingroup
\newlinechar=`\^^J
\def\\{^^J}%
\wlog{#1}%
\endgroup}
% \end{macrocode}
%
% \changes{v3.0c}{2014/03/30}{frenchb requires babel-3.9i.}
%
% Quit if \babel's version is less than 3.9i.
% \begin{macrocode}
\let\bbl@tempa\relax
\ifx\babeltags\@undefined
\let\bbl@tempa\endinput
\ifLaTeXe
\PackageError{frenchb.ldf}
{frenchb requires babel v.3.9i.\MessageBreak
Aborting here}
{Please upgrade Babel!}
\else
\fb@error{frenchb requires babel v.3.9i.\\
Aborting here}
{Please upgrade Babel!}
\fi
\fi
\bbl@tempa
% \end{macrocode}
%
% \file{frenchb.ldf} can be loaded with options \Lopt{canadien} or
% \Lopt{acadian}, which both stand for Canadian French. Internally,
% \Lopt{acadian} will be the name of the corresponding \babel's
% dialect, so we set |\CurrentOption| to \Lopt{acadian} in both
% cases.
% If no specific hyphenation patterns are available, Canadian French
% will use the French ones.
%
% TODO: Canadian French hyphenation doesn't work with LuaTeX.
% \begin{macrocode}
\ifx\l@acadian\@undefined
\ifx\l@canadien\@undefined
\adddialect\l@acadian\l@french
\adddialect\l@canadien\l@french
\else
\adddialect\l@acadian\l@canadien
\fi
\else
\adddialect\l@canadien\l@acadian
\fi
\def\bbl@tempa{canadien}
\ifx\CurrentOption\bbl@tempa
\def\captionscanadien{\captionsacadian}
\def\datecanadien{\dateacadian}
\def\extrascanadien{\extrasacadian}
\def\noextrascanadien{\extrasacadian}
\def\CurrentOption{acadian}
\fi
% \end{macrocode}
%
% French uses the standard values of |\lefthyphenmin| (2)
% and |\righthyphenmin| (3); let's provide their values though,
% as required by \babel.
%
% \begin{macrocode}
\expandafter\providehyphenmins\expandafter{\CurrentOption}{\tw@\thr@@}
% \end{macrocode}
%
% \begin{macro}{\ifFBunicode}
% \begin{macro}{\ifFBLuaTeX}
% \begin{macro}{\ifFBXeTeX}
% French hyphenation patterns are now coded in Unicode, see file
% \file{hyph-fr.tex}. XeTeX and LuaTeX engines require some extra
% code to deal with the French ``apostrophe''.
% Let's define three new `if': |\ifFBLuaTeX|, |\ifFBXeTeX| and
% |\ifFBunicode| which will be true for XeTeX and LuaTeX engines
% and false for 8-bits engines.
%
% \changes{v2.4a}{2009/11/23}{Added a new `if' \cs{FBunicode} and
% some \cs{lccode} definitions to \cs{extrasfrench} and
% \cs{noextrasfrench}.}
%
% \changes{v2.5d}{2011/01/17}{Added two new `if' \cs{FBXeTeX} and
% \cs{FBLuaTeX} as XeTeX and behave differently regarding the status
% of the French ``apostrophe''.}
%
% \changes{v2.6g}{2013/12/15}{lccode values for the French
% ``apostrophe'' are now the same for XeTeX and LuaTeX.}
%
% We cannot rely on \eTeX's |\ifdefined| at this stage, as it is not
% defined in Plain \TeX{} format.
% \begin{macrocode}
\newif\ifFBunicode
\newif\ifFBLuaTeX
\newif\ifFBXeTeX
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname luatexversion\endcsname\relax
\else
\FBunicodetrue \FBLuaTeXtrue
\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname XeTeXrevision\endcsname\relax
\else
\FBunicodetrue \FBXeTeXtrue
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\extrasfrench}
% \changes{v3.0a}{2014/02/18}{Take advantage of babel's
% \cs{babel@savevariable} to handle apostrophe's \cs{lccode}.}
%
% \begin{macro}{\noextrasfrench}
% The macro |\extrasfrench| will perform all the extra
% definitions needed for the French language.
% The macro |\noextrasfrench| is used to cancel the actions of
% |\extrasfrench|.
%
% In French, character ``apostrophe'' is a letter in expressions
% like |l'ambulance| (French hyphenation patterns provide entries
% for this kind of words). This means that the |\lccode| of
% ``apostrophe'' has to be non null in French for proper hyphenation
% of those expressions, and has to be reset to null when exiting
% French.
%
% The following code ensures correct hyphenation of words like
% |d'aventure|, |l'utopie|, with all TeX engines (XeTeX, LuaTeX,
% pdfTeX) using \file{hyph-fr.tex} patterns.
%
% \begin{macrocode}
\@namedef{extras\CurrentOption}{%
\babel@savevariable{\lccode`\'}%
\ifFBunicode
\babel@savevariable{\lccode"2019}%
\lccode`\'="2019\lccode"2019="2019
\else
\lccode`\'=`\'
\fi
}
\@namedef{noextras\CurrentOption}{}
% \end{macrocode}
%
% Let's define a handy command for adding stuff to
% |\extras\CurrentOption|,\linebreak[0] |\noextras\CurrentOption| or
% |\captions\CurrentOption| but first let's save the value of
% |\CurrentOption| for later use in \fbsetup{} (`AfterEndOfPackage',
% |\CurrentOption| will be lost).
% \begin{macrocode}
\let\FB@CurOpt\CurrentOption
\newcommand*{\FB@addto}[2]{%
\expandafter\addto\csname #1\FB@CurOpt\endcsname{#2}}
% \end{macrocode}
%
% One more thing |\extrasfrench| needs to do is to make sure that
% ``Frenchspacing'' is in effect. |\noextrasfrench| will switch
% ``Frenchspacing'' off again if necessary.
% \begin{macrocode}
\FB@addto{extras}{\bbl@frenchspacing}
\FB@addto{noextras}{\bbl@nonfrenchspacing}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Punctuation}
% \label{ssec-punct}
%
% \changes{v2.5a}{2010/08/10}{Punctation is no longer made active
% with XeTeX-based engines.}
%
% As long as no better solution is available, the `high
% punctuation' characters (|;| |!| |?| and |:|) have to be made
% |\active| for an automatic control of the amount of space to be
% inserted before them. Both XeTeX and LuaTeX provide an
% alternative to active characters (`XeTeXinterchar' mechanism and
% LuaTeX's callbacks).
%
% \changes{v3.0a}{2014/01/10}{New flag \cs{ifFB@luatex@punct} for
% `high punctuation' management with LuaTeX engines.}
%
% \begin{macro}{\ifFB@active@punct}
% \begin{macrocode}
\newif\ifFB@active@punct \FB@active@puncttrue
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifFB@luatex@punct}
% Three internal flags are needed for the three different techniques
% used for `high punctuation' management.
%
% With LuaTeX, starting with version 0.95, callbacks are used to
% get rid of active punctuation. With previous versions, `high
% punctuation' characters remain active (see below).
% \begin{macrocode}
\newif\ifFB@luatex@punct
\ifFBLuaTeX
\ifnum\luatexversion<95
\ifx\PackageWarning\@undefined
\fb@warning{Please upgrade LuaTeX to version 0.95 or above!\\%
frenchb will make high punctuation characters (;:!?) active\\%
with LuaTeX < 0.95.}%
\else
\PackageWarning{frenchb.ldf}{Please upgrade LuaTeX
to version 0.95 or above!\MessageBreak
frenchb will make high punctuation characters\MessageBreak
(;:!?) active with LuaTeX < 0.95;\MessageBreak reported}%
\fi
\else
\FB@luatex@puncttrue\FB@active@punctfalse
\fi
\fi
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifFB@xetex@punct}
% For XeTeX, the availability of |\XeTeXinterchartokenstate|
% decides whether the `high punctuation' characters (|;| |!| |?|
% and |:|) have to be made |\active| or not.
%
% \changes{v3.2b}{2016/04/18}{New counter \cs{FB@nonchar} needed for
% non characters: it's value will be 4095 for new engines and 255
% for older ones.}
%
% The number of available character classes has been increased
% from 256 to 4096 in XeTeX v.~0.99994, the class for
% non-characters is now 4095 instead of 255.
% \begin{macrocode}
\newcount\FB@nonchar
\newif\ifFB@xetex@punct
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname XeTeXinterchartokenstate\endcsname\relax
\else
\FB@xetex@puncttrue\FB@active@punctfalse
\ifdim\the\XeTeXversion\XeTeXrevision pt<0.99994pt
\FB@nonchar=255 \relax
\else
\FB@nonchar=4095 \relax
\fi
\fi
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FBcolonspace}
% \begin{macro}{\FBthinspace}
% \changes{v2.5a}{2010/08/10}{Define \cs{FBthinspace} for those who want
% to customise the width of the space before ; and co.}
%
% \changes{v2.6d}{2013/06/19}{Rename \cs{Fthinspace} to
% \cs{FBthinspace} and \cs{Fcolonspace} to \cs{FBcolonspace} to avoid
% a conflict with fournier.sty.}
%
% \changes{v3.1f}{2015/05/31}{\cs{FBthinspace} is no longer a kern but
% a skip (frenchb adds a nobreak penalty before it).}
%
% \changes{v3.2c}{2016/05/14}{Change .16667em to
% .5\cs{fontdimen2}\cs{font} in \cs{FBthinspace}
% to get a real thinspace with every font.}
%
% According to the I.N.\ specifications, the `:' requires an
% inter-word space before it, the other three require just
% a |\thinspace|. We define |\FBcolonspace| as |\space|
% (inter-word space) and |\FBthinspace| as |\thinspace| (both
% are user customisable).
% \begin{macrocode}
\newcommand*{\FBcolonspace}{\space}
\newcommand*{\FBthinspace}{\hskip.5\fontdimen2\font \relax}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\FBcolonskip}
% \begin{macro}{\FBthinskip}
% \changes{v3.0a}{2014/01/10}{LuaTeX requires dimensions: two new skips
% \cs{FBcolonskip} and \cs{FBthinskip}.}
%
% LuaTeX requires skips instead of commands, so we define
% |\FBcolonskip| and |\FBthinskip| to hold the specifications
% (width/stretch/shrink) of |\space| and |\thinspace| for the
% |lmr10| font; these parameters will be scaled for the current font
% by the \file{frenchb.lua} script (see how p.~\pageref{lua-scaling}).
% |\FBcolonskip| and |\FBthinskip| are also user customisable.
% \begin{macrocode}
\newskip\FBcolonskip
\FBcolonskip=3.33pt plus 1.665pt minus 1.11pt \relax
\newskip\FBthinskip
\FBthinskip=1.66672pt \relax
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{v3.2c}{2016/05/14}{Newif \cs{ifFB@spacing} and new commands
% \cs{FB@spacingon}, \cs{FB@spacingoff} to control space tuning in
% French.}
%
% With LuaTeX and XeTeX engines, \frenchb{} handles French quotes
% together with `high punctuation'; the conditional |\ifFB@spacing|
% will be used by PdfTeX and XeTeX engines to switch on or off space
% tuning before high punctuation and inside French quotes.
% A matching attribute will be defined later for LuaTeX.
% \begin{macrocode}
\newif\ifFB@spacing \FB@spacingtrue
% \end{macrocode}
%
% \begin{macro}{\FB@spacing@off}
% \begin{macro}{\FB@spacing@on}
% Two internal commands to switch on and off all space tuning
% for all six characters `;:!?«»'.
% They will be triggered by user command |\NoAutoSpacing| and by
% font family switching commands |\ttfamilyFB| |\rmfamilyFB| and
% |\sffamilyFB|. These four commands will now behave the same with
% any engine (up to version 3.2b, results were engine dependent).
% \begin{macrocode}
\newcommand*{\FB@spacing@on}{%
\ifFB@luatex@punct
\FB@spacing=1 \relax
\else
\FB@spacingtrue
\fi}
\newcommand*{\FB@spacing@off}{%
\ifFB@luatex@punct
\FB@spacing=0 \relax
\else
\FB@spacingfalse
\fi}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsubsection{Punctuation with LuaTeX}
% \label{sssec-punct-luatex}
%
% \changes{v3.0a}{2014/01/10}{New handling of `high punctuation'
% through callbacks with LuaTeX engines.}
%
% The following part holds specific code for punctuation with modern
% LuaTeX engines (version $\ge 0.76$).
%
% \changes{v3.0b}{2014/02/13}{Require luatexbase with LaTeXe in case
% fontspec has not been loaded before babel.}
%
% \changes{v3.0c}{2014/03/26}{Just load luatexbase.sty instead of
% luaotfload.sty with plain formats.}
%
% \changes{v3.1a}{2014/05/30}{Misplaced \cs{fi} for plain formats.}
%
% \changes{v3.1i}{2015/10/04}{Compatibility code added due to changes
% in the 2015/10/01 LaTeX release, see ltnews23.tex.}
%
% \changes{v3.1j}{2015/10/16}{Loading luatexbase.sty is no longer
% needed with LaTeX release 2015/10/01 or later.}
%
% \changes{v3.2b}{2016/04/18}{Load ltluatex.tex for plain LuaTeX to
% ensure \cs{newattribute} is defined.}
%
% \changes{v3.2c}{2016/05/14}{New LuaTeX attribute \cs{FB@spacing}.}
%
% The following |\directlua| call ensures compatibility with LaTeX
% releases prior to 2015/10/01: the |\localleftbox| primitive%
% \footnote{used by \cs{frquote}, see p.~\pageref{cs:localleftbox}.}
% introduced by Omega was prefixed with ``luatex'', it should no
% longer be, see \file{ltnews23.tex} for details.
% \begin{macrocode}
\ifFB@luatex@punct
\directlua{tex.enableprimitives("", tex.extraprimitives("omega"))}
% \end{macrocode}
%
% We define three LuaTeX attributes to control spacing in French
% for `high punctuation' and quotes, making sure that
% |\newattribute| is defined.
% \begin{macrocode}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname newluafunction\endcsname\relax
% \end{macrocode}
% This code is for Plain: load\file{ltluatex.tex} if it hasn't been
% loaded before \babel.
% \begin{macrocode}
\input ltluatex.tex
\fi
% \end{macrocode}
% |\FB@spacing=0| switches off any space tuning both before high
% punctuation characters and inside French quotes (i.e.\ function
% |french_punctuation| doesn't alter the node list at all).
% |\FB@addDPspace=0| switches off automatic insertion of spaces
% before high punctuation characters (but typed spaces are still
% turned into nobreak thin- or word-spaces).
% |\FB@addGUILspace| will be set to~1 by option \fbo{og=«, fg=»},
% thus enabling automatic insertion of proper spaces after `«' and
% before `»'.
% \begin{macrocode}
\newattribute\FB@spacing \FB@spacing=1 \relax
\newattribute\FB@addDPspace \FB@addDPspace=1 \relax
\newattribute\FB@addGUILspace \FB@addGUILspace=0 \relax
\ifLaTeXe
\PackageInfo{frenchb.ldf}{No need for active punctuation
characters\MessageBreak with this version
of LuaTeX!\MessageBreak reported}
\else
\fb@info{No need for active punctuation characters\\
with this version of LuaTeX!}
\fi
\fi
% \end{macrocode}
%
% \iffalse
%</ldf>
%<*lua>
% \fi
% This is \file{frenchb.lua}. It holds Lua code to deal with `high
% punctuation' and quotes. This code is based on suggestions from
% Paul Isambert.
%
% \begin{macro}{frenchb.lua}
% First we define two flags to control spacing before French `high
% punctuation' (thin space or inter-word space).
%
% \changes{v3.1a}{2014/06/16}{Codes 0x13 and 0x14 added for French
% quotes in T1-encoding.}
%
% \begin{macrocode}
local FB_punct_thin =
{[string.byte("!")] = true,
[string.byte("?")] = true,
[string.byte(";")] = true}
local FB_punct_thick =
{[string.byte(":")] = true}
% \end{macrocode}
% Managing spacing after `«' (U+00AB) and before `»' (U+00BB) can be
% done by the way; we define two flags, |FB_punct_left| for
% characters requiring some space before them and |FB_punct_right|
% for `\guillemotleft' which must be followed by some space.
% In case LuaTeX is used to output T1-encoded fonts instead of
% OpenType fonts, codes \texttt{0x13} and \texttt{0x14} have to be
% added for `«' and `»'.
% \begin{macrocode}
local FB_punct_left =
{[string.byte("!")] = true,
[string.byte("?")] = true,
[string.byte(";")] = true,
[string.byte(":")] = true,
[0x14] = true,
[0xBB] = true}
local FB_punct_right =
{[0x13] = true,
[0xAB] = true}
% \end{macrocode}
% Two more flags will be needed to avoid spurious spaces in
% strings like !! ?? or (?)
% \begin{macrocode}
local FB_punct_null =
{[string.byte("!")] = true,
[string.byte("?")] = true,
[string.byte("[")] = true,
[string.byte("(")] = true,
% \end{macrocode}
% or if the user has typed a nobreak space U+00A0 or a nobreak thin
% space U+202F before a `high punctuation' character: no space
% should be added by \frenchb. Same is true inside French quotes.
% \begin{macrocode}
[0xA0] = true,
[0x202F] = true}
local FB_guil_null =
{[0xA0] = true,
[0x202F] = true}
% \end{macrocode}
% \changes{v3.1g}{2015/06/17}{Node HLIST added; node TEMP added
% for the first node of \cs{hbox}es.}
%
% Local definitions for nodes:
% \begin{macrocode}
local new_node = node.new
local copy_node = node.copy
local node_id = node.id
local HLIST = node_id("hlist")
local TEMP = node_id("temp")
local KERN = node_id("kern")
local GLUE = node_id("glue")
local GLYPH = node_id("glyph")
local PENALTY = node_id("penalty")
local nobreak = new_node(PENALTY)
nobreak.penalty = 10000
local insert_node_before = node.insert_before
local insert_node_after = node.insert_after
local remove_node = node.remove
% \end{macrocode}
% Some variables to store |\FBthinskip|, |\FBcolonskip| and
% |\FBguillskip| (given for |lmr10|); width/stretch/shrink are
% stored as fractions of |\fontdimen2|, |\fontdimen3| and
% |\fontdimen4| of |lmr10| font respectively\dots
% \label{lua-scaling}
% \begin{macrocode}
local thin10 = tex.skip['FBthinskip']
local thinwd = thin10.width/65536/3.33
local thinst = thin10.stretch/65536/1.665
local thinsh = thin10.shrink/655.36/1.11
local coln10 = tex.skip['FBcolonskip']
local colnwd = coln10.width/65536/3.33
local colnst = coln10.stretch/65536/1.665
local colnsh = coln10.shrink/65536/1.11
local guil10 = tex.skip['FBguillskip']
local guilwd = guil10.width/65536/3.33
local guilst = guil10.stretch/65536/1.665
local guilsh = guil10.shrink/65536/1.11
% \end{macrocode}
% and a function to scale them for the current font (beware of null
% values for fid, see |\nullfont| in TikZ, and of special fonts like
% lcircle1.pfb for which |font.getfont(fid)| does not return
% a proper font table, in such cases the function returns |nil|):
%
% \changes{v3.1l}{2016/02/13}{font.getfont(fid) possibly
% returns nil even for a positive fid (i.e. AMS lcircle1.pfb).
% Reported by François Legendre.}
%
% \changes{v3.1m}{2016/02/16}{new\_glue\_scaled returns
% nil in case of invalid font table (i.e. lcircle1.pfb). In such
% cases frenchb leaves the node list unchanged.}
%
% \changes{v3.2b}{2016/04/18}{glue\_spec removed;
% starting with LuaTeX 0.95, glue specifications fit in glue.}
%
% \begin{macrocode}
local font_table = {}
local function new_glue_scaled (fid,width,stretch,shrink)
if fid > 0 then
local fp = font_table[fid]
if not fp then
local ft = font.getfont(fid)
if ft then
font_table[fid] = ft.parameters
fp = font_table[fid]
end
end
local gl = new_node(GLUE,0)
if fp then
gl.width = width * fp.space
gl.stretch = stretch * fp.space_stretch
gl.shrink = shrink * fp.space_shrink
return gl
else
return nil
end
else
return nil
end
end
% \end{macrocode}
% Let's catch LuaTeX attributes |\FB@spacing|, |\FB@addDPspace|
% and |\FB@addGUILspace|. Constant |FR=lang.id(french)| will be
% defined by command |\activate@luatexpunct|.
% \begin{macrocode}
local FBspacing = luatexbase.attributes['FB@spacing']
local addDPspace = luatexbase.attributes['FB@addDPspace']
local addGUILspace = luatexbase.attributes['FB@addGUILspace']
local has_attribute = node.has_attribute
% \end{macrocode}
% The following function will be added to |kerning| callback.
% It catches all nodes of type |GLYPH| in the list starting at
% |head| and checks the language attributes of the current glyph:
% nothing is done if the current language is not French and only
% specific punctuation characters (those for which |FB_punct_left|
% or |FB_punct_right| is true) need a special treatment.
% In French, local variables are defined to hold the properties of
% the current glyph (|item|) and of the previous one (|prev|) or the
% next one (|next|).
%
% \changes{v3.1b}{2014/09/16}{Add a check for null fid
% in french\_punctuation (Tikz \cs{nullfont}).
% Bug pointed out by Paul Gaborit.}
%
% \begin{macrocode}
local function french_punctuation (head)
for item in node.traverse_id(GLYPH, head) do
local lang = item.lang
local char = item.char
local fid = item.font
local FRspacing = has_attribute(item, FBspacing)
FRspacing = FRspacing and FRspacing > 0
local SIG = has_attribute(item, addGUILspace)
SIG = SIG and SIG >0
if lang == FR and FRspacing and
FB_punct_left[char] and fid > 0 then
local prev = item.prev
local prev_id, prev_subtype, prev_char
if prev then
prev_id = prev.id
prev_subtype = prev.subtype
if prev_id == GLYPH then
prev_char = prev.char
end
end
% \end{macrocode}
%
% \changes{v3.0c}{2014/04/18}{Null glues should not
% trigger space insertion before high ponctuation. Bug pointed out
% by Benoit Rivet for the `lstlisting' environment of the listings
% package.}
%
% \changes{v3.1c}{2014/10/25}{Previous bug fix for null
% glues (v3.0c) did not work properly. Fixed now (I hope!).
% Pointed out by Jacques André.}
%
% If the previous item is a glue, check its natural width, only
% positive glues (actually glues > 1 sp, for tabular `l'
% columns) are to be replaced by a nobreakspace.
% \begin{macrocode}
local is_glue = prev_id == GLUE
local glue_wd
if is_glue then
glue_wd = prev.width
end
local realglue = is_glue and glue_wd > 1
% \end{macrocode}
% For characters for which |FB_punct_thin| or |FB_punct_thick| is
% \emph{true}, the amount of spacing to be typeset before them
% is controlled by |\FBthinskip| (|thinwd|, |thinst|, |thinsh|) or
% |\FBcolonskip| (|colnwd|, |colnst|, |colnsh|) respectively.
% Two options: if a space has been typed in before (turned into
% \emph{glue} in the node list), we remove the \emph{glue} and add a
% nobreak penalty and the required \emph{glue}.
% Otherwise (|auto| option), the penalty and the required
% \emph{glue} are inserted if attribute |\FB@addDPspace| is set,
% unless one of these three conditions is met:
% a) the previous character is part of type |FB_punct_null| (this
% avoids spurious spaces in strings like |(!)| or |??|),
% b) a null glue (actually glues <= 1 sp for tabulars) preceeds the
% punctuation character,
% c) the punctuation character starts a paragraph or an |\hbox{}|.
%
% \begin{macrocode}
if FB_punct_thin[char] or FB_punct_thick[char] then
local SBDP = has_attribute(item, addDPspace)
local auto = SBDP and SBDP > 0
if auto then
if (prev_char and FB_punct_null[prev_char]) or
(is_glue and glue_wd <= 1) or
(prev_id == HLIST and prev_subtype == 3) or
(prev_id == TEMP) then
auto = false
end
end
local fbglue
if FB_punct_thick[char] then
fbglue = new_glue_scaled(fid,colnwd,colnst,colnsh)
else
fbglue = new_glue_scaled(fid,thinwd,thinst,thinsh)
end
% \end{macrocode}
% In case |new_glue_scaled| fails (returns |nil|) the node list
% remains unchanged.
% \begin{macrocode}
if (realglue or auto) and fbglue then
if realglue then
head = remove_node(head,prev,true)
end
insert_node_before(head, item, copy_node(nobreak))
insert_node_before(head, item, copy_node(fbglue))
end
% \end{macrocode}
% Let's consider `»' now (the only remaining glyph of
% |FB_punct_left| class): we just have to remove any \emph{glue}
% possibly preceeding `»', then to insert the nobreak penalty and
% the proper \emph{glue} (controlled by |\FBguillskip|).
% This is done only if French quotes have been `activated' by
% options \fbo{og=«, fg=»} in \fbsetup{} and can be denied locally
% with |\NoAutoSpacing| (this is controlled by the |SIG| flag).
% If either a) the preceding glyph is member of |FB_guil_null|, or
% b) `»' is the first glyph of an |\hbox{}| or a paragraph, nothing
% is done, this is controlled by the |addgl| flag.
%
% \changes{v3.1a}{2014/06/18}{Added flag addgl which must also be true
% when prev or next is not a char (i.e. kern0 in
% «\cs{texttt}\{a\}»).}
%
% \changes{v3.1g}{2015/06/26}{flag addgl set to false for `»'
% at the beginning of an \cs{hbox} or a paragraph or a tabular
% `l' and `c' columns.}
%
% \begin{macrocode}
elseif SIG then
local addgl = (prev_char and not FB_guil_null[prev_char]) or
(not prev_char and
prev_id ~= TEMP and
not (prev_id == HLIST and prev_subtype == 3)
)
% \end{macrocode}
% Correction for tabular `c' (glue 0 plus 1 fil) and `l' (glue 1sp)
% columns:
% \begin{macrocode}
if is_glue and glue_wd <= 1 then
addgl = false
end
local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh)
if addgl and fbglue then
if is_glue then
head = remove_node(head,prev,true)
end
insert_node_before(head, item, copy_node(nobreak))
insert_node_before(head, item, copy_node(fbglue))
end
end
end
% \end{macrocode}
% Similarly, for `«' (unique member of the |FB_punct_right| class):
% unless either a) the next glyph is member of |FB_guil_null|, or
% b) `«' is the last glyph of an |\hbox{}| or a paragraph (then the
% |addgl| flag is false, nothing is done), we remove any \emph{glue}
% possibly following it and insert first the proper \emph{glue} then
% a nobreak penalty so that finally the penalty preceeds the
% \emph{glue}.
%
% \changes{v3.1a}{2014/06/18}{Look ahead when next is a kern
% (i.e. in « \cs{texttt}\{a\} »).}
%
% \changes{v3.1g}{2015/06/26}{Flag addgl set to false for
% `«' at the end of an \cs{hbox} or a paragraph or when followed by
% a null glue (i.e. springs).}
%
% \begin{macrocode}
if lang == FR and FRspacing and FB_punct_right[char]
and fid > 0 and SIG then
local next = item.next
local next_id, next_subtype, next_char, nextnext, kern_wd
if next then
next_id = next.id
next_subtype = next.subtype
if next_id == GLYPH then
next_char = next.char
% \end{macrocode}
% A |kern0| might hide a |glue|, so look ahead if |next| is a kern
% (this occurs with |« \texttt{a} »|):
% \begin{macrocode}
elseif next_id == KERN then
kern_wd = next.kern
if kern_wd == 0 then
nextnext = next.next
if nextnext then
next = nextnext
next_id = nextnext.id
next_subtype = nextnext.subtype
if next_id == GLYPH then
next_char = nextnext.char
end
end
end
end
end
local is_glue = next_id == GLUE
if is_glue then
glue_wd = next.width
end
local addgl = (next_char and not FB_guil_null[next_char]) or
(next and not next_char)
% \end{macrocode}
% Correction for tabular `c' columns. For `r' columns, a final
% `«' character needs to be coded as |\mbox{«}| for proper spacing
% (|\NoAutoSpacing| is another option).
% \begin{macrocode}
if is_glue and glue_wd == 0 then
addgl = false
end
local fid = item.font
local fbglue = new_glue_scaled(fid,guilwd,guilst,guilsh)
if addgl and fbglue then
if is_glue then
head = remove_node(head,next,true)
end
insert_node_after(head, item, copy_node(fbglue))
insert_node_after(head, item, copy_node(nobreak))
end
end
end
return head
end
return french_punctuation
% \end{macrocode}
% \end{macro}
% \iffalse
%</lua>
%<*ldf>
% \fi
%
% \begin{macro}{\FB@luatex@punct@french}
% As a language tag is part of glyph nodes in LuaTeX, nothing needs
% to be added to |\extrasfrench| and |\noextrasfrench|; we will just
% redefine |\shorthandoff| and |\shorthandon| in French to issue a
% warning reminding the user that active characters are no longer
% used in French with recent LuaTeX engines.
%
% \changes{v3.1l}{2016/02/07}{Use \cs{babel@save} to save and restore
% \cs{shorthandon} and \cs{shorthandoff}.}
%
% \begin{macrocode}
\ifFB@luatex@punct
\newcommand*{\FB@luatex@punct@french}{%
\babel@save{\shorthandon}%
\babel@save{\shorthandoff}%
\def\shorthandoff##1{%
\ifx\PackageWarning\@undefined
\fb@warning{\noexpand\shorthandoff{;:!?} is helpless with
LuaTeX,\\ use \noexpand\NoAutoSpacing
*inside a group* instead.}%
\else
\PackageWarning{frenchb.ldf}{\protect\shorthandoff{;:!?} is
helpless with LuaTeX,\MessageBreak use \protect\NoAutoSpacing
\space *inside a group* instead;\MessageBreak reported}%
\fi}%
\def\shorthandon##1{}%
}
\FB@addto{extras}{\FB@luatex@punct@french}
% \end{macrocode}
% \end{macro}
%
% \changes{v3.0b}{2014/02/13}{frenchb.lua was not found by
% Lua function dofile (not kpathsea aware).
% Call function kpse.find\_file first, as suggested by Paul Gaborit.}
%
% \changes{v3.1g}{2015/06/17}{Lua function french\_punctuation is now
% inserted at the end of the "kerning" callback (no priority)
% instead of "hpack\_filter" and "pre\_linebreak\_filter".}
%
% In \LaTeXe, file \file{frenchb.lua} will be loaded
% `AtBeginDocument' \emph{after} processing options
% (\fbo{ThinColonSpace} needs to be taken into account). The next
% definition will be used to activate Lua punctuation: it sets the
% language number for French, loads \file{frenchb.lua} and adds
% function |french_punctuation| at the end of the |kerning| callback
% (no priority).
% \begin{macrocode}
\def\activate@luatexpunct{%
\directlua{%
FR = \the\l@french
local path = kpse.find_file("frenchb.lua", "lua")
if path then
local f = dofile(path)
luatexbase.add_to_callback("kerning",
f, "frenchb.french_punctuation")
else
texio.write_nl('')
texio.write_nl('*****************************')
texio.write_nl('Error: frenchb.lua not found.')
texio.write_nl('*****************************')
texio.write_nl('')
end
}%
}
\fi
% \end{macrocode}
% End of specific code for punctuation with LuaTeX engines.
%
% \subsubsection{Punctuation with XeTeX}
% \label{sssec-punct-xetex}
%
% If |\XeTeXinterchartokenstate| is available, we use the
% ``inter char'' mechanism to provide correct spacing in French
% before the four characters |;| |!| |?| and |:|. The basis of the
% following code was borrowed from the \pkg{polyglossia} package,
% see \file{gloss-french.ldf}. We use the same mechanism for French
% quotes (\texttt{«} and \texttt{»}), when automatic spacing for
% quotes is required by options \fbo{og=«} and \fbo{fg=»} in
% \fbsetup{} (see section~\ref{ssec-keyval}).
%
% The default value for |\XeTeXcharclass| is 0 for characters tokens
% and |\FB@nonchar| for all other tokens (glues, kerns, math and box
% boundaries, etc.).
% These defaults should not be changed otherwise the spacing before
% the `high punctuation' characters and inside quotes might not be
% correct.
%
% We switch |\XeTeXinterchartokenstate| to 1 and change the
% |\XeTeXcharclass| values of |;| |!| |?| |:| |(| |]|
% \texttt{«} and \texttt{»} when
% entering French. Special care is taken to restore them to their
% inital values when leaving French.
%
% \changes{v2.5d}{2011/01/19}{Moved the \cs{newcount} command outside
% \cs{ifFB@xetex@punct} ... \cs{fi} (it broke Plain formats).}
%
% \changes{v3.1g}{2015/06/14}{Use Babel defined loops \cs{bbl@for}
% instead of \cs{@for} borrowed from file ltcntrl.dtx
% (\cs{@for} is undefined in Plain).}
%
% The following part holds specific code for punctuation with XeTeX
% engines.
%
% \begin{macrocode}
\ifFB@xetex@punct
\ifLaTeXe
\PackageInfo{frenchb.ldf}{No need for active punctuation characters%
\MessageBreak with this version of XeTeX!%
\MessageBreak reported}
\else
\fb@info{No need for active punctuation characters\\
with this version of XeTeX!}
\fi
% \end{macrocode}
%
% \changes{v2.5i}{2012/04/20}{Temporary fix: as long as
% \file{xeCJK.sty} will not use \cs{newXeTeXintercharclass} to
% allocate its classes, we will have to define 3 fake classes.}
%
% \changes{v2.5j}{2012/05/08}{Previous fix removed: bug fixed in
% \file{xeCJK.sty} version 3.0.4 (06-May-2012).}
%
% \changes{v2.6g}{2013/12/09}{U+00A0 (Unicode nobreakspace) and U+202F
% (Unicode nobreakthinspace) added to class \cs{FB@punctnul}
% to prevent frenchb from adding it's own space before `high
% punctuation' characters.}
%
% \changes{v2.6h}{2014/01/03}{New class \cs{FB@guilnul} for characters
% U+00A0 (Unicode nobreakspace) and U+202F (Unicode
% nobreakthinspace), to prevent frenchb from adding spurious spaces
% inside quotes.}
%
% Six new character classes are defined for \frenchb.
% \begin{macrocode}
\newXeTeXintercharclass\FB@punctthick
\newXeTeXintercharclass\FB@punctthin
\newXeTeXintercharclass\FB@punctnul
\newXeTeXintercharclass\FB@guilo
\newXeTeXintercharclass\FB@guilf
\newXeTeXintercharclass\FB@guilnul
% \end{macrocode}
%
% \changes{v3.1l}{2016/02/07}{Add a variant of \cs{babel@savevariable}
% to save \cs{XeTeXcharclass}(es) in a loop.}
%
% As |\babel@savevariable| doesn't work inside a |\bbl@for| loop,
% we define a variant to save the |\XeTeXcharclass| values which
% will be modified in French.
% \begin{macrocode}
\def\FBsavevariable@loop#1#2{\begingroup
\toks@\expandafter{\originalTeX #1}%
\edef\x{\endgroup
\def\noexpand\originalTeX{\the\toks@ #2=\the#1#2\relax}}%
\x}
% \end{macrocode}
% |\FB@charlist| holds the all list of characters which have their
% |\XeTeXcharclass| value modified in French: the first set includes
% high punctuation, French quotes, opening delimiters and no-break
% spaces \\[5pt]
% \begin{tabular}{*{10}{|c}|}\hline
% "21 &"3A &"3B &"3F &"AB &"BB &"28 &"5B &"A0 &"202F
% \\ \hline
% \char"21 &\char"3A &\char"3B &\char"3F & « & »
% &\char"28 &\char"5B & & \\ \hline
% \end{tabular}\\[5pt]
% the second one holds those which need resetting in French when
% \file{xeCJK.sty} is in use\\[5pt]
% \begin{tabular}{*{12}{|c}|}\hline
% "29 &"5D &"7B &"7D &"2C &"2D &"2E &"22 &"25 &"27 &"60 &"2019
% \\ \hline
% \char"29 &\char"5D &\char"7B &\char"7D &\char"2C &\char"2D
% &\char"2E &\char"22 &\char"25 &\textquotesingle &\char"60
% &\char"27 \\ \hline
% \end{tabular}
%
% \begin{macrocode}
\def\FB@charlist{"21,"3A,"3B,"3F,"AB,"BB,"28,"5B,"A0,"202F,%
"29,"5D,"7B,"7D,"2C,"2D,"2E,"22,"25,"27,"60,"2019}
% \end{macrocode}
%
% \begin{macro}{\FB@xetex@punct@french}
% The following command will be executed when entering French, it
% first saves the values to be modified, then fits them to our
% needs. It also redefines |\shorthandoff| and |\shorthandon|
% (locally) to avoid error messages with XeTeX-based engines.
%
% \changes{v2.5g}{2011/12/31}{XeTeXcharclass(es) for French quotes will
% be set to \cs{FB@guilo} and \cs{FB@guilf} by options
% `og' and `fg' in \cs{frenchbsetup}. French quotes should behave
% as normal characters by default in XeLaTeX as in LaTeX.}
%
% \changes{v2.5i}{2012/04/20}{\file{xeCJK.sty} changes the
% \cs{XeTeXcharclass} of ASCII chars '-' ',' '.' ')' ']' '\}'
% '\{' '\%' opening and closing single and double quotes.
% We set their class to 0 in French and reset their class
% to their original value when leaving French. See
% \cs{FB@xetex@punct@nonfrench} below.}
%
% \changes{v3.1k}{2015/12/05}{Thin glues (less than 1sp) should not
% trigger space insertion before high ponctuation. Add a check on
% \cs{lastkip}.}
%
% \changes{v3.1l}{2016/02/07}{Save and restore
% \cs{XeTeXinterchartokenstate}, \cs{shorthandon}, \cs{shorthandoff}
% using \cs{babel@savevariable} and \cs{babel@save},
% \cs{XeTeXcharclass}(es) using \cs{FB@savevariable@loop}.}
%
% \changes{v3.2c}{2016/05/14}{Switch \cs{ifFB@spacing} added to all
% \cs{XeTeXinterchartoks} commands.}
%
% \begin{macrocode}
\newcommand*{\FB@xetex@punct@french}{%
\babel@savevariable{\XeTeXinterchartokenstate}%
\babel@save{\shorthandon}%
\babel@save{\shorthandoff}%
\bbl@for\FB@char\FB@charlist
{\FBsavevariable@loop{\XeTeXcharclass}{\FB@char}}%
\def\shorthandoff##1{%
\ifx\PackageWarning\@undefined
\fb@warning{\noexpand\shorthandoff{;:!?} is helpless with
XeTeX,\\ use \noexpand\NoAutoSpacing
*inside a group* instead.}%
\else
\PackageWarning{frenchb.ldf}{\protect\shorthandoff{;:!?} is
helpless with XeTeX,\MessageBreak use \protect\NoAutoSpacing
\space *inside a group* instead;\MessageBreak reported}%
\fi}%
\def\shorthandon##1{}%
% \end{macrocode}
% Let's now set the classes and interactions between classes.
% When false, the flag |\ifFB@spacing| switches off any interaction
% between classes (this flag is controlled by user-level command
% |\NoAutoSpacing|; this flag is also set to false when the current
% font is a typewriter font).
% \begin{macrocode}
\XeTeXinterchartokenstate=1
\XeTeXcharclass `\: = \FB@punctthick
\XeTeXinterchartoks \z@ \FB@punctthick = {%
\ifFB@spacing\ifhmode\FDP@colonspace\fi\fi}%
\XeTeXinterchartoks \FB@guilf \FB@punctthick = {%
\ifFB@spacing\FDP@colonspace\fi}%
% \end{macrocode}
% Small glues such as ``glue 1sp'' in tabular `l' columns or ``glue
% 0 plus 1 fil'' in tabular `c' columns or \env{lstlisting}
% environment should not trigger any extra space; they will still do
% when \fbo{AutoSpacePunctuation} is true: unfortunately
% |\XeTeXcharclass=\FB@nonchar| isn't specific to glue tokens (this
% class includes box and math boundaries f.i.), so the |\else| part
% cannot be omitted.
% \begin{macrocode}
\XeTeXinterchartoks \FB@nonchar \FB@punctthick = {%
\ifFB@spacing
\ifhmode
\ifdim\lastskip>1sp
\unskip\penalty\@M\FBcolonspace
\else
\FDP@colonspace
\fi
\fi
\fi}%
\bbl@for\FB@char
{`\;,`\!,`\?}%
{\XeTeXcharclass\FB@char=\FB@punctthin}%
\XeTeXinterchartoks \z@ \FB@punctthin = {%
\ifFB@spacing\ifhmode\FDP@thinspace\fi\fi}%
\XeTeXinterchartoks \FB@guilf \FB@punctthin = {%
\ifFB@spacing\FDP@thinspace\fi}%
\XeTeXinterchartoks \FB@nonchar \FB@punctthin = {%
\ifFB@spacing
\ifhmode
\ifdim\lastskip>1sp
\unskip\penalty\@M\FBthinspace
\else
\FDP@thinspace
\fi
\fi
\fi}%
\XeTeXinterchartoks \FB@guilo \z@ = {%
\ifFB@spacing\FBguillspace\fi}%
\XeTeXinterchartoks \FB@guilo \FB@nonchar = {%
\ifFB@spacing\FBguillspace\ignorespaces\fi}%
\XeTeXinterchartoks \z@ \FB@guilf = {%
\ifFB@spacing\FBguillspace\fi}%
\XeTeXinterchartoks \FB@punctthin \FB@guilf = {%
\ifFB@spacing\FBguillspace\fi}%
\XeTeXinterchartoks \FB@nonchar \FB@guilf = {%
\ifFB@spacing\unskip\FBguillspace\fi}%
% \end{macrocode}
% This will avoid spurious spaces in (!), [?] and with Unicode
% nobreakspaces (U+00A0, U+202F):
% \begin{macrocode}
\bbl@for\FB@char
{`\[,`\(,"A0,"202F}%
{\XeTeXcharclass\FB@char=\FB@punctnul}%
% \end{macrocode}
% These characters have their class changed by \file{xeCJK.sty},
% let's reset them to 0 in French.
% \begin{macrocode}
\bbl@for\FB@char
{`\{,`\,,`\.,`\-,`\),`\],`\},`\%,"22,"27,"60,"2019}%
{\XeTeXcharclass\FB@char=\z@}%
}
\FB@addto{extras}{\FB@xetex@punct@french}
% \end{macrocode}
% \end{macro}
%
% End of specific code for punctuation with modern XeTeX engines.
% \begin{macrocode}
\fi
% \end{macrocode}
%
% \subsubsection{Punctuation with standard (pdf)TeX}
% \label{sssec-punct-tex}
%
% In standard (pdf)TeX we need to make the four characters |;| |!| |?|
% and |:| `active' and provide their definitions.
% \begin{macrocode}
\ifFB@active@punct
\initiate@active@char{:}%
\initiate@active@char{;}%
\initiate@active@char{!}%
\initiate@active@char{?}%
% \end{macrocode}
% We first tune the amount of space before \texttt{;}
% \texttt{!} \texttt{?} and \texttt{:}. This should only happen
% in horizontal mode, hence the test |\ifhmode|.
%
% In horizontal mode, if a space has been typed before `;' we
% remove it and put an unbreakable |\FBthinspace| instead. If no
% space has been typed, we add |\FDP@thinspace| which will be
% defined, up to the user's wishes, as |\FBthinspace|, or as
% |\@empty|.
%
% \changes{v3.1k}{2015/12/05}{(pdfTeX shorthands) test on \cs{lastskip}
% changed from 0pt to 1sp for active punctuation for consistency
% with XeTeX and LuaTeX.}
%
% \changes{v3.2c}{2016/05/14}{Switch \cs{ifFB@spacing} added to the
% four French shorthands.}
%
% \begin{macrocode}
\declare@shorthand{french}{;}{%
\ifFB@spacing
\ifhmode
\ifdim\lastskip>1sp
\unskip\penalty\@M\FBthinspace
\else
\FDP@thinspace
\fi
\fi
\fi
% \end{macrocode}
% Now we can insert a |;| character.
% \begin{macrocode}
\string;}
% \end{macrocode}
% The next three definitions are very similar.
% \begin{macrocode}
\declare@shorthand{french}{!}{%
\ifFB@spacing
\ifhmode
\ifdim\lastskip>1sp
\unskip\penalty\@M\FBthinspace
\else
\FDP@thinspace
\fi
\fi
\fi
\string!}
\declare@shorthand{french}{?}{%
\ifFB@spacing
\ifhmode
\ifdim\lastskip>1sp
\unskip\penalty\@M\FBthinspace
\else
\FDP@thinspace
\fi
\fi
\fi
\string?}
\declare@shorthand{french}{:}{%
\ifFB@spacing
\ifhmode
\ifdim\lastskip>1sp
\unskip\penalty\@M\FBcolonspace
\else
\FDP@colonspace
\fi
\fi
\fi
\string:}
% \end{macrocode}
% When the active characters appear in an environment where their
% French behaviour is not wanted they should give an `expected'
% result. Therefore we define shorthands at system level as well.
% \begin{macrocode}
\declare@shorthand{system}{:}{\string:}
\declare@shorthand{system}{!}{\string!}
\declare@shorthand{system}{?}{\string?}
\declare@shorthand{system}{;}{\string;}
%}
% \end{macrocode}
% We specify that the French group of shorthands should be used when
% switching to French.
% \begin{macrocode}
\FB@addto{extras}{\languageshorthands{french}%
% \end{macrocode}
% These characters are `turned on' once, later their definition may
% vary. Don't misunderstand the following code: they keep being
% active all along the document, even when leaving French.
% \begin{macrocode}
\bbl@activate{:}\bbl@activate{;}%
\bbl@activate{!}\bbl@activate{?}%
}
\FB@addto{noextras}{%
\bbl@deactivate{:}\bbl@deactivate{;}%
\bbl@deactivate{!}\bbl@deactivate{?}%
}
\fi
% \end{macrocode}
%
% \subsubsection{Punctuation switches common to all engines}
% \label{sssec-punct-switches}
%
% A new `if' |\ifFBAutoSpacePunctuation| needs to be defined now to
% control the two possible ways of dealing with `high punctuation'.
% it's default value is true, but it can be set to false by
% \fbsetup{AutoSpacePunctuation=false} for finer control.
% \begin{macrocode}
\newif\ifFBAutoSpacePunctuation \FBAutoSpacePunctuationtrue
% \end{macrocode}
%
% \begin{macro}{\AutoSpaceBeforeFDP}
% \begin{macro}{\NoAutoSpaceBeforeFDP}
%
% \changes{v2.3a}{2008/10/10}{\cs{NoAutoSpaceBeforeFDP} and
% \cs{AutoSpaceBeforeFDP} now set the flag
% \cs{ifFBAutoSpacePunctuation} accordingly (LaTeX only).}
%
% \changes{v2.3e}{2009/10/10}{Execute \cs{AutoSpaceBeforeFDP}
% also in LaTeX to define \cs{FDP@colonspace}: needed for
% tex4ht, pointed out by MPG.}
%
% |\autospace@beforeFDP| and |\noautospace@beforeFDP| are internal
% commands. |\autospace@beforeFDP| defines |\FDP@thinspace| and
% |\FDP@colonspace| as unbreakable spaces and sets LuaTeX attribute
% |\FB@addDPspace| to 1 (true), while |\noautospace@beforeFDP|
% lets these spaces empty and sets flag |\FB@addDPspace|
% to 0 (false). User commands |\AutoSpaceBeforeFDP| and
% |\NoAutoSpaceBeforeFDP| do the same and take care of the flag
% |\ifFBAutoSpacePunctuation| in \LaTeX{}.
% Set the default now for Plain (done later for \LaTeX).
% \begin{macrocode}
\def\autospace@beforeFDP{%
\ifFB@luatex@punct\FB@addDPspace=1 \fi
\def\FDP@thinspace{\penalty\@M\FBthinspace}%
\def\FDP@colonspace{\penalty\@M\FBcolonspace}}
\def\noautospace@beforeFDP{%
\ifFB@luatex@punct\FB@addDPspace=0 \fi
\let\FDP@thinspace\@empty
\let\FDP@colonspace\@empty}
\ifLaTeXe
\def\AutoSpaceBeforeFDP{\autospace@beforeFDP
\FBAutoSpacePunctuationtrue}
\def\NoAutoSpaceBeforeFDP{\noautospace@beforeFDP
\FBAutoSpacePunctuationfalse}
\AtEndOfPackage{\AutoSpaceBeforeFDP}
\else
\let\AutoSpaceBeforeFDP\autospace@beforeFDP
\let\NoAutoSpaceBeforeFDP\noautospace@beforeFDP
\AutoSpaceBeforeFDP
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{v2.3a}{2008/10/10}{In LaTeX, frenchb no longer adds spaces
% before `high punctuation' characters in computer code.
% Suggested by Yannis Haralambous.}
%
% \begin{macro}{\rmfamilyFB}
% \begin{macro}{\sffamilyFB}
% \begin{macro}{\ttfamilyFB}
%
% \changes{v2.3c}{2009/02/07}{Commands \cs{ttfamily}, \cs{rmfamily}
% and \cs{sffamily} have to be robust. Bug introduced in 2.3a,
% pointed out by Manuel Pégourié-Gonnard.}
%
% In \LaTeXe{} |\ttfamily| (and hence |\texttt|) will be redefined
% `AtBeginDocument' as |\ttfamilyFB| so that no space
% is added before the four |; : ! ?| characters, even if
% \fbo{AutoSpacePunctuation} is \fbo{true}. When
% \fbo{AutoSpacePunctuation} is \fbo{false}, the eventually typed
% spaces are left unchanged (not turned into thinspaces, no penalty
% added). |\rmfamily| and |\sffamily| need to be redefined also
% (|\ttfamily| is not always used inside a group, its effect can be
% cancelled by |\rmfamily| or |\sffamily|).
%
% These redefinitions can be canceled if necessary, for instance to
% recompile older documents, see option \fbo{OriginalTypewriter}
% below.
%
% \changes{v2.4c}{2010/05/23}{In \cs{ttfamilyFB}, also cancel
% automatic spaces inside French guillemets entered as characters
% (see \cs{frenchbsetup}).}
%
% \changes{v3.2c}{2016/05/14}{New definitions of \cs{ttfamilyFB} and
% co, common to all engines, based on \cs{FB@spacing@off}
% and\cs{FB@spacing@on}.}
%
% To be consistent with what is done for the |; : ! ?|
% characters, |\ttfamilyFB| also switches off insertion of spaces
% inside French guillemets \emph{when they are typed in as
% characters} with the `og'/`fg' options in \fbsetup{}.
% This is also a workaround for the weird behaviour of these
% characters in verbatim mode.
%
% \begin{macrocode}
\ifLaTeXe
\DeclareRobustCommand\ttfamilyFB{\FB@spacing@off \ttfamilyORI}
\DeclareRobustCommand\rmfamilyFB{\FB@spacing@on \rmfamilyORI}
\DeclareRobustCommand\sffamilyFB{\FB@spacing@on \sffamilyORI}
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \changes{v2.5a}{2010/08/14}{New command \cs{NoAutoSpacing},
% suggested by MPG.}
%
% \begin{macro}{\NoAutoSpacing}
% The following command disables automatic spacing for high
% punctuation and French quote characters; it also switches off
% active punctuation characters (if any).
% It is engine independent (works for TeX, LuaTeX and
% XeTeX based engines) and is meant to be used inside a group.
%
% \changes{v3.2b}{2016/04/18}{\cs{NoAutoSpacing} made robust.}
%
% \changes{v3.2c}{2016/05/14}{New definition based on
% \cs{FB@spacing@off} common to all engines.}
%
% \begin{macrocode}
\DeclareRobustCommand*{\NoAutoSpacing}{%
\FB@spacing@off
\ifFB@active@punct\shorthandoff{;:!?}\fi
}
% \end{macrocode}
% \end{macro}
%
% \subsection{Commands for French quotation marks}
% \label{ssec-quotes}
%
% \begin{macro}{\guillemotleft}
% \begin{macro}{\guillemotright}
% \begin{macro}{\textquoteddblleft}
% \begin{macro}{\textquoteddblright}
% \LaTeX{} users are supposed to use 8-bit output encodings (T1,
% LY1,\dots) to typeset French, those who still stick to OT1 should
% call \pkg{aeguill} or a similar package. In both cases the
% commands |\guillemotleft| and |\guillemotright| will print the
% French opening and closing quote characters from the output font.
% For XeLaTeX and LuaLaTeX, |\guillemotleft| and |\guillemotright|
% are defined by package \pkg{xunicode} loaded by \pkg{fontspec}.
%
% \changes{v2.5a}{2010/08/20}{Change \cs{guillemotleft} and
% \cs{guillemotright} definitions for Unicode anf provide
% definitions for \cs{textquotedblleft} and
% \cs{textquotedbright}. Insures correct printing of quotes
% by \cs{og} and \cs{fg} in French and outside.}
%
% We provide the following definitions for non-LaTeX users only as
% fall-back, they are welcome to change them for anything better.
% \begin{macrocode}
\ifLaTeXe
\else
\ifFBunicode
\def\guillemotleft{{\char"00AB}}
\def\guillemotright{{\char"00BB}}
\def\textquotedblleft{{\char"201C}}
\def\textquotedblright{{\char"201D}}
\else
\def\guillemotleft{\leavevmode\raise0.25ex
\hbox{$\scriptscriptstyle\ll$}}
\def\guillemotright{\raise0.25ex
\hbox{$\scriptscriptstyle\gg$}}
\def\textquotedblleft{``}
\def\textquotedblright{''}
\fi
\let\xspace\relax
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\FB@og}
% \begin{macro}{\FB@fg}
% The next step is to provide correct spacing after |\guillemotleft|
% and before |\guillemotright|: a space precedes and follows
% quotation marks but no line break is allowed neither \emph{after}
% the opening one, nor \emph{before} the closing one.
% |\FBguillspace| which does the spacing, has been fine tuned by
% Thierry Bouche to 80\% of an inter-word space but with reduced
% stretchability. French quotes (including spacing) are printed by
% |\FB@og| and |\FB@fg|, the expansion of the top level commands
% |\og| and |\og| is different in and outside French.
%
% \changes{v3.0a}{2014/01/10}{Definitions of \cs{FB@og} and \cs{FB@fg}
% now depend on punctuation handling (LuaTeX / XeTeX / active).}
%
% \changes{v3.0a}{2014/01/10}{Added explicit \cs{FBguillskip}
% for LuaTeX.}
%
% \changes{v3.0c}{2014/04/18}{Changed \cs{FBguill@spacing} (internal)
% to \cs{FBguillspace} (public).}
%
% LuaTeX which requires skips; |\FBguillskip| is computed from
% |\FBguillspace| for the |lmr10| font, its dimensions will
% be scaled by \file{frenchb.lua} for the current font and used
% after `«' and before `»' when option \fbo{og=«, fg=»} is set.
% \begin{macrocode}
\newskip\FBguillskip
\FBguillskip=2.664pt plus 0.500pt minus 0.888pt \relax
\newcommand*{\FBguillspace}{\penalty\@M\hskip.8\fontdimen2\font
plus.3\fontdimen3\font
minus.8\fontdimen4\font}
% \end{macrocode}
% For efficiency reasons, |\FB@og| and |\FB@fg| relie on
% |\FBguillspace| with LuaTeX engines (|\FB@spacing| is set
% to~0 locally).
% \begin{macrocode}
\ifFB@luatex@punct
\DeclareRobustCommand*{\FB@og}{\leavevmode
\bgroup\FB@spacing=0 \guillemotleft\egroup
\FBguillspace}
\DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
\FBguillspace
\bgroup\FB@spacing=0 \guillemotright\egroup}
\fi
% \end{macrocode}
% With XeTeX, |\ifFB@spacing| is set to |false| locally to
% prevent the quotes characters from adding space when option
% \fbo{og=«, fg=»} is set.
% characters.
% \begin{macrocode}
\ifFB@xetex@punct
\DeclareRobustCommand*{\FB@og}{\leavevmode
\bgroup\FB@spacingfalse\guillemotleft\egroup
\FBguillspace}
\DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
\FBguillspace
\bgroup\FB@spacingfalse\guillemotright\egroup}
\fi
\ifFB@active@punct
\DeclareRobustCommand*{\FB@og}{\leavevmode
\guillemotleft
\FBguillspace}
\DeclareRobustCommand*{\FB@fg}{\ifdim\lastskip>\z@\unskip\fi
\FBguillspace
\guillemotright}
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\og}
% \begin{macro}{\fg}
%
% The user level macros for quotation marks are named |\og|
% (``\underline{o}uvrez \underline{g}uillemets'') and |\fg|
% (``\underline{f}ermez \underline{g}uillemets'').
% Another option for typesetting quotes in French is to use the
% command |\frquote| (see below).
% Dummy definition of |\og| and |\fg| just to ensure that this
% commands are not yet defined.
% \begin{macrocode}
\newcommand*{\og}{\@empty}
\newcommand*{\fg}{\@empty}
% \end{macrocode}
%
% The definitions of |\og| and |\fg| for quotation marks are
% switched on and off through the |\extrasfrench| |\noextrasfrench|
% mechanism. Outside French, |\og| and |\fg| will typeset standard
% English opening and closing double quotes.
% We'll try to be smart to users of David~Carlisle's \pkg{xspace}
% package: if this package is loaded there will be no need for |{}|
% or |\ | to get a space after |\fg|, otherwise |\xspace| will be
% defined as |\relax| (done at the end of this file).
%
% \changes{v2.5a}{2010/08/20}{\cs{og} and \cs{fg} do not print
% correctly in English when using XeTeX or LuaTeX, fixed by using
% \cs{textquotedblleft} and \cs{textquotedblright} defined above.}
%
% \changes{v3.2a}{2016/03/18}{\cs{xspace} moved from \cs{FB@fg} to
% \cs{fg}: \cs{xspace} messes up \cs{frquote}, pointed out by Sonia
% Labetoulle. As a side effect \cs{xspace} is now active in \cs{fg}
% in and outside French.}
%
% \begin{macrocode}
\ifLaTeXe
\def\bbl@frenchguillemets{\renewcommand*{\og}{\FB@og}%
\renewcommand*{\fg}{\FB@fg\xspace}}
\renewcommand*{\og}{\textquotedblleft}
\renewcommand*{\fg}{\ifdim\lastskip>\z@\unskip\fi
\textquotedblright\xspace}
\else
\def\bbl@frenchguillemets{\let\og\FB@og
\let\fg\FB@fg}
\def\og{\textquotedblleft}
\def\fg{\ifdim\lastskip>\z@\unskip\fi\textquotedblright}
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{v3.0a}{2014/01/10}{\cs{bbl@nonfrenchguillemets} deleted,
% use \cs{babel@save} instead.}
%
% \begin{macrocode}
\FB@addto{extras}{\babel@save\og \babel@save\fg \bbl@frenchguillemets}
% \end{macrocode}
%
% \changes{v3.1a}{2014/05/20}{New command \cs{frquote} for imbedded or
% long French quotations.}
%
% \begin{macro}{\frquote}
% Maximum two levels are supported by |\frquote{}|.
% Let's define the default quote characters to be used for level one
% or two of quotes\dots{}
% \begin{macrocode}
\newcommand*{\ogi}{\FB@og}
\newcommand*{\fgi}{\FB@fg}
\newcommand*{\ogii}{\textquotedblleft}
\newcommand*{\fgii}{\textquotedblright}
% \end{macrocode}
% and the needed technical stuff to handle options:
% \begin{macrocode}
\newcount\FBguill@level
\newtoks\FB@everypar
\newif\ifFBcloseguill \FBcloseguilltrue
\newif\ifFBInnerGuillSingle
\def\FBguillopen{\bgroup\NoAutoSpacing\guillemotleft\egroup}
\def\FBguillclose{\bgroup\NoAutoSpacing\guillemotright\egroup}
\let\FBguillnone\relax
\let\FBeveryparguill\FBguillopen
\ifFB@luatex@punct
\let\FBeverylineguill\FBguillopen
\else
\let\FBeverylineguill\FBguillnone
\fi
% \end{macrocode}
% The main command |\frquote| accepts (in \LaTeXe{} only) a starred
% version which suppresses the closing quote; it is meant to be used
% for inner quotations which end together with the outer one, then
% only one closing guillemet (the outer one) should be printed.
% \begin{macrocode}
\ifLaTeXe
\DeclareRobustCommand\frquote{%
\@ifstar{\FBcloseguillfalse\fr@quote}%
{\FBcloseguilltrue\fr@quote}}
\else
\newcommand\frquote[1]{\fr@quote{#1}}
\fi
% \end{macrocode}
%
% \changes{v3.1j}{2015/11/25}{\cs{fr@quote} completely rewritten:
% \cs{leavevmode} added and explicitly save/retore \cs{everypar} and
% \cs{localleftbox} instead of using a group in order to ensure
% compatibility with package wrapfig.}
%
% \changes{v3.1j}{2015/11/21}{\cs{PackageWarning} is undefined in
% Plain, use \cs{fb@warning} instead.}
%
% The internal command |\fr@quote| takes one (long) argument: the
% quotation text.
% \begin{macrocode}
\newcommand{\fr@quote}[1]{%
\leavevmode
\advance\FBguill@level by \@ne
% \end{macrocode}
% Kern used inside French quotes; must match the fixed part of
% |\FBguillspace|.
% \begin{macrocode}
\def\FB@quotespace{\kern.8\fontdimen2\font}%
\ifcase\FBguill@level
\or
% \end{macrocode}
% This for level 1 (outer) quotations: save |\everypar| before
% customising it, set |\FBeverypar@quote| for level 1 quotations
% and add it to |\everypar|, then print the quotation:
% \begin{macrocode}
\FB@everypar=\everypar
\ifx\FBeveryparguill\relax
\else
\def\FBeverypar@quote{\FBeveryparguill\FB@quotespace}%
\everypar=\expandafter{\the\everypar \FBeverypar@quote}%
\fi
\ogi #1\fgi
\or
% \end{macrocode}
% This for level 2 (inner) quotations: Omega's command
% |\localleftbox| included in LuaTeX, formerly named
% |\luatexlocalleftbox|, is convenient for repeating guillemets
% at the beginning of every line.\label{cs:localleftbox}
%
% \changes{v3.1i}{2015/10/04}{\cs{luatexlocalleftbox} changed to
% \cs{localleftbox} by new LaTeX release 2015/10/01.}
%
% \begin{macrocode}
\ifx\FBeverylineguill\FBguillopen
\localleftbox{\guillemotleft\FB@quotespace}%
\let\FBeverypar@quote\relax
\ogi #1\ifFBcloseguill\fgi\fi
\else
\ifx\FBeverylineguill\FBguillclose
\localleftbox{\guillemotright\FB@quotespace}%
\let\FBeverypar@quote\relax
\ogi #1\ifFBcloseguill\fgi\fi
\else
% \end{macrocode}
% otherwise we need to redefine |\FBeverypar@quote| (and eventually
% |\ogii|, |\fgii|) for level 2 quotations:
% \begin{macrocode}
\let\FBeverypar@quote\relax
\ifFBInnerGuillSingle
\def\ogii{\leavevmode
\guilsinglleft\FBguillspace}%
\def\fgii{\ifdim\lastskip>\z@\unskip\fi
\FBguillspace\guilsinglright}%
\ifx\FBeveryparguill\FBguillopen
\def\FBeverypar@quote{\guilsinglleft\FB@quotespace}%
\fi
\ifx\FBeveryparguill\FBguillclose
\def\FBeverypar@quote{\guilsinglright\FB@quotespace}%
\fi
\fi
\ogii #1\ifFBcloseguill \fgii \fi
\fi
\fi
\else
% \end{macrocode}
% Warn if |\FBguill@level| $\ge 3$:
% \begin{macrocode}
\ifx\PackageWarning\@undefined
\fb@warning{\noexpand\frquote\space accepts no more than
two levels.\\ Quotation not printed.}%
\else
\PackageWarning{frenchb.ldf}{%
\protect\frquote\space accepts no more than two levels
\MessageBreak Quotation not printed. Reported}
\fi
\fi
% \end{macrocode}
% Clean on exit: adjust |\FBguill@level| and restore
% |\localleftbox| and |\everypar|.
% \begin{macrocode}
\advance\FBguill@level by \m@ne
\ifx\FBeverylineguill\FBguillnone\else\localleftbox{}\fi
\ifx\FBeveryparguill\relax\else\everypar=\FB@everypar\fi
}
% \end{macrocode}
% \end{macro}
%
% \subsection{Date in French}
% \label{sssec-date}
%
% \begin{macro}{\datefrench}
% The macro |\datefrench| redefines the command |\today| to
% produce French dates. This new implementation requires \babel~3.9i
% or newer but, as of 3.9k, doesn't work with Plain based formats,
% so |\date\CurrentOption| is defined the old way for these formats.
%
% \changes{v2.0}{2006/11/06}{2 '\cs{relax}' added in
% \cs{today}'s definition.}
%
% \changes{v2.1a}{2008/03/25}{\cs{today} changed (correction in 2.0
% was wrong: \cs{today} was printed without spaces in toc).}
%
% \changes{v3.0a}{2014/02/18}{Take advantage of babel's \cs{SetString}
% commands for \cs{datefrench}. Doesn't work with Plain (yet?).}
%
% \changes{v3.0c}{2014/03/26}{\cs{SetString} still does not work for
% Plain with babel 3.9k. Need to define \cs{datefrench}.}
%
% \begin{macrocode}
\ifLaTeXe
\def\BabelLanguages{french,acadian}
\StartBabelCommands*{\BabelLanguages}{date}
[unicode, fontenc=EU1 EU2, charset=utf8]
\SetString\monthiiname{février}
\SetString\monthviiiname{août}
\SetString\monthxiiname{décembre}
\StartBabelCommands*{\BabelLanguages}{date}
\SetStringLoop{month#1name}{%
janvier,f\'evrier,mars,avril,mai,juin,juillet,%
ao\^ut,septembre,octobre,novembre,d\'ecembre}
\SetString\today{{\number\day}\ifnum1=\day {\ier}\fi\space
\csname month\romannumeral\month name\endcsname \space
\number\year
}
\EndBabelCommands
\else
\ifFBunicode
\@namedef{date\CurrentOption}{%
\def\today{{\number\day}\ifnum1=\day {\ier}\fi \space
\ifcase\month
\or janvier\or février\or mars\or avril\or mai\or
juin\or juillet\or août\or septembre\or
octobre\or novembre\or décembre\fi
\space \number\year}}
\else
\@namedef{date\CurrentOption}{%
\def\today{{\number\day}\ifnum1=\day {\ier}\fi \space
\ifcase\month
\or janvier\or f\'evrier\or mars\or avril\or mai\or
juin\or juillet\or ao\^ut\or septembre\or
octobre\or novembre\or d\'ecembre\fi
\space \number\year}}
\fi
\fi
% \end{macrocode}
% \end{macro}
%
% \subsection{Extra utilities}
%
% Let's provide the French user with some extra utilities.
%
% \changes{v2.1a}{2008/03/24}{Command \cs{fup} added to produce
% better superscripts than \cs{textsuperscript}.}
%
% \begin{macro}{\up}
%
% \changes{v2.1c}{2008/04/29}{Provide a temporary definition
% (hyperref safe) of \cs{up} in case it has to be expanded in
% the preamble (by beamer's \cs{title} command for instance).}
%
% \changes{v2.4d}{2010/07/28}{Command \cs{up} defined with
% \cs{providecommand} instead of \cs{newcommand} as \cs{up} may be
% defined elsewhere (catalan.ldf).
% Bug pointed out by Felip Manyé i Ballester.}
%
% \begin{macro}{\fup}
%
% \changes{v2.1b}{2008/04/02}{Command \cs{fup} changed to use
% real superscripts from fourier v.~1.6.}
%
% \changes{v2.2a}{2008/05/08}{\cs{newif} and \cs{newdimen} moved
% before \cs{ifLaTeXe} to avoid an error with plainTeX.}
%
% \changes{v2.3a}{2008/09/30}{\cs{lowercase} changed to
% \cs{MakeLowercase} as the former doesn't work for non ASCII
% characters in encodings like applemac, utf-8,\dots}
%
% |\up| eases the typesetting of superscripts like
% `1\textsuperscript{er}'. Up to version 2.0 of \frenchb{} |\up|
% was just a shortcut for |\textsuperscript| in \LaTeXe, but several
% users complained that |\textsuperscript| typesets superscripts
% too high and too big, so we now define |\fup| as an attempt to
% produce better looking superscripts. |\up| is defined as |\fup|
% but \fbsetup{FrenchSuperscripts=false} redefines |\up|
% as |\textsuperscript| for compatibility with previous versions.
%
% When a font has built-in superscripts, the best thing to do is
% to just use them, otherwise |\fup| has to simulate superscripts
% by scaling and raising ordinary letters. Scaling is done using
% package \pkg{scalefnt} which will be loaded at the end of
% \babel's loading (\frenchb{} being an option of \babel, it cannot
% load a package while being read).
%
% \begin{macrocode}
\newif\ifFB@poorman
\newdimen\FB@Mht
\ifLaTeXe
\AtEndOfPackage{\RequirePackage{scalefnt}}
% \end{macrocode}
% |\FB@up@fake| holds the definition of fake superscripts.
% The scaling ratio is 0.65, raising is computed to put the top of
% lower case letters (like `m') just under the top of upper case
% letters (like `M'), precisely 12\% down. The chosen settings
% look correct for most fonts, but can be tuned by the end-user
% if necessary by changing |\FBsupR| and |\FBsupS| commands.
%
% |\FB@lc| is defined as |\MakeLowercase| to inhibit the uppercasing
% of superscripts (this may happen in page headers with the standard
% classes but is wrong); |\FB@lc| can be redefined to do nothing
% by option \fbo{LowercaseSuperscripts=false} of \fbsetup{}.
% \begin{macrocode}
\newcommand*{\FBsupR}{-0.12}
\newcommand*{\FBsupS}{0.65}
\newcommand*{\FB@lc}[1]{\MakeLowercase{#1}}
\DeclareRobustCommand*{\FB@up@fake}[1]{%
\settoheight{\FB@Mht}{M}%
\addtolength{\FB@Mht}{\FBsupR \FB@Mht}%
\addtolength{\FB@Mht}{-\FBsupS ex}%
\raisebox{\FB@Mht}{\scalefont{\FBsupS}{\FB@lc{#1}}}%
}
% \end{macrocode}
% The only packages I currently know to take advantage of real
% superscripts are a) \pkg{realscripts} used in conjunction with
% XeLaTeX or LuaLaTeX and OpenType fonts having the font feature
% 'VerticalPosition=Superior' and b) \pkg{fourier}
% (from version 1.6) when Expert Utopia fonts are available.
%
% |\FB@up| checks whether the current font is a Type1 `Expert'
% (or `Pro') font with real superscripts or not (the code works
% currently only with \file{fourier-1.6} but could work with any
% Expert Type1 font with built-in superscripts, see below), and
% decides to use real or fake superscripts.
% It works as follows: the content of |\f@family| (family name of
% the current font) is split by |\FB@split| into two pieces, the
% first three characters (`|fut|' for Fourier, `|ppl|' for Adobe's
% Palatino, \dots) stored in |\FB@firstthree| and the rest stored
% in |\FB@suffix| which is expected to be `|x|' or `|j|' for expert
% fonts.
% \begin{macrocode}
\def\FB@split#1#2#3#4\@nil{\def\FB@firstthree{#1#2#3}%
\def\FB@suffix{#4}}
\def\FB@x{x}
\def\FB@j{j}
\DeclareRobustCommand*{\FB@up}[1]{%
\bgroup \FB@poormantrue
\expandafter\FB@split\f@family\@nil
% \end{macrocode}
% Then |\FB@up| looks for a \file{.fd} file named \file{t1fut-sup.fd}
% (Fourier) or \file{t1ppl-sup.fd} (Palatino), etc.\ supposed to
% define the subfamily (|fut-sup| or |ppl-sup|, etc.) giving access
% to the built-in superscripts. If the \file{.fd} file is not found
% by |\IfFileExists|, |\FB@up| falls back on fake superscripts,
% otherwise |\FB@suffix| is checked to decide whether to use fake or
% real superscripts.
% \begin{macrocode}
\edef\reserved@a{\lowercase{%
\noexpand\IfFileExists{\f@encoding\FB@firstthree -sup.fd}}}%
\reserved@a
{\ifx\FB@suffix\FB@x \FB@poormanfalse\fi
\ifx\FB@suffix\FB@j \FB@poormanfalse\fi
\ifFB@poorman \FB@up@fake{#1}%
\else \FB@up@real{#1}%
\fi}%
{\FB@up@fake{#1}}%
\egroup}
% \end{macrocode}
% |\FB@up@real| just picks up the superscripts from the subfamily
% (and forces lowercase).
% \begin{macrocode}
\newcommand*{\FB@up@real}[1]{\bgroup
\fontfamily{\FB@firstthree -sup}\selectfont \FB@lc{#1}\egroup}
% \end{macrocode}
% |\fup| is defined as |\FB@up| unless |\realsuperscript| is
% defined by \file{realscripts.sty}.
% \begin{macrocode}
\DeclareRobustCommand*{\fup}[1]{%
\ifx\realsuperscript\@undefined
\FB@up{#1}%
\else
\bgroup\let\fakesuperscript\FB@up@fake
\realsuperscript{\FB@lc{#1}}\egroup
\fi}
% \end{macrocode}
% Let's provide a temporary definition for |\up| (redefined
% `AtBeginDocument' as |\fup| or |\textsuperscript| according to
% \fbsetup{} options).
% \begin{macrocode}
\providecommand*{\up}{\relax}
% \end{macrocode}
% Poor man's definition of |\up| for Plain.
% \begin{macrocode}
\else
\providecommand*{\up}[1]{\leavevmode\raise1ex\hbox{\sevenrm #1}}
\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ieme}
% \begin{macro}{\ier}
% \begin{macro}{\iere}
% \begin{macro}{\iemes}
% \begin{macro}{\iers}
% \begin{macro}{\ieres}
% \changes{v3.1b}{2014/06/23}{Removed \cs{lowercase} from definitions
% of \cs{ieme} and co: \cs{up} already does the conversion.}
%
% Some handy macros for those who don't know how to abbreviate
% ordinals:
% \begin{macrocode}
\def\ieme{\up{e}\xspace}
\def\iemes{\up{es}\xspace}
\def\ier{\up{er}\xspace}
\def\iers{\up{ers}\xspace}
\def\iere{\up{re}\xspace}
\def\ieres{\up{res}\xspace}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \changes{v2.1c}{2008/04/29}{Added commands \cs{Nos} and \cs{nos}.}
%
% \begin{macro}{\No}
% \begin{macro}{\no}
% \begin{macro}{\Nos}
% \begin{macro}{\nos}
% \begin{macro}{\primo}
% \begin{macro}{\fprimo)}
% \changes{v3.1b}{2014/06/23}{Removed \cs{lowercase} from definitions
% of \cs{FrenchEnumerate}, \dots{} \cs{No} and co: \cs{up} already
% does the conversion.}
%
% And some more macros relying on |\up| for numbering,
% first two support macros.
% \begin{macrocode}
\newcommand*{\FrenchEnumerate}[1]{%
#1\up{o}\kern+.3em}
\newcommand*{\FrenchPopularEnumerate}[1]{%
#1\up{o})\kern+.3em}
% \end{macrocode}
%
% Typing |\primo| should result in `$1^{\rm o}$\kern+.3em',
% \begin{macrocode}
\def\primo{\FrenchEnumerate1}
\def\secundo{\FrenchEnumerate2}
\def\tertio{\FrenchEnumerate3}
\def\quarto{\FrenchEnumerate4}
% \end{macrocode}
% while typing |\fprimo)| gives `1$^{\rm o}$)\kern+.3em.
% \begin{macrocode}
\def\fprimo){\FrenchPopularEnumerate1}
\def\fsecundo){\FrenchPopularEnumerate2}
\def\ftertio){\FrenchPopularEnumerate3}
\def\fquarto){\FrenchPopularEnumerate4}
% \end{macrocode}
%
% Let's provide four macros for the common abbreviations
% of ``Numéro''.
% \begin{macrocode}
\DeclareRobustCommand*{\No}{N\up{o}\kern+.2em}
\DeclareRobustCommand*{\no}{n\up{o}\kern+.2em}
\DeclareRobustCommand*{\Nos}{N\up{os}\kern+.2em}
\DeclareRobustCommand*{\nos}{n\up{os}\kern+.2em}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\bsc}
% As family names should be written in small capitals and never be
% hyphenated, we provide a command (its name comes from Boxed Small
% Caps) to input them easily. Note that this command has changed
% with version~2 of \frenchb: a |\kern0pt| is used instead of |\hbox|
% because |\hbox| would break microtype's font expansion; as a
% (positive?) side effect, composed names (such as Dupont-Durand)
% can now be hyphenated on explicit hyphens.
% Usage: |Jean~\bsc{Duchemin}|.
%
% \changes{v2.0}{2006/11/06}{\cs{hbox} dropped, replaced by
% \cs{kern0pt}.}
%
% \begin{macrocode}
\DeclareRobustCommand*{\bsc}[1]{\leavevmode\begingroup\kern0pt
\scshape #1\endgroup}
\ifLaTeXe\else\let\scshape\relax\fi
% \end{macrocode}
% \end{macro}
%
% Some definitions for special characters. We won't define |\tilde|
% as a Text Symbol not to conflict with the macro |\tilde| for math
% mode and use the name |\tild| instead. Note that |\boi| may
% \emph{not} be used in math mode, its name in math mode is
% |\backslash|. |\degre| can be accessed by the command |\r{}|
% for ring accent.
%
% \changes{v2.5f}{2011/07/18}{Changed definitions of \cs{at},
% \cs{circonflexe}, \cs{tild}, \cs{boi} and \cs{degre} for
% Unicode based engines.}
%
% \begin{macrocode}
\ifFBunicode
\newcommand*{\at}{{\char"0040}}
\newcommand*{\circonflexe}{{\char"005E}}
\newcommand*{\tild}{{\char"007E}}
\newcommand*{\boi}{\textbackslash}
\newcommand*{\degre}{{\char"00B0}}
\else
\ifLaTeXe
\DeclareTextSymbol{\at}{T1}{64}
\DeclareTextSymbol{\circonflexe}{T1}{94}
\DeclareTextSymbol{\tild}{T1}{126}
\DeclareTextSymbolDefault{\at}{T1}
\DeclareTextSymbolDefault{\circonflexe}{T1}
\DeclareTextSymbolDefault{\tild}{T1}
\DeclareRobustCommand*{\boi}{\textbackslash}
\DeclareRobustCommand*{\degre}{\r{}}
\else
\def\T@one{T1}
\ifx\f@encoding\T@one
\newcommand*{\degre}{{\char6}}
\else
\newcommand*{\degre}{{\char23}}
\fi
\newcommand*{\at}{{\char64}}
\newcommand*{\circonflexe}{{\char94}}
\newcommand*{\tild}{{\char126}}
\newcommand*{\boi}{$\backslash$}
\fi
\fi
% \end{macrocode}
%
% \begin{macro}{\degres}
% We now define a macro |\degres| for typesetting the abbreviation
% for `degrees' (as in `degrees Celsius'). As the bounding box of
% the character `degree' has \emph{very} different widths in CM/EC
% and PostScript fonts, we fix the width of the bounding box of
% |\degres| to 0.3\,em, this lets the symbol `degree' stick to the
% preceding (e.g., |45\degres|) or following character
% (e.g., |20~\degres C|).
%
% \changes{v2.6e}{2013/07/06}{Refrain from redefining \cs{textdegree}
% from latin1.def, applemac.def, etc. as \cs{degres} because it
% loops in hyperref's bookmarks. Pointed out by Eddy Flas on fctt.}
%
% If \TeX{} Companion fonts are available (\file{textcomp.sty}),
% we pick up |\textdegree| from them instead of emulating `degrees'
% from the |\r{}| accent. Otherwise we advise the user (once only)
% to use TS1-encoding.
%
% \changes{v2.1c}{2008/04/29}{Provide a temporary definition (hyperref
% safe) of \cs{degres} in case it has to be expanded in the preamble
% (by beamer's \cs{title} command for instance).}
%
% \changes{v2.5h}{2012/03/21}{textcomp.sty has changed. The test
% about \cs{M@TS1} is no longer relevant, let's change it.}
%
% \begin{macrocode}
\ifLaTeXe
\newcommand*{\degres}{\degre}
\ifFBunicode
\DeclareRobustCommand*{\degres}{\degre}
\else
\def\Warning@degree@TSone{%
\PackageWarning{frenchb.ldf}{%
Degrees would look better in TS1-encoding:%
\MessageBreak add \protect
\usepackage{textcomp} to the preamble.%
\MessageBreak Degrees used}}
\AtBeginDocument{\ifx\DeclareEncodingSubset\@undefined
\DeclareRobustCommand*{\degres}{%
\leavevmode\hbox to 0.3em{\hss\degre\hss}%
\Warning@degree@TSone
\global\let\Warning@degree@TSone\relax}%
\else
\DeclareRobustCommand*{\degres}{%
\hbox{\UseTextSymbol{TS1}{\textdegree}}}%
\fi
}
\fi
\else
\newcommand*{\degres}{%
\leavevmode\hbox to 0.3em{\hss\degre\hss}}
\fi
% \end{macrocode}
% \end{macro}
%
% \subsection{Formatting numbers}
% \label{ssec-numbers}
%
% \begin{macro}{\DecimalMathComma}
% \begin{macro}{\StandardMathComma}
% As mentioned in the \TeX{}book p.~134, the comma is of type
% |\mathpunct| in math mode: it is automatically followed by a
% space. This is convenient in lists and intervals but
% unpleasant when the comma is used as a decimal separator
% in French: it has to be entered as |{,}|.
% |\DecimalMathComma| makes the comma be an ordinary character
% (of type |\mathord|) in French \emph{only} (no space added);
% |\StandardMathComma| switches back to the standard behaviour
% of the comma.
% \begin{macrocode}
\newcount\std@mcc
\newcount\dec@mcc
\std@mcc=\mathcode`\,
\dec@mcc=\std@mcc
\@tempcnta=\std@mcc
\divide\@tempcnta by "1000
\multiply\@tempcnta by "1000
\advance\dec@mcc by -\@tempcnta
\newcommand*{\DecimalMathComma}{\iflanguage{french}%
{\mathcode`\,=\dec@mcc}{}%
\FB@addto{extras}{\mathcode`\,=\dec@mcc}%
}
\newcommand*{\StandardMathComma}{\mathcode`\,=\std@mcc
\FB@addto{extras}{\mathcode`\,=\std@mcc}%
}
\FB@addto{noextras}{\mathcode`\,=\std@mcc}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\nombre}
%
% \changes{v2.0}{2006/11/06}{\cs{nombre} now requires numprint.sty.}
%
% The command |\nombre| is now borrowed from \file{numprint.sty} for
% \LaTeXe. There is no point to maintain the former tricky code
% when a package is dedicated to do the same job and more.
% For Plain based formats, |\nombre| no longer formats numbers,
% it prints them as is and issues a warning about the change.
%
% Fake command |\nombre| for Plain based formats, warning users of
% \frenchb{} v.~1.x.\ about the change:
% \begin{macrocode}
\newcommand*{\nombre}[1]{{#1}\fb@warning{*** \noexpand\nombre
no longer formats numbers\string! ***}}
% \end{macrocode}
% \end{macro}
%
% The next definitions only make sense for \LaTeXe.
% For Plain based formats, let's activate LuaTeX punctuation if
% necessary, then cleanup and exit. Temporary fix: |\l@french| is
% not properly set by \babel~3.9h with Plain LuaTeX format.
%
% \begin{macrocode}
\let\FBstop@here\relax
\def\FBclean@on@exit{\let\ifLaTeXe\undefined
\let\LaTeXetrue\undefined
\let\LaTeXefalse\undefined}
\ifx\magnification\@undefined
\else
\def\FBstop@here{\ifFB@luatex@punct
\activate@luatexpunct
\fi
\FBclean@on@exit
\ldf@quit\CurrentOption\endinput}
\fi
\FBstop@here
% \end{macrocode}
%
% What follows is for \LaTeXe{} \emph{only}; as all \LaTeXe{}
% based formats include \eTeX, we can use |\ifdefined| now.
% We redefine |\nombre| for \LaTeXe. A warning is issued
% at the first call of |\nombre| if |\numprint| is not
% defined, suggesting what to do. The package \pkg{numprint}
% is \emph{not} loaded automatically by \frenchb{} because of
% possible options conflict.
%
% \changes{v3.1i}{2015/10/03}{\cs{nombre} command changed when
% numprint.sty is not loaded: only one warning, no error.}
%
% \begin{macrocode}
\renewcommand*{\nombre}[1]{\Warning@nombre{#1}}
\newcommand*{\Warning@nombre}[1]{%
\ifdefined\numprint
\numprint{#1}%
\else
\PackageWarning{frenchb.ldf}{%
\protect\nombre\space now relies on package numprint.sty,%
\MessageBreak add \protect
\usepackage[autolanguage]{numprint},\MessageBreak
see file numprint.pdf for more options.\MessageBreak
\protect\nombre\space called}%
\global\let\Warning@nombre\relax
{#1}%
\fi
}
% \end{macrocode}
%
% \changes{v2.0c}{2007/06/25}{There is no need to define here
% numprint's command \cs{npstylefrench}, it will be redefined
% `AtBeginDocument' by \cs{FBprocess@options}.}
%
% \subsection{Caption names}
% \label{ssec-captions}
%
% The next step consists in defining the French equivalents for
% the \LaTeX{} caption names.
%
% \begin{macro}{\captionsfrench}
% Let's first define |\captionsfrench| which sets all strings used
% in the four standard document classes provided with \LaTeX.
%
% \changes{v2.0}{2006/11/06}{`Fig.' changed to `Figure' and
% `Tab.' to `Table'.}
%
% \changes{v2.5a}{2010/08/16}{\cs{emph} deleted in \cs{seename}
% and \cs{alsoname} to match what is done for the other languages.
% Suggested by Marc Baudoin.}
%
% \changes{v3.0a}{2014/02/18}{Take advantage of babel's \cs{SetString}
% commands for captionnames.}
%
% \changes{v3.1b}{2014/09/15}{Change \cs{scshape} to customisable
% \cs{FBfigtabshape} for \cs{figurename} and \cs{tablename}.}
%
% \changes{v3.1g}{2015/05/10}{\cs{partname}'s definition depends now on
% flag PartNameFull. No need to redefine it in \cs{frenchbsetup}.}
%
% Let's give a chance to a class or a package read before frenchb to
% define |\FBfigtabshape| as |\relax|, otherwise |\FBfigtabshape|
% will be defined as |\scshape| (can be changed with
% \fbsetup{SmallCapsFigTabCaptions=false}).
% \begin{macrocode}
\ifx\FBfigtabshape\@undefined \let\FBfigtabshape\scshape \fi
% \end{macrocode}
%
% New implementation for caption names (requires \babel's~3.9 or up).
% \begin{macrocode}
\StartBabelCommands*{\BabelLanguages}{captions}
[unicode, fontenc=EU1 EU2, charset=utf8]
\SetString{\refname}{Références}
\SetString{\abstractname}{Résumé}
\SetString{\prefacename}{Préface}
\SetString{\contentsname}{Table des matières}
\SetString{\ccname}{Copie à }
\SetString{\proofname}{Démonstration}
\SetStringLoop{ordinal#1}{%
Première,Deuxième,Troisième,Quatrième,Cinquième,%
Sixième,Septième,Huitième,Neuvième,Dixième,Onzième,%
Douzième,Treizième,Quatorzième,Quinzième,Seizième,%
Dix-septième,Dix-huitième,Dix-neuvième,Vingtième}
\StartBabelCommands*{\BabelLanguages}{captions}
\SetString{\refname}{R\'ef\'erences}
\SetString{\abstractname}{R\'esum\'e}
\SetString{\bibname}{Bibliographie}
\SetString{\prefacename}{Pr\'eface}
\SetString{\chaptername}{Chapitre}
\SetString{\appendixname}{Annexe}
\SetString{\contentsname}{Table des mati\`eres}
\SetString{\listfigurename}{Table des figures}
\SetString{\listtablename}{Liste des tableaux}
\SetString{\indexname}{Index}
\SetString{\figurename}{{\FBfigtabshape Figure}}
\SetString{\tablename}{{\FBfigtabshape Table}}
\SetString{\pagename}{page}
\SetString{\seename}{voir}
\SetString{\alsoname}{voir aussi}
\SetString{\enclname}{P.~J. }
\SetString{\ccname}{Copie \`a }
\SetString{\headtoname}{}
\SetString{\proofname}{D\'emonstration}
\SetString{\glossaryname}{Glossaire}
% \end{macrocode}
% When \fbo{PartNameFull=true} (default), |\part{}| is printed in
% French as ``Première partie'' instead of ``Partie I''.
% As logic is prohibited inside |\SetString|, let's hide the test
% about \fbo{PartNameFull} in |\FB@partname|.
% \begin{macrocode}
\SetStringLoop{ordinal#1}{%
Premi\`ere,Deuxi\`eme,Troisi\`eme,Quatri\`eme,Cinqui\`eme,%
Sixi\`eme,Septi\`eme,Huiti\`eme,Neuvi\`eme,Dixi\`eme,Onzi\`eme,%
Douzi\`eme,Treizi\`eme,Quatorzi\`eme,Quinzi\`eme,Seizi\`eme,%
Dix-septi\`eme,Dix-huiti\`eme,Dix-neuvi\`eme,Vingti\`eme}
\AfterBabelCommands{%
\DeclareRobustCommand*{\FB@emptypart}{\def\thepart{}}%
\DeclareRobustCommand*{\FB@partname}{%
\ifFBPartNameFull
\csname ordinal\romannumeral\value{part}\endcsname\space
partie\FB@emptypart
\else
Partie%
\fi}%
}
\SetString{\partname}{\FB@partname}
\EndBabelCommands
% \end{macrocode}
%
% \changes{v3.1g}{2015/05/10}{Bug fix for koma-scripts classes:
% a spurious dot was added by the \cs{partformat} command.}
%
% The following patch is for koma-script classes: |\partformat|
% needs to be redefined in French as this command, defined as
% |\partname~\thepart\autodot| is incompatible with our redefinition
% of |\partname|. The code is postponed to the end of package
% because |\ifFB@koma| will be defined and set later on
% (see p.~\pageref{ifFB@koma}).
% \begin{macrocode}
\AtEndOfPackage{%
\ifFB@koma
\ifdefined\partformat
\FB@addto{captions}{%
\ifFBPartNameFull
\babel@save\partformat
\renewcommand*{\partformat}{\partname}%
\fi}%
\fi
\fi
}
% \end{macrocode}
% \end{macro}
%
% \changes{v3.0a}{2014/02/28}{Merging of \cs{captionsfrenchb},
% \cs{captionsfrancais} with \cs{captionsfrench} deleted in favor
% of new babel 3.9 syntax.}
%
% Up to v2.6h \frenchb{} used to merge |\captionsfrenchb| and
% |\captionsfrancais| into |\captionsfrench| at |\begin{document}|.
% This is deprecated in favor of the new (much simpler!) syntax
% introduced in \babel~3.9. No need to define |\captionscanadien|
% and |\captionsacadian| either.
%
% \begin{macro}{\CaptionSeparator}
% Let's consider now captions in figures and tables.
% In French, captions in figures and tables should never be printed
% as `Figure 1:' which is the default in standard \LaTeXe{} classes;
% the `:' is made active too late, no space is added before it.
% With LuaLaTeX and XeLaTeX, this glitch doesn't occur, you get
% `Figure 1~:' which is correct in French. With pdfLaTeX \frenchb{}
% provides the following workaround.
%
% The standard definition of |\@makecaption| (e.g., the one provided
% in article.cls, report.cls, book.cls which is frozen for \LaTeXe{}
% according to Frank Mittelbach), is saved in |\STD@makecaption|.
% `AtBeginDocument' we compare it to its current definition (some
% classes like \cls{memoir}, koma-script classes, AMS classes,
% ua-thesis.cls\dots change it).
% If they are identical, \frenchb{} just adds a hook called
% |\FBCaption@Separator| to |\@makecaption|; |\FBCaption@Separator|
% defaults to `: ' as in the standard |\@makecaption| and will be
% changed to ` : ' in French `AtBeginDocument'; it can be also set to
% |\CaptionSeparator| (` -- ') using \fbo{CustomiseFigTabCaptions}.
%
% \changes{v2.4a}{2009/11/23}{\cs{PackageWarning} changed to
% \cs{FBWarning} (in case \cs{@makecaption} has been customised).
% \cs{FBWarning} is defined as \cs{PackageWarning} by default but
% can be made silent using \cs{frenchbsetup}, (suggested by MPG).}
%
% \changes{v2.6c}{2013/05/18}{Former \cs{CaptionSeparator}
% has been renamed as \cs{FBCaption@Separator};
% Newif \cs{if@FBwarning@capsep} added.}
%
% \changes{v2.6h}{2014/01/03}{No active catcodes in
% \cs{STD@makecaption}'s definition.}
%
% \changes{v3.0a}{2014/02/28}{Remove \cs{CaptionSeparatorORI}, use
% \cs{babel@save} instead.}
%
% While saving the standard definition of |\@makecaption| we have to
% make sure that characters `:' and `|>|' have |\catcode| 12
% (\frenchb{} makes `:' active and \file{spanish.ldf} makes `|>|'
% active).
% \begin{macrocode}
\bgroup
\catcode`:=12 \catcode`>=12 \relax
\long\gdef\STD@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{#1: #2}%
\ifdim \wd\@tempboxa >\hsize
#1: #2\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
\egroup
% \end{macrocode}
%
% No warning is issued for SMF and AMS classes as their layout of
% captions is compatible with French typographic standards.
%
% With \cls{memoir} and koma-script classes, \frenchb{} customises
% |\captiondelim| or |\captionformat| in French (unless option
% \fbo{CustomiseFigTabCaptions} is set to \fbo{false}) and issues
% no warning.
%
% When |\@makecaption| has been changed by another class
% or package, a warning is printed in the .log file.
%
% \begin{macrocode}
\newif\if@FBwarning@capsep
\@FBwarning@capseptrue
\newcommand{\FBWarning}[2]{\PackageWarning{#1}{#2}}
\newcommand*{\CaptionSeparator}{\space\textendash\space}
\def\FBCaption@Separator{: }
\long\def\FB@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{#1\FBCaption@Separator #2}%
\ifdim \wd\@tempboxa >\hsize
#1\FBCaption@Separator #2\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
% \end{macrocode}
% \end{macro}
%
% \changes{v2.6c}{2013/05/18}{No warning about \cs{@makecaption} for
% AMS classes.}
%
% \changes{v3.0a}{2014/02/20}{No warning about \cs{@makecaption} for
% SMF classes. No warning either with LuaTeX or XeTeX engines.}
%
% Disable the standard warning with AMS and SMF classes.
% \begin{macrocode}
\@ifclassloaded{amsart}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{amsbook}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{amsdtx}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{amsldoc}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{amproc}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{smfart}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{smfbook}{\@FBwarning@capsepfalse}{}
% \end{macrocode}
%
% Disable the standard warning unless high punctuation is active.
% \begin{macrocode}
\ifFB@active@punct\else\@FBwarning@capsepfalse\fi
% \end{macrocode}
%
% \changes{v2.6c}{2013/05/18}{No warning about \cs{@makecaption} for
% koma-script classes. \cs{captionformat} customised in French.}
%
% \changes{v2.6h}{2014/01/05}{If \cs{@makecaption} is undefined, no
% warning.}
%
% No warning with \cls{memoir} or koma-script classes: they change
% |\@makecaption| but we will manage to customise them in French
% later on (see below after executing |\FBprocess@options|)
% \label{ifFB@koma}.
% \begin{macrocode}
\newif\ifFB@koma
\@ifclassloaded{memoir}{\@FBwarning@capsepfalse}{}
\@ifclassloaded{scrartcl}{\@FBwarning@capsepfalse\FB@komatrue}{}
\@ifclassloaded{scrbook}{\@FBwarning@capsepfalse\FB@komatrue}{}
\@ifclassloaded{scrreprt}{\@FBwarning@capsepfalse\FB@komatrue}{}
% \end{macrocode}
% No warning with the \cls{beamer} class which defines
% |\beamer@makecaption| (customised below) instead of
% |\@makecaption|. No warning either if |\@makecaption| is
% undefined (i.e.\ \cls{letter}).
% \begin{macrocode}
\@ifclassloaded{beamer}{\@FBwarning@capsepfalse}{}
\ifdefined\@makecaption\else\@FBwarning@capsepfalse\fi
% \end{macrocode}
%
% \changes{v2.6c}{2013/05/18}{Warning added when the caption
% or floatrow package is loaded before babel/frenchb.}
%
% The \pkg{caption}, \pkg{subcaption} and \pkg{floatrow} packages are
% compatible with \frenchb{} if they are loaded after \babel{}.
%
% Check if package \pkg{caption} is loaded now (before
% \babel/\frenchb), then issue a warning advising to load it
% after \babel/\frenchb{} and disable the standard warning.
% \begin{macrocode}
\@ifpackageloaded{caption}
{\FBWarning{frenchb.ldf}%
{Please load the "caption" package\MessageBreak
AFTER babel/frenchb; reported}%
\@FBwarning@capsepfalse}%
{}
% \end{macrocode}
%
% \changes{v3.2b}{2016/03/30}{Warning added when the subcaption
% package is loaded before babel/frenchb.}
%
% Same for package \pkg{subcaption}.
% \begin{macrocode}
\@ifpackageloaded{subcaption}
{\FBWarning{frenchb.ldf}%
{Please load the "subcaption" package\MessageBreak
AFTER babel/frenchb; reported}%
\@FBwarning@capsepfalse}%
{}
% \end{macrocode}
%
% Same for package \pkg{floatrow}.
% \begin{macrocode}
\@ifpackageloaded{floatrow}
{\FBWarning{frenchb.ldf}%
{Please load the "floatrow" package\MessageBreak
AFTER babel/frenchb; reported}%
\@FBwarning@capsepfalse}%
{}
% \end{macrocode}
%
% \changes{v3.0a}{2014/02/20}{More informative, less TeXnical warning
% about \cs{@makecaption}.}
%
% First check the definition of |\@makecaption|, change it or issue
% a warning in case it has been changed by a class or package not
% (yet) compatible with \frenchb; then change the definition of
% |\FBCaption@Separator|, taking care that the colon is typeset
% correctly in French (\emph{not} `Figure~1: légende').
%
% \changes{v3.1f}{2015/05/31}{\cs{FBCaption@Separator} changed when
% option CustomiseFigTabCaptions is set to false.}
%
% \begin{macrocode}
\AtBeginDocument{%
\ifx\@makecaption\STD@makecaption
\global\let\@makecaption\FB@makecaption
% \end{macrocode}
% Do not overwrite |\FBCaption@Separator| if already saved
% as ': ' for other languages and set to |\CaptionSeparator| by
% |\extrasfrench| when French is the main language.
% \begin{macrocode}
\ifFBOldFigTabCaptions
\else
\def\FBCaption@Separator{{\autospace@beforeFDP : }}%
\fi
\ifFBCustomiseFigTabCaptions
\ifx\bbl@main@language\FB@french
\def\FBCaption@Separator{\CaptionSeparator}%
\fi
\fi
\@FBwarning@capsepfalse
\fi
\if@FBwarning@capsep
\FBWarning{frenchb.ldf}%
{Figures' and tables' captions might look like\MessageBreak
`Figure 1:' which is wrong in French.\MessageBreak
Check your class or packages to change this;\MessageBreak
reported}%
\fi
\let\FB@makecaption\relax
\let\STD@makecaption\relax
}
% \end{macrocode}
%
% \subsection{Dots\dots}
% \label{ssec-dots}
%
% \begin{macro}{\FBtextellipsis}
% \LaTeXe's standard definition of |\dots| in text-mode is
% |\textellipsis| which includes a |\kern| at the end;
% this space is not wanted in some cases (before a closing brace
% for instance) and |\kern| breaks hyphenation of the next word.
% We define |\FBtextellipsis| for French (in \LaTeXe{} only).
%
% The |\if| construction in the \LaTeXe{} definition of |\dots|
% doesn't allow the use of |xspace| (|xspace| is always followed
% by a |\fi|), so we use the AMS-\LaTeX{} construction of |\dots|;
% this has to be done `AtBeginDocument' not to be overwritten
% when \file{amsmath.sty} is loaded after \babel.
%
% \changes{v2.0}{2006/11/06}{Added special case for LY1 encoding,
% see bug report from Bruno Voisin (2004/05/18).}
%
% \changes{v2.5f}{2011/06/18}{Unicode fonts also provide a ready made
% character for \cs{textellipsis}, let's just use it!
% (reported by Maxime Chupin, 2011/06/04).}
%
% LY1 has a ready made character for |\textellipsis|, it should be
% used in French too. The same is true for Unicode fonts in use
% with XeTeX and LuaTeX.
%
% \begin{macrocode}
\ifFBunicode
\let\FBtextellipsis\textellipsis
\else
\DeclareTextSymbol{\FBtextellipsis}{LY1}{133}
\DeclareTextCommandDefault{\FBtextellipsis}{%
.\kern\fontdimen3\font.\kern\fontdimen3\font.\xspace}
\fi
% \end{macrocode}
% |\Mdots@| and |\Tdots@| hold the definitions of |\dots| in
% Math and Text mode. They default to those of amsmath-2.0, and
% will revert to standard \LaTeX{} definitions `AtBeginDocument',
% if amsmath has not been loaded. |\Mdots@| doesn't change when
% switching from/to French, while |\Tdots@| is redefined as
% |\FBtextellipsis| in French.
% \begin{macrocode}
\newcommand*{\Tdots@}{\@xp\textellipsis}
\newcommand*{\Mdots@}{\@xp\mdots@}
\AtBeginDocument{\DeclareRobustCommand*{\dots}{\relax
\csname\ifmmode M\else T\fi dots@\endcsname}%
\ifdefined\@xp\else\let\@xp\relax\fi
\ifdefined\mdots@\else\let\Mdots@\mathellipsis\fi
}
\def\bbl@frenchdots{\babel@save\Tdots@ \let\Tdots@\FBtextellipsis}
\FB@addto{extras}{\bbl@frenchdots}
% \end{macrocode}
% \end{macro}
%
% \subsection{More checks about packages' loading order}
% \label{ssec-loading-order}
%
% \changes{v3.1d}{2015/04/06}{New section: issue warnings if packages
% listings, numprint and natbib are loaded too early or too late
% vs babel.}
%
% \changes{v3.1i}{2015/10/03}{Remove restriction about loading
% numprint.sty after babel.}
%
% Like packages \file{captions} and \file{floatrow} (see
% section~\ref{ssec-captions}), package \file{listings} should be
% loaded after \babel/\frenchb{} due to active characters issues
% (pdfLaTeX only).
%
% \begin{macrocode}
\ifFB@active@punct
\@ifpackageloaded{listings}
{\FBWarning{frenchb.ldf}%
{Please load the "listings" package\MessageBreak
AFTER babel/frenchb; reported}%
}{}
\fi
% \end{macrocode}
%
% Package \file{natbib} should be loaded before \babel/\frenchb{}
% due to active characters issues (pdfLaTeX only).
%
% \begin{macrocode}
\newif\if@FBwarning@natbib
\ifFB@active@punct
\@ifpackageloaded{natbib}{}{\@FBwarning@natbibtrue}
\fi
\AtBeginDocument{%
\if@FBwarning@natbib
\@ifpackageloaded{natbib}{}{\@FBwarning@natbibfalse}%
\fi
\if@FBwarning@natbib
\FBWarning{frenchb.ldf}%
{Please load the "natbib" package\MessageBreak
BEFORE babel/frenchb; reported}%
\fi
}
% \end{macrocode}
%
% \subsection{Setup options: keyval stuff}
% \label{ssec-keyval}
%
% \changes{v2.0}{2006/11/06}{New command \cs{frenchbsetup} added
% for global customisation.}
%
% \changes{v3.0a}{2014/02/24}{Options processing completely
% reorganised, now \cs{babel@save} and\cs{babel@savevariable} are
% usable for French.}
%
% All setup options are handled by command \fbsetup{} using the
% keyval syntax. A list of flags is defined and set to a default
% value which will possibly be changed `AtEndOfPackage' if French is
% the main language. After this, \fbsetup{} eventually modifies the
% preset values of these flags.
%
% Option processing can occur either in \fbsetup{}, but \emph{only
% for options explicitly set} by \fbsetup{}, or `AtBeginDocument';
% any option affecting |\extrasfrench{}| \emph{must} be processed by
% \fbsetup{}: when French is the main language, |\extrasfrench{}| is
% executed by \babel{} when it switches the main language and this
% occurs \emph{before} reading the stuff postponed by \frenchb{}
% `AtBeginDocument'. Reexecuting |\extrasfrench{}| is an option
% which was used up to v2.6h, it has been dropped in v3.0a because
% of its side-effects (f.i.\ |\babel@save| and |\babel@savevariable|
% did not work for French).
%
% \begin{macro}{\frenchbsetup}
% Let's now define this command which reads and sets the options
% to be processed either immediately (i.e.\ just after setting the
% key) or later (at |\begin{document}|) by |\FBprocess@options|.
% \fbsetup{} can only be called in the preamble.
%
% \changes{v2.0c}{2007/06/25}{Option ThinSpaceInFrenchNumbers added.}
%
% \changes{v2.0d}{2007/07/15}{Options og and fg changed: limit
% the definition to French so that quote characters can be used
% in German.}
%
% \changes{v2.0e}{2007/10/05}{New option: StandardLists.}
%
% \changes{v2.0f}{2008/03/23}{Two typos corrected in
% option StandardLists: [false] $\to$ [true] and
% StandardLayout $\to$ StandardLists.}
%
% \changes{v2.0f}{2008/03/23}{StandardLayout option had no
% effect on lists. Test moved to \cs{FBprocess@options}.}
%
% \changes{v2.0g}{2008/03/23}{Revert previous change to
% StandardLayout. This option must set the three flags
% \cs{FBReduceListSpacingfalse}, \cs{FBCompactItemizefalse},
% and \cs{FBStandardItemLabeltrue} instead of
% \cs{FBStandardListstrue}, so that later options can still
% change their value before executing \cs{FBprocess@options}.
% Same thing for option StandardLists.}
%
% \changes{v2.1a}{2008/03/24}{New option: FrenchSuperscripts
% to define \cs{up} as \cs{fup} or as \cs{textsuperscript}.}
%
% \changes{v2.1a}{2008/03/30}{New option: LowercaseSuperscripts.}
%
% \changes{v2.2a}{2008/05/08}{The global layout of the document is
% no longer changed when frenchb is not the last option of babel
% (\cs{bbl@main@language}). Suggested by Ulrike Fischer.}
%
% \changes{v2.2a}{2008/05/08}{Default values of flags changed:
% default now means `StandardLayout', they will be changed to
% `FrenchLayout' AtEndOfPackage only if french is
% \cs{bbl@main@language}.}
%
% \changes{v2.2a}{2008/05/08}{When frenchb is babel's last option,
% French becomes the document's main language, so
% GlobalLayoutFrench applies.}
%
% \changes{v2.4a}{2009/11/23}{New option SuppressWarning.}
%
% \changes{v2.6a}{2013/01/30}{New options ListOldLayout,
% StandardItemizeEnv and StandardEnumerateEnv (CompactItemize is
% deprecated).}
%
% \changes{v3.0a}{2014/02/28}{New options OldFigTabCaptions and
% CustomiseFigTabCaptions.}
%
% \changes{v3.0c}{2014/04/18}{New option INGuillSpace.}
%
% \changes{v3.1a}{2014/05/20}{New options InnerGuillSingle,
% EveryParGuill and EveryLineGuill to control \cs{frquote}.}
%
% \changes{v3.1b}{2014/09/15}{New option SmallCapsFigTabCaptions.}
%
% \changes{v3.1e}{2015/04/10}{Corrected typo: SmallCapsFigTabcaptions
% instead of SmallCapsFigTabCaptions. Pointed out by Céline
% Chevalier.}
%
% \changes{v3.1g}{2015/05/10}{PartNameFull now just sets the flag,
% nothing to add to \cs{captionsfrench} when false.}
%
% \begin{macrocode}
\newcommand*{\frenchbsetup}[1]{%
\setkeys{FB}{#1}%
}%
\@onlypreamble\frenchbsetup
% \end{macrocode}
%
% We define a collection of conditionals with their defaults
% (true or false).
%
% \begin{macrocode}
\newif\ifFBShowOptions \FBShowOptionsfalse
\newif\ifFBStandardLayout \FBStandardLayouttrue
\newif\ifFBGlobalLayoutFrench \FBGlobalLayoutFrenchtrue
\newif\ifFBReduceListSpacing \FBReduceListSpacingfalse
\newif\ifFBListOldLayout \FBListOldLayoutfalse
\newif\ifFBCompactItemize \FBCompactItemizefalse
\newif\ifFBStandardItemizeEnv \FBStandardItemizeEnvtrue
\newif\ifFBStandardEnumerateEnv \FBStandardEnumerateEnvtrue
\newif\ifFBStandardItemLabels \FBStandardItemLabelstrue
\newif\ifFBStandardLists \FBStandardListstrue
\newif\ifFBIndentFirst \FBIndentFirstfalse
\newif\ifFBFrenchFootnotes \FBFrenchFootnotesfalse
\newif\ifFBAutoSpaceFootnotes \FBAutoSpaceFootnotesfalse
\newif\ifFBOriginalTypewriter \FBOriginalTypewriterfalse
\newif\ifFBThinColonSpace \FBThinColonSpacefalse
\newif\ifFBThinSpaceInFrenchNumbers \FBThinSpaceInFrenchNumbersfalse
\newif\ifFBFrenchSuperscripts \FBFrenchSuperscriptstrue
\newif\ifFBLowercaseSuperscripts \FBLowercaseSuperscriptstrue
\newif\ifFBPartNameFull \FBPartNameFulltrue
\newif\ifFBCustomiseFigTabCaptions \FBCustomiseFigTabCaptionsfalse
\newif\ifFBOldFigTabCaptions \FBOldFigTabCaptionsfalse
\newif\ifFBSmallCapsFigTabCaptions \FBSmallCapsFigTabCaptionstrue
\newif\ifFBSuppressWarning \FBSuppressWarningfalse
\newif\ifFBINGuillSpace \FBINGuillSpacefalse
% \end{macrocode}
%
% The defaults values of these flags have been choosen so that
% \frenchb{} does not change anything regarding the global layout.
% |\bbl@main@language|, set by the last option of \babel, controls
% the global layout of the document. `AtEndOfPackage' we check the
% main language in |\bbl@main@language|; if it is French,
% the values of some flags have to be changed to ensure a French
% looking layout for the whole document (even in parts written in
% languages other than French); the end-user will then be able to
% customise the values of all these flags with \fbsetup{}.
% When the \cls{beamer} is loaded, lists are not customised at all
% to ensure compatibility.
%
% \changes{v2.5b}{2010/10/30}{Do not use the
% test \cs{iflanguage}\{french\} to check whether French is the
% main language or not, as it might be be erroneously positive
% when English is the main language and no hyphenation patterns
% are available for French.
% In this case \cs{l@french} and \cs{l@english} are 0.
% Pointed out by Günter Milde.}
%
% \changes{v3.0c}{2014/03/30}{Activate option StandardLists when beamer
% class is loaded.}
%
% \begin{macrocode}
\edef\FB@french{\CurrentOption}
\AtEndOfPackage{%
\ifx\bbl@main@language\FB@french
\FBGlobalLayoutFrenchtrue
\@ifclassloaded{beamer}%
{\PackageInfo{frenchb.ldf}{%
No list customisation for the beamer class,%
\MessageBreak reported}}%
{\FBReduceListSpacingtrue
\FBStandardItemizeEnvfalse
\FBStandardEnumerateEnvfalse
\FBStandardItemLabelsfalse}%
\FBIndentFirsttrue
\FBFrenchFootnotestrue
\FBAutoSpaceFootnotestrue
\FBCustomiseFigTabCaptionstrue
\else
\FBGlobalLayoutFrenchfalse
\fi
% \end{macrocode}
% \frenchb{} being an option of \babel, it cannot load a package
% (\pkg{keyval}) while \file{frenchb.ldf} is read, so we defer the
% loading of \file{keyval} and the options setup at the end of
% \babel's loading.
% \begin{macrocode}
\RequirePackage{keyval}%
\define@key{FB}{ShowOptions}[true]%
{\csname FBShowOptions#1\endcsname}%
\define@key{FB}{StandardLayout}[true]%
{\csname FBStandardLayout#1\endcsname
\ifFBStandardLayout
\FBReduceListSpacingfalse
\FBStandardItemizeEnvtrue
\FBStandardItemLabelstrue
\FBStandardEnumerateEnvtrue
\FBIndentFirstfalse
\FBFrenchFootnotesfalse
\FBAutoSpaceFootnotesfalse
\FBGlobalLayoutFrenchfalse
\else
\FBReduceListSpacingtrue
\FBStandardItemizeEnvfalse
\FBStandardItemLabelsfalse
\FBStandardEnumerateEnvfalse
\FBIndentFirsttrue
\FBFrenchFootnotestrue
\FBAutoSpaceFootnotestrue
\fi}%
\define@key{FB}{GlobalLayoutFrench}[true]%
{\csname FBGlobalLayoutFrench#1\endcsname
% \end{macrocode}
% If this key is set to \fbo{true} when French is the main language,
% nothing to do: all flags keep their default value.
% If this key is set to \fbo{false}, nothing to do either:
% |\babel@save| will do the job.
% \begin{macrocode}
\ifFBGlobalLayoutFrench
\ifx\bbl@main@language\FB@french
\else
\PackageWarning{frenchb.ldf}%
{Option `GlobalLayoutFrench' skipped:%
\MessageBreak French is *not*
babel's last option.\MessageBreak}%
\fi
\fi}%
\define@key{FB}{ReduceListSpacing}[true]%
{\csname FBReduceListSpacing#1\endcsname}%
\define@key{FB}{ListOldLayout}[true]%
{\csname FBListOldLayout#1\endcsname
\ifFBListOldLayout
\FBStandardEnumerateEnvtrue
\renewcommand*{\FrenchLabelItem}{\textendash}%
\fi}%
\define@key{FB}{CompactItemize}[true]%
{\csname FBCompactItemize#1\endcsname
\ifFBCompactItemize
\FBStandardItemizeEnvfalse
\FBStandardEnumerateEnvfalse
\else
\FBStandardItemizeEnvtrue
\FBStandardEnumerateEnvtrue
\fi}%
\define@key{FB}{StandardItemizeEnv}[true]%
{\csname FBStandardItemizeEnv#1\endcsname}%
\define@key{FB}{StandardEnumerateEnv}[true]%
{\csname FBStandardEnumerateEnv#1\endcsname}%
\define@key{FB}{StandardItemLabels}[true]%
{\csname FBStandardItemLabels#1\endcsname}%
\define@key{FB}{ItemLabels}{%
\renewcommand*{\FrenchLabelItem}{#1}}%
\define@key{FB}{ItemLabeli}{%
\renewcommand*{\Frlabelitemi}{#1}}%
\define@key{FB}{ItemLabelii}{%
\renewcommand*{\Frlabelitemii}{#1}}%
\define@key{FB}{ItemLabeliii}{%
\renewcommand*{\Frlabelitemiii}{#1}}%
\define@key{FB}{ItemLabeliv}{%
\renewcommand*{\Frlabelitemiv}{#1}}%
\define@key{FB}{StandardLists}[true]%
{\csname FBStandardLists#1\endcsname
\ifFBStandardLists
\FBReduceListSpacingfalse
\FBCompactItemizefalse
\FBStandardItemizeEnvtrue
\FBStandardEnumerateEnvtrue
\FBStandardItemLabelstrue
\else
\FBReduceListSpacingtrue
\FBCompactItemizetrue
\FBStandardItemizeEnvfalse
\FBStandardEnumerateEnvfalse
\FBStandardItemLabelsfalse
\fi}%
\define@key{FB}{IndentFirst}[true]%
{\csname FBIndentFirst#1\endcsname}%
\define@key{FB}{FrenchFootnotes}[true]%
{\csname FBFrenchFootnotes#1\endcsname}%
\define@key{FB}{AutoSpaceFootnotes}[true]%
{\csname FBAutoSpaceFootnotes#1\endcsname}%
\define@key{FB}{AutoSpacePunctuation}[true]%
{\csname FBAutoSpacePunctuation#1\endcsname}%
\define@key{FB}{OriginalTypewriter}[true]%
{\csname FBOriginalTypewriter#1\endcsname}%
\define@key{FB}{ThinColonSpace}[true]%
{\csname FBThinColonSpace#1\endcsname}%
\define@key{FB}{ThinSpaceInFrenchNumbers}[true]%
{\csname FBThinSpaceInFrenchNumbers#1\endcsname}%
\define@key{FB}{FrenchSuperscripts}[true]%
{\csname FBFrenchSuperscripts#1\endcsname}
\define@key{FB}{LowercaseSuperscripts}[true]%
{\csname FBLowercaseSuperscripts#1\endcsname}
\define@key{FB}{PartNameFull}[true]%
{\csname FBPartNameFull#1\endcsname}%
\define@key{FB}{CustomiseFigTabCaptions}[true]%
{\csname FBCustomiseFigTabCaptions#1\endcsname}%
\define@key{FB}{OldFigTabCaptions}[true]%
{\csname FBOldFigTabCaptions#1\endcsname
% \end{macrocode}
% |\CurrentOption| no longer defined. It's value has been saved
% in |\FB@CurOpt| while reading \file{frenchb.ldf}.
% \begin{macrocode}
\ifFBOldFigTabCaptions
\FB@addto{extras}{\babel@save\FBCaption@Separator
\def\FBCaption@Separator{\CaptionSeparator}}%
\fi}%
\define@key{FB}{SmallCapsFigTabCaptions}[true]%
{\csname FBSmallCapsFigTabCaptions#1\endcsname
\ifFBSmallCapsFigTabCaptions
\let\FBfigtabshape\scshape
\else
\let\FBfigtabshape\relax
\fi}%
\define@key{FB}{SuppressWarning}[true]%
{\csname FBSuppressWarning#1\endcsname
\ifFBSuppressWarning
\renewcommand{\FBWarning}[2]{\relax}%
\fi}%
% \end{macrocode}
% Here are the options controlling French guillemets spacing
% and the output of |\frquote{}|.
% \begin{macrocode}
\define@key{FB}{INGuillSpace}[true]%
{\csname FBINGuillSpace#1\endcsname}%
\define@key{FB}{InnerGuillSingle}[true]%
{\csname FBInnerGuillSingle#1\endcsname}%
\define@key{FB}{EveryParGuill}{\expandafter\let\expandafter
\FBeveryparguill\csname FBguill#1\endcsname}%
\define@key{FB}{EveryLineGuill}{\expandafter\let\expandafter
\FBeverylineguill\csname FBguill#1\endcsname
\ifFB@luatex@punct
\else
\let\FBeverylineguill\FBguillnone
\PackageWarning{frenchb.ldf}%
{Option `EveryLineGuill' skipped:%
\MessageBreak this option is for
LuaTeX *only*.\MessageBreak Reported}%
\fi}%
% \end{macrocode}
% Inputing French quotes as \emph{single characters} when they are
% available on the keyboard (through a compose key for instance)
% is more comfortable than typing |\og| and |\fg|.
%
% With pdfTeX (or old LuaTeX and XeTeX engines), quote characters
% are made active and expand to |\og\ignorespaces| and |{\fg}|
% respectively if the current language is French, and to
% |\guillemotleft| and |\guillemotright| otherwise (think of German
% quotes), this is done by |\FB@@og| and |\FB@@fg|; thus correct
% unbreakable spaces will be added automatically to French quotes.
% The quote characters typed in depend on the input encoding,
% it can be single-byte (latin1, latin9, applemac,\dots) or
% multi-bytes (utf-8, utf8x); the \pkg{inputenc} package has to
% be loaded before the |\begin{document}| with the proper coding
% option, so we check if |\DeclareInputText| is defined.
%
% Life is much simpler here with modern LuaTeX or XeTeX engines: we
% just have to activate the |\FB@addGUILspace| attribute for LuaTeX
% or set |\XeTeXcharclass| of quotes to the proper value for XeTeX.
%
% \changes{v2.4c}{2010/05/23}{In \cs{ttfamilyFB}, also cancel
% automatic spaces inside French guillemets coded as characters
% (see \cs{frenchbsetup}).}
%
% \changes{v2.5g}{2011/12/31}{When \cs{ifFB@xetex@punct} is true,
% `og' and `fg' options now set XeTeXcharclasses of these characters
% to \cs{FB@guilo} and \cs{FB@guilf}. Otherwise French
% quotes behave as normal characters (their XeTeXcharclass is 0).}
%
% \changes{v2.6h}{2014/01/03}{\cs{FG@og} and \cs{FG@fg} changed:
% former clumsy code removed.}
%
% \changes{v3.1a}{2014/06/16}{Codes "13 and "14 added for French
% quotes in T1-encoding. Support for older versions of LuaTeX and
% XeTeX dropped.}
%
% \changes{v3.2c}{2016/05/03}{Add a warning about options og/fg for old
% XeTeX or LuaTeX engines requiring active characters.}
%
% \begin{macrocode}
\define@key{FB}{og}{%
\ifFBunicode
% \end{macrocode}
% LuaTeX or XeTeX in use, first try modern LuaTeX: we just need
% to set LuaTeX's attribute |\FB@addGUILspace| to 1,
% \begin{macrocode}
\ifFB@luatex@punct
\FB@addGUILspace=1 \relax
\fi
% \end{macrocode}
% then with XeTeX it is a bit more tricky:
% \begin{macrocode}
\ifFB@xetex@punct
% \end{macrocode}
% |\XeTeXinterchartokenstate| is defined, we just need to set
% |\XeTeXcharclass| to |\FB@guilo| for the French opening quote
% in T1 and Unicode encoding (see subsection~\ref{ssec-punct}).
% \begin{macrocode}
\XeTeXcharclass"13 = \FB@guilo
\XeTeXcharclass"AB = \FB@guilo
\XeTeXcharclass"A0 = \FB@guilnul
\XeTeXcharclass"202F = \FB@guilnul
\fi
% \end{macrocode}
% Issue a warning with older Unicode engines requiring active
% characters.
% \begin{macrocode}
\ifFB@active@punct
\FBWarning{frenchb.ldf}%
{Option og=« not supported with this version
of\MessageBreak LuaTeX/XeTeX; reported}%
\fi
\else
% \end{macrocode}
% This is for conventional TeX engines:
% \begin{macrocode}
\newcommand*{\FB@@og}{%
\iflanguage{french}%
{\ifFB@spacing\FB@og\ignorespaces
\else\guillemotleft
\fi}%
{\guillemotleft}}%
\AtBeginDocument{%
\ifdefined\DeclareInputText
\ifdefined\uc@dclc
% \end{macrocode}
% Package \pkg{inputenc} with utf8x encoding loaded, use |\uc@dclc|,
% \begin{macrocode}
\uc@dclc{171}{default}{\FB@@og}%
\else
% \end{macrocode}
% if encoding is not utf8x, try utf8\dots
% \begin{macrocode}
\ifdefined\DeclareUnicodeCharacter
% \end{macrocode}
% utf8 loaded, use |\DeclareUnicodeCharacter|,
% \begin{macrocode}
\DeclareUnicodeCharacter{00AB}{\FB@@og}%
\else
% \end{macrocode}
% if utf8 is not loaded either, we assume 8-bit character input
% encoding. Package \pkg{MULEenc} (from CJK) defines |\mule@def|
% to map characters to control sequences.
% \begin{macrocode}
\@tempcnta`#1\relax
\ifdefined\mule@def
\mule@def{11}{\FB@@og}%
\else
\DeclareInputText{\the\@tempcnta}{\FB@@og}%
\fi
\fi
\fi
\else
% \end{macrocode}
% Package \pkg{inputenc} not loaded, no way\dots{}
% \begin{macrocode}
\PackageWarning{frenchb.ldf}%
{Option `og' requires package inputenc.\MessageBreak}%
\fi
}%
\fi
}%
% \end{macrocode}
%
% Same code for the closing quote.
% \begin{macrocode}
\define@key{FB}{fg}{%
\ifFBunicode
\ifFB@luatex@punct
\FB@addGUILspace=1 \relax
\fi
\ifFB@xetex@punct
\XeTeXcharclass"14 = \FB@guilf
\XeTeXcharclass"BB = \FB@guilf
\XeTeXcharclass"A0 = \FB@guilnul
\XeTeXcharclass"202F = \FB@guilnul
\fi
\ifFB@active@punct
\FBWarning{frenchb.ldf}%
{Option fg=» not supported with this version
of\MessageBreak LuaTeX/XeTeX; reported}%
\fi
\else
\newcommand*{\FB@@fg}{%
\iflanguage{french}%
{\ifFB@spacing\FB@fg
\else\guillemotright
\fi}%
{\guillemotright}}%
\AtBeginDocument{%
\ifdefined\DeclareInputText
\ifdefined\uc@dclc
\uc@dclc{187}{default}{\FB@@fg}%
\else
\ifdefined\DeclareUnicodeCharacter
\DeclareUnicodeCharacter{00BB}{\FB@@fg}%
\else
\@tempcnta`#1\relax
\ifdefined\mule@def
\mule@def{27}{{\FB@@fg}}%
\else
\DeclareInputText{\the\@tempcnta}{\FB@@fg}%
\fi
\fi
\fi
\else
\PackageWarning{frenchb.ldf}%
{Option `fg' requires package inputenc.\MessageBreak}%
\fi
}%
\fi
}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FBprocess@options}
% |\FBprocess@options| will be executed at |\begin{document}|:
% it first checks about packages loaded in the preamble (possibly
% after \babel) which customise lists: currently \pkg{enumitem},
% \pkg{paralist} and \pkg{enumerate}; then it processes the options
% as set by \fbsetup{} or forced for compatibility with packages
% loaded in the preamble.
%
% When French is the main language, |\extrasfrench| and
% |\captionsfrench| \emph{have already been processed} by \babel{}
% at |\begin{document}| \emph{before} |\FBprocess@options|.
% \begin{macrocode}
\newcommand*{\FBprocess@options}{%
% \end{macrocode}
% Update flags if a package customising lists has been loaded,
% currently: \pkg{enumitem}, \pkg{paralist}, \pkg{enumerate}.
% \begin{macrocode}
\@ifpackageloaded{enumitem}{%
\ifFBStandardItemizeEnv
\else
\FBStandardItemizeEnvtrue
\PackageInfo{frenchb.ldf}%
{Setting StandardItemizeEnv=true for\MessageBreak
compatibility with enumitem package,\MessageBreak}%
\fi
\ifFBStandardEnumerateEnv
\else
\FBStandardEnumerateEnvtrue
\PackageInfo{frenchb.ldf}%
{Setting StandardEnumerateEnv=true for\MessageBreak
compatibility with enumitem package,\MessageBreak}%
\fi}{}%
\@ifpackageloaded{paralist}{%
\ifFBStandardItemizeEnv
\else
\FBStandardItemizeEnvtrue
\PackageInfo{frenchb.ldf}%
{Setting StandardItemizeEnv=true for\MessageBreak
compatibility with paralist package,\MessageBreak}%
\fi
\ifFBStandardEnumerateEnv
\else
\FBStandardEnumerateEnvtrue
\PackageInfo{frenchb.ldf}%
{Setting StandardEnumerateEnv=true for\MessageBreak
compatibility with paralist package,\MessageBreak}%
\fi}{}%
\@ifpackageloaded{enumerate}{%
\ifFBStandardEnumerateEnv
\else
\FBStandardEnumerateEnvtrue
\PackageInfo{frenchb.ldf}%
{Setting StandardEnumerateEnv=true for\MessageBreak
compatibility with enumerate package,\MessageBreak}%
\fi}{}%
% \end{macrocode}
% Reset |\FB@ufl|'s normal meaning and update lists' settings
% in case French is the main language: \label{FB@ufl}
% \begin{macrocode}
\def\FB@ufl{\update@frenchlists}
\ifx\bbl@main@language\FB@french
\update@frenchlists
\fi
% \end{macrocode}
% The layout of footnotes is handled at the |\begin{document}|
% depending on the values of flags \fbo{FrenchFootnotes}
% and \fbo{AutoSpaceFootnotes} (see section~\ref{ssec-footnotes}),
% nothing has to be done here for footnotes.
%
% \fbo{AutoSpacePunctuation} adds an unbreakable space (in French
% only) before the four active characters (:;!?) even if none has
% been typed before them.
% \begin{macrocode}
\ifFBAutoSpacePunctuation
\autospace@beforeFDP
\else
\noautospace@beforeFDP
\fi
% \end{macrocode}
% When \fbo{OriginalTypewriter} is set to \fbo{false} (the default),
% |\ttfamily|, |\rmfamily| and |\sffamily| are redefined as
% |\ttfamilyFB|, |\rmfamilyFB| and |\sffamilyFB| respectively
% to prevent addition of automatic spaces before the four active
% characters in computer code.
% \begin{macrocode}
\ifFBOriginalTypewriter
\else
\let\ttfamilyORI\ttfamily
\let\rmfamilyORI\rmfamily
\let\sffamilyORI\sffamily
\let\ttfamily\ttfamilyFB
\let\rmfamily\rmfamilyFB
\let\sffamily\sffamilyFB
\fi
% \end{macrocode}
%
% \changes{v3.0a}{2014/01/10}{Changed option ThinColonSpace to make it
% work also with LuaTeX.}
%
% \fbo{ThinColonSpace} changes the normal unbreakable space typeset
% in French before `:' to a thin space.
% \begin{macrocode}
\ifFBThinColonSpace
\ifFB@luatex@punct
\FBcolonskip=\FBthinskip\relax
\else
\renewcommand*{\FBcolonspace}{\FBthinspace}%
\fi
\fi
% \end{macrocode}
% When \fbo{true}, \fbo{INGuillSpace} resets the dimensions of skips
% after opening French quotes and before closing French quotes to
% I.N. standards.
% \begin{macrocode}
\ifFBINGuillSpace
\ifFB@luatex@punct
\FBguillskip=3.33pt plus 1.665pt minus 1.11pt \relax
\else
\renewcommand*{\FBguillspace}{\space}%
\fi
\fi
% \end{macrocode}
% When package \pkg{numprint} is loaded with option
% \opt{autolanguage}, \pkg{numprint}'s command |\npstylefrench| has
% to be redefined differently according to the value of flag
% \fbo{ThinSpaceInFrenchNumbers}.
% As |\npstylefrench| was undefined in old versions of
% \pkg{numprint}, we have to provide this command.
% \begin{macrocode}
\@ifpackageloaded{numprint}%
{\ifnprt@autolanguage
\providecommand*{\npstylefrench}{}%
\ifFBThinSpaceInFrenchNumbers
\renewcommand*\npstylefrench{%
\npthousandsep{\,}%
\npdecimalsign{,}%
\npproductsign{\cdot}%
\npunitseparator{\,}%
\npdegreeseparator{}%
\nppercentseparator{\nprt@unitsep}%
}%
\else
\renewcommand*\npstylefrench{%
\npthousandsep{~}%
\npdecimalsign{,}%
\npproductsign{\cdot}%
\npunitseparator{\,}%
\npdegreeseparator{}%
\nppercentseparator{\nprt@unitsep}%
}%
\fi
\npaddtolanguage{french}{french}%
\fi}{}%
% \end{macrocode}
% \fbo{FrenchSuperscripts}: if \fbo{true} |\up=\fup|, else
% |\up=\textsuperscript|. Anyway |\up*=\FB@up@fake|. The star-form
% |\up*{}| is provided for fonts that lack some superior letters:
% Adobe Jenson Pro and Utopia Expert have no ``g superior'' for
% instance.
% \begin{macrocode}
\ifFBFrenchSuperscripts
\DeclareRobustCommand*{\up}{\@ifstar{\FB@up@fake}{\fup}}%
\else
\DeclareRobustCommand*{\up}{\@ifstar{\FB@up@fake}%
{\textsuperscript}}%
\fi
% \end{macrocode}
% \fbo{LowercaseSuperscripts}: if \fbo{true} let |\FB@lc| be
% |\lowercase|, else |\FB@lc| is redefined to do nothing.
% \begin{macrocode}
\ifFBLowercaseSuperscripts
\else
\renewcommand*{\FB@lc}[1]{##1}%
\fi
% \end{macrocode}
%
% \changes{v3.0a}{2014/02/20}{With koma-script and memoir class,
% customise \cs{captionformat} and \cs{captiondelim}.}
%
% \changes{v3.1f}{2015/05/31}{Definition of \cs{captionformat} and
% \cs{captiondelim} changed when option CustomiseFigTabCaptions
% is set to false.}
%
% \changes{v3.1f}{2015/05/31}{Bug fix for the beamer class:
% figure and table captions are now consistent with frenchb's
% documentation. Pointed out by Denis Bitouzé.}
%
% Unless \fbo{CustomiseFigTabCaptions} has been set to \fbo{false},
% use |\CaptionSeparator| for koma-script, \cls{memoir} and
% \cls{beamer} classes.
% \begin{macrocode}
\ifFBCustomiseFigTabCaptions
\ifFB@koma
\renewcommand*{\captionformat}{\CaptionSeparator}%
\fi
\@ifclassloaded{memoir}%
{\captiondelim{\CaptionSeparator}}{}%
\@ifclassloaded{beamer}%
{\defbeamertemplate{caption label separator}{FBcustom}{%
\CaptionSeparator}%
\setbeamertemplate{caption label separator}[FBcustom]}{}%
\else
% \end{macrocode}
% When \fbo{CustomiseFigTabCaptions} is \fbo{false}, have the colon
% behave properly in French: locally force |\autospace@beforeFDP| in
% case of \fbo{AutoSpacePunctuation=false}.
% \begin{macrocode}
\ifFB@koma
\renewcommand*{\captionformat}{{\autospace@beforeFDP : }}%
\fi
\@ifclassloaded{memoir}%
{\captiondelim{{\autospace@beforeFDP : }}%
}{}%
\@ifclassloaded{beamer}%
{\defbeamertemplate{caption label separator}{FBcolon}{%
{\autospace@beforeFDP : }}%
\setbeamertemplate{caption label separator}[FBcolon]%
}{}%
\fi
% \end{macrocode}
% \fbo{ShowOptions}: if \fbo{true}, print the list of all options
% to the \file{.log} file.
% \begin{macrocode}
\ifFBShowOptions
\GenericWarning{* }{%
* **** List of possible options for frenchb ****\MessageBreak
[Default values between brackets when frenchb is loaded *LAST*]%
\MessageBreak
ShowOptions=true [false]\MessageBreak
StandardLayout=true [false]\MessageBreak
GlobalLayoutFrench=false [true]\MessageBreak
StandardLists=true [false]\MessageBreak
IndentFirst=false [true]\MessageBreak
ReduceListSpacing=false [true]\MessageBreak
ListOldLayout=true [false]\MessageBreak
StandardItemizeEnv=true [false]\MessageBreak
StandardEnumerateEnv=true [false]\MessageBreak
StandardItemLabels=true [false]\MessageBreak
ItemLabels=\textemdash, \textbullet,
\protect\ding{43},... [\textendash]\MessageBreak
ItemLabeli=\textemdash, \textbullet,
\protect\ding{43},... [\textendash]\MessageBreak
ItemLabelii=\textemdash, \textbullet,
\protect\ding{43},... [\textendash]\MessageBreak
ItemLabeliii=\textemdash, \textbullet,
\protect\ding{43},... [\textendash]\MessageBreak
ItemLabeliv=\textemdash, \textbullet,
\protect\ding{43},... [\textendash]\MessageBreak
FrenchFootnotes=false [true]\MessageBreak
AutoSpaceFootnotes=false [true]\MessageBreak
AutoSpacePunctuation=false [true]\MessageBreak
OriginalTypewriter=true [false]\MessageBreak
ThinColonSpace=true [false]\MessageBreak
ThinSpaceInFrenchNumbers=true [false]\MessageBreak
FrenchSuperscripts=false [true]\MessageBreak
LowercaseSuperscripts=false [true]\MessageBreak
PartNameFull=false [true]\MessageBreak
SuppressWarning=true [false]\MessageBreak
CustomiseFigTabCaptions=false [true]\MessageBreak
OldFigTabCaptions=true [false]\MessageBreak
SmallCapsFigTabCaptions=false [true]\MessageBreak
INGuillSpace=true [false]\MessageBreak
InnerGuillSingle=true [false]\MessageBreak
EveryParGuill=open, close, none [open]\MessageBreak
EveryLineGuill=open, close, none
[open in LuaTeX, none otherwise]\MessageBreak
og= <left quote character>, fg= <right quote character>%
\MessageBreak
*********************************************%
\MessageBreak\protect\frenchbsetup{ShowOptions}}
\fi
}
% \end{macrocode}
% \end{macro}
%
% \changes{v2.0}{2006/12/06}{Added warning for OT1 encoding.}
%
% \changes{v2.1b}{2008/04/07}{Disable some commands in bookmarks.}
%
% \changes{v2.5e}{2011/04/03}{\cs{pdfstringdefDisableCommands} should
% redefine \cs{FB@og} and \cs{FB@fg} instead of \cs{og} and \cs{fg}
% so that it works also when quotes are entered as characters.
% Reported by Sébastien Gouezel.}
%
% At |\begin{document}|, we have to provide an |\xspace| command
% in case the \pkg{xspace} package is not loaded, do some setup for
% \file{hyperref}'s bookmarks, execute |\FBprocess@options|, switch
% LuaTeX punctuation on and issue some warnings if necessary.
% \begin{macrocode}
\AtBeginDocument{%
\providecommand*{\xspace}{\relax}%
% \end{macrocode}
%
% \changes{v2.5g}{2011/11/13}{Redefine \cs{degre}, \cs{degres} \cs{at}
% \cs{circonflexe} and \cs{tild} for bookmarks. Add \cs{fup} also.}
%
% Let's redefine some commands in \file{hyperref}'s bookmarks.
% \begin{macrocode}
\ifdefined\pdfstringdefDisableCommands
\pdfstringdefDisableCommands{%
\let\up\relax
\let\fup\relax
\let\degre\textdegree
\let\degres\textdegree
\def\ieme{e\xspace}%
\def\iemes{es\xspace}%
\def\ier{er\xspace}%
\def\iers{ers\xspace}%
\def\iere{re\xspace}%
\def\ieres{res\xspace}%
\def\FrenchEnumerate#1{#1\degre\space}%
\def\FrenchPopularEnumerate#1{#1\degre)\space}%
\def\No{N\degre\space}%
\def\no{n\degre\space}%
\def\Nos{N\degre\space}%
\def\nos{n\degre\space}%
\def\FB@og{\guillemotleft\space}%
\def\FB@fg{\space\guillemotright}%
\def\at{@}%
\def\circonflexe{\string^}%
\def\tild{\string~}%
\let\bsc\textsc
}%
\fi
% \end{macrocode}
% It is time to process the options set with \fbsetup{} or later.
% \begin{macrocode}
\FBprocess@options
% \end{macrocode}
% With LuaTeX engines (|\FBthinskip| and |\FBcolonskip| values are
% set now), it is time to load file \file{frenchb.lua}.
% \begin{macrocode}
\ifFB@luatex@punct
\activate@luatexpunct
\fi
% \end{macrocode}
%
% \changes{v3.0a}{2014/01/28}{Test \cs{ifXeTeX} changed to
% \cs{ifFBunicode} and `xltxtra' changed to `fontspec'.}
%
% \changes{v3.1a}{2014/06/14}{fontspec is not required for T1 fonts
% used with the luainputenc.sty package.}
%
% Some warnings are issued when output font encodings are not
% properly set. With XeLaTeX or LuaLaTeX, \file{fontspec.sty} and
% \file{xunicode.sty} should be loaded unless T1 encoded fonts are
% used through \file{luainputenc}, in the latter case |\FB@og| and
% |\FB@fg| have to be redefined; with (pdf)\LaTeX, a warning
% is issued when OT1 encoding is in use at the |\begin{document}|.
% Mind that |\encodingdefault| is defined as `long', defining
% |\FBOTone| with |\newcommand*| would fail!
% \begin{macrocode}
\ifFBunicode
\ifdefined\DeclareUTFcharacter
\else
\@ifpackageloaded{luainputenc}{}%
{\PackageWarning{frenchb.ldf}%
{Add \protect\usepackage{fontspec} to the\MessageBreak
preamble of your document,}%
}%
\fi
\else
\begingroup \newcommand{\FBOTone}{OT1}%
\ifx\encodingdefault\FBOTone
\PackageWarning{frenchb.ldf}%
{OT1 encoding should not be used for French.%
\MessageBreak
Add \protect\usepackage[T1]{fontenc} to the
preamble\MessageBreak of your document,}%
\fi
\endgroup
\fi
}
% \end{macrocode}
%
% \subsection{French lists}
% \label{ssec-lists}
%
% \changes{v2.6a}{2013/01/30}{Bug correction: changing \cs{leftmargin}
% cannot be done only for itemize-lists: it messes up
% embedded enumerate lists. Pointed out by Denis Bitouzé.
% Lists have been completely redesigned in frenchb v.~2.6a.
% An option for backward compatibility is provided.}
%
% \begin{macro}{\listFB}
% \begin{macro}{\listORI}
% \begin{macro}{\FB@listVsettings}
% Vertical spacing in lists should be shorter in French texts than
% the defaults provided by \LaTeX.
% Note that the easy way, just changing values of vertical spacing
% parameters when entering French and restoring them to their
% defaults on exit would not work; so we define the command
% |\FB@listVsettings| to hold the settings to be used by
% the French variant |\listFB| of |\list|. Note that switching
% to |\listFB| reduces vertical spacing in \emph{all} environments
% built on |\list|: |itemize|, |enumerate|, |description|, but also
% |abstract|, |quotation|, |quote| and |verse|\dots{}
%
% The amount of vertical space before and after a list is given by
% |\topsep| + |\parskip| (+ |\partopsep| if the list starts a new
% paragraph). IMHO, |\parskip| should be added \emph{only} when
% the list starts a new paragraph, so I subtract |\parskip| from
% |\topsep| and add it back to |\partopsep|; this will normally
% make no difference because |\parskip|'s default value is 0pt, but
% will be noticeable when |\parskip| is \emph{not} null.
%
% \begin{macrocode}
\let\listORI\list
\let\endlistORI\endlist
\def\FB@listVsettings{%
\setlength{\itemsep}{0.4ex plus 0.2ex minus 0.2ex}%
\setlength{\parsep}{0.4ex plus 0.2ex minus 0.2ex}%
\setlength{\topsep}{0.8ex plus 0.4ex minus 0.4ex}%
\setlength{\partopsep}{0.4ex plus 0.2ex minus 0.2ex}%
% \end{macrocode}
% |\parskip| is of type `skip', its mean value only (\emph{not
% the glue}) should be subtracted from |\topsep| and added to
% |\partopsep|, so convert |\parskip| to a `dimen' using
% |\@tempdima|.
% \begin{macrocode}
\@tempdima=\parskip
\addtolength{\topsep}{-\@tempdima}%
\addtolength{\partopsep}{\@tempdima}%
}
\def\listFB#1#2{\listORI{#1}{\FB@listVsettings #2}}
\let\endlistFB\endlist
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% Let's now consider French itemize-lists. They differ from those
% provided by the standard \LaTeXe{} classes:
% \begin{itemize}
% \item The `\textbullet' is never used in French itemize-lists,
% an emdash `---' or an endash `--' is preferred for all
% levels. The item label to be used in French is stored in
% |\FrenchLabelItem}|, it defaults to `---' and can be changed
% using \fbsetup{} (see section~\ref{ssec-keyval}).
% \item Vertical spacing between items, before and after
% the list, should be \emph{null} with \emph{no glue} added;
% \item In French the labels of itemize-lists are vertically
% aligned as follows:\\
% \fbox{\parbox[t]{.5\textwidth}{%
% \parindent=1.5em
% \def\FBlabel{\textemdash}%
% \settowidth{\labelwidth}{\FBlabel}%
% Text starting at `parindent' \\
% \noindent$\Leftarrow$ Leftmargin\\
% \hspace*{\parindent}\textemdash{} first item\dots\\
% \hspace*{\parindent}\hspace*{\labelwidth}%
% \textemdash{} first second level item\\
% \hspace*{\parindent}\hspace*{\labelwidth}%
% \textemdash{} next one\dots{}\\
% \hspace*{\parindent}\textemdash{} second item\dots
% }}
% \end{itemize}
%
% \begin{macro}{\FrenchLabelItem}
% \changes{v2.6a}{2013/01/30}{default changed from \cs{textendash} to
% \cs{textemdash}.}
% \begin{macro}{\Frlabelitemi}
% \begin{macro}{\Frlabelitemii}
% \begin{macro}{\Frlabelitemiii}
% \begin{macro}{\Frlabelitemiv}
% Default labels for French itemize-lists (same label for all levels):
% \begin{macrocode}
\newcommand*{\FrenchLabelItem}{\textemdash}
\newcommand*{\Frlabelitemi}{\FrenchLabelItem}
\newcommand*{\Frlabelitemii}{\FrenchLabelItem}
\newcommand*{\Frlabelitemiii}{\FrenchLabelItem}
\newcommand*{\Frlabelitemiv}{\FrenchLabelItem}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\listindentFB}
% \begin{macro}{\labelwidthFB}
% Let's define two lengths |\listindentFB| and |\labelwidthFB| to
% customise lists' horizontal indentations. They are given
% silly values here ($-1$\,pt) in order to eventually
% enable their customisation in the preamble. They will get
% reasonnable defaults later when entering French (see
% |\bbl@frenchlabelitems|) unless they have been customised.
% \begin{macrocode}
\newlength\listindentFB
\setlength{\listindentFB}{-1pt}
\newlength\labelwidthFB
\setlength{\labelwidthFB}{-1pt}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\FB@listHsettings}
% \begin{macro}{\leftmarginFB}
% |\FB@listHsettings| holds the new horizontal settings chosen for
% French lists itemize and enumerate starting with version~2.6a.
% They are based on the look resquested in French for
% itemize-lists.
% \begin{macrocode}
\newlength\leftmarginFB
\def\FB@listHsettings{%
\leftmarginFB\labelwidthFB
\advance\leftmarginFB \labelsep
\leftmargini\leftmarginFB
\advance\leftmargini \listindentFB
\leftmarginii\leftmarginFB
\leftmarginiii\leftmarginFB
\leftmarginiv\leftmarginFB
\leftmargin\csname leftmargin\romannumeral\the\@listdepth\endcsname
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\itemizeFB}
% \begin{macro}{\FB@itemizesettings}
%
% \changes{v2.6f}{2013/11/25}{\cs{labelwidth} must be reset, f.i. when
% an itemize list occurs inside environments based on trivlist which
% set \cs{labelwidth} to 0 (see proof environment in amsthm.sty).
% Bug pointed out by Julien Hauseux.}
%
% \changes{v2.6g}{2013/12/30}{Suppress all vertical spaces only if
% ReduceListSpacing is true. Pointed out by Pierre Willaime.}
%
% New environment for French itemize-lists.\\ |\FB@itemizesettings|
% does two things: first suppress all vertical spaces including glue
% when option \fbo{ReduceListSpacing} is set, then set horizontal
% indentations according to |\FB@listHsettings| unless option
% \fbo{ListOldLayout} is \fbo{true} (compatibility with lists up to
% v.~2.5k).
% \begin{macrocode}
\def\FB@itemizesettings{%
\ifFBReduceListSpacing
\setlength{\itemsep}{\z@}%
\setlength{\parsep}{\z@}%
\setlength{\topsep}{\z@}%
\setlength{\partopsep}{\z@}%
\@tempdima=\parskip
\addtolength{\topsep}{-\@tempdima}%
\addtolength{\partopsep}{\@tempdima}%
\fi
\settowidth{\labelwidth}{\csname\@itemitem\endcsname}%
\ifFBListOldLayout
\setlength{\leftmargin}{\labelwidth}%
\addtolength{\leftmargin}{\labelsep}%
\addtolength{\leftmargin}{\parindent}%
\else
\FB@listHsettings
\fi
}
% \end{macrocode}
% The definition of |\itemizeFB| follows the one of |\itemize|
% in standard \LaTeXe{} classes (see \file{ltlists.dtx}),
% spaces are customised by |\FB@itemizesettings|.
%
% \begin{macrocode}
\def\itemizeFB{%
\ifnum \@itemdepth >\thr@@\@toodeep\else
\advance\@itemdepth\@ne
\edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
\expandafter
\listORI
\csname\@itemitem\endcsname
\FB@itemizesettings
\fi
}
\let\enditemizeFB\endlistORI
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macrocode}
\def\labelitemsFB{%
\let\labelitemi\Frlabelitemi
\let\labelitemii\Frlabelitemii
\let\labelitemiii\Frlabelitemiii
\let\labelitemiv\Frlabelitemiv
\ifdim\labelwidthFB<\z@
\settowidth{\labelwidthFB}{\FrenchLabelItem}%
\fi
\ifdim\listindentFB<\z@
\ifdim\parindent=\z@
\setlength{\listindentFB}{1.5em}%
\else
\setlength{\listindentFB}{\parindent}%
\fi
\fi
}
% \end{macrocode}
%
% \begin{macro}{\enumerateFB}
% The definition of |\enumerateFB|, new to version~2.6a, follows
% the one of |\enumerate| in standard \LaTeXe{} classes (see
% \file{ltlists.dtx}), vertical spaces are customised (or not)
% via |\list| (=|\listFB| or |\listORI|) and horizontal spaces
% (leftmargins) are borrowed from |itemize| lists via
% |\FB@listHsettings|.
%
% \begin{macrocode}
\def\enumerateFB{%
\ifnum \@enumdepth >\thr@@\@toodeep\else
\advance\@enumdepth\@ne
\edef\@enumctr{enum\romannumeral\the\@enumdepth}%
\expandafter
\list
\csname label\@enumctr\endcsname
{\FB@listHsettings
\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}%
\fi
}
\let\endenumerateFB\endlistORI
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\descriptionFB}
% \changes{v2.6b}{2013/02/10}{Settings of \cs{FB@listHsettings} should
% apply to description lists too.}
%
% \changes{v3.0a}{2014/02/28}{Add \cs{listindentFB} to
% \cs{itemindent}. Suggested by Denis Bitouzé.}
%
% Same tuning for the \env{description} environment (see the
% original definition in \file{classes.dtx}). Customisable
% |\listindentFB| added to |\itemindent| (first level only).
%
% \begin{macrocode}
\def\descriptionFB{%
\list{}{\FB@listHsettings
\labelwidth\z@
\itemindent-\leftmargin
\ifnum\@listdepth=1
\advance\itemindent by \listindentFB
\fi
\let\makelabel\descriptionlabel}%
}
\let\enddescriptionFB\endlistORI
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\update@frenchlists}
% \begin{macro}{\bbl@frenchlistlayout}
% \begin{macro}{\bbl@nonfrenchlistlayout}
% |\update@frenchlists| will set up lists according to the options
% of \fbsetup{}.
% \begin{macrocode}
\def\update@frenchlists{%
\ifFBReduceListSpacing \let\list\listFB \fi
\ifFBStandardItemizeEnv
\else \let\itemize\itemizeFB \fi
\ifFBStandardItemLabels
\else \labelitemsFB \fi
\ifFBStandardEnumerateEnv
\else \let\enumerate\enumerateFB \let\description\descriptionFB \fi
}
% \end{macrocode}
% In order to ensure compatibility with packages customising lists,
% the command |\update@frenchlists| should not be included in
% |\extrasfrench| yet, so we also define |\FB@ufl| as |\relax|,
% it will be redefined as |\update@frenchlists| in due time
% `AtBeginDocument' by |\FBprocess@options|,
% see p.~\pageref{FB@ufl}.
% \begin{macrocode}
\def\FB@ufl{\relax}
\def\bbl@frenchlistlayout{%
\ifFBGlobalLayoutFrench
\else
\babel@save\list \babel@save\itemize
\babel@save\enumerate \babel@save\description
\babel@save\labelitemi \babel@save\labelitemii
\babel@save\labelitemiii \babel@save\labelitemiv
\fi
\FB@ufl
}
\def\bbl@nonfrenchlistlayout{%
\ifFBGlobalLayoutFrench
\update@frenchlists
\fi
}
\FB@addto{extras}{\bbl@frenchlistlayout}
\FB@addto{noextras}{\bbl@nonfrenchlistlayout}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{French indentation of sections}
% \label{ssec-indent}
%
% \begin{macro}{\bbl@frenchindent}
% \begin{macro}{\bbl@nonfrenchindent}
% In French the first paragraph of each section should be indented,
% this is another difference with US-English. This is controlled
% by the flag |\if@afterindent|.
%
% \changes{v2.3d}{2009/03/16}{Bug correction: previous versions of
% frenchb set the flag \cs{if@afterindent} to false outside
% French which is correct for English but wrong for some languages
% like Spanish. Pointed out by Juan José Torrens.}
%
% We will need to save the value of the flag |\if@afterindent|
% `AtBeginDocument' before eventually changing its value.
%
% \begin{macrocode}
\def\bbl@frenchindent{%
\ifFBGlobalLayoutFrench\else\babel@save\@afterindentfalse\fi
\ifFBIndentFirst
\let\@afterindentfalse\@afterindenttrue
\@afterindenttrue
\fi}
\def\bbl@nonfrenchindent{%
\ifFBGlobalLayoutFrench
\ifFBIndentFirst
\@afterindenttrue
\fi
\fi}
\FB@addto{extras}{\bbl@frenchindent}
\FB@addto{noextras}{\bbl@nonfrenchindent}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Formatting footnotes}
% \label{ssec-footnotes}
%
% \changes{v2.0}{2006/11/06}{Footnotes are now printed
% by default `à la française' for the whole document.}
%
% \changes{v2.0b}{2007/04/18}{Footnotes: Just do nothing
% (except warning) when the bigfoot package is loaded.}
%
% The \pkg{bigfoot} package deeply changes the way footnotes are
% handled. When \file{bigfoot} is loaded, we just warn the user
% that \frenchb{} will drop the customisation of footnotes.
%
% The layout of footnotes is controlled by two flags
% |\ifFBAutoSpaceFootnotes| and |\ifFBFrenchFootnotes| which are
% set by options of \fbsetup{} (see section~\ref{ssec-keyval}).
% The layout of footnotes \emph{does not depend} on the current
% language (just think of two footnotes on the same page looking
% different because one was called in a French part, the other one
% in English!).
%
% We save the original definition of |\@footnotemark| at the
% |\begin{document}| in order to include any customisation that
% packages might have done; we define a variant |\@footnotemarkFB|
% which just adds a thin space before the number or symbol calling
% a footnote (any space typed in is removed first). The choice
% between the two definitions (valid for the whole document) is
% controlled by flag |\ifFBAutoSpaceFootnotes|.
%
% \changes{v2.4a}{2009/11/23}{\cs{PackageWarning} changed to
% \cs{FBWarning} (when bigfoot package in use).}
%
% \begin{macrocode}
\AtBeginDocument{\@ifpackageloaded{bigfoot}%
{\PackageInfo{frenchb.ldf}%
{bigfoot package in use.\MessageBreak
frenchb will NOT customise footnotes;\MessageBreak
reported}}%
{\let\@footnotemarkORI\@footnotemark
\def\@footnotemarkFB{\leavevmode\unskip\unkern
\,\@footnotemarkORI}%
\ifFBAutoSpaceFootnotes
\let\@footnotemark\@footnotemarkFB
\fi}%
}
% \end{macrocode}
%
% We then define |\@makefntextFB|, a variant of |\@makefntext|
% which is responsible for the layout of footnotes, to match the
% specifications of the French `Imprimerie Nationale': footnotes
% will be indented by |\parindentFFN|, numbers (if any) typeset on
% the baseline (instead of superscripts), right aligned on
% |\parindentFFN| and followed by a dot and an half quad kern.
% Whenever symbols are used to number footnotes (as in |\thanks|
% for instance), we switch back to the standard layout (the French
% layout of footnotes is meant for footnotes numbered by arabic or
% roman digits).
%
% \changes{v2.0}{2006/11/06}{\cs{parindentFFN} not changed if
% already defined (required by JA for cah-gut.cls).}
%
% \changes{v2.3b}{2008/12/06}{New commands \cs{dotFFN} and
% \cs{kernFFN} for more flexibility (suggested by JA).}
%
% \changes{v3.2a}{2016/03/14}{beamer.cls requires a specific
% definition of \cs{@makefntextFB} (pointed out by DB).
% The same is true for memoir and koma-script classes (done).}
%
% The value of |\parindentFFN| will be redefined at the
% |\begin{document}|, as the maximum of |\parindent| and 1.5em
% \emph{unless} it has been set in the preamble (the weird value
% 10in is just for testing whether |\parindentFFN| has been set
% or not).
% \begin{macrocode}
\newdimen\parindentFFN
\parindentFFN=10in
% \end{macrocode}
% |\FBfnindent| will be set `AtBeginDocument' to the width of
% the box holding the footnote mark, |\dotFFN| and |\kernFFN|
% (flushed right). It is used by \cls{memoir} and koma-script
% classes.
% \begin{macrocode}
\newcommand*{\dotFFN}{.}
\newcommand*{\kernFFN}{\kern .5em}
\newlength\FBfnindent
% \end{macrocode}
% |\@makefntextFB|'s definition is now tuned according to the
% document's class for better compatibility.
%
% Koma-script classes provide |\deffootnote|, a handy command
% to customise the footnotes' layout (see English manual
% \file{scrguien.pdf}); it redefines |\@makefntext| and
% |\@@makefnmark|. First, save the original definitions.
% \begin{macrocode}
\ifFB@koma
\let\@makefntextORI\@makefntext
\let\@@makefnmarkORI\@@makefnmark
% \end{macrocode}
% |\@makefntextFB| and |\@@makefnmarkFB| will be used when option
% \fbo{FrenchFootnotes} is \fbo{true}.
% \begin{macrocode}
\deffootnote[\FBfnindent]{0pt}{\parindentFFN}%
{\thefootnotemark\dotFFN\kernFFN}
\let\@makefntextFB\@makefntext
\let\@@makefnmarkFB\@@makefnmark
% \end{macrocode}
% |\@makefntextTH| and |\@@makefnmarkTH| are meant for the
% |\thanks| command used by |\maketitle| when \fbo{FrenchFootnotes}
% is \fbo{true}.
% \begin{macrocode}
\deffootnote[\parindentFFN]{0pt}{\parindentFFN}%
{\textsuperscript{\thefootnotemark}}
\let\@makefntextTH\@makefntext
\let\@@makefnmarkTH\@@makefnmark
% \end{macrocode}
% Restore the original definitions.
% \begin{macrocode}
\let\@makefntext\@makefntextORI
\let\@@makefnmark\@@makefnmarkORI
\fi
% \end{macrocode}
% Definitions for the \cls{memoir} class:
% \begin{macrocode}
\@ifclassloaded{memoir}
% \end{macrocode}
% (see original definition in \file{memman.pdf})
% \begin{macrocode}
{\newcommand{\@makefntextFB}[1]{%
\def\footscript##1{##1\dotFFN\kernFFN}%
\setlength{\footmarkwidth}{\FBfnindent}%
\setlength{\footmarksep}{-\footmarkwidth}%
\setlength{\footparindent}{\parindentFFN}%
\makefootmark #1}%
}{}
% \end{macrocode}
% Definitions for the \cls{beamer} class:
% \begin{macrocode}
\@ifclassloaded{beamer}
% \end{macrocode}
% (see original definition in \file{beamerbaseframecomponents.sty}),
% note that for the \cls{beamer} class footnotes are LR-boxes, not
% paragraphs, so |\parindentFFN| is irrelevant.
% class.
% \begin{macrocode}
{\def\@makefntextFB#1{%
\def\insertfootnotetext{#1}%
\def\insertfootnotemark{\insertfootnotemarkFB}%
\usebeamertemplate***{footnote}}%
\def\insertfootnotemarkFB{%
\usebeamercolor[fg]{footnote mark}%
\usebeamerfont*{footnote mark}%
\@thefnmark\dotFFN\kernFFN}%
}{}
% \end{macrocode}
% Now the default definition of |\@makefntextFB| for standard LaTeX
% and AMS classes.
%
% The next command prints the footnote mark according to the
% specifications of the French `Imprimerie Nationale'.
% Keep in mind that |\@thefnmark| might be empty (i.e.\ in
% AMS classes' titles)!
% \begin{macrocode}
\providecommand*{\insertfootnotemarkFB}{%
\parindent=\parindentFFN
\rule\z@\footnotesep
\setbox\@tempboxa\hbox{\@thefnmark}%
\ifdim\wd\@tempboxa>\z@
\llap{\@thefnmark}\dotFFN\kernFFN
\fi}
\providecommand\@makefntextFB[1]{\insertfootnotemarkFB #1}
% \end{macrocode}
%
% The rest of |\@makefntext|'s customisation is done at the
% |\begin{document}|. We save the original definition of
% |\@makefntext|, and then redefine |\@makefntext| according
% to the value of flag |\ifFBFrenchFootnotes| (true or false).
% Koma-script classes require a special treatment.
%
% \begin{macrocode}
\AtBeginDocument{%
\@ifpackageloaded{bigfoot}{}%
{\ifdim\parindentFFN<10in
\else
\parindentFFN=\parindent
\ifdim\parindentFFN<1.5em \parindentFFN=1.5em \fi
\fi
\settowidth{\FBfnindent}{\dotFFN\kernFFN}%
\addtolength{\FBfnindent}{\parindentFFN}%
\let\@makefntextORI\@makefntext
\ifFB@koma
% \end{macrocode}
% Definition of |\@makefntext| for koma-script classes:
% \begin{macrocode}
\let\@@makefnmarkORI\@@makefnmark
\long\def\@makefntext#1{%
\ifFBFrenchFootnotes
\ifx\footnote\thanks
\let\@@makefnmark\@@makefnmarkTH
\@makefntextTH{#1}%
\else
\let\@@makefnmark\@@makefnmarkFB
\@makefntextFB{#1}%
\fi
\else
\let\@@makefnmark\@@makefnmarkORI
\@makefntextORI{#1}%
\fi}%
\else
% \end{macrocode}
% Special add-on for the \cls{memoir} class: |\maketitle| redefines
% |\@makefntext| as |\makethanksmark| which is customised as follows
% to match the other notes' vertical alignment.
% \begin{macrocode}
\@ifclassloaded{memoir}%
{\ifFBFrenchFootnotes
\setlength{\thanksmarkwidth}{\parindentFFN}%
\setlength{\thanksmarksep}{-\thanksmarkwidth}%
\fi
}{}%
% \end{macrocode}
% Special add-on for the \cls{beamer} class: issue a warning
% in case |\parindentFFN| has been changed.
% \begin{macrocode}
\@ifclassloaded{beamer}%
{\ifFBFrenchFootnotes
\ifdim\parindentFFN=1.5em\else
\FBWarning{frenchb}{%
\protect\parindentFFN\space is ineffective%
\MessageBreak within the beamer class.\MessageBreak
Reported}%
\fi
\fi
}{}%
% \end{macrocode}
% Definition of |\@makefntext| for all classes other than
% koma-script:
% \begin{macrocode}
\long\def\@makefntext#1{%
\ifFBFrenchFootnotes
\@makefntextFB{#1}%
\else
\@makefntextORI{#1}%
\fi}%
\fi
}%
}
% \end{macrocode}
%
% For compatibility reasons, we provide definitions for the commands
% dealing with the layout of footnotes in \frenchb{} version~1.6.
% \fbsetup{} (see in section \ref{ssec-keyval}) should be
% preferred for setting these options. |\StandardFootnotes| may
% still be used locally (in minipages for instance), that's why the
% test |\ifFBFrenchFootnotes| is done inside |\@makefntext|.
% \begin{macrocode}
\newcommand*{\AddThinSpaceBeforeFootnotes}{\FBAutoSpaceFootnotestrue}
\newcommand*{\FrenchFootnotes}{\FBFrenchFootnotestrue}
\newcommand*{\StandardFootnotes}{\FBFrenchFootnotesfalse}
% \end{macrocode}
%
% \subsection{Clean up and exit}
%
% \changes{v3.0a}{2014/02/20}{french.cfg will be loaded (if found)
% instead of frenchb.cfg. NO NEED for .cfg files in French anyway.}
%
% \changes{v3.1h}{2015/08/19}{french.cfg from e-french conflicts with
% frenchb. Do NOT load it (no need for .cfg files with frenchb
% anyway).}
%
% Final cleaning.
% The macro |\ldf@finish| takes care for setting the main language
% to be switched on at |\begin{document}| and resetting the
% category code of \texttt{@} to its original value. |\loadlocalcfg|
% is redefined locally in order not to load any \file{.cfg} file for
% French.
% \begin{macrocode}
\FBclean@on@exit
\let\FB@llc\loadlocalcfg
\let\loadlocalcfg\@gobble
\ldf@finish\CurrentOption
\let\loadlocalcfg\FB@llc
% \end{macrocode}
% \iffalse
%</ldf>
%<*dtx>
% \fi
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%%
% \iffalse
%</dtx>
% \fi
%
% \Finale
\endinput
|