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

\usepackage[svgnames]{xcolor}
\usepackage{textcomp}
\usepackage[cache, langlinenos]{minted}

\usepackage{environ}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{hyperref}

\newcommand{\env}[1]{\texttt{#1}}

\makeatletter
% The typesetting for macrocode doesn't use \@noligs, which upquote modifies.
% So apply the upquote fix to \verbatim@nolig@list as well, which is in macrocode.
\begingroup
\catcode`'=\active
\catcode``=\active
\g@addto@macro\verbatim@nolig@list{%
  \let'\textquotesingle
  \let`\textasciigrave
  \ifx\encodingdefault\upquote@OTone
  \ifx\ttdefault\upquote@cmtt
    \def'{\char13 }%
    \def`{\char18 }%
  \fi\fi}
\endgroup

% Create a short verbatim pipe that handles quotation marks properly
\begingroup
\catcode`\|=\active
\gdef\pipe@active@verbatim{%
  \begingroup
  \let\do\@makeother\dospecials
  \catcode`\|=\active
  \catcode`\`=\active
  \catcode`\'=\active
  \catcode`\<=\active
  \catcode`\>=\active
  \catcode`\-=\active
  \catcode`\,=\active
  \catcode`\ =\active
  \pipe@active@verbatim@i}
\gdef\pipe@active@verbatim@i#1|{%
  \endgroup
  \begingroup
  \def\FV@SV@pipe@active@verbatim{%
    \FV@Gobble
    \expandafter\FV@ProcessLine\expandafter{#1}}%
  %\let\FV@BeginVBox\relax
  %\let\FV@EndVBox\relax
  %\def\FV@BProcessLine##1{\FancyVerbFormatLine{##1}}%
  \BUseVerbatim{pipe@active@verbatim}%
  \endgroup}
\AtBeginDocument{\let|\pipe@active@verbatim}
\endgroup

\newcommand{\changestext}{}
\NewEnviron{changelog}[2]{%
    \g@addto@macro\changestext{\item[#1] (#2) \begin{itemize}}%
    \expandafter\g@addto@macro\expandafter\changestext\expandafter{\BODY}%
    \g@addto@macro\changestext{\end{itemize}}%
}
\newcommand{\PrintChangelog}{%
    \section*{Version History}%
    \addcontentsline{toc}{section}{Version History}
    \label{sec:version-history}
    \begin{description}%
    \changestext
    \end{description}%
}

\def\MacroFont{%
  \fontencoding\encodingdefault%
  \fontfamily\ttdefault%
  \fontseries\mddefault%
  \fontshape\updefault%
  \small}

\definecolor{minted@mint}{HTML}{0B610B}
\definecolor{minted@samplebg}{HTML}{F0F0E0}
\colorlet{minted@linkcolor}{minted@mint}
%
\def\PrintDescribeMacro#1{\strut \MacroFont\textcolor{minted@linkcolor}{\string #1\ }}
\let\PrintDescribeEnv\PrintDescribeMacro
\let\PrintMacroName\PrintDescribeMacro
\let\PrintEnvName\PrintDescribeEnv
\def\theCodelineNo{\textcolor{minted@linkcolor}{\sffamily\footnotesize\oldstylenums{\arabic{CodelineNo}}}}
%
\hypersetup{
  pdftitle=The minted package: Highlighted source code in LaTeX,
  pdfauthor=Geoffrey M. Poore,
  pdfsubject={Minted LaTeX package manual},
  colorlinks=true,
  allcolors=minted@linkcolor,
}
%
% Shamelessly stolen from http://blog.karssen.org/2009/11/15/a-latex-example-environment/
\newenvironment{example}
  {\VerbatimEnvironment
   \begin{VerbatimOut}[gobble=3]{example.out}}
  {\end{VerbatimOut}%
   \vspace{1ex}%
   \setlength{\parindent}{0pt}%
   \fbox{\begin{minipage}{0.5\linewidth}%
     \inputminted[resetmargins]{latex}{example.out}%
   \end{minipage}%
   \hspace{0.05\linewidth}%
   \begin{minipage}{0.45\linewidth-2\fboxsep}%
     \input{example.out}%
   \end{minipage}%
   \vspace{1ex}}}

\newenvironment{longexample}
  {\VerbatimEnvironment
   \begin{VerbatimOut}[gobble=3]{example.out}}
  {\end{VerbatimOut}%
   \vspace{1ex}%
   \setlength{\parindent}{0pt}%
   \fbox{\begin{minipage}{\linewidth-2\fboxsep}%
     \inputminted[resetmargins]{latex}{example.out}%
     ~\hrulefill~
     \input{example.out}%
   \end{minipage}%
   \vspace{1ex}}}

\def\minted@printopt#1(#2) (#3){%
  \vspace{0.1in}%
  \leavevmode%
  \marginpar{\raggedleft\texttt{\textcolor{minted@linkcolor}{\small #1}}\ }%
  \kern-\parindent\textsf{(#2)}\hfill(default: \texttt{#3})\\}

\newenvironment{optionlist}%
 {%
  ~\par\vspace{-14pt}%
  \def\pipechar{|}
  \let\|\pipechar
  \newcommand*\mintednext{}%
  \renewcommand*\item[1][]{%
    \mintednext%
    \renewcommand*\mintednext{\par}%
    \minted@printopt##1%
    \ignorespaces}}
 {%
  \par}

\edef\hashchar{\string#}
\makeatother

\newcommand{\hide}[1]{}

\setlength{\parindent}{0pt}
\addtolength{\parskip}{0.5\baselineskip}

\def\warn{\textcolor{red}{\large\textbf{\textsf{WARNING}}}}

\begin{document}
\DocInput{minted.dtx}
\PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{2548}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
%
%
% \begin{changelog}{v2.7}{2022/12/12}
% \item Reimplemented \texttt{\string\mintinline} to use \texttt{fvextra}'s argument reading and processing macros, and to use \texttt{fvextra}'s \texttt{\string\Verb} internally.  \texttt{\string\mintinline} now works with all line breaking options supported by \texttt{fvextra}'s \texttt{\string\Verb}, including \texttt{breakanywhere} (\#329, \#340).  It now gives better results when used inside other commands, since it uses \texttt{fvextra}'s retokenization macros.  It is now compatible with \texttt{hyperref} for PDF strings such as bookmarks.
% \item Reimplemented \texttt{\string\newmintinline} based on new \texttt{\string\mintinline}.
% \item Reimplemented \texttt{\string\mint} to use \texttt{fvextra}'s argument reading and processing macros.  It now gives better results when used inside other commands, since it uses \texttt{fvextra}'s retokenization macros.  Fixed a bug that caused a continued paragraph after \texttt{\string\mint} to be indented (\#218).
% \item Reimplemented \texttt{\string\newmint} based on new \texttt{\string\mint}.  Commands created with \texttt{\string\newmint} can now use curly braces as delimiters, just like \texttt{\string\mint} (\#254).
% \item Settings passed to \Verb{pygmentize} as command-line options are now quoted.  This prevents \Verb{escapeinside} characters from being interpreted as special shell characters (\#179, \#262).
% \item Fixed bug with \texttt{autogobble} that produced incorrect dedent when using \texttt{lastline} with the lines beyond \texttt{lastline} having less indentation than the selected range (\#326).
% \item Fixed unintended line breaks after hyphens under LuaTeX (\#263).
% \item Added warning to documentation of \Verb{\inputminted} regarding filenames and shell command execution (\#338).
% \end{changelog}
%
%
% \begin{changelog}{v2.6}{2021/12/24}
% \item \texttt{autogobble} automatically uses \texttt{python} or \texttt{python3} executables, depending on availability, instead of requiring \texttt{python}.  A custom executable can be specified by redefining \texttt{\string\MintedPython} (\#277, \#287).
% \item Fixed \texttt{autogobble} compatibility with \texttt{fancyvrb} 4.0+ (\#315, \#316).
% \item Pygments style names may now contain arbitrary non-whitespace characters.  Previously, style names containing digits and some punctuation characters were incompatible (\#210, \#294, \#299, \#317).  Pygments macros are now only defined just before use locally within \texttt{minted} commands and environments, rather than globally.  Pygments macros now always use a \texttt{\string\PYG} prefix regardless of style, rather than a prefix of the form \texttt{\string\PYG<style>} (for example, what was previously \texttt{\string\PYGdefault} is now simply \texttt{\string\PYG}).
% \item Removed Python-based MD5 hashing for XeTeX, which was necessary before XeTeX added \texttt{\string\mdfivesum} in 2017.
% \item The default for \texttt{stripnl} is now \texttt{false}, so that original code is preserved exactly by default (\#198).
% \item Added support for \texttt{fontencoding} option from \texttt{fvextra} (\#208).
% \item Added note to FAQ about getting \texttt{texi2pdf} to work with \texttt{minted} given \texttt{texi2pdf}'s assumptions about temp files (\#186).
% \item Reimplemented \texttt{bgcolor} option to be compatible with \texttt{color} package.
% \end{changelog}
%
%
% \begin{changelog}{v2.5}{2017/07/19}
% \item The default placement for the \texttt{listing} float is now \texttt{tbp} instead of \texttt{h}, to parallel \texttt{figure} and \texttt{table} and also avoid warnings caused by \texttt{h} (\#165).  The documentation now contains information about changing default placement.  The \texttt{float} package is no longer loaded when the \texttt{newfloat} package option is used.
% \item Added support for \texttt{*nchars} options from \texttt{fvextra} v1.3 that allow setting \texttt{breaklines}-related indentation in terms of a number of characters, rather than as a fixed dimension.
% \item Fixed incompatibility with \texttt{babel magyar} (\#158).
% \item Added support for \texttt{beamer} overlays with \texttt{beameroverlays} option (\#155).
% \item Comments in the Pygments \LaTeX\ style files no longer appear as literal text when \texttt{minted} is used in \texttt{.dtx} files (\#161).
% \item \texttt{autogobble} now works with package option \texttt{kpsewhich} (\#151).  Under Windows, the \texttt{kpsewhich} option no longer requires PowerShell.
% \item Fixed a bug that prevented \texttt{finalizecache} from working with \texttt{outputdir} (\#149).
% \item Fixed a bug with \texttt{firstline} and \texttt{lastline} that prevented them from working with the \texttt{minted} environment (\#145).
% \item Added note on \texttt{breqn} conflicts to FAQ (\#163).
% \end{changelog}
%
%
% \begin{changelog}{v2.4.1}{2016/10/31}
% \item Single quotation marks in \texttt{\string\jobname} are now replaced with underscores in \texttt{\string\minted@jobname} to prevent quoting errors (\#137).
% \item The \texttt{autogobble} option now takes \texttt{firstline} and \texttt{lastline} into account (\#130).
% \item Fixed \texttt{numberblanklines}, which had been lost in the transition to v2.0+ (\#135).
% \end{changelog}
%
%
% \begin{changelog}{v2.4}{2016/07/20}
% \item Line breaking and all associated options are now completely delegated to \texttt{fvextra}.
% \item Fixed a bug from v2.2 that could cause the first command or environment to vanish when \texttt{cache=false} (related to work on \texttt{\string\MintedPygmentize}).
% \end{changelog}
%
%
% \begin{changelog}{v2.3}{2016/07/14}
% \item The \texttt{fvextra} package is now required.  \texttt{fvextra} extends and patches \texttt{fancyvrb}, and includes improved versions of \texttt{fancyvrb} extensions that were formerly in \texttt{minted}.
% \item As part of \texttt{fvextra}, the \texttt{upquote} package is always loaded.  \texttt{fvextra} brings the new option \texttt{curlyquotes}, which allows curly single quotation marks instead of the literal backtick and typewriter single quotation mark produced by \texttt{upquote}.  This allows the default \texttt{upquote} behavior to be disabled when desired.
% \item Thanks to \texttt{fvextra}, the options \texttt{breakbefore}, \texttt{breakafter}, and \texttt{breakanywhere} are now compatible with non-ASCII characters under pdfTeX (\#123).
% \item Thanks to \texttt{fvextra}, \texttt{obeytabs} no longer causes lines in multi-line comments or strings to vanish (\#88), and is now compatible with \texttt{breaklines} (\#99).  \texttt{obeytabs} will now always give correct results with tabs used for indentation.  However, tab stops are not guaranteed to be correct for tabs in the midst of text.
% \item \texttt{fvextra} brings the new options \texttt{space}, \texttt{spacecolor}, \texttt{tab}, and \texttt{tabcolor} that allow these characters and their colors to be redefined (\#98).  The tab may now be redefined to a flexible-width character such as \texttt{\string\rightarrowfill}.  The visible tab will now always be black by default, instead of changing colors depending on whether it is part of indentation for a multiline string or comment.
% \item \texttt{fvextra} brings the new options \texttt{highlightcolor} and \texttt{highlightlines}, which allow single lines or ranges of lines to be highlighted based on line number (\#124).
% \item \texttt{fvextra} brings the new options \texttt{numberfirstline}, \texttt{stepnumberfromfirst}, and \texttt{stepnumberoffsetvalues} that provide better control over line numbering when \texttt{stepnumber} is not 1.
% \item Fixed a bug from v2.2.2 that prevented \texttt{upquote} from working.
% \end{changelog} 
%
%
% \begin{changelog}{v2.2.2}{2016/06/21}
% \item Fixed a bug introduced in v2.2 that prevented setting the Pygments style in the preamble.  Style definitions are now more compatible with using \texttt{\string\MintedPygmentize} to call a custom \texttt{pygmentize}.
% \end{changelog}
%
%
% \begin{changelog}{v2.2.1}{2016/06/15}
% \item The \texttt{shellesc} package is loaded before \texttt{ifplatform} and other packages that might invoke \texttt{\string\write18} (\#112).
% \item When caching is enabled, XeTeX uses the new \texttt{\string\mdfivesum} macro from TeX Live 2016 to hash cache content, rather than using \texttt{\string\ShellEscape} with Python to perform hashing.
% \end{changelog}
%
%
% \begin{changelog}{v2.2}{2016/06/08}
% \item All uses of \texttt{\string\ShellEscape} (\texttt{\string\write18}) no longer wrap file names and paths with double quotes.  This allows a cache directory to be specified relative to a user's home directory, for example, \texttt{\string~/minted\_cache}.  \texttt{cachedir} and \texttt{outputdir} paths containing spaces will now require explicit quoting of the parts of the paths that contain spaces, since \texttt{minted} no longer supplies quoting.  See the updated documentation for examples (\#89).
% \item Added \texttt{breakbefore}, \texttt{breakbeforegroup}, \texttt{breakbeforesymbolpre}, and \texttt{breakbeforesymbolpost}.  These parallel \texttt{breakafter*}.  It is possible to use \texttt{breakbefore} and \texttt{breakafter} for the same character, so long as \texttt{breakbeforegroup} and \texttt{breakaftergroup} have the same setting (\#117).
% \item Added package options \texttt{finalizecache} and \texttt{frozencache}.  These allow the cache to be prepared for (\texttt{finalizecache}) and then used (\texttt{frozencache}) in an environment in which \texttt{-shell-escape}, Python, and/or Pygments are not available.  Note that this only works if \texttt{minted} content does not need to be modified, and if no settings that depend on Pygments or Python need to be changed (\#113).
% \item Style names containing hyphens and underscores (\texttt{paraiso-light}, \texttt{paraiso-dark}, \texttt{algol\_nu}) now work (\#111).
% \item The \texttt{shellesc} package is now loaded, when available, for compatibility with LuaTeX 0.87+ (TeX Live 2016+, etc.).  \texttt{\string\ShellEscape} is now used everywhere instead of \texttt{\string\immediate\string\write18}.  If \texttt{shellesc} is not available, then a \texttt{\string\ShellEscape} macro is created.  When \texttt{shellesc} is loaded, there is a check for versions before v0.01c to patch a bug in v0.01b (present in TeX Live 2015) (\#112).
% \item The \texttt{bgcolor} option now uses the \texttt{snugshade*} environment from the \texttt{framed} package, so \texttt{bgcolor} is now compatible with page breaks.  When \texttt{bgcolor} is in use, immediately preceding text will no longer push the \texttt{minted} environment into the margin, and there is now adequate spacing from surrounding text (\#121).
% \item Added missing support for \texttt{fancyvrb}'s \texttt{labelposition} (\#102).
% \item Improved fix for TikZ externalization, thanks to Patrick Vogt (\#73).
% \item Fixed \texttt{breakautoindent}; it was disabled in version 2.1 due to a bug in \texttt{breakanywhere}.
% \item Properly fixed handling of \texttt{\string\MintedPygmentize} (\#62).
% \item Added note on incompatibility of \texttt{breaklines} and \texttt{obeytabs} options.  Trying to use these together will now result in a package error (\#99).  Added note on issues with \texttt{obeytabs} and multiline comments (\#88).  Due to the various \texttt{obeytabs} issues, the docs now discourage using \texttt{obeytabs}.
% \item Added note to FAQ on \texttt{fancybox} and \texttt{fancyvrb} conflict (\#87).
% \item Added note to docs on the need for \texttt{\string\VerbatimEnvironment} in environment definitions based on \texttt{minted} environments.
% \end{changelog}
%
%
% \begin{changelog}{v2.1}{2015/09/09}
% \item Changing the highlighting style now no longer involves re-highlighing code.  Style may be changed with almost no overhead.
% \item Improved control of automatic line breaks.  New option \texttt{breakanywhere} allows line breaks anywhere when \texttt{breaklines=true}.  The pre-break and post-break symbols for these types of breaks may be set with \texttt{breakanywheresymbolpre} and \texttt{breakanywheresymbolpost} (\#79).  New option \texttt{breakafter} allows specifying characters after which line breaks are allowed.  Breaks between adjacent, identical characters may be controlled with \texttt{breakaftergroup}.  The pre-break and post-break symbols for these types of breaks may be set with \texttt{breakaftersymbolpre} and \texttt{breakaftersymbolpost}.
% \item \texttt{breakbytoken} now only breaks lines between tokens that are separated by spaces, matching the documentation.  The new option \texttt{breakbytokenanywhere} allows for breaking between tokens that are immediately adjacent.  Fixed a bug in \texttt{\string\mintinline} that produced a following linebreak when \texttt{\string\mintinline} was the first thing in a paragraph and \texttt{breakbytoken} was true (\#77).
% \item Fixed a bug in draft mode option handling for \texttt{\string\inputminted} (\#75).
% \item Fixed a bug with \texttt{\string\MintedPygmentize} when a custom \texttt{pygmentize} was specified and there was no \texttt{pygmentize} on the default path (\#62).
% \item Added note to docs on caching large numbers of code blocks under OS~X (\#78).
% \item Added discussion of current limitations of \texttt{texcomments} (\#66) and \texttt{escapeinside} (\#70).
% \item PGF/Ti\textit{k}Z externalization is automatically detected and supported (\#73).
% \item The package is now compatible with \LaTeX\ files whose names contain spaces (\#85).
% \end{changelog}
%
%
% \begin{changelog}{v2.0}{2015/01/31}
% \item Added the compatibility package \texttt{minted1}, which provides the \texpkg{minted} 1.7 code.  This may be loaded when 1.7 compatibility is required.  This package works with other packages that \texttt{\string\RequirePackage\{minted\}}, so long as it is loaded first.
% \item Moved all old \texttt{\string\changes} into \texttt{changelog}.
% \end{changelog}
%
%
% \begin{changelog}{Development releases for 2.0}{2014--January 2015}
% \item Caching is now on by default.
% \item Fixed a bug that prevented compiling under Windows when file names contained commas.
% \item Added \texttt{breaksymbolleft}, \texttt{breaksymbolsepleft}, \texttt{breaksymbolindentleft}, \texttt{breaksymbolright}, \texttt{breaksymbolsepright}, and \texttt{breaksymbolindentright} options.  \texttt{breaksymbol}, \texttt{breaksymbolsep}, and \texttt{breaksymbolindent} are now aliases for the correspondent \texttt{*left} options.
% \item Added \texttt{kpsewhich} package option. This uses \texttt{kpsewhich} to locate the files that are to be highlighted. This provides compatibility with build tools like \texttt{texi2pdf} that function by modifying \texttt{TEXINPUTS} (\#25).
% \item Fixed a bug that prevented \texttt{\string\inputminted} from working with \texttt{outputdir}.
% \item Added informative error messages when Pygments output is missing.
% \item Added \texttt{final} package option (opposite of \texttt{draft}).
% \item Renamed the default cache directory to \texttt{\_minted-<jobname>} (replaced leading period with underscore).  The leading period caused the cache directory to be hidden on many systems, which was a potential source of confusion.
% \item \texttt{breaklines} and \texttt{breakbytoken} now work with \texttt{\string\mintinline} (\#31).
% \item \texttt{bgcolor} may now be set through \texttt{\string\setminted} and \texttt{\string\setmintedinline}.
% \item When math is enabled via \texttt{texcomments}, \texttt{mathescape}, or \texttt{escapeinside}, space characters now behave as in normal math by vanishing, instead of appearing as literal spaces.  Math need no longer be specially formatted to avoid undesired spaces.
% \item In default value of \texttt{\string\listoflistingscaption}, capitalized ``Listings'' so that capitalization is consistent with default values for other lists (figures, tables, algorithms, etc.).
% \item Added \texttt{newfloat} package option that creates the \texttt{listing} environment using \texttt{newfloat} rather than \texttt{float}, thus providing better compatibility with the \texttt{caption} package (\#12).
% \item Added support for Pygments option \texttt{stripall}.
% \item Added \texttt{breakbytoken} option that prevents \texttt{breaklines} from breaking lines within Pygments tokens.
% \item \texttt{\string\mintinline} uses a \texttt{\string\colorbox} when \texttt{bgcolor} is set, to give more reasonable behavior (\#57).
% \item For PHP, \texttt{\string\mintinline} automatically begins with \texttt{startinline=true} (\#23).
% \item Fixed a bug that threw off line numbering in \texttt{minted} when \texttt{langlinenos=false} and \texttt{firstnumber=last}.  Fixed a bug in \texttt{\string\mintinline} that threw off subsequent line numbering when \texttt{langlinenos=false} and \texttt{firstnumber=last}.
% \item Improved behavior of \texttt{\string\mint} and \texttt{\string\mintinline} in \texttt{draft} mode.
% \item The \texttt{\string\mint} command now has the additional capability to take code delimited by paired curly braces \texttt{\{\}}.
% \item It is now possible to set options only for \texttt{\string\mintinline} using the new \texttt{\string\setmintedinline} command.  Inline options override options specified via \texttt{\string\setminted}.
% \item Completely rewrote option handling.  \texpkg{fancyvrb} options are now handled on the \LaTeX\ side directly, rather than being passed to Pygments and then returned.  This makes caching more efficient, since code is no longer rehighlighted just because \texpkg{fancyvrb} options changed.
% \item Fixed buffer size error caused by using \texttt{cache} with a very large number of files (\#61).
% \item Fixed \texttt{autogobble} bug that caused failure under some operating systems.
% \item Added support for \texttt{escapeinside} (requires Pygments 2.0+; \#38).
% \item Fixed issues with XeTeX and caching (\#40).
% \item The \texttt{upquote} package now works correctly with single quotes when using Pygments 1.6+ (\#34).
% \item Fixed caching incompatibility with Linux and OS X under xelatex (\#18 and \#42).
% \item Fixed \texttt{autogobble} incompatibility with Linux and OS X.
% \item \texttt{\string\mintinline} and derived commands are now robust, via \texttt{\string\newrobustcmd} from \texttt{etoolbox}.
% \item Unused styles are now cleaned up when caching.
% \item Fixed a bug that could interfere with caching (\#24).
% \item Added \texttt{draft} package option (\#39).  This typesets all code using \texttt{fancyvrb}; Pygments is not used.  This trades syntax highlighting for maximum speed in compiling.
% \item Added automatic line breaking with \texttt{breaklines} and related options (\#1).
% \item Fixed a bug with boolean options that needed a False argument to cooperate with \texttt{\string\setminted} (\#48).
% \end{changelog}
%
% \begin{changelog}{v2.0-alpha3}{2013/12/21}
% \item Added \texttt{autogobble} option.  This sends code through Python's \texttt{textwrap.dedent()} to remove common leading whitespace.
% \item Added package option \texttt{cachedir}.  This allows the directory in which cached content is saved to be specified.
% \item Added package option \texttt{outputdir}.  This allows an output directory for temporary files to be specified, so that the package can work with LaTeX's \texttt{-output-directory} command-line option.
% \item The \texttt{kvoptions} package is now required.  It is needed to process key-value package options, such as the new \texttt{cachedir} option.
% \item Many small improvements, including better handling of paths under Windows and improved key system.
% \end{changelog}
%
% \begin{changelog}{v2.0-alpha2}{2013/08/21}
% \item \texttt{\string\DeleteFile} now only deletes files if they do indeed exist.  This eliminates warning messages due to missing files.
% \item Fixed a bug in the definition of \texttt{\string\DeleteFile} for non-Windows systems.
% \item Added support for Pygments option \texttt{stripnl}.
% \item Settings macros that were previously defined globally are now defined locally, so that \texttt{\string\setminted} may be confined by \texttt{\string\begingroup...\string\endgroup} as expected.
% \item Macro definitions for a given style are now loaded only once per document, rather than once per command/environment.  This works even without caching.
% \item A custom script/executable may now be substituted for \texttt{pygmentize} by redefining \texttt{\string\MintedPygmentize}.
% \end{changelog}
%
%
% \begin{changelog}{v2.0alpha}{2013/07/30}
% \item Added the package option \texttt{cache}.  This significantly increases compilation speed by caching old output.  For example, compiling the documentation is around 5x faster.
% \item New inline command \texttt{\string\mintinline}.  Custom versions can be created via \texttt{\string\newmintinline}.  The command works inside other commands (for example, footnotes) in most situations, so long as the percent and hash characters are avoided.
% \item The new \texttt{\string\setminted} command allows options to be specified at the document and language levels.
% \item All extended characters (Unicode, etc.) supported by \texttt{inputenc} now work under the pdfTeX engine.  This involved using \texttt{\string\detokenize} on everything prior to saving.
% \item New package option \texttt{langlinenos} allows line numbering to pick up where it left off for a given language when \texttt{firstnumber=last}.
% \item New options, including \texttt{style}, \texttt{encoding}, \texttt{outencoding}, \texttt{codetagify}, \texttt{keywordcase}, \texttt{texcomments} (same as \texttt{texcl}), \texttt{python3} (for the \texttt{PythonConsoleLexer}), and \texttt{numbers}.
% \item \texttt{\string\usemintedstyle} now takes an optional argument to specify the style for a particular language, and works anywhere in the document.
% \item \texttt{xcolor} is only loaded if \texttt{color} isn't, preventing potential package clashes.
% \end{changelog}
%
%
% \begin{changelog}{1.7}{2011/09/17}
% \item Options for float placement added [2011/09/12]
% \item Fixed \texttt{tabsize} option [2011/08/30]
% \item More robust detection of the \texttt{-shell-escape} option [2011/01/21]
% \item Added the \texttt{label} option [2011/01/04]
% \item Installation instructions added [2010/03/16]
% \item Minimal working example added [2010/03/16]
% \item Added PHP-specific options [2010/03/14]
% \item Removed unportable flag from Unix shell command [2010/02/16]
% \end{changelog}
%
%
% \begin{changelog}{1.6}{2010/01/31}
% \item Added font-related options [2010/01/27]
% \item Windows support added [2010/01/27]
% \item Added command shortcuts [2010/01/22]
% \item Simpler versioning scheme [2010/01/22]
% \end{changelog}
%
%
% \begin{changelog}{0.1.5}{2010/01/13}
% \item Added \texttt{fillcolor} option [2010/01/10]
% \item Added float support [2010/01/10]
% \item Fixed \texttt{firstnumber} option [2010/01/10]
% \item Removed \texttt{caption} option [2010/01/10]
% \end{changelog}
%
%
% \begin{changelog}{0.0.4}{2010/01/08}
% \item Initial version [2010/01/08]
% \end{changelog}
%
%
% %\DoNotIndex{\newcommand,\newenvironment}
% %\DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ }
% %\DoNotIndex{\@ne}
% %\DoNotIndex{\advance,\begingroup,\catcode,\closein}
% %\DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup}
% %\DoNotIndex{\begin,\end,\bgroup,\egroup}
% %\DoNotIndex{\@namedef,\@nameuse,=,\csname,\endcsname}
%
%
% \GetFileInfo{minted.sty}
%
% \newcommand{\texpkg}[1]{\textsf{#1}}
% \newcommand{\app}[1]{\textsf{#1}}
%
% \title{The \textcolor{minted@mint}{\texpkg{minted}} package:\\Highlighted source code in \LaTeX}
% \author{Geoffrey M.\ Poore \\ \url{gpoore@gmail.com} \\ \href{https://github.com/gpoore/minted}{\texttt{github.com/gpoore/minted}} \\ ~\\ Originally created and maintained (2009--2013) by \\ Konrad Rudolph}
% \date{\fileversion~from \filedate}
%
% \maketitle
%
% \begin{abstract}
%   \noindent\texpkg{minted} is a package that facilitates expressive syntax highlighting
%   using the powerful \app{Pygments} library. The package also provides options to
%   customize the highlighted source code output.
% \end{abstract}
%
% \vspace{2in}
%
% \subsection*{License}
% \href{http://www.latex-project.org/lppl.txt}{LaTeX Project Public License (LPPL)} version 1.3.
%
% Additionally, the project may be distributed under the terms of the 3-Clause
% (``New'') BSD license:  \url{http://opensource.org/licenses/BSD-3-Clause}.
%
% \pagebreak
%
%   \tableofcontents
%
% \fvset{
%   codes={\catcode`\%=9}, ^^A Ignore initial |%|
%   numbersep=5pt,
% }
% \setlength{\fboxsep}{1ex}
%
% \mbox{}\newpage
% \section{Introduction}
%
%
%
% \texpkg{minted} is a package that allows formatting source code in \LaTeX.
% For example:
% \begin{VerbatimOut}[gobble=1]{minted.doc.out}
%   \begin{minted}{<language>}
%     <code>
%   \end{minted}
% \end{VerbatimOut}
% \inputminted[gobble=2,frame=lines]{latex}{minted.doc.out}
%
% will highlight a piece of code in a chosen language.
% The appearance can be customized with a number of options and color schemes.
%
% Unlike some other packages, most notably \texpkg{listings}, \texpkg{minted} requires
% the installation of additional software, \app{Pygments}.
% This may seem like a disadvantage, but there are also significant advantages.
%
% \app{Pygments} provides superior syntax highlighting compared to conventional packages.
% For example, \texpkg{listings} basically only highlights strings, comments and keywords.
% \app{Pygments}, on the other hand, can be completely customized to highlight any kind of token the
% source language might support.
% This might include special formatting sequences inside strings, numbers, different kinds of
% identifiers and exotic constructs such as HTML tags.
%
% Some languages make this especially desirable.
% Consider the following Ruby code as an extreme, but at the same time typical, example:
%
% \begin{minted}[gobble=3]{ruby}
%   class Foo
%     def init
%       pi = Math::PI
%       @var = "Pi is approx. #{pi}"
%     end
%   end
% \end{minted}
%
% Here we have four different colors for identifiers (five, if you count keywords) and escapes from
% inside strings, none of which pose a problem for \app{Pygments}.
%
% Additionally, installing \app{Pygments} is actually incredibly easy (see the next section).
%
%
% \section{Installation}
%
% \subsection{Prerequisites}
%
% \app{Pygments} is written in Python, so make sure that you have Python 2.6 or later installed on your system.  This may be easily checked from the command line:
%
% \begin{Verbatim}[gobble=3,commandchars=\\\{\}]
%   \$ python --version
%   Python 2.7.5
% \end{Verbatim}
%
% If you don't have Python installed, you can download it from the \href{http://www.python.org/download/}{Python website} or
% use your operating system's package manager.
%
% Some Python distributions include \texpkg{Pygments} (see some of the options under ``Alternative Implementations'' on the Python site).  Otherwise, you will need to install \texpkg{Pygments} manually. This may  be done by installing \href{http://pypi.python.org/pypi/setuptools}{\app{setuptools}}, which facilitates the distribution of Python applications.  You can then install \app{Pygments} using the following command:
% \begin{Verbatim}[gobble=3,commandchars=\\\{\}]
%   \$ sudo easy_install Pygments
% \end{Verbatim}
% Under Windows, you will not need the |sudo|, but may need to run the command prompt as administrator.  \texpkg{Pygments} may also be installed with |pip|:
% \begin{Verbatim}[gobble=3,commandchars=\\\{\}]
%   \$ pip install Pygments
% \end{Verbatim}
%
% If you already have \app{Pygments} installed, be aware that the latest version is recommended (at least 1.4 or later).  Some features, such as |escapeinside|, will only work with 2.0+.  \texpkg{minted} may work with versions as early as 1.2, but there are no guarantees.
%
%
% \subsection{Required packages}
%
% \texpkg{minted} requires that the following packages be available and reasonably up to date on your system.  All of these ship with recent \TeX\ distributions.
%
% \begin{multicols}{3}
% \begingroup
% \setlength\parskip{0pt}
% \setlength\topsep{0pt}
% \begin{list}{\textrm{\labelitemi}}{\ttfamily}
%   \item keyval
%   \item kvoptions
%   \item fancyvrb
%   \item fvextra
%   \item upquote
%   \item float
%   \item ifthen
%   \item calc
%   \item ifplatform
%   \item pdftexcmds
%   \item etoolbox
%   \item xstring
%   \item xcolor
%   \item lineno
%   \item framed
%   \item shellesc (for luatex 0.87+)
%   \item catchfile
%
%   ~
% \end{list}
% \endgroup
% \end{multicols}
%
%
% \subsection{Installing \texpkg{minted}}
% \label{sec:installing:installing}
%
% You can probably install \texpkg{minted} with your \TeX\ distribution's package manager.  Otherwise, or if you want the absolute latest version, you can install it manually by following the directions below.
%
% You may download |minted.sty| from the
% \href{https://github.com/gpoore/minted}{project's homepage}.  We have to install the file so that \TeX\ is able to find it.
% In order to do that, please refer to the
% \href{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=inst-wlcf}{\TeX{} FAQ}.
% If you just want to experiment with the latest version, you could locate your current |minted.sty| in your \TeX\ installation and replace it with the latest version.  Or you could just put the latest |minted.sty| in the same directory as the file you wish to use it with.
%
%
% \section{Basic usage}
%
% \subsection{Preliminary}
% \label{sec:basic:preliminary}
%
% Since \texpkg{minted} makes calls to the outside world (that is, \app{Pygments}), you need to tell the
% \LaTeX{} processor about this by passing it the |-shell-escape| option or it won't allow such calls.
% In effect, instead of calling the processor like this:
% \begin{Verbatim}[gobble=3,commandchars=\\\{\}]
%   \$ latex input
% \end{Verbatim}
%
% you need to call it like this:
%
% \begin{Verbatim}[gobble=3,commandchars=\\\{\}]
%   \$ latex -shell-escape input
% \end{Verbatim}
%
% The same holds for other processors, such as |pdflatex| or |xelatex|.
%
% You should be aware that using |-shell-escape| allows \LaTeX\ to run potentially arbitrary commands on your system.  It is probably best to use |-shell-escape| only when you need it, and to use it only with documents from trusted sources.
%
%
% \subsubsection*{Working with OS X}
%
% If you are using \texpkg{minted} with some versions/configurations of OS X, and are using caching with a large number of code blocks ($>256$), you may receive an error like
%\begin{Verbatim}
%OSError: [Errno 24] Too many open files:
%\end{Verbatim}
% This is due to the way files are handled by the operating system, combined with the way that caching works.  To resolve this, you may use the OS X commands |launchctl limit maxfiles| or |ulimit -n| to increase the number of files that may be used.
%
%
%
% \subsection{A minimal complete example}
%
% The following file |minimal.tex| shows the basic usage of \texpkg{minted}.
%
% \begin{VerbatimOut}[gobble=1]{minted.doc.out}
%   \documentclass{article}
%
%   \usepackage{minted}
%
%   \begin{document}
%   \begin{minted}{c}
%   int main() {
%       printf("hello, world");
%       return 0;
%   }
%   \end{minted}
%   \end{document}
% \end{VerbatimOut}
% \inputminted[gobble=2,frame=lines]{latex}{minted.doc.out}
%
% By compiling the source file like this:
%
% \begin{Verbatim}[gobble=3,commandchars=\\\{\}]
%   \$ pdflatex -shell-escape minimal
% \end{Verbatim}
%
% we end up with the following output in |minimal.pdf|:
%
% \hfill
% \colorbox{minted@samplebg}{\begin{minipage}{0.6\textwidth}
%   \inputminted[firstline=7,lastline=10]{c}{minted.doc.out}
% \end{minipage}}
% \hfill\hfill
%
%
% \subsection{Formatting source code}
%
% \DescribeEnv{minted}
% Using \texpkg{minted} is straightforward. For example, to highlight some Python source code we might use
% the following code snippet (result on the right):
%
% \begin{example}
%   \begin{minted}{python}
%   def boring(args = None):
%       pass
%   \end{minted}
% \end{example}
%
% Optionally, the environment accepts a number of options in |key=value| notation, which are described
% in more detail below.
%
%
% \DescribeMacro{\mint}
% For a single line of source code, you can alternatively use a shorthand notation:
%
% \begin{example}
%   \mint{python}|import this|
% \end{example}
%
% This typesets a single line of code using a command rather than an environment, so it saves a little typing, but its output is equivalent to that of the |minted| environment.
%
% The code is delimited by a pair of identical characters, similar to how  |\verb| works.  The complete syntax is \cmd\mint\oarg{options}\marg{language}\meta{delim}\meta{code}\meta{delim},
% where the code delimiter can be almost any punctuation character.
% The \meta{code} may also be delimited with matched curly braces |{}|, so long as \meta{code} itself does not contain unmatched curly braces.
% Again, this command supports a number of options described below.
%
% Note that the |\mint| command \textbf{is not for inline use}.  Rather, it is a shortcut for |minted| when only a single line of code is present.  The |\mintinline| command is provided for inline use.
%
%
% \DescribeMacro{\mintinline}
% Code can be typeset inline:
% 
% \begin{example}
%   X\mintinline{python}{print(x**2)}X
% \end{example}
%
% The syntax is  \cmd\mintinline\oarg{options}\marg{language}\meta{delim}\meta{code}\meta{delim}.  The delimiters can be a single repeated character, just like for \cmd{\verb}.  They can also be a pair of curly braces, |{}|.  Curly braces are required when \cmd{\mintinline} is used in a movable argument, such as in a \cmd{\section}.
%
% \cmd{\mintinline} has been carefully crafted so that in most cases it will function correctly when used inside other commands.  The main exception is when the code contains the percent \texttt{\%} or hash \texttt{\#} characters, or unmatched curly braces.  For example, \cmd{\mintinline} works in \cmd{\footnote} and \cmd{\section}!  The code typesetting for \cmd{\mintinline} is based on \texpkg{fvextra}'s \cmd{\Verb}.  See the \href{https://github.com/gpoore/fvextra/}{\texpkg{fvextra} documentation on \cmd{\Verb}} for details about functionality and limitations.
%
% \DescribeMacro{\inputminted}
% Finally, there's the |\inputminted| command to read and format whole files.
% Its syntax is \cmd\inputminted\oarg{options}\marg{language}\marg{filename}.
%
% \warn:  \meta{filename} is used to generate a shell command for highlighing the file.  Due to limitations in the design of \texpkg{minted} and limitations with TeX as a programming language, there is currently no escaping or sanitization of the filename as part of this process.  Providing a malformed filename can execute arbitrary system commands.  For example, providing ``|file.txt; touch file2.txt|'' as \meta{filename} could highlight one file while subsequently creating a new file.  (Issue \href{https://github.com/gpoore/minted/issues/338}{\#338}.)
%
%
% \subsection{Using different styles}
%
% \DescribeMacro{\usemintedstyle}
% Instead of using the default style you may choose another stylesheet provided by \app{Pygments}.  This may be done via the following:
%
% \mint[frame=lines]{latex}/\usemintedstyle{name}/
%
% The full syntax is \cmd\usemintedstyle\oarg{language}\marg{style}.  The style may be set for the document as a whole (no language specified), or only for a particular language.  Note that the style may also be set via \cmd\setminted\ and via the optional argument for each command and environment.\footnote{Version 2.0 added the optional language argument and removed the restriction that the command be used in the preamble.}
%
% To get a list of all available stylesheets, see the online demo at the \href{http://pygments.org/demo/}{Pygments website} or execute the following command on the command line:
%
% \begin{Verbatim}[gobble=3,commandchars=\\\{\}]
%   \$ pygmentize -L styles
% \end{Verbatim}
%
%
% Creating your own styles is also easy. Just follow the instructions provided on the
% \href{http://pygments.org/docs/styles/#creating-own-styles}{\texpkg{Pygments} website}.
%
%
% \subsection{Supported languages}
%
% \app{Pygments} supports over 300 different programming languages, template languages, and other markup languages.  To see an exhaustive list of the currently supported languages, use the command
%
% \begin{Verbatim}[gobble=3,commandchars=\\\{\}]
%   \$ pygmentize -L lexers
% \end{Verbatim}
%
%
% \section{Floating listings}\label{sec:float}
%
% \DescribeEnv{listing}
% \texpkg{minted} provides the |listing| environment to wrap around a source code block.  This puts the code into a floating box, with the default placement |tbp| like figures and tables.  You can also provide a |\caption| and a |\label| for such a listing in the usual way (that is, as for the |figure| and |table| environments):
% \begin{VerbatimOut}[gobble=1]{minted.doc.out}
%   \begin{listing}[H]
%     \mint{cl}/(car (cons 1 '(2)))/
%     \caption{Example of a listing.}
%     \label{lst:example}
%   \end{listing}
%
%   Listing \ref{lst:example} contains an example of a listing.
% \end{VerbatimOut}
% \inputminted[gobble=2,frame=lines]{latex}{minted.doc.out}
%
% will yield:
%
% \hfill
% \colorbox{minted@samplebg}{\begin{minipage}{0.6\textwidth}
%   \input{minted.doc.out}
% \end{minipage}}
% \hfill\hfill
%
% The default |listing| placement can be modified easily.  When the package option |newfloat=false| (default), the \texpkg{float} package is used to create the |listing| environment.  Placement can be modified by redefining |\fps@listing|.  For example,
%\begin{verbatim}
%\makeatletter
%\renewcommand{\fps@listing}{htp}
%\makeatother
%\end{verbatim}
% When |newfloat=true|, the more powerful \texpkg{newfloat} package is used to create the |listing| environment.  In that case, \texpkg{newfloat} commands are available to customize |listing|:
%\begin{verbatim}
%\SetupFloatingEnvironment{listing}{placement=htp}
%\end{verbatim}
%
%
% \DescribeMacro{\listoflistings}
% The |\listoflistings| macro will insert a list of all (floated) listings in the document:
%
% \begin{example}
%   \listoflistings
% \end{example}
%
% \subsection*{Customizing the \texttt{listing} environment}
% By default, the |listing| environment is created using the \texpkg{float} package.  In that case, the |\listingscaption| and |\listoflistingscaption| macros described below may be used to customize the caption and list of listings.  If \texpkg{minted} is loaded with the |newfloat| option, then the |listing| environment will be created with the more powerful \href{http://www.ctan.org/pkg/newfloat}{\texpkg{newfloat}} package instead.  \texpkg{newfloat} is part of \href{http://www.ctan.org/pkg/caption}{\texpkg{caption}}, which provides many options for customizing captions.
%
% When \texpkg{newfloat} is used to create the |listing| environment, customization should be achieved using \texpkg{newfloat}'s |\SetupFloatingEnvironment| command.  For example, the string ``Listing'' in the caption could be changed to ``Program code'' using 
%\begin{verbatim}
%\SetupFloatingEnvironment{listing}{name=Program code}
%\end{verbatim}
% And ``List of Listings'' could be changed to ``List of Program Code'' with %\begin{verbatim}
%\SetupFloatingEnvironment{listing}{listname=List of Program Code}
%\end{verbatim}
% Refer to the \texpkg{newfloat} and \texpkg{caption} documentation for additional information.
%
% \DescribeMacro{\listingscaption}
% (Only applies when package option |newfloat| is not used.) The string ``Listing'' in a listing's caption can be changed.
% To do this, simply redefine the macro |\listingscaption|, for example:
%
% \mint[frame=lines]{latex}/\renewcommand{\listingscaption}{Program code}/
%
% \DescribeMacro{\listoflistingscaption}
% (Only applies when package option |newfloat| is not used.) Likewise, the caption of the listings list, ``List of Listings,'' can be changed by redefining
% |\listoflistingscaption|:
%
% \mint[frame=lines]{latex}/\renewcommand{\listoflistingscaption}{List of Program Code}/
%
%
% \section{Options}
%
%
%
% \subsection{Package options}
%
% \DescribeMacro{chapter}
% To control how \LaTeX{} counts the |listing| floats, you can pass either the
% |section| or |chapter| option when loading the \texpkg{minted} package.
% For example, the following will cause listings to be counted by chapter:
%
% \mint[frame=lines]{latex}/\usepackage[chapter]{minted}/
%
%
% \DescribeMacro{cache=\meta{boolean} (default:~true)}
% \texpkg{minted} works by saving code to a temporary file, highlighting the code via \app{Pygments} and saving the output to another temporary file, and inputting the output into the \LaTeX\ document.  This process can become quite slow if there are several chunks of code to highlight.  To avoid this, the package provides a |cache| option.  This is on by default.
%
% The |cache| option creates a directory |_minted-|\meta{jobname} in the document's root directory (this may be customized with the |cachedir| option).\footnote{The directory is actually named using a ``sanitized'' copy of \meta{jobname}, in which spaces and asterisks have been replaced by underscores, and double quotation marks have been stripped.  If the file name contains spaces, \texttt{\string\jobname} will contain a quote-wrapped name, except under older versions of MiKTeX which used the name with spaces replaced by asterisks.  Using a ``sanitized'' \meta{jobname} is simpler than accomodating the various escaping conventions.}  Files of highlighted code are stored in this directory, so that the code will not have to be highlighted again in the future.  In most cases, caching will significantly speed up document compilation.
%
% Cached files that are no longer in use are automatically deleted.\footnote{This depends on the main auxiliary file not being deleted or becoming corrupted.  If that happens, you could simply delete the cache directory and start over.}
%
%
% \DescribeMacro{cachedir=\meta{directory} (def:~\_minted-\meta{jobname})}
% This allows the directory in which cached files are stored to be specified.  Paths should use forward slashes, even under Windows.
%
% Special characters must be escaped.  For example, |cachedir=~/mintedcache| would not work because the tilde |~| would be converted into the \LaTeX\ commands for a non-breaking space, rather than being treated literally.  Instead, use |\string~/mintedcache|, |\detokenize{~/mintedcache}|, or an equivalent solution.
%
% Paths may contain spaces, but only if the entire \meta{directory} is wrapped in curly braces |{}|, and only if the spaces are quoted.  For example,
%\begin{Verbatim}
%cachedir = {\detokenize{~/"minted cache"/"with spaces"}}
%\end{Verbatim}
%
% Note that the cache directory is relative to the |outputdir|, if an |outputdir| is specified.
%
%
% \DescribeMacro{finalizecache=\meta{boolean} (default:~false)}
% In some cases, it may be desirable to use \texpkg{minted} in an environment in which |-shell-escape| is not allowed.  A document might be submitted to a publisher or preprint server or used with an online service that does not support |-shell-escape|.  This is possible as long as \texpkg{minted} content does not need to be modified.
%
% Compiling with the |finalizecache| option prepares the cache for use in an environment without |-shell-escape|.\footnote{Ordinarily, cache files are named using an MD5 hash of highlighting settings and highlighted text.  \texttt{finalizecache} renames cache files using a \texttt{listing<number>.pygtex} scheme.  This makes it simpler to match up document content and cache files, and is also necessary for the XeTeX engine since prior to TeX Live 2016 it lacked the built-in MD5 capabilities that pdfTeX and LuaTeX have.}  Once this has been done, the |finalizecache| option may be swapped for the |frozencache| option, which will then use the frozen (static) cache in the future, without needing |-shell-escape|.
%
%
% \DescribeMacro{fontencoding=\meta{encoding} (default:~\meta{doc~encoding})}
% Set font encoding used for typesetting code.
%
% For example, |fontencoding=T1|.
%
% \DescribeMacro{frozencache=\meta{boolean} (default:~false)}
% Use a frozen (static) cache created with the |finalizecache| option.  When |frozencache| is on, |-shell-escape| is not needed, and Python and Pygments are not required.  In addition, any external files accessed through |\inputminted| are no longer necessary.
%
% \textbf{This option must be used with care.  A document \emph{must} be in final form, as far as \texpkg{minted} is concerned, \emph{before} \texttt{frozencache} is turned on, and the document \emph{must} have been compiled with \texttt{finalizecache}.   When this option is on, \texpkg{minted} content cannot be modified, except by editing the cache files directly.  Changing any \texpkg{minted} settings that require Pygments or Python is not possible.  If \texpkg{minted} content is incorrectly modified after \texttt{frozencache} is turned on, \texpkg{minted} \emph{cannot} detect the modification.}
% 
% If you are using |frozencache|, and want to verify that \texpkg{minted} settings or content have not been modified in an invalid fashion, you can test the cache using the following procedure.
% \begin{enumerate}
% \item Obtain a copy of the cache used with |frozencache|.
% \item Compile the document in an environment that supports |-shell-escape|, with |finalizecache=true| and |frozencache=false|.  This essentially regenerates the frozen (static) cache.
% \item Compare the original cache with the newly generated cache.  Under Linux and OS X, you could use |diff|; under Windows, you probably want |fc|.  If \texpkg{minted} content and settings have not been modified in an invalid fashion, all files will be identical (assuming that compatible versions of Pygments are used for both caches).
% \end{enumerate}
%
%
% \DescribeMacro{draft=\meta{boolean} (default:~false)}
% This uses \texpkg{fancyvrb} alone for all typesetting; \app{Pygments} is not used.  This trades syntax highlighting and some other \app{minted} features for faster compiling.  Performance should be essentially the same as using \texpkg{fancyvrb} directly; no external temporary files are used.  Note that if you are not changing much code between compiles, the difference in performance between caching and draft mode may be minimal.  Also note that |draft| settings are typically inherited from the document class.
%
% Draft mode does not support |autogobble|.  Regular |gobble|, |linenos|, and most other options not related to syntax highlighting will still function in draft mode.
%
% Documents can usually be compiled without shell escape in draft mode.  The \texpkg{ifplatform} package may issue a warning about limited functionality due to shell escape being disabled, but this may be ignored in almost all cases.  (Shell escape is only really required if you have an unusual system configuration such that the |\ifwindows| macro must fall back to using shell escape to determine the system.  See the \texpkg{ifplatform} documentation for more details:  \url{http://www.ctan.org/pkg/ifplatform}.)
%
% If the |cache| option is set, then all existing cache files will be kept while draft mode is on.  This allows caching to be used intermitently with draft mode without requiring that the cache be completely recreated each time.  Automatic cleanup of cached files will resume as soon as draft mode is turned off.  (This assumes that the auxiliary file has not been deleted in the meantime; it contains the cache history and allows automatic cleanup of unused files.)
%
%
% \DescribeMacro{final=\meta{boolean} (default:~true)}
% This is the opposite of |draft|; it is equivalent to |draft=false|.  Again, note that |draft| and |final| settings are typically inherited from the document class.
%
%
% \DescribeMacro{kpsewhich=\meta{boolean} (default:~false)}
% This option uses |kpsewhich| to locate files that are to be highlighted.  Some build tools such as |texi2pdf| function by modifying |TEXINPUTS|; in some cases, users may customize |TEXINPUTS| as well.  The |kpsewhich| option allows \texpkg{minted} to work with such configurations.
%
% This option may add a noticeable amount of overhead on some systems, or with some system configurations.
%
% This option does \emph{not} make \texpkg{minted} work with the |-output-directory| and |-aux-directory| command-line options for \LaTeX.  For those, see the |outputdir| package option.
%
%
% \DescribeMacro{langlinenos=\meta{boolean} (default:~false)}
% \texpkg{minted} uses the \texpkg{fancyvrb} package behind the scenes for the code typesetting.  \texpkg{fancyvrb} provides an option |firstnumber| that allows the starting line number of an environment to be specified.  For convenience, there is an option |firstnumber=last| that allows line numbering to pick up where it left off.  The |langlinenos| option makes |firstnumber| work for each language individually with all |minted| and |\mint| usages.  For example, consider the code and output below.
%
% \begin{VerbatimOut}[gobble=1]{minted.doc.out}
%   \begin{minted}[linenos]{python}
%   def f(x):
%       return x**2
%   \end{minted}
%
%   \begin{minted}[linenos]{ruby}
%   def func
%       puts "message"
%   end
%   \end{minted}
%
%   \begin{minted}[linenos, firstnumber=last]{python}
%   def g(x):
%       return 2*x
%   \end{minted}
% \end{VerbatimOut}
% \inputminted[frame=single, rulecolor=minted@linkcolor]{latex}{minted.doc.out}
% \hfill
% \colorbox{minted@samplebg}{\begin{minipage}{0.6\textwidth}
%   \input{minted.doc.out}
% \end{minipage}}
% \hfill\hfill
%
% Without the |langlinenos| option, the line numbering in the second Python environment would not pick up where the first Python environment left off.  Rather, it would pick up with the Ruby line numbering.
%
%
% \DescribeMacro{newfloat=\meta{boolean} (default:~false)}
% By default, the |listing| environment is created using the \texpkg{float} package.  The |newfloat| option creates the environment using \texpkg{newfloat} instead.  This provides better integration with the \texpkg{caption} package.
%
%
% \DescribeMacro{outputdir=\meta{directory} (default:~\meta{none})}
% The |-output-directory| and |-aux-directory| (MiKTeX) command-line options for \LaTeX\ cause problems for \texpkg{minted}, because the \texpkg{minted} temporary files are saved in |<outputdir>|, but \texpkg{minted} still looks for them in the document root directory.  There is no way to access the value of the command-line option so that \texpkg{minted} can automatically look in the right place.  But it is possible to allow the output directory to be specified manually as a package option.
%
% The output directory should be specified using an absolute path or a path relative to the document root directory.  Paths should use forward slashes, even under Windows.  Special characters must be escaped, while spaces require quoting and need the entire \meta{directory} to be wrapped in curly braces |{}|.  See |cachedir| above for examples of escaping and quoting.
%
%
% \DescribeMacro{section}
% To control how \LaTeX{} counts the |listing| floats, you can pass either the
% |section| or |chapter| option when loading the \texpkg{minted} package.
%
%
% \subsection{Macro option usage}
%
% All \texpkg{minted} highlighting commands accept the same set of options.
% Options are specified as a comma-separated list of |key=value| pairs.
% For example, we can specify that the lines should be numbered:
%
% \begin{example}
%   \begin{minted}[linenos=true]{c++}
%   #include <iostream>
%   int main() {
%       std::cout << "Hello "
%                 << "world"
%                 << std::endl;
%   }
%   \end{minted}
% \end{example}
%
% An option value of |true| may also be omitted entirely (including the ``|=|'').
% To customize the display of the line numbers further, override the |\theFancyVerbLine| command.
% Consult the \texpkg{fancyvrb} documentation for details.
%
% |\mint| accepts the same options:
%
% \begin{example}
%   \mint[linenos]{perl}|$x=~/foo/|
% \end{example}
%
% Here's another example: we want to use the \LaTeX{} math mode inside comments:
%
% \begin{example}
%   \begin{minted}[mathescape]{python}
%   # Returns $\sum_{i=1}^{n}i$
%   def sum_from_one_to(n):
%       r = range(1, n + 1)
%       return sum(r)
%   \end{minted}
% \end{example}
%
% To make your \LaTeX{} code more readable you might want to indent the code inside a |minted|
% environment.
% The option |gobble| removes these unnecessary whitespace characters from the output.  There is also an |autogobble| option that detects the length of this whitespace automatically.
%
% \begin{example}
%   \begin{minted}[gobble=2,
%     showspaces]{python}
%     def boring(args = None):
%         pass
%   \end{minted}
%
%   versus
%
%   \begin{minted}[showspaces]{python}
%     def boring(args = None):
%         pass
%   \end{minted}
% \end{example}
%
% \DescribeMacro{\setminted}
% You may wish to set options for the document as a whole, or for an entire language.  This is possible via \cmd\setminted\oarg{language}\marg{key=value,...}.  Language-specific options override document-wide options.  Individual command and environment options override language-specific options.
%
% \DescribeMacro{\setmintedinline}
% You may wish to set separate options for \cmd\mintinline, either for the document as a whole or for a specific language.  This is possible via \cmd\setmintedinline.  The syntax is
% \cmd\setmintedinline\oarg{language}\marg{key=value,...}.  Language-specific options override document-wide options. Individual command options override language-specific options.  All settings specified with \cmd\setmintedinline\ override those set with \cmd\setminted.  That is, inline settings always have a higher precedence than general settings.
%
% \subsection{Available options}
%
% \newcommand\appliesto[1]{\textsf{[For #1 only]}}
%
% Following is a full list of available options.
% For more detailed option descriptions please refer to the \texpkg{fancyvrb} and \app{Pygments} documentation.
%
% \begin{optionlist}
%   \item[autogobble (boolean) (false)]
%     Remove (gobble) all common leading whitespace from code.  Essentially a version of |gobble| that automatically determines what should be removed.  Good for code that originally is not indented, but is manually indented after being pasted into a \LaTeX\ document.
%
% \begin{example}
%   ...text.
%   \begin{minted}[autogobble]{python}
%       def f(x):
%           return x**2
%   \end{minted}
% \end{example}
%
%   \item[baselinestretch (dimension) (\meta{document default})]
%     Value to use as for baselinestretch inside the listing.
%
%
% \item[beameroverlays (boolean) (false)]
% Give the |<| and |>| characters their normal text meanings when used with |escapeinside| and |texcomments|, so that \texpkg{beamer} overlays of the form |\only<1>{...}| will work.
%
%
%   \item[breakafter (string) (\meta{none})]
%     Break lines after specified characters, not just at spaces, when \texttt{breaklines=true}.
%
% For example, \texttt{breakafter=-/} would allow breaks after any hyphens or slashes.  Special characters given to \texttt{breakafter} should be backslash-escaped (usually \texttt{\hashchar}, \texttt{\{}, \texttt{\}}, \texttt{\%}, \texttt{[}, \texttt{]}; the backslash \texttt{\textbackslash} may be obtained via \texttt{\textbackslash\textbackslash}).
%
% For an alternative, see \texttt{breakbefore}.  When \texttt{breakbefore} and \texttt{breakafter} are used for the same character, \texttt{breakbeforegroup} and \texttt{breakaftergroup} must both have the same setting.
%
% \begin{longexample}
%   \begin{minted}[breaklines, breakafter=d]{python}
%   some_string = 'SomeTextThatGoesOnAndOnForSoLongThatItCouldNeverFitOnOneLine'
%   \end{minted}
% \end{longexample}
%
%   \item[breakaftergroup] (boolean) (true)
%     When \texttt{breakafter} is used, group all adjacent identical characters together, and only allow a break after the last character.  When \texttt{breakbefore} and \texttt{breakafter} are used for the same character, \texttt{breakbeforegroup} and \texttt{breakaftergroup} must both have the same setting.
%
%   \item[breakaftersymbolpre (string) (\string\,\string\footnotesize\string\ensuremath\{\_\string\rfloor\}, \,\footnotesize\ensuremath{_\rfloor})]
%     The symbol inserted pre-break for breaks inserted by \texttt{breakafter}.
%
%   \item[breakaftersymbolpost (string) (\meta{none})]
%     The symbol inserted post-break for breaks inserted by \texttt{breakafter}.
%
%   \item[breakanywhere (boolean) (false)]
%     Break lines anywhere, not just at spaces, when \texttt{breaklines=true}.
%
% \begingroup
% \fvset{xrightmargin=1em}
% \begin{longexample}
%   \begin{minted}[breaklines, breakanywhere]{python}
%   some_string = 'SomeTextThatGoesOnAndOnForSoLongThatItCouldNeverFitOnOneLine'
%   \end{minted}
% \end{longexample}
% \endgroup
%
%   \item[breakanywheresymbolpre (string) (\string\,\string\footnotesize\string\ensuremath\{\_\string\rfloor\}, \,\footnotesize\ensuremath{_\rfloor})]
%     The symbol inserted pre-break for breaks inserted by \texttt{breakanywhere}.
%
%   \item[breakanywheresymbolpost (string) (\meta{none})]
%     The symbol inserted post-break for breaks inserted by \texttt{breakanywhere}.
%
%   \item[breakautoindent (boolean) (true)]
%     When a line is broken, automatically indent the continuation lines to the indentation level of the first line.  When \texttt{breakautoindent} and \texttt{breakindent} are used together, the indentations add.  This  indentation is combined with \texttt{breaksymbolindentleft} to give the total actual left indentation.  Does not apply to \texttt{\string\mintinline}.
%
%   \item[breakbefore (string) (\meta{none})]
%     Break lines before specified characters, not just at spaces, when \texttt{breaklines=true}.
%
% For example, \texttt{breakbefore=A} would allow breaks before capital A's.  Special characters given to \texttt{breakbefore} should be backslash-escaped (usually \texttt{\hashchar}, \texttt{\{}, \texttt{\}}, \texttt{\%}, \texttt{[}, \texttt{]}; the backslash \texttt{\textbackslash} may be obtained via \texttt{\textbackslash\textbackslash}).
%
%  For an alternative, see \texttt{breakafter}.  When \texttt{breakbefore} and \texttt{breakafter} are used for the same character, \texttt{breakbeforegroup} and \texttt{breakaftergroup} must both have the same setting.
%
% \begin{longexample}
%   \begin{minted}[breaklines, breakbefore=A]{python}
%   some_string = 'SomeTextThatGoesOnAndOnForSoLongThatItCouldNeverFitOnOneLine'
%   \end{minted}
% \end{longexample}
%
%   \item[breakbeforegroup] (boolean) (true)
%     When \texttt{breakbefore} is used, group all adjacent identical characters together, and only allow a break before the first character.  When \texttt{breakbefore} and \texttt{breakafter} are used for the same character, \texttt{breakbeforegroup} and \texttt{breakaftergroup} must both have the same setting.
%
%   \item[breakbeforesymbolpre (string) (\string\,\string\footnotesize\string\ensuremath\{\_\string\rfloor\}, \,\footnotesize\ensuremath{_\rfloor})]
%     The symbol inserted pre-break for breaks inserted by \texttt{breakbefore}.
%
%   \item[breakbeforesymbolpost (string) (\meta{none})]
%     The symbol inserted post-break for breaks inserted by \texttt{breakbefore}.
%
%   \item[breakbytoken (boolean) (false)]
%   Only break lines at locations that are not within tokens; prevent tokens from being split by line breaks.  By default, \texttt{breaklines} causes line breaking at the space nearest the margin.  While this minimizes the number of line breaks that are necessary, it can be inconvenient if a break occurs in the middle of a string or similar token.
%
%   This is not compatible with \texttt{draft} mode.  A complete list of Pygments tokens is available at \url{http://pygments.org/docs/tokens/}.  If the breaks provided by \texttt{breakbytoken} occur in unexpected locations, it may indicate a bug or shortcoming in the Pygments lexer for the language.
%
%   \item[breakbytokenanywhere (boolean) (false)] 
%   Like \texttt{breakbytoken}, but also allows line breaks between immediately adjacent tokens, not just between tokens that are separated by spaces.  Using \texttt{breakbytokenanywhere} with \texttt{breakanywhere} is redundant.
%
% \item[breakindent (dimension) (\meta{breakindentnchars})]
% When a line is broken, indent the continuation lines by this amount.  When |breakautoindent| and |breakindent| are used together, the indentations add.  This  indentation is combined with |breaksymbolindentleft| to give the total actual left indentation.
%
% Does not apply to \texttt{\string\mintinline}.
%
% \item[breakindentnchars (integer) (0)]
% This allows |breakindent| to be specified as an integer number of characters rather than as a dimension (assumes a fixed-width font).
%
%   \item[breaklines (boolean) (false)] 
%     Automatically break long lines in \texttt{minted} environments and \texttt{\string\mint} commands, and wrap longer lines in \texttt{\string\mintinline}.
%
% By default, automatic breaks occur at space characters.  Use \texttt{breakanywhere} to enable breaking anywhere; use \texttt{breakbytoken}, \texttt{breakbytokenanywhere}, \texttt{breakbefore}, and \texttt{breakafter} for more fine-tuned breaking.  Using \texttt{escapeinside} to escape to \LaTeX\ and then insert a manual break is also an option.  For example, use \texttt{escapeinside=||}, and then insert \texttt{|\textbackslash\textbackslash|} at the appropriate point.  (Note that \texttt{escapeinside} does not work within strings.)
%
% \begin{example}
%   ...text.
%   \begin{minted}[breaklines]{python}
%   def f(x):
%       return 'Some text ' + str(x)
%   \end{minted}
% \end{example}
%
%     Breaking in \texttt{minted} and \texttt{\string\mint} may be customized in several ways.  To customize the indentation of broken lines, see \texttt{breakindent} and \texttt{breakautoindent}.  To customize the line continuation symbols, use \texttt{breaksymbolleft} and \texttt{breaksymbolright}.  To customize the separation between the continuation symbols and the code, use \texttt{breaksymbolsepleft} and \texttt{breaksymbolsepright}.  To customize the extra indentation that is supplied to make room for the break symbols, use \texttt{breaksymbolindentleft} and \texttt{breaksymbolindentright}.  Since only the left-hand symbol is used by default, it may also be modified using the alias options \texttt{breaksymbol}, \texttt{breaksymbolsep}, and \texttt{breaksymbolindent}.  Note than none of these options applies to \texttt{\string\mintinline}, since they are not relevant in the inline context.
%
% An example using these options to customize the \texttt{minted} environment is shown below.  This uses the \texttt{\string\carriagereturn} symbol from the \texpkg{dingbat} package.
%
% \begingroup
% \fvset{breaklines, xleftmargin=2em, xrightmargin=2em}
% \begin{longexample}
%   \begin{minted}[breaklines,
%                  breakautoindent=false,
%                  breaksymbolleft=\raisebox{0.8ex}{
%                    \small\reflectbox{\carriagereturn}},
%                  breaksymbolindentleft=0pt,
%                  breaksymbolsepleft=0pt,
%                  breaksymbolright=\small\carriagereturn,
%                  breaksymbolindentright=0pt,
%                  breaksymbolsepright=0pt]{python}
%   def f(x):
%       return 'Some text ' + str(x) + ' some more text ' + str(x) + ' even more text that goes on for a while'
%   \end{minted}
% \end{longexample}
% \endgroup
%
%     Automatic line breaks are limited with \app{Pygments} styles that use a colored background behind large chunks of text.  This coloring is accomplished with \texttt{\string\colorbox}, which cannot break across lines.  It may be possible to create an alternative to \texttt{\string\colorbox} that supports line breaks, perhaps with \texpkg{TikZ}, but the author is unaware of a satisfactory solution.  The only current alternative is to redefine \texttt{\string\colorbox} so that it does nothing.  For example,
%\begin{Verbatim}
%\AtBeginEnvironment{minted}{\renewcommand{\colorbox}[3][]{#3}}
%\end{Verbatim}
%     uses the \texpkg{etoolbox} package to redefine \texttt{\string\colorbox} within all \texttt{minted} environments.
%
%     Automatic line breaks will not work with \texttt{showspaces=true} unless you use \texttt{breakanywhere} or \texttt{breakafter=\string\space}.
%
%   \item[breaksymbol (string) (breaksymbolleft)]
%     Alias for \texttt{breaksymbolleft}.
%
%   \item[breaksymbolleft (string) (\string\tiny\string\ensuremath\{\string\hookrightarrow\}, {\tiny\ensuremath{\hookrightarrow}})]
%     The symbol used at the beginning (left) of continuation lines when \texttt{breaklines=true}.  To have no symbol, simply set \texttt{breaksymbolleft} to an empty string (``\texttt{=,}'' or ``\texttt{=\{\}}'').  The symbol is wrapped within curly braces \texttt{\{\}} when used, so there is no danger of formatting commands such as \texttt{\string\tiny} ``escaping.''
%
%     The \texttt{\string\hookrightarrow} and \texttt{\string\hookleftarrow} may be further customized by the use of the \texttt{\string\rotatebox} command provided by \texpkg{graphicx}.  Additional arrow-type symbols that may be useful are available in the \texpkg{dingbat} (\texttt{\string\carriagereturn}) and \texpkg{mnsymbol} (hook and curve arrows) packages, among others.
%
%     Does not apply to \texttt{\string\mintinline}.
%
%   \item[breaksymbolright (string) (\meta{none})]
%     The symbol used at breaks (right) when \texttt{breaklines=true}. Does not appear at the end of the very last segment of a broken line.
%
%
% \item[breaksymbolindent (dimension) (\meta{breaksymbolindentleftnchars})]
% Alias for |breaksymbolindentleft|.
%
% \item[breaksymbolindentnchars (integer) (\meta{breaksymbolindentleftnchars})]
% Alias for |breaksymbolindentleftnchars|.
%
%
% \item[breaksymbolindentleft (dimension) (\meta{breaksymbolindentleftnchars})]
% The extra left indentation that is provided to make room for |breaksymbolleft|.  This indentation is only applied when there is a |breaksymbolleft|.
%
%     Does not apply to \texttt{\string\mintinline}.
%
% \item[breaksymbolindentleftnchars (integer) (4)]
% This allows |breaksymbolindentleft| to be specified as an integer number of characters rather than as a dimension (assumes a fixed-width font).
%
% \item[breaksymbolindentright (dimension) (\meta{breaksymbolindentrightnchars})]
% The extra right indentation that is provided to make room for |breaksymbolright|.  This indentation is only applied when there is a |breaksymbolright|.
%
% \item[breaksymbolindentrightnchars (integer) (4)]
% This allows |breaksymbolindentright| to be specified as an integer number of characters rather than as a dimension (assumes a fixed-width font).
%
%
% \item[breaksymbolsep (dimension) (\meta{breaksymbolsepleftnchars})]
% Alias for |breaksymbolsepleft|.
%
% \item[breaksymbolsepnchars (integer) (\meta{breaksymbolsepleftnchars})]
% Alias for |breaksymbolsepleftnchars|.
%
%
% \item[breaksymbolsepleft (dimension) (\meta{breaksymbolsepleftnchars})]
% The separation between the |breaksymbolleft| and the adjacent text. 
%
% \item[breaksymbolsepleftnchars (integer) (2)]
% Allows |breaksymbolsepleft| to be specified as an integer number of characters rather than as a dimension (assumes a fixed-width font).
%
%
% \item[breaksymbolsepright (dimension) (\meta{breaksymbolseprightnchars})]
% The \emph{minimum} separation between the |breaksymbolright| and the adjacent text.  This is the separation between |breaksymbolright| and the furthest extent to which adjacent text could reach.  In practice, |\linewidth| will typically not be an exact integer multiple of the character width (assuming a fixed-width font), so the actual separation between the |breaksymbolright| and adjacent text will generally be larger than |breaksymbolsepright|.  This ensures that break symbols have the same spacing from the margins on both left and right.  If the same spacing from text is desired instead, |breaksymbolsepright| may be adjusted.  (See the definition of |\FV@makeLineNumber| in \texpkg{fvextra} for implementation details.)
%
% \item[breaksymbolseprightnchars (integer) (2)]
% Allows |breaksymbolsepright| to be specified as an integer number of characters rather than as a dimension (assumes a fixed-width font).
%
%
%   \item[bgcolor (string) (\meta{none})]
%     Background color of the listing.  Be aware that this option has several limitations (described below); see ``Framing alternatives'' below for more powerful alternatives.
%
%     The value of this option must \emph{not} be a color command. Instead, it must be a color \emph{name}, given as a string, of a previously-defined color:
%
% \begin{example}
%   \definecolor{bg}{rgb}{0.95,0.95,0.95}
%   \begin{minted}[bgcolor=bg]{php}
%   <?php
%     echo "Hello, $x";
%   ?>
%   \end{minted}
% \end{example}
%
% This option puts \texttt{minted} environments and \texttt{\string\mint} commands in a \texttt{snugshade*} environment from the \texpkg{framed} package, which supports breaks across pages.  (Prior to \texpkg{minted} 2.2, a \texttt{minipage} was used, which prevented page breaks and gave undesirable spacing from surrounding text.)  Be aware that if \texttt{bgcolor} is used with \texttt{breaklines=true}, and a line break occurs just before a page break, then text may extend below the colored background in some instances.  It is best to use a more advanced framing package in those cases; see ``Framing alternatives'' below.
%
% This option puts \texttt{\string\mintinline} inside a \texttt{\string\colorbox}, which \textbf{does not allow line breaks}.  If you want to use \texttt{\string\setminted} to set background colors, and only want background colors on \texttt{minted} and \texttt{\string\mint}, you may use \texttt{\string\setmintedinline\{bgcolor=\{\}\}} to turn off the coloring for inline commands.
%
% ~
%
% \textbf{Framing alternatives}
%
% If you want more reliable and advanced options for background colors and framing, you should consider a more advanced framing package such as \texpkg{mdframed} or \texpkg{tcolorbox}.  It is easy to add framing to \texpkg{minted} commands and environments using the \texpkg{etoolbox} package, which is automatically loaded by \texpkg{minted}.  For example, using \texpkg{mdframed}:
%\begin{Verbatim}
%\BeforeBeginEnvironment{minted}{\begin{mdframed}}
%\AfterEndEnvironment{minted}{\end{mdframed}}
%\end{Verbatim}
% Some framing packages also provide built-in commands for such purposes.  For example, \texpkg{mdframed} provides a \texttt{\string\surroundwithmdframed} command, which could be used to add a frame to all \texttt{minted} environments:
%\begin{Verbatim}
%\surroundwithmdframed{minted}
%\end{Verbatim}
% \texpkg{tcolorbox} even provides a built-in framing environment with \texpkg{minted} support.  Simply use \texttt{\string\tcbuselibrary\{minted\}} in the preamble, and then put code within a \texttt{tcblisting} environment:
%\begin{Verbatim}
%\begin{tcblisting}{<tcb options>,
%                   minted language=<language>,
%                   minted style=<style>,
%                   minted options={<option list>} }
%<code>
%\end{tcblisting}
%\end{Verbatim}
% \texpkg{tcolorbox} provides other commands and environments for fine-tuning listing appearance and for working with external code files.
%
%   \item[codetagify (list of strings) (\textrm{highlight \texttt{XXX}, \texttt{TODO}, \texttt{BUG}, and \texttt{NOTE}})]
%     Highlight special code tags in comments and docstrings.
%
% \item[curlyquotes (boolean) (false)]
% By default, the backtick \texttt{\textasciigrave} and typewriter single quotation mark \texttt{\textquotesingle} always appear literally, instead of becoming the left and right curly single quotation marks \texttt{`'}.  This option allows these characters to be replaced by the curly quotation marks when that is desirable.
%
%   \item[encoding (string) (\meta{system-specific})]
%     Sets the file encoding that \app{Pygments} expects.  See also |outencoding|.
%   \item[escapeinside (string) (\meta{none})]
%   Escape to \LaTeX\ between the two characters specified in \texttt{\string(string\string)}.  All code between the two characters will be interpreted as \LaTeX\ and typeset accordingly.  This allows for additional formatting.  The escape characters need not be identical.  Special \LaTeX\ characters must be escaped when they are used as the escape characters (for example, \texttt{escapeinside=\textbackslash\#\textbackslash\%}).  Requires \app{Pygments} 2.0+.
%
% \textbf{Escaping does not work inside strings and comments (for comments, there is \texttt{texcomments}).  As of Pygments 2.0.2, this means that escaping is ``fragile'' with some lexers.}  Due to the way that Pygments implements \texttt{escapeinside}, any ``escaped'' \LaTeX\ code that resembles a string or comment for the current lexer may break \texttt{escapeinside}.  There is a \href{https://bitbucket.org/birkenfeld/pygments-main/issue/1118}{Pygments issue} for this case.  Additional details and a limited workaround for some scenarios are available on the \href{https://github.com/gpoore/minted/issues/70#issuecomment-111729930}{\texpkg{minted} GitHub site}.
%
% \begingroup  ^^A Need to prevent active "|" from causing problems
% \catcode`\|=11
% \begin{example}
%   \begin{minted}[escapeinside=||]{py}
%   def f(x):
%       y = x|\colorbox{green}{**}|2
%       return y
%   \end{minted}
% \end{example}
% \endgroup
%
% \textbf{Note that when math is used inside escapes, any active characters beyond those that are normally active in verbatim can cause problems.}  Any package that relies on special active characters in math mode (for example, \texpkg{icomma}) will produce errors along the lines of \texttt{TeX capacity exceeded} and \texttt{\string\leavevmode \string\kern \string\z@}.  This may be fixed by modifying \texttt{\string\@noligs}, as described at \url{http://tex.stackexchange.com/questions/223876}.
%   \item[firstline (integer) (1)]
%     The first line to be shown.
%     All lines before that line are ignored and do not appear in the output.
%   \item[firstnumber (auto \| last \| integer) (auto = 1)]
%     Line number of the first line.
%   \item[fontfamily (family name) (tt)]
%     The font family to use.
%     |tt|, |courier| and |helvetica| are pre-defined.
%   \item[fontseries (series name) (auto \textrm{-- the same as the current font})]
%     The font series to use.
%   \item[fontsize (font size) (auto \textrm{-- the same as the current font})]
%     The size of the font to use, as a size command, e.g. |\footnotesize|.
%   \item[fontshape (font shape) (auto \textrm{-- the same as the current font})]
%     The font shape to use.
%   \item[formatcom (command) (\meta{none})]
%     A format to execute before printing verbatim text.
%   \item[frame (none \| leftline \| topline \| bottomline \| lines \| single) (none)]
%     The type of frame to put around the source code listing.
%   \item[framerule (dimension) (0.4pt)]
%     Width of the frame.
%   \item[framesep (dimension) (\cmd\fboxsep)]
%     Distance between frame and content.
%   \item[funcnamehighlighting (boolean) (true)] \appliesto{PHP}
%     If |true|, highlights built-in function names.
%   \item[gobble (integer) (0)]
%     Remove the first $n$ characters from each input line.
%
% \item[highlightcolor (string) (LightCyan)]
% Set the color used for |highlightlines|, using a predefined color name from \texpkg{color} or \texpkg{xcolor}, or a color defined via |\definecolor|.
%
%
% \item[highlightlines (string) (\meta{none})]
% This highlights a single line or a range of lines based on line numbers.  For example, |highlightlines={1, 3-4}|.  The line numbers refer to the line numbers that would appear if |linenos=true|, etc.  They do not refer to original or actual line numbers before adjustment by |firstnumber|.
%
% The highlighting color can be customized with |highlightcolor|.
%
%
%   \item[keywordcase] (string) (lower)
%     Changes capitalization of keywords.  Takes |lower|, |upper|, or |capitalize|.
%   \item[label (string) (\emph{empty})]
%     Add a label to the top, the bottom or both of the frames around the code.
%     See the \texpkg{fancyvrb} documentation for more information and examples.
%     \emph{Note:} This does \emph{not} add a |\label| to the current listing.
%     To achieve that, use a floating environment (section \ref{sec:float}) instead.
%   \item[labelposition (none \| topline \| bottomline \| all) (topline, all,  \textrm{or} none)]
%     Position where to print the label (see above;  default: |topline| if one label is defined, |all| if two are defined, |none| else).
%     See the \texpkg{fancyvrb} documentation for more information.
%   \item[lastline (integer) (\meta{last line of input})]
%     The last line to be shown.
%   \item[linenos (boolean) (false)]
%     Enables line numbers.
%     In order to customize the display style of line numbers, you need to redefine the |\theFancyVerbLine| macro:
%
% \begin{example}
%   \renewcommand{\theFancyVerbLine}{\sffamily
%     \textcolor[rgb]{0.5,0.5,1.0}{\scriptsize
%     \oldstylenums{\arabic{FancyVerbLine}}}}
%
%   \begin{minted}[linenos,
%     firstnumber=11]{python}
%   def all(iterable):
%       for i in iterable:
%           if not i: 
%               return False
%       return True
%   \end{minted}
% \end{example}
%
% \item[numberfirstline (boolean) (false)]
% Always number the first line, regardless of |stepnumber|.
%
%
%   \item[numbers (left \| right \| both \| none) (none)]
%     Essentially the same as |linenos|, except the side on which the numbers appear may be specified.
%   \item[mathescape (boolean) (false)]
%     Enable \LaTeX{} math mode inside comments.
%     Usage as in package \texpkg{listings}.
%     See the note under \texttt{escapeinside} regarding math and ligatures.
%   \item[numberblanklines (boolean) (true)]
%     Enables or disables numbering of blank lines.
%   \item[numbersep (dimension) (12pt)]
%     Gap between numbers and start of line.
%   \item[obeytabs (boolean) (false)]
%     Treat tabs as tabs instead of converting them to spaces---that is, expand them to tab stops determined by |tabsize|.  \textcolor{DarkRed}{\textbf{While this will correctly expand tabs within leading indentation, usually it will not correctly expand tabs that are preceded by anything other than spaces or other tabs.  It should be avoided in those case.}}
%
%   \item[outencoding (string) (\meta{system-specific})]
%     Sets the file encoding that \app{Pygments} uses for highlighted output.  Overrides any encoding previously set via |encoding|.
%   \item[python3 (boolean) (false)] \appliesto{PythonConsoleLexer}
%     Specifies whether Python 3 highlighting is applied.
%   \item[resetmargins (boolean) (false)]
%     Resets the left margin inside other environments.
%   \item[rulecolor (color command) (black)]
%     The color of the frame.
%   \item[samepage (boolean) (false)]
%     Forces the whole listing to appear on the same page, even if it doesn't fit.
%   \item[showspaces (boolean) (false)]
%     Enables visible spaces: \verb*/visible spaces/.
%   \item[showtabs (boolean) (false)]
%     Enables visible tabs---only works in combination with |obeytabs|.
%
%
% \item[space (macro) (\string\textvisiblespace, \textvisiblespace)]
% Redefine the visible space character.  Note that this is only used if |showspaces=true|.
%
%
% \item[spacecolor (string) (none)]
% Set the color of visible spaces.  By default (|none|), they take the color of their surroundings.
%
%
%   \item[startinline (boolean) (false)] \appliesto{PHP}
%     Specifies that the code starts in PHP mode, i.e., leading |<?php| is omitted.
%   \item[style] (string) (\meta{default})
%     Sets the stylesheet used by \app{Pygments}.
%   \item[stepnumber (integer) (1)]
%     Interval at which line numbers appear.
%
%
% \item[stepnumberfromfirst (boolean) (false)]
% By default, when line numbering is used with |stepnumber| $\ne 1$, only line numbers that are a multiple of |stepnumber| are included.  This offsets the line numbering from the first line, so that the first line, and all lines separated from it by a multiple of |stepnumber|, are numbered.
%
%
% \item[stepnumberoffsetvalues (boolean) (false)]
% By default, when line numbering is used with |stepnumber| $\ne 1$, only line numbers that are a multiple of |stepnumber| are included.  Using |firstnumber| to offset the numbering will change which lines are numbered and which line gets which number, but will not change which \emph{numbers} appear.  This option causes |firstnumber| to be ignored in determining which line numbers are a multiple of |stepnumber|.  |firstnumber| is still used in calculating the actual numbers that appear.  As a result, the line numbers that appear will be a multiple of |stepnumber|, plus |firstnumber| minus 1.
%
%
%   \item[stripall (boolean) (false)]
%     Strip all leading and trailing whitespace from the input.
%   \item[stripnl (boolean) (false)]
%     Strip leading and trailing newlines from the input.
%
%
% \item[tab (macro) ({\rmfamily\texpkg{fancyvrb}'s} \string\FancyVerbTab, \FancyVerbTab)]
% Redefine the visible tab character.  Note that this is only used if |showtabs=true|.  |\rightarrowfill|, \hbox to 2em{\rightarrowfill}, may be a nice alternative.
%
%
% \item[tabcolor (string) (black)]
% Set the color of visible tabs.  If |tabcolor=none|, tabs take the color of their surroundings.  This is typically undesirable for tabs that indent multiline comments or strings.
%
%
%   \item[tabsize (integer) (8)]
%     The number of spaces a tab is equivalent to.  If |obeytabs| is \emph{not} active, tabs will be converted into this number of spaces.  If |obeytabs| is active, tab stops will be set this number of space characters apart.
%   \item[texcl (boolean) (false)]
%     Enables \LaTeX{} code inside comments.
%     Usage as in package \texpkg{listings}.  See the note under \texttt{escapeinside} regarding math and ligatures.
%   \item[texcomments (boolean) (false)]
%     Enables \LaTeX{} code inside comments.  The newer name for |texcl|.  See the note under |escapeinside| regarding math and ligatures.
%
%     As of Pygments 2.0.2, \texttt{texcomments} fails with multiline C/C++ preprocessor directives, and may fail in some other circumstances.  This is because preprocessor directives are \href{http://pygments.org/docs/tokens/}{tokenized as \texttt{Comment.Preproc}}, so \texttt{texcomments} causes preprocessor directives to be treated as literal \LaTeX\ code.  \href{https://bitbucket.org/birkenfeld/pygments-main/issue/1086/wrong-processing-of-in-c-c-macros-if-is}{An issue has been opened} at the Pygments site; additional details are also available on the \href{https://github.com/gpoore/minted/issues/66}{\texpkg{minted} GitHub site}.
%   \item[xleftmargin (dimension) (0)]
%     Indentation to add before the listing.
%   \item[xrightmargin (dimension) (0)]
%     Indentation to add after the listing.
%
% \end{optionlist}
%
%
%
%
% \section{Defining shortcuts}
%
% Large documents with a lot of listings will nonetheless use the same source language and the
% same set of options for most listings.
% Always specifying all options is redundant, a lot to type and makes performing changes hard.
%
% One option is to use \cmd\setminted, but even then you must still specify the language each time.
%
% \texpkg{minted} therefore defines a set of commands that lets you define shortcuts for the highlighting commands.
% Each shortcut is specific for one programming language.
%
% \DescribeMacro{\newminted}
% |\newminted| defines a new alias for the |minted| environment:
%
% \begin{example}
%   \newminted{cpp}{gobble=2,linenos}
%
%   \begin{cppcode}
%     template <typename T>
%     T id(T value) {
%         return value;
%     }
%   \end{cppcode}
% \end{example}
%
% If you want to provide extra options on the fly, or override existing default options, you can do that, too:
%
% \begin{example}
%   \newminted{cpp}{gobble=2,linenos}
%
%   \begin{cppcode*}{linenos=false,
%                    frame=single}
%     int const answer = 42;
%   \end{cppcode*}
% \end{example}
%
% Notice the star ``|*|'' behind the environment name---due to restrictions in \texpkg{fancyvrb}'s handling
% of options, it is necessary to provide a \emph{separate} environment that accepts options, and the options
% are \emph{not} optional on the starred version of the environment.
%
% The default name of the environment is \meta{language}|code|.
% If this name clashes with another environment or if you want to choose an own name for another reason, you may
% do so by specifying it as the first argument: \cmd\newminted\oarg{environment name}\marg{language}\marg{options}.
%
% Like normal \texpkg{minted} environments, environments created with |\newminted| may be used within other environment definitions.  Since the \texpkg{minted} environments use \texpkg{fancyvrb} internally, any environment based on them must include the \texpkg{fancyvrb} command |\VerbatimEnvironment|.  This allows \texpkg{fancyvrb} to determine the name of the environment that is being defined, and correctly find its end.  It is best to include this command at the beginning of the definition.  For example,
%\begin{Verbatim}
%\newminted{cpp}{gobble=2,linenos}
%\newenvironment{env}{\VerbatimEnvironment\begin{cppcode}}{\end{cppcode}}
%\end{Verbatim}
%
% \DescribeMacro{\newmint}
% The above macro only defines shortcuts for the |minted| environment.
% The main reason is that the short command form |\mint| often needs different options---at the very least, it
% will generally not use the |gobble| option.
% A shortcut for |\mint| is defined using \cmd\newmint\oarg{macro name}\marg{language}\marg{options}.
% The arguments and usage are identical to |\newminted|.
% If no \meta{macro name} is specified, \meta{language} is used.
%
% \begin{example}
%   \newmint{perl}{showspaces}
%
%   \perl/my $foo = $bar;/
% \end{example}
%
%
% \DescribeMacro{\newmintinline}
% This creates custom versions of \cmd\mintinline.  The syntax is the same as that for \cmd\newmint: \cmd\newmintinline\oarg{macro~name}\marg{language}\marg{options}.  If a \meta{macro~name} is not specified, then the created macro is called |\|\meta{language}|inline|.
%
% \begin{example}
%   \newmintinline{perl}{showspaces}
%
%   X\perlinline/my $foo = $bar;/X
% \end{example}
%
% \DescribeMacro{\newmintedfile}
% This creates custom versions of \cmd\inputminted.  The syntax is
% \begin{center}
% \cmd\newmintedfile\oarg{macro~name}\marg{language}\marg{options}
% \end{center}
% If no \meta{macro name} is given, then the macro is called |\|\meta{language}|file|.
%
%
%
% \section{FAQ and Troubleshooting}
%
% In some cases, \texpkg{minted} may not give the desired result due to other document settings that it cannot control.  Common issues are described below, with workarounds or solutions.  You may also wish to search \href{http://tex.stackexchange.com/}{tex.stackexchange.com} or ask a question there, if you are working with \texpkg{minted} in a non-typical context.
%
% \begin{itemize}
% \item \textbf{There are intermittent ``I can't write on file'' errors.}  This can be caused by using \texpkg{minted} in a directory that is synchronized with Dropbox or a similar file syncing program.  These programs can try to sync \texpkg{minted}'s temporary files while it still needs to be able to modify them.  The solution is to turn off file syncing or use a directory that is not synced.
% \item \textbf{I receive a ``Font Warning:  Some font shapes were not available'' message, or bold or italic seem to be missing.}  This is due to a limitation in the font that is currently in use for typesetting code.  In some cases, the default font shapes that \LaTeX\ substitutes are perfectly adequate, and the warning may be ignored.  In other cases, the font substitutions may not clearly indicate bold or italic text, and you will want to switch to a different font.  See The \LaTeX\ Font Catalogue's section on \href{http://www.tug.dk/FontCatalogue/typewriterfonts.html}{Typewriter Fonts} for alternatives.  If you like the default \LaTeX\ fonts, the \texpkg{lmodern} package is a good place to start.  The \texpkg{beramono} and \texpkg{courier} packages may also be good options.
% \item \textbf{I receive a ``Too many open files'' error under OS X when using caching.}  See the note on OS X under Section~\ref{sec:basic:preliminary}.
% \item \textbf{TeXShop can't find \texttt{pygmentize}.}  You may need to create a symlink.  See \url{https://tex.stackexchange.com/questions/279214}.
% \item \textbf{Weird things happen when I use the \texpkg{fancybox} package.}  \texpkg{fancybox} conflicts with \texpkg{fancyvrb}, which \texpkg{minted} uses internally.  When using \texpkg{fancybox}, make sure that it is loaded before \texpkg{minted} (or before \texpkg{fancyvrb}, if \texpkg{fancyvrb} is not loaded by \texpkg{minted}).
% \item \textbf{When I use \texpkg{minted} with KOMA-Script document classes, I get warnings about \texttt{\string\float@addtolists}.}  \texpkg{minted} uses the \texpkg{float} package to produce floated listings, but this conflicts with the way KOMA-Script does floats.  Load the package \texpkg{scrhack} to resolve the conflict.  Or use \texpkg{minted}'s |newfloat| package option.
% \item \textbf{Tilde characters \texttt{\string~} are raised, almost like superscripts.}
% This is a font issue.  You need a different font encoding, possibly with a different font.  Try |\usepackage[T1]{fontenc}|, perhaps with |\usepackage{lmodern}|, or something similar.
%
% \item \textbf{I'm getting errors with math, something like \texttt{TeX capacity exceeded} and \texttt{\string\leavevmode \string\kern \string\z@}.}  This is due to ligatures being disabled within verbatim content.  See the note under |escapeinside|.
%
% \item \textbf{With \texttt{mathescape} and the \texpkg{breqn} package (or another special math package), the document never finishes compiling or there are other unexpected results.}  Some math packages like \texpkg{breqn} give certain characters like the comma special meanings in math mode.  These can conflict with \texpkg{minted}.  In the \texpkg{breqn} and comma case, this can be fixed by redefining the comma within |minted| environments:
%\begin{verbatim}
%\AtBeginEnvironment{minted}{\catcode`\,=12\mathcode`\,="613B}
%\end{verbatim}
%Other packages/special characters may need their own modifications.
%
% \item \textbf{I'm getting errors with Beamer.}  Due to how Beamer treats verbatim content, you may need to use either the |fragile| or |fragile=singleslide| options for frames that contain \texpkg{minted} commands and environments.  |fragile=singleslide| works best, but it disables overlays.  |fragile| works by saving the contents of each frame to a temp file and then reusing them.  This approach allows overlays, but will break if you have the string |\end{frame}| at the beginning of a line (for example, in a |minted| environment).  To work around that, you can indent the content of the environment (so that the |\end{frame}| is preceded by one or more spaces) and then use the |gobble| or |autogobble| options to remove the indentation.
%
% \item \textbf{Tabs are eaten by Beamer.}  This is due to \href{https://bitbucket.org/rivanvx/beamer/issue/310/tab-characters-in-listings-lost-when-using}{a bug in Beamer's treatment of verbatim content}.  Upgrade Beamer or use the linked patch.  Otherwise, try |fragile=singleslide| if you don't need overlays, or consider using \cmd\inputminted\ or converting the tabs into spaces.
%
% \item \textbf{I'm trying to create several new \texpkg{minted} commands/environments, and want them all to have the same settings.  I'm saving the settings in a macro and then using the macro when defining the commands/environments.  But it's failing.}
% This is due to the way that \texpkg{keyval} works (\texpkg{minted} uses it to manage options). Arguments are not expanded. See \href{http://tex.stackexchange.com/questions/13563/building-keyval-arguments-using-a-macro/13564#13564}{this} and \href{http://tex.stackexchange.com/questions/145363/why-does-includegraphics-varone-vartwo-not-compile/145366#145366}{this} for more information.  It is still possible to do what you want; you just need to expand the options macro before passing it to the commands that create the new commands/environments.  An example is shown below.  The |\expandafter| is the vital part.
%\begin{verbatim}
%\def\args{linenos,frame=single,fontsize=\footnotesize,style=bw}
%
%\newcommand{\makenewmintedfiles}[1]{%
%  \newmintedfile[inputlatex]{latex}{#1}%
%  \newmintedfile[inputc]{c}{#1}%
%}
%
%\expandafter\makenewmintedfiles\expandafter{\args}
%\end{verbatim}
%
% \item \textbf{I want to use \texttt{\string\mintinline} in a context that normally doesn't allow verbatim content.}
% The |\mintinline| command will already work in many places that do not allow normal verbatim commands like |\verb|, so make sure to try it first.  If it doesn't work, one of the simplest alternatives is to save your code in a box, and then use it later.  For example,
%\begin{verbatim}
%\newsavebox\mybox
%\begin{lrbox}{\mybox}
%\mintinline{cpp}{std::cout}
%\end{lrbox}
%
%\commandthatdoesnotlikeverbatim{Text \usebox{\mybox}}
%\end{verbatim}
%
% \item \textbf{Extended characters do not work inside \texpkg{minted} commands and environments, even when the \texpkg{inputenc} package is used.}
% Version 2.0 adds support for extended characters under the pdfTeX engine.  But if you need characters that are not supported by \texpkg{inputenc}, you should use the XeTeX or LuaTeX engines instead.
%
% \item \textbf{The \texpkg{polyglossia} package is doing undesirable things to code. (For example, adding extra space around colons in French.)}  You may need to put your code within |\begin{english}...\end{english}|.  This may done for all |minted| environments using \texpkg{etoolbox} in the preamble:
% \begin{verbatim}
%\usepackage{etoolbox}
%\BeforeBeginEnvironment{minted}{\begin{english}}
%\AfterEndEnvironment{minted}{\end{english}}
% \end{verbatim}
%
% \item \begin{sloppypar} \textbf{Tabs are being turned into the character sequence \texttt{\string^\string^I}}.
% This happens when you use XeLaTeX.  You need to use the |-8bit| command-line option so that tabs may be written correctly to temporary files.  See \url{http://tex.stackexchange.com/questions/58732/how-to-output-a-tabulation-into-a-file} for more on XeLaTeX's handling of tab characters. \end{sloppypar}
%
% \item \textbf{The \texpkg{caption} package produces an error when \texttt{\string\captionof} and other commands are used in combination with \texpkg{minted}.}
% Load the \texpkg{caption} package with the option |compatibility=false|.  Or better yet, use \texpkg{minted}'s |newfloat| package option, which provides better \texpkg{caption} compatibility.
%
% \item \textbf{I need a listing environment that supports page breaks.}  The built-in listing environment is a standard float; it doesn't support page breaks.  You will probably want to define a new environment for long floats.  For example, 
%\begin{verbatim}
%\usepackage{caption}
%\newenvironment{longlisting}{\captionsetup{type=listing}}{}
%\end{verbatim}
% With the \texpkg{caption} package, it is best to use \texpkg{minted}'s |newfloat| package option.  See \url{http://tex.stackexchange.com/a/53540/10742} for more on |listing| environments with page breaks.
%
% \item \textbf{I want to use a custom script/executable to access Pygments, rather than |pygmentize|.}  Redefine |\MintedPygmentize|:
%\begin{verbatim}
%\renewcommand{\MintedPygmentize}{...}
%\end{verbatim}
%
% \item \textbf{I want to use the command-line option \texttt{-output-directory}, or MiKTeX's \texttt{-aux-directory}, but am getting errors.}  Use the package option |outputdir| to specify the location of the output directory.  Unfortunately, there is no way for \texpkg{minted} to detect the output directory automatically.
%
% \item \textbf{I want extended characters in frame labels, but am getting errors.}  This can happen with \texpkg{minted} <2.0 and Python 2.7, due to a \href{https://bitbucket.org/birkenfeld/pygments-main/issue/801/python-2-fails-to-detect-terminal-encoding}{terminal encoding issue with Pygments}.  It should work with any version of Python with \texpkg{minted} 2.0+, which processes labels internally and does not send them to Python.
% \item \textbf{\texttt{minted} environments have extra vertical space inside \texttt{tabular}.}  It is possible to \href{https://github.com/gpoore/minted/issues/82}{create a custom environment} that eliminates the extra space.  However, a general solution that behaves as expected in the presence of adjacent text remains to be found.
% \item \textbf{I'm receiving a warning from \texttt{lineno.sty} that ``Command \texttt{\string\@parboxrestore} has changed.''}  This can happen when \texpkg{minted} is loaded after \texpkg{csquotes}.  Try loading \texpkg{minted} first.  If you receive this message when you are not using \texpkg{csquotes}, you may want to experiment with the order of loading packages and might also open an issue.
% \item \textbf{I'm using \app{texi2pdf}, and getting ``Cannot stat'' errors from \app{tar}}:  This is due to the way that \app{texi2pdf} handles temporary files.  \texpkg{minted} automatically cleans up its temporary files, but \app{texi2pdf} assumes that any temporary file that is ever created will still exist at the end of the run, so it tries to access the files that \texpkg{minted} has deleted. It's possible to disable minted's temp file cleanup by adding |\renewcommand{\DeleteFile}[2][]{}| after the |\usepackage{minted}|.
% \end{itemize}
%
%
%
%
% \section*{Acknowledgements}
% \addcontentsline{toc}{section}{Acknowledgements}
%
% \textbf{Konrad Rudolph:}  Special thanks to Philipp Stephani and the rest of the guys from \texttt{comp.text.tex} and \texttt{tex.stackexchange.com}.
%
% \textbf{Geoffrey Poore:}
% \begin{itemize}
% \item Thanks to Marco Daniel for the code on \url{tex.stackexchange.com} that inspired automatic line breaking.
% \item Thanks to Patrick Vogt for improving TikZ externalization compatibility.
% \item Thanks to \textsf{@muzimuzhi} for assistance with GitHub issues.
% \item Thanks to \textsf{@jfbu} for suggestions and discussion regarding support for arbitrary Pygments style names (\#210, \#294, \#299, \#317), and for debugging assistance.
% \end{itemize}
%
% \PrintChangelog
%
% \StopEventually{} %\StopEventually{\PrintIndex}
%
%
% \section{Implementation}
%
% \iffalse
%<*package>
% \fi
%
%
% \subsection{Required packages}
% Load required packages.  For compatibility reasons, most old functionality should be supported with the original set of packages.  More recently added packages, such as |etoolbox| and |xstring|, should only be used for new features when possible.  |shellesc| must be loaded before any packages that invoke |\write18|, since it is possible that they haven't yet been patched to work with LuaTeX 0.87+.
%    \begin{macrocode}
\RequirePackage{keyval}
\RequirePackage{kvoptions}
\RequirePackage{fvextra}
\RequirePackage{ifthen}
\RequirePackage{calc}
\IfFileExists{shellesc.sty}
 {\RequirePackage{shellesc}
  \@ifpackagelater{shellesc}{2016/04/29}
   {}
   {\protected\def\ShellEscape{\immediate\write18 }}}
 {\protected\def\ShellEscape{\immediate\write18 }}
\RequirePackage{ifplatform}
\RequirePackage{pdftexcmds}
\RequirePackage{etoolbox}
\RequirePackage{xstring}
\RequirePackage{lineno}
\RequirePackage{framed}
\RequirePackage{catchfile}
%    \end{macrocode}
%
% Make sure that either |color| or |xcolor| is loaded by the beginning of the document.
%    \begin{macrocode}
\AtEndPreamble{%
  \@ifpackageloaded{color}{}{%
    \@ifpackageloaded{xcolor}{}{\RequirePackage{xcolor}}}%
}
%    \end{macrocode}
%
%
%
% \subsection{Package options}
%
% \begin{macro}{\minted@float@within}
%
% Define an option that controls the section numbering of the |listing| float.
%
%    \begin{macrocode}
\DeclareVoidOption{chapter}{\def\minted@float@within{chapter}}
\DeclareVoidOption{section}{\def\minted@float@within{section}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{newfloat}
%
% Define an option to use \texpkg{newfloat} rather than \texpkg{float} to create a floated |listing| environment.
%
%    \begin{macrocode}
\DeclareBoolOption{newfloat}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{cache}
% Define an option that determines whether highlighted content is cached.  We use a boolean to keep track of its state.
%    \begin{macrocode}
\DeclareBoolOption[true]{cache}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@jobname}
% At various points, temporary files and directories will need to be named after the main |.tex| file.  The typical way to do this is to use |\jobname|.  However, if the file name contains spaces, then |\jobname| will contain the name wrapped in quotes (older versions of MiKTeX replace spaces with asterisks instead, and \texttt{XeTeX} apparently \href{http://tex.stackexchange.com/a/93829/10742}{allows double quotes within file names}, in which case names are wrapped in single quotes).  While that is perfectly fine for working with \LaTeX\ internally, it causes problems with |\write18|, since quotes will end up in unwanted locations in shell commands.  It would be possible to strip the wrapping quotation marks when they are present, and maintain any spaces in the file name.  But it is simplest to create a ``sanitized'' version of |\jobname| in which spaces and asterisks are replaced by underscores, and double quotes are stripped.  Single quotes are also replaced, since they can cause quoted string errors, or become double quotes in the process of being passed to the system through |\write18|.
%    \begin{macrocode}
\StrSubstitute{\jobname}{ }{_}[\minted@jobname]
\StrSubstitute{\minted@jobname}{*}{_}[\minted@jobname]
\StrSubstitute{\minted@jobname}{"}{}[\minted@jobname]
\StrSubstitute{\minted@jobname}{'}{_}[\minted@jobname]
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@cachedir}
% Set the directory in which cached content is saved.  The default uses a |minted-| prefix followed by the sanitized |\minted@jobname|.
%    \begin{macrocode}
\newcommand{\minted@cachedir}{\detokenize{_}minted-\minted@jobname}
\let\minted@cachedir@windows\minted@cachedir
\define@key{minted}{cachedir}{%
  \@namedef{minted@cachedir}{#1}%
  \StrSubstitute{\minted@cachedir}{/}{\@backslashchar}[\minted@cachedir@windows]}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{finalizecache}
% Define an option that switches the naming of cache files from an MD5-based system to a |listing<number>| scheme.  Compiling with this option is a prerequisite to turning on |frozencache|.
%    \begin{macrocode}
\DeclareBoolOption{finalizecache}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{frozencache}
% Define an option that uses a fixed set of cache files, using |listing<number>| file naming with |\write18| disabled.  This is convenient for working with a document in an environment in which |\write18| support is disabled and \texpkg{minted} content does not need to be modified.
%    \begin{macrocode}
\DeclareBoolOption{frozencache}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@outputdir}
% The |-output-directory| command-line option for \LaTeX\ causes problems for \texpkg{minted}, because the \texpkg{minted} temporary files are saved in the output directory, but \texpkg{minted} still looks for them in the document root directory.  There is no way to access the value of the command-line option.  But it is possible to allow the output directory to be specified manually as a package option.  A trailing slash is automatically appended to the |outputdir|, so that it may be directly joined to |cachedir|.  This may be redundant if the user-supplied value already ends with a slash, but doubled slashes are ignored under *nix and Windows, so it isn't a problem.
%    \begin{macrocode}
\let\minted@outputdir\@empty
\let\minted@outputdir@windows\@empty
\define@key{minted}{outputdir}{%
  \@namedef{minted@outputdir}{#1/}%
  \StrSubstitute{\minted@outputdir}{/}%
    {\@backslashchar}[\minted@outputdir@windows]}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{kpsewhich}
% Define an option that invokes |kpsewhich| to locate the files that are to be |pygmentize|d.  This isn't done by default to avoid the extra overhead, but can be useful with some build tools such as |texi2pdf| that rely on modifying |TEXINPUTS|.
%    \begin{macrocode}
\DeclareBoolOption{kpsewhich}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{langlinenos}
% Define an option that makes all |minted| environments and |\mint| commands for a given language share cumulative line numbering (if |firstnumber=last|).
%    \begin{macrocode}
\DeclareBoolOption{langlinenos}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{draft}
% Define an option that allows \texpkg{fancyvrb} to do all typesetting directly, without using \app{Pygments}.  This trades syntax highlighting for speed.  Note that in many cases, the difference in performance between caching and draft mode will be minimal.  Also note that draft settings may be inherited from the document class.
%    \begin{macrocode}
\DeclareBoolOption{draft}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{final}
% Define a |final| option that is the opposite of |draft|, since many packages do this.
%    \begin{macrocode}
\DeclareComplementaryOption{final}{draft}
%    \end{macrocode}
% \end{macro}
%
%
% Process package options.  Proceed with everything that immediately relies upon them.  If PGF/Ti\textit{k}Z externalization is in use, switch on |draft| mode and turn off |cache|.  Externalization involves compiling the \emph{entire} document; all parts not related to the current image are ``silently thrown away.'' \texpkg{minted} needs to cooperate with that by not writing any temp files or creating any directories.  Two checks are done for externalization.  The first, using |\tikzifexternalizing|, works if externalization is set before \texpkg{minted} is loaded.  The second, using |\tikzexternalrealjob|, works if externalization is set after \texpkg{minted} is loaded.
%
%    \begin{macrocode}
\ProcessKeyvalOptions*
\ifthenelse{\boolean{minted@newfloat}}{\RequirePackage{newfloat}}{\RequirePackage{float}}
\ifcsname tikzifexternalizing\endcsname 
  \tikzifexternalizing{\minted@drafttrue\minted@cachefalse}{}
\else
  \ifcsname tikzexternalrealjob\endcsname
    \minted@drafttrue
    \minted@cachefalse
  \else
  \fi
\fi
\ifthenelse{\boolean{minted@finalizecache}}%
 {\ifthenelse{\boolean{minted@frozencache}}%
   {\PackageError{minted}%
     {Options "finalizecache" and "frozencache" are not compatible}%
     {Options "finalizecache" and "frozencache" are not compatible}}%
   {}}%
 {}
\ifthenelse{\boolean{minted@cache}}%
 {\ifthenelse{\boolean{minted@frozencache}}%
   {}%
   {\AtEndOfPackage{\ProvideDirectory{\minted@outputdir\minted@cachedir}}}}%
 {}
%    \end{macrocode}
%
%
%
% \subsection{Input, caching, and temp files}
% 
% \begin{macro}{\minted@input}
% We need a wrapper for |\input|.  In most cases, |\input| failure will be due to attempts to use |\inputminted| with files that don't exist, but we also want to give informative error messages when |outputdir| is needed or incompatible build tools are used.
%    \begin{macrocode}
\newcommand{\minted@input}[1]{%
  \IfFileExists{#1}%
   {\input{#1}}%
   {\PackageError{minted}{Missing Pygments output; \string\inputminted\space 
     was^^Jprobably given a file that does not exist--otherwise, you may need 
     ^^Jthe outputdir package option, or may be using an incompatible build
     tool,^^Jor may be using frozencache with a missing file}%
    {This could be caused by using -output-directory or -aux-directory
     ^^Jwithout setting minted's outputdir, or by using a build tool that
     ^^Jchanges paths in ways minted cannot detect,
     ^^Jor using frozencache with a missing file.}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@infile}
% Define a default name for files of highlighted content that are brought it.  Caching will redefine this.  We start out with the default, non-caching value.
%    \begin{macrocode}
\newcommand{\minted@infile}{\minted@jobname.out.pyg}
%    \end{macrocode}
% \end{macro}
%
%
% We need a way to track the cache files that are created, and delete those that are not in use.  This is accomplished by creating a comma-delimited list of cache files and saving this list to the |.aux| file so that it may be accessed on subsequent runs.  During subsequent runs, this list is compared against the cache files that are actually used, and unused files are deleted.  Cache file names are created with MD5 hashes of highlighting settings and file contents, with a |.pygtex| extension, so they never contain commas. Thus comma-delimiting the list of file names doesn't introduce a potential for errors.
%
% \begin{macro}{\minted@cachelist}
% This is a list of the current cache files.
%    \begin{macrocode}
\newcommand{\minted@cachelist}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@addcachefile}
% This adds a file to the list of cache files.  It also creates a macro involving the hash, so that the current usage of the hash can be easily checked by seeing if the macro exists.  The list of cache files must be created with built-in linebreaks, so that when it is written to the |.aux| file, it won't all be on one line and thereby risk buffer errors.
%    \begin{macrocode}
\newcommand{\minted@addcachefile}[1]{%
  \expandafter\long\expandafter\gdef\expandafter\minted@cachelist\expandafter{%
    \minted@cachelist,^^J%
    \space\space#1}%
  \expandafter\gdef\csname minted@cached@#1\endcsname{}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@savecachelist}
%
% We need to be able to save the list of cache files to the |.aux| file, so that we can reload it on the next run.
%    \begin{macrocode}
\newcommand{\minted@savecachelist}{%
  \ifdefempty{\minted@cachelist}{}{%
    \immediate\write\@mainaux{%
      \string\gdef\string\minted@oldcachelist\string{%
        \minted@cachelist\string}}%
  }%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@cleancache}
% Clean up old cache files that are no longer in use.
%    \begin{macrocode}
\newcommand{\minted@cleancache}{%
  \ifcsname minted@oldcachelist\endcsname
    \def\do##1{%
      \ifthenelse{\equal{##1}{}}{}{%
        \ifcsname minted@cached@##1\endcsname\else
          \DeleteFile[\minted@outputdir\minted@cachedir]{##1}%
        \fi
      }%
    }%
    \expandafter\docsvlist\expandafter{\minted@oldcachelist}%
  \else
  \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% At the end of the document, save the list of cache files and clean the cache.  If in draft mode, don't clean up the cache and save the old cache file list for next time.  This allows draft mode to be switched on and off without requiring that all highlighted content be regenerated.  The saving and cleaning operations may be called without conditionals, since their definitions already contain all necessary checks for their correct operation.
%    \begin{macrocode}
\ifthenelse{\boolean{minted@draft}}%
 {\AtEndDocument{%
    \ifcsname minted@oldcachelist\endcsname
      \StrSubstitute{\minted@oldcachelist}{,}{,^^J }[\minted@cachelist]
      \minted@savecachelist
    \fi}}%
 {\ifthenelse{\boolean{minted@frozencache}}%
   {\AtEndDocument{%
      \ifcsname minted@oldcachelist\endcsname
        \StrSubstitute{\minted@oldcachelist}{,}{,^^J }[\minted@cachelist]
        \minted@savecachelist
      \fi}}%
   {\AtEndDocument{%
    \minted@savecachelist
    \minted@cleancache}}}%
%    \end{macrocode}
%
%
%
% \subsection{OS interaction}
%
% We need system-dependent macros for communicating with the ``outside world.''
%
% \begin{macro}{\DeleteFile}
%
% Delete a file.  Define conditionally in case an equivalent macro has already been defined.
%
%    \begin{macrocode}
\ifwindows
  \providecommand{\DeleteFile}[2][]{%
    \ifthenelse{\equal{#1}{}}%
      {\IfFileExists{#2}{\ShellEscape{del #2}}{}}%
      {\IfFileExists{#1/#2}{%
        \StrSubstitute{#1}{/}{\@backslashchar}[\minted@windir]
        \ShellEscape{del \minted@windir\@backslashchar #2}}{}}}
\else
  \providecommand{\DeleteFile}[2][]{%
    \ifthenelse{\equal{#1}{}}%
      {\IfFileExists{#2}{\ShellEscape{rm #2}}{}}%
      {\IfFileExists{#1/#2}{\ShellEscape{rm #1/#2}}{}}}
\fi
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ProvideDirectory}
%
% We need to be able to create a directory, if it doesn't already exist.  This is primarily for storing cached highlighted content.
%
%    \begin{macrocode}
\ifwindows
  \newcommand{\ProvideDirectory}[1]{%
    \StrSubstitute{#1}{/}{\@backslashchar}[\minted@windir]
    \ShellEscape{if not exist \minted@windir\space mkdir \minted@windir}}
\else
  \newcommand{\ProvideDirectory}[1]{%
    \ShellEscape{mkdir -p #1}}
\fi
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\TestAppExists}
%
% Determine whether a given application exists.
%
% Usage is a bit roundabout, but has been retained for backward compatibility.  At some point, it may be worth replacing this with something using \verb`\@@input"|<command>"`. That would require MiKTeX users to |--enable-pipes|, however, which would make things a little more complicated.  If Windows XP compatibility is ever no longer required, the |where| command could be used instead of the approach for Windows.
%
% To test whether an application exists, use the following code:
%
% \begin{Verbatim}
%\TestAppExists{appname}
%\ifthenelse{\boolean{AppExists}}{app exists}{app doesn't exist}
% \end{Verbatim}
%
%    \begin{macrocode}
\newboolean{AppExists}
\newread\minted@appexistsfile
\newcommand{\TestAppExists}[1]{%
  \ifwindows
%    \end{macrocode}
%
% On Windows, we need to use path expansion and write the result to a file.
% If the application doesn't exist, the file will be empty (except for a newline);
% otherwise, it will contain the full path of the application.
%
%    \begin{macrocode}
    \DeleteFile{\minted@jobname.aex}%
    \ShellEscape{for \string^\@percentchar i in (#1.exe #1.bat #1.cmd)
      do set > \minted@jobname.aex <nul: /p 
      x=\string^\@percentchar \string~$PATH:i>> \minted@jobname.aex}%
    %$ <- balance syntax highlighting
    \immediate\openin\minted@appexistsfile\minted@jobname.aex
    \expandafter\def\expandafter\@tmp@cr\expandafter{\the\endlinechar}%
    \endlinechar=-1\relax
    \readline\minted@appexistsfile to \minted@apppathifexists
    \endlinechar=\@tmp@cr
    \ifthenelse{\equal{\minted@apppathifexists}{}}%
     {\AppExistsfalse}%
     {\AppExiststrue}%
    \immediate\closein\minted@appexistsfile
    \DeleteFile{\minted@jobname.aex}%
  \else
%    \end{macrocode}
%
% On Unix-like systems, we do a straightforward |which| test and create a file upon success, whose existence we can then check.
%
%    \begin{macrocode}
    \ShellEscape{which #1 && touch \minted@jobname.aex}%
    \IfFileExists{\minted@jobname.aex}%
      {\AppExiststrue
        \DeleteFile{\minted@jobname.aex}}%
      {\AppExistsfalse}%
  \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{Option processing}
%
% Option processing is somewhat involved, because we want to be able to define options at various levels of hierarchy:  individual command/environment, language, global (document).  And once those options are defined, we need to go through the hierarchy in a defined order of precedence to determine which option to apply.  As if that wasn't complicated enough, some options need to be sent to Pygments, some need to be sent to \texpkg{fancyvrb}, and some need to be processed within \texpkg{minted} itself.
%
% To begin with, we need macros for storing lists of options that will later be passed via the command line to Pygments (|optlistcl|).  These are defined at the global (|cl@g|), language (|cl@lang|), and command or environment (|cl@cmd|) levels, so that settings can be specified at various levels of hierarchy.  The language macro is actually a placeholder.  The current language will be tracked using |\minted@lang|.  Each individual language will create a |\minted@optlistcl@lang|\meta{language} macro.  |\minted@optlistcl@lang| may be |\let| to this macro as convenient; otherwise, the general language macro merely serves as a placeholder.
%
% The global- and language-level lists also have an |inline| (|i|) variant.  This allows different settings to be applied in inline settings.  An inline variant is not needed at the command/environment level, since at that level settings would not be present unless they were supposed to be applied.
%
% \begin{macro}{\minted@optlistcl@g}
%    \begin{macrocode}
\newcommand{\minted@optlistcl@g}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@optlistcl@g@i}
%    \begin{macrocode}
\newcommand{\minted@optlistcl@g@i}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@lang}
%    \begin{macrocode}
\let\minted@lang\@empty
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@optlistcl@lang}
%    \begin{macrocode}
\newcommand{\minted@optlistcl@lang}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@optlistcl@lang@i}
%    \begin{macrocode}
\newcommand{\minted@optlistcl@lang@i}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@optlistcl@cmd}
%    \begin{macrocode}
\newcommand{\minted@optlistcl@cmd}{}
%    \end{macrocode}
% \end{macro}
%
% We also need macros for storing lists of options that will later be passed to \texpkg{fancyvrb} (|optlistfv|).  As before, these exist at the global (|fv@g|), language (|fv@lang|), and command or environment (|fv@cmd|) levels.  Pygments accepts \texpkg{fancyvrb} options, but in almost all cases, these options may be applied via |\fvset| rather than via running Pygments.  This is significantly more efficient when caching is turned on, since it allows formatting changes to be applied without having to re-highlight the code.
%
% \begin{macro}{\minted@optlistfv@g}
%    \begin{macrocode}
\newcommand{\minted@optlistfv@g}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@optlistfv@g@i}
%    \begin{macrocode}
\newcommand{\minted@optlistfv@g@i}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@optlistfv@lang}
%    \begin{macrocode}
\newcommand{\minted@optlistfv@lang}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@optlistfv@lang@i}
%    \begin{macrocode}
\newcommand{\minted@optlistfv@lang@i}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@optlistfv@cmd}
%    \begin{macrocode}
\newcommand{\minted@optlistfv@cmd}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@configlang}
%
% We need a way to check whether a language has had all its option list macros created.  This generally occurs in a context where |\minted@lang| needs to be set.  So we create a macro that does both at once.  If the language list macros do not exist, we create them globally to simplify future operations.
%    \begin{macrocode}
\newcommand{\minted@configlang}[1]{%
  \def\minted@lang{#1}%
  \ifcsname minted@optlistcl@lang\minted@lang\endcsname\else
    \expandafter\gdef\csname minted@optlistcl@lang\minted@lang\endcsname{}%
  \fi
  \ifcsname minted@optlistcl@lang\minted@lang @i\endcsname\else
    \expandafter\gdef\csname minted@optlistcl@lang\minted@lang @i\endcsname{}%
  \fi
  \ifcsname minted@optlistfv@lang\minted@lang\endcsname\else
    \expandafter\gdef\csname minted@optlistfv@lang\minted@lang\endcsname{}%
  \fi
  \ifcsname minted@optlistfv@lang\minted@lang @i\endcsname\else
    \expandafter\gdef\csname minted@optlistfv@lang\minted@lang @i\endcsname{}%
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% We need a way to define options in bulk at the global, language, and command levels.  How this is done will depend on the type of option.  The keys created are grouped by level:  |minted@opt@g|, |minted@opt@lang|, and |minted@opt@cmd|, plus inline variants.  The language-level key groupings use |\minted@lang| internally, so we don't need to duplicate the internals for different languages.  The key groupings are independent of whether a given option relates to Pygments, \texpkg{fancyvrb}, etc.  Organization by level is the only thing that is important here, since keys are applied in a hierarchical fashion.  Key values are stored in macros of the form |\minted@opt@|\meta{level}|:|\meta{key}, so that they may be retrieved later.  In practice, these key macros will generally not be used directly (hence the colon in the name).  Rather, the hierarchy of macros will be traversed until an existing macro is found.
%
% \begin{macro}{\minted@def@optcl}
%
% Define a generic option that will be passed to the command line.  Options are given in a |{key}{value}| format that is transformed into |key=value| and then passed to |pygmentize|.  This allows |value| to be easily stored in a separate macro for later access.  This is useful, for example, in separately accessing the value of |encoding| for performing |autogobble|.
%
% If a |key| option is specified without |=value|, the default is assumed.  Options are automatically created at all levels.
%
% Options are added to the option lists in such a way that they will be detokenized.  This is necessary since they will ultimately be used in |\write18|.
%    \begin{macrocode}
\ifwindows
  \newcommand{\minted@optlistcl@quote}[2]{%
    \detokenize{#1="#2"}}
\else
  \newcommand{\minted@optlistcl@quote}[2]{%
    \detokenize{#1='#2'}}
\fi
\newcommand{\minted@addto@optlistcl}[3]{%
  \expandafter\def\expandafter#1\expandafter{#1%
    \minted@optlistcl@quote{#2}{#3}\space}}
\newcommand{\minted@addto@optlistcl@lang}[3]{%
  \expandafter\let\expandafter\minted@tmp\csname #1\endcsname
  \expandafter\def\expandafter\minted@tmp\expandafter{\minted@tmp%
    \minted@optlistcl@quote{#2}{#3}\space}%
  \expandafter\let\csname #1\endcsname\minted@tmp}
\newcommand{\minted@def@optcl}[4][]{%
  \ifthenelse{\equal{#1}{}}%
    {\define@key{minted@opt@g}{#2}{%
        \minted@addto@optlistcl{\minted@optlistcl@g}{#3}{#4}%
        \@namedef{minted@opt@g:#2}{#4}}%
      \define@key{minted@opt@g@i}{#2}{%
        \minted@addto@optlistcl{\minted@optlistcl@g@i}{#3}{#4}%
        \@namedef{minted@opt@g@i:#2}{#4}}%
      \define@key{minted@opt@lang}{#2}{%
        \minted@addto@optlistcl@lang{minted@optlistcl@lang\minted@lang}{#3}{#4}%
        \@namedef{minted@opt@lang\minted@lang:#2}{#4}}%
      \define@key{minted@opt@lang@i}{#2}{%
        \minted@addto@optlistcl@lang{%
          minted@optlistcl@lang\minted@lang @i}{#3}{#4}%
        \@namedef{minted@opt@lang\minted@lang @i:#2}{#4}}%
      \define@key{minted@opt@cmd}{#2}{%
        \minted@addto@optlistcl{\minted@optlistcl@cmd}{#3}{#4}%
        \@namedef{minted@opt@cmd:#2}{#4}}}%
    {\define@key{minted@opt@g}{#2}[#1]{%
        \minted@addto@optlistcl{\minted@optlistcl@g}{#3}{#4}%
        \@namedef{minted@opt@g:#2}{#4}}%
      \define@key{minted@opt@g@i}{#2}[#1]{%
        \minted@addto@optlistcl{\minted@optlistcl@g@i}{#3}{#4}%
        \@namedef{minted@opt@g@i:#2}{#4}}%
      \define@key{minted@opt@lang}{#2}[#1]{%
        \minted@addto@optlistcl@lang{minted@optlistcl@lang\minted@lang}{#3}{#4}%
        \@namedef{minted@opt@lang\minted@lang:#2}{#4}}%
      \define@key{minted@opt@lang@i}{#2}[#1]{%
        \minted@addto@optlistcl@lang{%
          minted@optlistcl@lang\minted@lang @i}{#3}{#4}%
        \@namedef{minted@opt@lang\minted@lang @i:#2}{#4}}%
      \define@key{minted@opt@cmd}{#2}[#1]{%
        \minted@addto@optlistcl{\minted@optlistcl@cmd}{#3}{#4}%
        \@namedef{minted@opt@cmd:#2}{#4}}}%
}
%    \end{macrocode}
% \end{macro}
%
% This covers the typical options that must be passed to Pygments.  But some, particularly |escapeinside|, need more work.  Since their arguments may contain escaped characters, expansion rather than detokenization is needed.  Getting expansion to work as desired in a |\write18| context requires the redefinition of some characters.
%
% \begin{macro}{\minted@escape}
% Process (possibly backslash-escaped) characters into a form that will work correctly under expansion for use in |\write18|.  This assumes that only punctuation characters are escaped.  (Otherwise, trailing spaces from |\detokenize| would need to be stripped.)  This is currently only used for |escapeinside|.
%    \begin{macrocode}
\begingroup
\catcode`\!=0
!catcode`!\=12
!gdef!minted@escape#1{%
  !expandafter!minted@escape@i!detokenize{#1}\!FV@Sentinel}
!gdef!minted@escape@i#1\#2!FV@Sentinel{%
  !if!relax!detokenize{#2}!relax
    !expandafter!@firstoftwo
  !else
    !expandafter!@secondoftwo
  !fi
  {#1!minted@escape@end\#2!FV@Sentinel}
  {#1!minted@escape@esc\#2!FV@Sentinel}}
!gdef!minted@escape@end#1!FV@Sentinel{}
!gdef!minted@escape@esc\#1#2!FV@Sentinel{%
  #1!minted@escape@i#2!FV@Sentinel}
!endgroup
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@def@optcl@e}
% Now to define options that involve backslash escapes.
%    \begin{macrocode}
\newcommand{\minted@addto@optlistcl@e}[3]{%
  \edef\minted@tmp{\minted@escape{#3}}%
  \expandafter\minted@addto@optlistcl@e@i\expandafter{\minted@tmp}{#1}{#2}}
\def\minted@addto@optlistcl@e@i#1#2#3{%
  \expandafter\def\expandafter#2\expandafter{#2\minted@optlistcl@quote{#3}{#1}\space}}
\newcommand{\minted@addto@optlistcl@lang@e}[3]{%
  \edef\minted@tmp{\minted@escape{#3}}%
  \expandafter\minted@addto@optlistcl@lang@e@i\expandafter{\minted@tmp}{#1}{#2}}
\def\minted@addto@optlistcl@lang@e@i#1#2#3{%
  \expandafter\let\expandafter\minted@tmp\csname #2\endcsname
  \expandafter\def\expandafter\minted@tmp\expandafter{\minted@tmp\minted@optlistcl@quote{#3}{#1}\space}%
  \expandafter\let\csname #2\endcsname\minted@tmp}
\newcommand{\minted@def@optcl@e}[4][]{%
  \ifthenelse{\equal{#1}{}}%
    {\define@key{minted@opt@g}{#2}{%
        \minted@addto@optlistcl@e{\minted@optlistcl@g}{#3}{#4}%
        \@namedef{minted@opt@g:#2}{#4}}%
      \define@key{minted@opt@g@i}{#2}{%
        \minted@addto@optlistcl@e{\minted@optlistcl@g@i}{#3}{#4}%
        \@namedef{minted@opt@g@i:#2}{#4}}%
      \define@key{minted@opt@lang}{#2}{%
        \minted@addto@optlistcl@lang@e{minted@optlistcl@lang\minted@lang}{#3}{#4}%
        \@namedef{minted@opt@lang\minted@lang:#2}{#4}}%
      \define@key{minted@opt@lang@i}{#2}{%
        \minted@addto@optlistcl@lang@e{%
          minted@optlistcl@lang\minted@lang @i}{#3}{#4}%
        \@namedef{minted@opt@lang\minted@lang @i:#2}{#4}}%
      \define@key{minted@opt@cmd}{#2}{%
        \minted@addto@optlistcl@e{\minted@optlistcl@cmd}{#3}{#4}%
        \@namedef{minted@opt@cmd:#2}{#4}}}%
    {\define@key{minted@opt@g}{#2}[#1]{%
        \minted@addto@optlistcl@e{\minted@optlistcl@g}{#3}{#4}%
        \@namedef{minted@opt@g:#2}{#4}}%
      \define@key{minted@opt@g@i}{#2}[#1]{%
        \minted@addto@optlistcl@e{\minted@optlistcl@g@i}{#3}{#4}%
        \@namedef{minted@opt@g@i:#2}{#4}}%
      \define@key{minted@opt@lang}{#2}[#1]{%
        \minted@addto@optlistcl@lang@e{minted@optlistcl@lang\minted@lang}{#3}{#4}%
        \@namedef{minted@opt@lang\minted@lang:#2}{#4}}%
      \define@key{minted@opt@lang@i}{#2}[#1]{%
        \minted@addto@optlistcl@lang@e{%
          minted@optlistcl@lang\minted@lang @i}{#3}{#4}%
        \@namedef{minted@opt@lang\minted@lang @i:#2}{#4}}%
      \define@key{minted@opt@cmd}{#2}[#1]{%
        \minted@addto@optlistcl@e{\minted@optlistcl@cmd}{#3}{#4}%
        \@namedef{minted@opt@cmd:#2}{#4}}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@def@optcl@switch}
%
% Define a switch or boolean option that is passed to Pygments, which is |true| when no value is specified.
%    \begin{macrocode}
\newcommand{\minted@def@optcl@switch}[2]{%
  \define@booleankey{minted@opt@g}{#1}%
    {\minted@addto@optlistcl{\minted@optlistcl@g}{#2}{True}%
      \@namedef{minted@opt@g:#1}{true}}
    {\minted@addto@optlistcl{\minted@optlistcl@g}{#2}{False}%
      \@namedef{minted@opt@g:#1}{false}}
  \define@booleankey{minted@opt@g@i}{#1}%
    {\minted@addto@optlistcl{\minted@optlistcl@g@i}{#2}{True}%
      \@namedef{minted@opt@g@i:#1}{true}}
    {\minted@addto@optlistcl{\minted@optlistcl@g@i}{#2}{False}%
      \@namedef{minted@opt@g@i:#1}{false}}
  \define@booleankey{minted@opt@lang}{#1}%
    {\minted@addto@optlistcl@lang{minted@optlistcl@lang\minted@lang}{#2}{True}%
      \@namedef{minted@opt@lang\minted@lang:#1}{true}}
    {\minted@addto@optlistcl@lang{minted@optlistcl@lang\minted@lang}{#2}{False}%
      \@namedef{minted@opt@lang\minted@lang:#1}{false}}
  \define@booleankey{minted@opt@lang@i}{#1}%
    {\minted@addto@optlistcl@lang{minted@optlistcl@lang\minted@lang @i}{#2}{True}%
      \@namedef{minted@opt@lang\minted@lang @i:#1}{true}}
    {\minted@addto@optlistcl@lang{minted@optlistcl@lang\minted@lang @i}{#2}{False}%
      \@namedef{minted@opt@lang\minted@lang @i:#1}{false}}
  \define@booleankey{minted@opt@cmd}{#1}%
      {\minted@addto@optlistcl{\minted@optlistcl@cmd}{#2}{True}%
        \@namedef{minted@opt@cmd:#1}{true}}
      {\minted@addto@optlistcl{\minted@optlistcl@cmd}{#2}{False}%
        \@namedef{minted@opt@cmd:#1}{false}}
}
%    \end{macrocode}
% \end{macro}
%
% Now that all the machinery for Pygments options is in place, we can move on to \texpkg{fancyvrb} options.
%
% \begin{macro}{\minted@def@optfv}
%
% Define \texpkg{fancyvrb} options.  The |#1={##1}| is needed because any braces enclosing the argument (|##1|) will be stripped during the initial capture, and they need to be reinserted before \texpkg{fancyvrb} gets the argument and sends it through another \texpkg{keyval} processing step.  If there were no braces initially, adding them here doesn't hurt, since they are just stripped off again during processing.
%    \begin{macrocode}
\newcommand{\minted@def@optfv}[1]{%
  \define@key{minted@opt@g}{#1}{%
    \expandafter\def\expandafter\minted@optlistfv@g\expandafter{%
      \minted@optlistfv@g#1={##1},}%
    \@namedef{minted@opt@g:#1}{##1}}
  \define@key{minted@opt@g@i}{#1}{%
    \expandafter\def\expandafter\minted@optlistfv@g@i\expandafter{%
      \minted@optlistfv@g@i#1={##1},}%
    \@namedef{minted@opt@g@i:#1}{##1}}
  \define@key{minted@opt@lang}{#1}{%
    \expandafter\let\expandafter\minted@tmp%
      \csname minted@optlistfv@lang\minted@lang\endcsname
    \expandafter\def\expandafter\minted@tmp\expandafter{%
      \minted@tmp#1={##1},}%
    \expandafter\let\csname minted@optlistfv@lang\minted@lang\endcsname%
      \minted@tmp
    \@namedef{minted@opt@lang\minted@lang:#1}{##1}}
  \define@key{minted@opt@lang@i}{#1}{%
    \expandafter\let\expandafter\minted@tmp%
      \csname minted@optlistfv@lang\minted@lang @i\endcsname
    \expandafter\def\expandafter\minted@tmp\expandafter{%
      \minted@tmp#1={##1},}%
    \expandafter\let\csname minted@optlistfv@lang\minted@lang @i\endcsname%
      \minted@tmp
    \@namedef{minted@opt@lang\minted@lang @i:#1}{##1}}
  \define@key{minted@opt@cmd}{#1}{%
    \expandafter\def\expandafter\minted@optlistfv@cmd\expandafter{%
      \minted@optlistfv@cmd#1={##1},}%
    \@namedef{minted@opt@cmd:#1}{##1}}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@def@optfv@switch}
%
% Define \texpkg{fancyvrb} boolean options.
%    \begin{macrocode}
\newcommand{\minted@def@optfv@switch}[1]{%
  \define@booleankey{minted@opt@g}{#1}%
    {\expandafter\def\expandafter\minted@optlistfv@g\expandafter{%
      \minted@optlistfv@g#1=true,}%
     \@namedef{minted@opt@g:#1}{true}}%
    {\expandafter\def\expandafter\minted@optlistfv@g\expandafter{%
      \minted@optlistfv@g#1=false,}%
     \@namedef{minted@opt@g:#1}{false}}%
  \define@booleankey{minted@opt@g@i}{#1}%
    {\expandafter\def\expandafter\minted@optlistfv@g@i\expandafter{%
      \minted@optlistfv@g@i#1=true,}%
     \@namedef{minted@opt@g@i:#1}{true}}%
    {\expandafter\def\expandafter\minted@optlistfv@g@i\expandafter{%
      \minted@optlistfv@g@i#1=false,}%
     \@namedef{minted@opt@g@i:#1}{false}}%
  \define@booleankey{minted@opt@lang}{#1}%
    {\expandafter\let\expandafter\minted@tmp%
        \csname minted@optlistfv@lang\minted@lang\endcsname
      \expandafter\def\expandafter\minted@tmp\expandafter{%
        \minted@tmp#1=true,}%
      \expandafter\let\csname minted@optlistfv@lang\minted@lang\endcsname%
        \minted@tmp
     \@namedef{minted@opt@lang\minted@lang:#1}{true}}%
    {\expandafter\let\expandafter\minted@tmp%
        \csname minted@optlistfv@lang\minted@lang\endcsname
      \expandafter\def\expandafter\minted@tmp\expandafter{%
        \minted@tmp#1=false,}%
      \expandafter\let\csname minted@optlistfv@lang\minted@lang\endcsname%
        \minted@tmp
     \@namedef{minted@opt@lang\minted@lang:#1}{false}}%
  \define@booleankey{minted@opt@lang@i}{#1}%
    {\expandafter\let\expandafter\minted@tmp%
        \csname minted@optlistfv@lang\minted@lang @i\endcsname
      \expandafter\def\expandafter\minted@tmp\expandafter{%
        \minted@tmp#1=true,}%
      \expandafter\let\csname minted@optlistfv@lang\minted@lang @i\endcsname%
        \minted@tmp
     \@namedef{minted@opt@lang\minted@lang @i:#1}{true}}%
    {\expandafter\let\expandafter\minted@tmp%
        \csname minted@optlistfv@lang\minted@lang @i\endcsname
      \expandafter\def\expandafter\minted@tmp\expandafter{%
        \minted@tmp#1=false,}%
      \expandafter\let\csname minted@optlistfv@lang\minted@lang @i\endcsname%
        \minted@tmp
     \@namedef{minted@opt@lang\minted@lang @i:#1}{false}}%
  \define@booleankey{minted@opt@cmd}{#1}%
    {\expandafter\def\expandafter\minted@optlistfv@cmd\expandafter{%
      \minted@optlistfv@cmd#1=true,}%
     \@namedef{minted@opt@cmd:#1}{true}}%
    {\expandafter\def\expandafter\minted@optlistfv@cmd\expandafter{%
      \minted@optlistfv@cmd#1=false,}%
     \@namedef{minted@opt@cmd:#1}{false}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{minted@isinline}
% In resolving value precedence when actually using values, we need a way to determine whether we are in an inline context.  This is accomplished via a boolean that is set at the beginning of inline commands.
%    \begin{macrocode}
\newboolean{minted@isinline}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@fvset}
% We will need a way to actually use the lists of stored \texpkg{fancyvrb} options later on.
%    \begin{macrocode}
\newcommand{\minted@fvset}{%
  \expandafter\fvset\expandafter{\minted@optlistfv@g}%
  \expandafter\let\expandafter\minted@tmp%
    \csname minted@optlistfv@lang\minted@lang\endcsname
  \expandafter\fvset\expandafter{\minted@tmp}%
  \ifthenelse{\boolean{minted@isinline}}%
   {\expandafter\fvset\expandafter{\minted@optlistfv@g@i}%
    \expandafter\let\expandafter\minted@tmp%
      \csname minted@optlistfv@lang\minted@lang @i\endcsname
    \expandafter\fvset\expandafter{\minted@tmp}}%
   {}%
  \expandafter\fvset\expandafter{\minted@optlistfv@cmd}%
}
%    \end{macrocode}
% \end{macro}
%
%
% We need a way to define \texpkg{minted}-specific options at multiple levels of hierarchy, as well as a way to retrieve these options.  As with previous types of options, values are stored in macros of the form |\minted@opt@|\meta{level}|:|\meta{key}, since they are not meant to be accessed directly.
%
% The order of precedence is |cmd|, |lang@i|, |g@i|, |lang|, |g|.  A value specified at the command or environment level should override other settings.  In its absence, a value specified for an inline command should override other settings, if we are indeed in an inline context.  Otherwise, language settings take precedence over global settings.
%
% Before actually creating the option-definition macro, we need a few helper macros.
%
%
% \begin{macro}{\minted@def@opt}
% Finally, on to the actual option definitions for \texpkg{minted}-specific options.
%
% Usage:  |\minted@def@opt[|\meta{initial global value}|]{|\meta{key name}|}|
%    \begin{macrocode}
\newcommand{\minted@def@opt}[2][]{%
  \define@key{minted@opt@g}{#2}{%
    \@namedef{minted@opt@g:#2}{##1}}
  \define@key{minted@opt@g@i}{#2}{%
    \@namedef{minted@opt@g@i:#2}{##1}}
  \define@key{minted@opt@lang}{#2}{%
    \@namedef{minted@opt@lang\minted@lang:#2}{##1}}
  \define@key{minted@opt@lang@i}{#2}{%
    \@namedef{minted@opt@lang\minted@lang @i:#2}{##1}}
  \define@key{minted@opt@cmd}{#2}{%
    \@namedef{minted@opt@cmd:#2}{##1}}
  \ifstrempty{#1}{}{\@namedef{minted@opt@g:#2}{#1}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@def@opt@detok}
% Same as |\minted@def@opt|, except wraps argument in |\detokenize|.
%    \begin{macrocode}
\newcommand{\minted@def@opt@detok}[2][]{%
  \define@key{minted@opt@g}{#2}{%
    \@namedef{minted@opt@g:#2}{\detokenize{##1}}}
  \define@key{minted@opt@g@i}{#2}{%
    \@namedef{minted@opt@g@i:#2}{\detokenize{##1}}}
  \define@key{minted@opt@lang}{#2}{%
    \@namedef{minted@opt@lang\minted@lang:#2}{\detokenize{##1}}}
  \define@key{minted@opt@lang@i}{#2}{%
    \@namedef{minted@opt@lang\minted@lang @i:#2}{\detokenize{##1}}}
  \define@key{minted@opt@cmd}{#2}{%
    \@namedef{minted@opt@cmd:#2}{\detokenize{##1}}}
  \ifstrempty{#1}{}{\@namedef{minted@opt@g:#2}{\detokenize{#1}}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@generate@PYGdef}
% Generate Pygments style definition with |pygmentize| if a cached version does not exist.  Load the style definition into a global macro of the form 
%\begin{Verbatim}
%\csname minted@PYGdef@<style>\endcsname
%\end{Verbatim}
% to allow styles to be defined later.  Styles are not defined globally to avoid naming issues with style names that involve punctuation characters and numbers.  Rather, styles are redefined upon every use (within groups), and all styles use macros with a |\PYG| prefix.
%
% Takes a single argument that is the detokenized style name.  Getting the detokenized style name here requires expansion (|\edef|) in an earlier macro (currently |\minted@defstyle|) to convert |\minted@get@opt{style}{default}| into detokenized text.  The |style| value is always wrapped in |\detokenize| when it is set, so expansion automatically detokenizes.  Detokenization can be important depending on active characters.  Expansion is important because the style name may be used with caching, so we need the current value retrieved by |\minted@get@opt|, not the value at the end of the document when cache data is written to the |.aux| file.  
%
% Certain catcodes are required when loading Pygments style definitions from file.
% \begin{itemize}
% \item At sign |@| would be handled by the |\makeatletter| within the Pygments style definition if the style was brought in via |\input|, but |\makeatletter| doesn't affect tokenization with the |catchfile| approach.
% \item Percent |%| may not have its normal meaning within a |.dtx| file.
% \item Backtick |`| is made active by some \texpkg{babel} package options, such as |magyar|.
% \end{itemize}
% |\endlinechar| also requires special handling to avoid introducing unwanted spaces.
%
% The |\ifx\PYG\relax| tests detect outdated style definitions from \texpkg{minted} <2.6 and replace them when possible, and also detect missing styles.  Before \texpkg{minted} 2.6, style macros used a |\PYG<style>| prefix and were defined globally.  Starting with 2.6, styles are redefined upon every use (within groups), and all styles use macros with a |\PYG| prefix.  This allows more robust treatment of style names that involve punctuation characters and numbers.
%    \begin{macrocode}
\newcommand{\minted@generate@PYGdef}[1]{%
  \ifthenelse{\boolean{minted@cache}}%
   {\def\minted@pygstylepath@load{\minted@outputdir\minted@cachedir/#1.pygstyle}%
    \minted@addcachefile{#1.pygstyle}}%
   {\def\minted@pygstylepath@load{\minted@outputdir\minted@jobname.out.pyg}}%
  \ifwindows
    \StrSubstitute{\minted@pygstylepath@load}%
      {/}{\@backslashchar}[\minted@pygstylepath@save]%
  \else
    \let\minted@pygstylepath@save\minted@pygstylepath@load
  \fi
  \IfFileExists{\minted@pygstylepath@load}%
   {}%
   {\ifthenelse{\boolean{minted@frozencache}}%
     {\PackageError{minted}%
       {Missing style definition for #1 with frozencache}%
       {Missing style definition for #1 with frozencache}}%
     {}%
    \ShellEscape{%
      \MintedPygmentize\space -S #1 -f latex -P commandprefix=PYG 
      > \minted@pygstylepath@save
    }%
   }%
  \CatchFileDef{\minted@tmp@filecontents}%
   {\minted@pygstylepath@load}{\catcode`@=11\catcode`\%=14\catcode``=12\endlinechar=-1}%
  \begingroup
  \let\PYG\relax
  \minted@tmp@filecontents
  \ifx\PYG\relax
    \ifthenelse{\boolean{minted@frozencache}}%
     {\PackageError{minted}%
       {Outdated style definition for #1 with frozencache}%
       {Outdated style definition for #1 with frozencache}}%
     {}%
    \ShellEscape{%
      \MintedPygmentize\space -S #1 -f latex -P commandprefix=PYG 
      > \minted@pygstylepath@save
    }%
    \CatchFileDef{\minted@tmp@filecontents}%
     {\minted@pygstylepath@load}{\catcode`@=11\catcode`\%=14\catcode``=12\endlinechar=-1}%
    \minted@tmp@filecontents
    \ifx\PYG\relax
      \PackageError{minted}%
       {Cannot find Pygments style #1}%
       {Cannot find Pygments style #1}%
    \fi
  \fi
  \expandafter\global\expandafter\let\csname minted@PYGdef@#1\endcsname%
    \minted@tmp@filecontents    
  \endgroup  
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@defstyle}
% Define Pygments style macros.  These are defined locally rather than globally, and redefined upon every use.  Patch single quote macro if needed.
%    \begin{macrocode}
\newcommand{\minted@defstyle}[1]{%
  \edef\minted@style{#1}%
  \ifcsname minted@PYGdef@\minted@style\endcsname\else
    \expandafter\minted@generate@PYGdef\expandafter{\minted@style}%
  \fi
  \csname minted@PYGdef@\minted@style\endcsname
  \minted@patch@PYGZsq
  \minted@patch@PYGZhy
}
\ifthenelse{\boolean{minted@draft}}{\renewcommand{\minted@defstyle}[1]{}}{}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@patch@PYGZsq}
% The single quote macro from \texpkg{Pygments} 1.6+ needs to be patched if the \texpkg{upquote} package is in use.  Patching is done when the default style is created.  Patching is only attempted if the macro exists, so that there is a graceful fallback in the event of a custom \texpkg{Pygments} stylesheet.
%    \begin{macrocode}
\newcommand{\minted@patch@PYGZsq}{%
  \ifcsname PYGZsq\endcsname
    \expandafter\ifdefstring\expandafter{\csname PYGZsq\endcsname}{\char`\'}%
     {\minted@patch@PYGZsq@i}%
     {}%
  \fi
}
\begingroup
\catcode`\'=\active
\gdef\minted@patch@PYGZsq@i{\gdef\PYGZsq{'}}
\endgroup
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@patch@PYGZhy}
% Redefine the hyphen under LuaTeX to prevent unintended line breaks.
%    \begin{macrocode}
\newcommand{\minted@patch@PYGZhy}{%
  \ifcsname PYGZhy\endcsname
    \expandafter\ifdefstring\expandafter{\csname PYGZhy\endcsname}{\char`\-}%
     {\def\PYGZhy{\mbox{-}}}%
     {}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% 
%
%
% \begin{macro}{\minted@def@opt@switch}
% And we need a switch version.
%
% It would be possible to create a special version of |\minted@get@opt| to work with these, but that would be redundant.  During the key processing, any values other than |true| and |false| are filtered out.  So when using |\minted@get@opt| later, we know that that part has already been taken care of, and we can just use something like |\ifthenelse{\equal{\minted@get@opt{<opt>}{<default>}}{true}}{...}{...}|.  Of course, there is the possibility that a default value has not been set, but  |\minted@def@opt@switch| sets a global default of |false| to avoid this.  And as usual, Pygments values shouldn't be used without considering whether |\minted@get@opt| needs a fallback value.
%    \begin{macrocode}
\newcommand{\minted@def@opt@switch}[2][false]{%
  \define@booleankey{minted@opt@g}{#2}%
    {\@namedef{minted@opt@g:#2}{true}}%
    {\@namedef{minted@opt@g:#2}{false}}
  \define@booleankey{minted@opt@g@i}{#2}%
    {\@namedef{minted@opt@g@i:#2}{true}}%
    {\@namedef{minted@opt@g@i:#2}{false}}
  \define@booleankey{minted@opt@lang}{#2}%
    {\@namedef{minted@opt@lang\minted@lang:#2}{true}}%
    {\@namedef{minted@opt@lang\minted@lang:#2}{false}}
  \define@booleankey{minted@opt@lang@i}{#2}%
    {\@namedef{minted@opt@lang\minted@lang @i:#2}{true}}%
    {\@namedef{minted@opt@lang\minted@lang @i:#2}{false}}
  \define@booleankey{minted@opt@cmd}{#2}%
    {\@namedef{minted@opt@cmd:#2}{true}}%
    {\@namedef{minted@opt@cmd:#2}{false}}%
  \@namedef{minted@opt@g:#2}{#1}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@get@opt}
% We need a way to traverse the hierarchy of values for a given key and return the current value that has precedence.  In doing this, we need to specify a default value to use if no value is found.  When working with \texpkg{minted}-specific values, there should generally be a default value; in those cases, an empty default may be supplied.  But the macro should also work with Pygments settings, which are stored in macros of the same form and will sometimes need to be accessed (for example, |encoding|).  In the Pygments case, there may very well be no default values on the \LaTeX\ side, because we are falling back on Pygments' own built-in defaults.  There is no need to duplicate those when very few Pygments values are ever needed; it is simpler to specify the default fallback when accessing the macro value.
%
% From a programming perspective, the default argument value needs to be mandatory, so that |\minted@get@opt| can be fully expandable. This significantly simplifies accessing options.
%    \begin{macrocode}
\def\minted@get@opt#1#2{%
  \ifcsname minted@opt@cmd:#1\endcsname
    \csname minted@opt@cmd:#1\endcsname
  \else
    \ifminted@isinline
      \ifcsname minted@opt@lang\minted@lang @i:#1\endcsname
        \csname minted@opt@lang\minted@lang @i:#1\endcsname
      \else
        \ifcsname minted@opt@g@i:#1\endcsname
          \csname minted@opt@g@i:#1\endcsname
        \else
          \ifcsname minted@opt@lang\minted@lang:#1\endcsname
            \csname minted@opt@lang\minted@lang:#1\endcsname
          \else
            \ifcsname minted@opt@g:#1\endcsname
              \csname minted@opt@g:#1\endcsname
            \else
              #2%
            \fi
          \fi
        \fi
      \fi
    \else
      \ifcsname minted@opt@lang\minted@lang:#1\endcsname
        \csname minted@opt@lang\minted@lang:#1\endcsname
      \else
        \ifcsname minted@opt@g:#1\endcsname
          \csname minted@opt@g:#1\endcsname
        \else
          #2%
        \fi
      \fi
    \fi
  \fi
}%
%    \end{macrocode}
% \end{macro}
%
%
% \noindent Actual option definitions.  Some of these must be defined conditionally depending on whether we are in |draft| mode; in |draft| mode, we need to emulate Pygments functionality with \LaTeX, particularly with \texpkg{fancyvrb}, when possible.  For example, gobbling must be performed by Pygments when |draft| is off, but when |draft| is on, \texpkg{fancyvrb} can perform gobbling.
%
% Lexers.
%    \begin{macrocode}
\minted@def@optcl{encoding}{-P encoding}{#1}
\minted@def@optcl{outencoding}{-P outencoding}{#1}
\minted@def@optcl@e{escapeinside}{-P escapeinside}{#1}
\minted@def@optcl@switch{stripnl}{-P stripnl}
\minted@def@optcl@switch{stripall}{-P stripall}
% Python console
\minted@def@optcl@switch{python3}{-P python3}
% PHP
\minted@def@optcl@switch{funcnamehighlighting}{-P funcnamehighlighting}
\minted@def@optcl@switch{startinline}{-P startinline}
%    \end{macrocode}
%
% Filters.
%    \begin{macrocode}
\ifthenelse{\boolean{minted@draft}}%
  {\minted@def@optfv{gobble}}%
  {\minted@def@optcl{gobble}{-F gobble:n}{#1}}
\minted@def@optcl{codetagify}{-F codetagify:codetags}{#1}
\minted@def@optcl{keywordcase}{-F keywordcase:case}{#1}
%    \end{macrocode}
%
% \LaTeX\ formatter.
%    \begin{macrocode}
\minted@def@optcl@switch{texcl}{-P texcomments}
\minted@def@optcl@switch{texcomments}{-P texcomments}
\minted@def@optcl@switch{mathescape}{-P mathescape}
\minted@def@optfv@switch{linenos}
\minted@def@opt@detok{style}
%    \end{macrocode}
%
% \texpkg{fancyvrb} and \texpkg{fvextra} options.
%    \begin{macrocode}
\minted@def@optfv{frame}
\minted@def@optfv{framesep}
\minted@def@optfv{framerule}
\minted@def@optfv{rulecolor}
\minted@def@optfv{numbersep}
\minted@def@optfv{numbers}
\minted@def@optfv{firstnumber}
\minted@def@optfv{stepnumber}
\minted@def@optfv{firstline}
\minted@def@optfv{lastline}
\minted@def@optfv{baselinestretch}
\minted@def@optfv{xleftmargin}
\minted@def@optfv{xrightmargin}
\minted@def@optfv{fillcolor}
\minted@def@optfv{tabsize}
\minted@def@optfv{fontfamily}
\minted@def@optfv{fontsize}
\minted@def@optfv{fontshape}
\minted@def@optfv{fontseries}
\minted@def@optfv{formatcom}
\minted@def@optfv{label}
\minted@def@optfv{labelposition}
\minted@def@optfv{highlightlines}
\minted@def@optfv{highlightcolor}
\minted@def@optfv{space}
\minted@def@optfv{spacecolor}
\minted@def@optfv{tab}
\minted@def@optfv{tabcolor}
\minted@def@optfv{highlightcolor}
\minted@def@optfv@switch{beameroverlays}
\minted@def@optfv@switch{curlyquotes}
\minted@def@optfv@switch{numberfirstline}
\minted@def@optfv@switch{numberblanklines}
\minted@def@optfv@switch{stepnumberfromfirst}
\minted@def@optfv@switch{stepnumberoffsetvalues}
\minted@def@optfv@switch{showspaces}
\minted@def@optfv@switch{resetmargins}
\minted@def@optfv@switch{samepage}
\minted@def@optfv@switch{showtabs}
\minted@def@optfv@switch{obeytabs}
\minted@def@optfv@switch{breaklines}
\minted@def@optfv@switch{breakbytoken}
\minted@def@optfv@switch{breakbytokenanywhere}
\minted@def@optfv{breakindent}
\minted@def@optfv{breakindentnchars}
\minted@def@optfv@switch{breakautoindent}
\minted@def@optfv{breaksymbol}
\minted@def@optfv{breaksymbolsep}
\minted@def@optfv{breaksymbolsepnchars}
\minted@def@optfv{breaksymbolindent}
\minted@def@optfv{breaksymbolindentnchars}
\minted@def@optfv{breaksymbolleft}
\minted@def@optfv{breaksymbolsepleft}
\minted@def@optfv{breaksymbolsepleftnchars}
\minted@def@optfv{breaksymbolindentleft}
\minted@def@optfv{breaksymbolindentleftnchars}
\minted@def@optfv{breaksymbolright}
\minted@def@optfv{breaksymbolsepright}
\minted@def@optfv{breaksymbolseprightnchars}
\minted@def@optfv{breaksymbolindentright}
\minted@def@optfv{breaksymbolindentrightnchars}
\minted@def@optfv{breakbefore}
\minted@def@optfv{breakbeforesymbolpre}
\minted@def@optfv{breakbeforesymbolpost}
\minted@def@optfv@switch{breakbeforegroup}
\minted@def@optfv{breakafter}
\minted@def@optfv@switch{breakaftergroup}
\minted@def@optfv{breakaftersymbolpre}
\minted@def@optfv{breakaftersymbolpost}
\minted@def@optfv@switch{breakanywhere}
\minted@def@optfv{breakanywheresymbolpre}
\minted@def@optfv{breakanywheresymbolpost}
\minted@def@optfv{fontencoding}
%    \end{macrocode}
%
% Finally, options specific to \texpkg{minted}.
%
% |bgcolor|.  The original, |minipage|- and |\colorbox|-based solution was replaced with a |framed|-based solution in version 2.2.  A dedicated framing package will often be preferable.
%    \begin{macrocode}
\minted@def@opt{bgcolor}
%    \end{macrocode}
%
% Autogobble.  We create an option that governs when Python's |textwrap.dedent()| is used to autogobble code.
%    \begin{macrocode}
\minted@def@opt@switch{autogobble}
%    \end{macrocode}
%
% \begin{macro}{\minted@encoding}
% When working with encoding, we will need access to the current encoding.  That may be done via |\minted@get@opt|, but it is more convenient to go ahead and define a shortcut with an appropriate default
%    \begin{macrocode}
\newcommand{\minted@encoding}{\minted@get@opt{encoding}{UTF8}}
%    \end{macrocode}
% \end{macro}
%
%
%
%
% \subsection{Internal helpers}
%
% \begin{environment}{minted@snugshade*}
% Define a custom version of \texpkg{framed}'s |snugshade*| that takes a color as argument.  This avoids the need to redefine |shadecolor|.
%    \begin{macrocode}
\newenvironment{minted@snugshade*}[1]{%
  \def\FrameCommand##1{\hskip\@totalleftmargin 
    \colorbox{#1}{##1}%
    \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
  \MakeFramed{\advance\hsize-\width 
    \@totalleftmargin\z@ \linewidth\hsize
    \advance\labelsep\fboxsep
    \@setminipage}%
 }{\par\unskip\@minipagefalse\endMakeFramed}
%    \end{macrocode}
% \end{environment}
%
%
% \begin{environment}{\minted@bgbox}
%
% Define an environment that may be wrapped around a |minted| environment to assign a background color.  This is retained as a holdover from version 1.0.  In most cases, it is probably better to use a dedicated framing package, such as \texpkg{tcolorbox} or \texpkg{mdframed}.
%
% First, we need to define a new save box.
%
%    \begin{macrocode}
\newsavebox{\minted@bgbox}
%    \end{macrocode}
%
% Now we can define the environment that applies a background color.  Prior to \texpkg{minted} 2.2, this involved a |minipage|.  However, that approach was problematic because it did not allow linebreaks, would be pushed into the margin by immediately preceding text, and had very different whitespace separation from preceding and following text compared to no background color.  In version 2.2, this was replaced with an approach based on \texpkg{framed}.  |\FV@NumberSep| is adjusted by |\fboxsep| to ensure that line numbers remain in the same location in the margin regardless of whether |bgcolor| is used.
%
%    \begin{macrocode}
\newenvironment{minted@colorbg}[1]{%
  \setlength{\OuterFrameSep}{0pt}%
  \let\minted@tmp\FV@NumberSep
  \edef\FV@NumberSep{%
    \the\numexpr\dimexpr\minted@tmp+\number\fboxsep\relax sp\relax}%
  \medskip
  \begin{minted@snugshade*}{#1}}
 {\end{minted@snugshade*}%
  \medskip\noindent}
%    \end{macrocode}
% \end{environment}
%
%
% \begin{macro}{\minted@code}
% Create a file handle for saving code (and anything else that must be written to temp files).
%    \begin{macrocode}
\newwrite\minted@code
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@savecode}
%
% Save code to be pygmentized to a file.
%    \begin{macrocode}
\newcommand{\minted@savecode}[1]{
  \immediate\openout\minted@code\minted@jobname.pyg\relax
  \immediate\write\minted@code{\expandafter\detokenize\expandafter{#1}}%
  \immediate\closeout\minted@code}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{minted@FancyVerbLineTemp}
% At various points, we will need a temporary counter for storing and then restoring the value of |FancyVerbLine|.  When using the |langlinenos| option, we need to store the current value of |FancyVerbLine|, then set |FancyVerbLine| to the current value of a language-specific counter, and finally restore |FancyVerbLine| to its initial value after the current chunk of code has been typeset.  In patching |VerbatimOut|, we need to prevent |FancyVerbLine| from being incremented during the write process.
%    \begin{macrocode}
\newcounter{minted@FancyVerbLineTemp}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@FVB@VerbatimOut}
% We need a custom version of \texpkg{fancyvrb}'s |\FVB@VerbatimOut| that supports Unicode (everything written to file is |\detokenized|).  We also need to prevent the value of |FancyVerbLine| from being incorrectly incremented.
%    \begin{macrocode}
\newcommand{\minted@write@detok}[1]{%
  \immediate\write\FV@OutFile{\detokenize{#1}}}
\newcommand{\minted@FVB@VerbatimOut}[1]{%
  \setcounter{minted@FancyVerbLineTemp}{\value{FancyVerbLine}}%
  \@bsphack
  \begingroup
    \FV@UseKeyValues
    \FV@DefineWhiteSpace
    \def\FV@Space{\space}%
    \FV@DefineTabOut
    \let\FV@ProcessLine\minted@write@detok
    \immediate\openout\FV@OutFile #1\relax
    \let\FV@FontScanPrep\relax
    \let\@noligs\relax
    \FV@Scan}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@FVE@VerbatimOut}
% Likewise, we need a custom version of |\FVE@VerbatimOut| that completes the protection of |FancyVerbLine| from being incremented.
%    \begin{macrocode}
\newcommand{\minted@FVE@VerbatimOut}{%
  \immediate\closeout\FV@OutFile\endgroup\@esphack
  \setcounter{FancyVerbLine}{\value{minted@FancyVerbLineTemp}}}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\MintedPygmentize}
% We need a way to customize the executable/script that is called to perform highlighting.  Typically, we will want |pygmentize|.  But advanced users might wish to use a custom Python script instead.  The command is only defined if it does not exist.  In general, the command should be |\renewcommand|ed after the package is loaded, but this way, it will work if defined before \texpkg{minted} is loaded.
%    \begin{macrocode}
\ifcsname MintedPygmentize\endcsname\else
  \newcommand{\MintedPygmentize}{pygmentize}
\fi
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{minted@pygmentizecounter}
% We need a counter to keep track of how many files have been pygmentized.  This is primarily used with |finalizecache| for naming cache files sequentially in |listing<number>.pygtex| form.
%    \begin{macrocode}
\newcounter{minted@pygmentizecounter}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\MintedPython}
% Python executable to be used for |autogobble|.
%    \begin{macrocode}
\ifwindows
  \newcommand{\MintedPython}{python}
\else
  \newcommand{\MintedPython}{python3}
\fi
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@check@MintedPython}
% Check that |\MintedPython| is a valid executable before use.  Swap |python| for |python3| and vice versa depending on what is available.
%    \begin{macrocode}
\newcommand{\minted@check@MintedPython}{%
  \ifcsname minted@MintedPython@\MintedPython\endcsname
  \else
    \let\minted@altpython\minted@undefined
    \ifdefstring{\MintedPython}{python}{\def\minted@altpython{python3}}{}%
    \ifdefstring{\MintedPython}{python3}{\def\minted@altpython{python}}{}%
    \ifx\minted@altpython\minted@undefined\relax
      \TestAppExists{\MintedPython}%
      \ifAppExists
        \expandafter\global\expandafter\let%
          \csname minted@MintedPython@\MintedPython\endcsname\relax
      \else
        \PackageError{minted}%
         {Failed to find Python executable \MintedPython;
          check Python installation (including PATH),
          or redefine \string\MintedPython}%
         {Failed to find Python executable \MintedPython;
          check Python installation (including PATH),
          or redefine \string\MintedPython}%
      \fi
    \else
      \ifcsname minted@MintedPython@\minted@altpython\endcsname
        \let\MintedPython\minted@altpython
      \else
        \TestAppExists{\MintedPython}%
        \ifAppExists
          \expandafter\global\expandafter\let%
            \csname minted@MintedPython@\MintedPython\endcsname\relax
        \else      
          \TestAppExists{\minted@altpython}%
          \ifAppExists
            \expandafter\global\expandafter\let%
              \csname minted@MintedPython@\minted@altpython\endcsname\relax
            \let\MintedPython\minted@altpython
          \else
            \PackageError{minted}%
             {Failed to find Python executables python or python3;
              check Python installation (including PATH),
              or redefine \string\MintedPython}%
             {Failed to find Python executables python or python3;
              check Python installation (including PATH),
              or redefine \string\MintedPython}%
          \fi
        \fi
      \fi
    \fi
  \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@pygmentize}
%
% Pygmentize a file (default: |\minted@outputdir\minted@jobname.pyg|) using the options provided.
%
% Unfortunately, the logic for caching is a little complex due to operations that are OS- and engine-dependent.
%
% The name of cached files is the result of concatenating the md5 of the code and the md5 of the command.  This results in a filename that is longer than ideal (64 characters plus path and extension).  Unfortunately, this is the only robust approach that is possible using the built-in pdfTeX hashing capabilities.\footnote{It would be possible to use only the cache of the code, but that approach breaks down as soon as the code is used multiple times with different options.  While that may seem unlikely in practice, it occurs in this documentation and may be expected to occur in other docs.}  LuaTeX could do better, by hashing the command and code together.  The Python script that provides XeTeX capabilities simply runs both the command and the code through a single sha1 hasher, but has the additional overhead of the |\write18| call and Python execution.
%
% One potential concern is that caching should also keep track of the command from which code originates.  What if identical code is highlighted with identical settings in both the |minted| environment and |\mintinline| command?  In both cases, what is actually saved by Pygments is identical.  The difference in final appearance is due to how the environment and command treat the Pygments output.
%
% \textbf{This macro must always be checked carefully whenever it is modified.}  Under no circumstances should |#1| be written to or opened by Python in write mode.  When |\inputminted| is used, |#1| will be an external file that is brought in for highlighting, so it must be left intact.
%
% At the very beginning, a check is performed to make sure that style macros exist.  This must be done before the highlighted content is generated, so that temp file names can be shared without accidental overwriting.  Styles are generated here, rather than when a style is set, so that creating the style macros is done as late as possible in case a custom |pygmentize| is in use via |\MintedPygmentize|.
%
%    \begin{macrocode}
\ifwindows
  \def\minted@opt@quote#1{\detokenize{"#1"}}
\else
  \def\minted@opt@quote#1{\detokenize{'#1'}}
\fi
\newcommand{\minted@pygmentize}[2][\minted@outputdir\minted@jobname.pyg]{%
  \minted@defstyle{\minted@get@opt{style}{default}}%
  \stepcounter{minted@pygmentizecounter}%
  \ifthenelse{\equal{\minted@get@opt{autogobble}{false}}{true}}%
    {\def\minted@codefile{\minted@outputdir\minted@jobname.pyg}}%
    {\def\minted@codefile{#1}}%
  \ifthenelse{\boolean{minted@isinline}}%
    {\def\minted@optlistcl@inlines{%
      \minted@optlistcl@g@i
      \csname minted@optlistcl@lang\minted@lang @i\endcsname}}%
    {\let\minted@optlistcl@inlines\@empty}%
  \def\minted@cmd{%
    \ifminted@kpsewhich
      \ifwindows
        \detokenize{for /f "usebackq tokens=*"}\space\@percentchar\detokenize{a in (`kpsewhich}\space\minted@codefile\detokenize{`) do}\space
      \fi
    \fi
    \MintedPygmentize\space -l \minted@opt@quote{#2}
    -f latex -P commandprefix=PYG -F tokenmerge
    \minted@optlistcl@g \csname minted@optlistcl@lang\minted@lang\endcsname
    \minted@optlistcl@inlines
    \minted@optlistcl@cmd -o \minted@outputdir\minted@infile\space
    \ifminted@kpsewhich
      \ifwindows
        \@percentchar\detokenize{a}%
      \else
        \detokenize{`}kpsewhich \minted@codefile\space 
          \detokenize{||} \minted@codefile\detokenize{`}%
      \fi
    \else
      \minted@codefile
    \fi}%
  % For debugging, uncomment: %%%%
  % \immediate\typeout{\minted@cmd}%
  % %%%%
  \ifthenelse{\boolean{minted@cache}}%
    {%
      \ifminted@frozencache
      \else
        \ifthenelse{\equal{\minted@get@opt{autogobble}{false}}{true}}%
         {\edef\minted@hash{%
            \pdf@filemdfivesum{#1}%
            \pdf@mdfivesum{\minted@cmd\space%
              autogobble(\the\numexpr\FancyVerbStartNum\relax-%
                         \the\numexpr\FancyVerbStopNum\relax)}}}%
         {\edef\minted@hash{%
            \pdf@filemdfivesum{#1}%
            \pdf@mdfivesum{\minted@cmd}}}%
        \edef\minted@infile{\minted@cachedir/\minted@hash.pygtex}%
        \IfFileExists{\minted@infile}{}{%
          \ifthenelse{\equal{\minted@get@opt{autogobble}{false}}{true}}{%
            \minted@autogobble{#1}}{}%
          \ShellEscape{\minted@cmd}}%
      \fi
      \ifthenelse{\boolean{minted@finalizecache}}%
       {%
          \edef\minted@cachefilename{listing\arabic{minted@pygmentizecounter}.pygtex}%
          \edef\minted@actualinfile{\minted@cachedir/\minted@cachefilename}%
          \ifwindows
            \StrSubstitute{\minted@infile}{/}{\@backslashchar}[\minted@infile@windows]
            \StrSubstitute{\minted@actualinfile}{/}{\@backslashchar}[\minted@actualinfile@windows]
            \ShellEscape{move /y \minted@outputdir\minted@infile@windows\space\minted@outputdir\minted@actualinfile@windows}%
          \else
            \ShellEscape{mv -f \minted@outputdir\minted@infile\space\minted@outputdir\minted@actualinfile}%
          \fi
          \let\minted@infile\minted@actualinfile
          \expandafter\minted@addcachefile\expandafter{\minted@cachefilename}%
       }%
       {\ifthenelse{\boolean{minted@frozencache}}%
         {%
            \edef\minted@cachefilename{listing\arabic{minted@pygmentizecounter}.pygtex}%
            \edef\minted@infile{\minted@cachedir/\minted@cachefilename}%
            \expandafter\minted@addcachefile\expandafter{\minted@cachefilename}}%
         {\expandafter\minted@addcachefile\expandafter{\minted@hash.pygtex}}%
       }%
      \minted@inputpyg}%
    {%
      \ifthenelse{\equal{\minted@get@opt{autogobble}{false}}{true}}{%
        \minted@autogobble{#1}}{}%
      \ShellEscape{\minted@cmd}%
      \minted@inputpyg}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@autogobble}
% Remove common leading whitespace.
%    \begin{macrocode}
\def\minted@autogobble#1{%
  \edef\minted@argone@esc{#1}%
  \StrSubstitute{\minted@argone@esc}{\@backslashchar}{\@backslashchar\@backslashchar}[\minted@argone@esc]%
  \StrSubstitute{\minted@argone@esc}{"}{\@backslashchar"}[\minted@argone@esc]%
  \edef\minted@tmpfname@esc{\minted@outputdir\minted@jobname}%
  \StrSubstitute{\minted@tmpfname@esc}{\@backslashchar}{\@backslashchar\@backslashchar}[\minted@tmpfname@esc]%
  \StrSubstitute{\minted@tmpfname@esc}{"}{\@backslashchar"}[\minted@tmpfname@esc]%
  %Need a version of open() that supports encoding under Python 2
  \minted@check@MintedPython
  \edef\minted@autogobblecmd{%
    \ifminted@kpsewhich
      \ifwindows
        \detokenize{for /f "usebackq tokens=*" }\@percentchar\detokenize{a in (`kpsewhich} #1\detokenize{`) do}\space
      \fi
    \fi    
    \MintedPython\detokenize{ -c "import sys; import os;
    import textwrap;
    from io import open;
    fname = }%
      \ifminted@kpsewhich
        \detokenize{sys.argv[1];}\space
      \else
        \detokenize{os.path.expanduser(os.path.expandvars(\"}\minted@argone@esc\detokenize{\"));}\space
      \fi
    \detokenize{f = open(fname, \"r\", encoding=\"}\minted@encoding\detokenize{\") if os.path.isfile(fname) else None;
    t = f.readlines() if f is not None else None;
    t_opt = t if t is not None else [];
    f.close() if f is not None else None;
    tmpfname = os.path.expanduser(os.path.expandvars(\"}\minted@tmpfname@esc.pyg\detokenize{\"));
    f = open(tmpfname, \"w\", encoding=\"}\minted@encoding\detokenize{\") if t is not None else None;
    fvstartnum = }\the\numexpr\FancyVerbStartNum\detokenize{;
    fvstopnum = }\the\numexpr\FancyVerbStopNum\detokenize{;
    s = max(0, fvstartnum-1);
    e = max(s, fvstopnum) if fvstopnum > 0 else len(t_opt);
    [f.write(textwrap.dedent(\"\".join(x))) for x in (t_opt[0:s], t_opt[s:e], t_opt[e:]) if x and t is not None];
    f.close() if t is not None else os.remove(tmpfname);"}%
    \ifminted@kpsewhich
      \ifwindows
        \space\@percentchar\detokenize{a}%
      \else
        \space\detokenize{`}kpsewhich #1\space\detokenize{||} #1\detokenize{`}%
      \fi
    \fi
  }%
  \ShellEscape{\minted@autogobblecmd}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@inputpyg}
% For increased clarity, the actual |\input| process is separated out into its own macro.
%
% At the last possible moment, |\PYG| is |\let| to |\PYG|\meta{style} and redefined to used appropriate line breaking via |\VerbatimPygments| from \texpkg{fvextra}.
%
% The |bgcolor| option needs to be dealt with in different ways depending on whether we are using |\mintinline|.  It is simplest to apply this option here, so that the macro redefinitions may be local and thus do not need to be manually reset later.
%    \begin{macrocode}
\newcommand{\minted@inputpyg}{%
  \VerbatimPygments{\PYG}{\PYG}%
  \ifthenelse{\boolean{minted@isinline}}%
   {\ifthenelse{\equal{\minted@get@opt{breaklines}{false}}{true}}%
    {\let\FV@BeginVBox\relax
     \let\FV@EndVBox\relax
     \def\FV@BProcessLine##1{\FancyVerbFormatLine{##1}}%
     \minted@inputpyg@inline}%
    {\minted@inputpyg@inline}}%
   {\minted@inputpyg@block}%
}
\def\minted@inputpyg@inline{%
  \ifthenelse{\equal{\minted@get@opt{bgcolor}{}}{}}%
   {\minted@input{\minted@outputdir\minted@infile}}%
   {\colorbox{\minted@get@opt{bgcolor}{}}{%
      \minted@input{\minted@outputdir\minted@infile}}}%
}
\def\minted@inputpyg@block{%
  \ifthenelse{\equal{\minted@get@opt{bgcolor}{}}{}}%
   {\minted@input{\minted@outputdir\minted@infile}}%
   {\begin{minted@colorbg}{\minted@get@opt{bgcolor}{}}%
    \minted@input{\minted@outputdir\minted@infile}%
    \end{minted@colorbg}}}
%    \end{macrocode}
% \end{macro}
%
%
% We need a way to have line counters on a per-language basis.
%
% \begin{macro}{\minted@langlinenoson}
%    \begin{macrocode}
\newcommand{\minted@langlinenoson}{%
  \ifcsname c@minted@lang\minted@lang\endcsname\else
    \newcounter{minted@lang\minted@lang}%
  \fi
  \setcounter{minted@FancyVerbLineTemp}{\value{FancyVerbLine}}%
  \setcounter{FancyVerbLine}{\value{minted@lang\minted@lang}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minted@langlinenosoff}
% 
%    \begin{macrocode}
\newcommand{\minted@langlinenosoff}{%
  \setcounter{minted@lang\minted@lang}{\value{FancyVerbLine}}%
  \setcounter{FancyVerbLine}{\value{minted@FancyVerbLineTemp}}%
}
%    \end{macrocode}
% \end{macro}
%
%
% Disable the language-specific settings if the package option isn't used.
%    \begin{macrocode}
\ifthenelse{\boolean{minted@langlinenos}}{}{%
  \let\minted@langlinenoson\relax
  \let\minted@langlinenosoff\relax
}
%    \end{macrocode}
%
%
%
% \subsection{Public API}
%
% \begin{macro}{\setminted}
% Set global or language-level options.
%    \begin{macrocode}
\newcommand{\setminted}[2][]{%
  \ifthenelse{\equal{#1}{}}%
    {\setkeys{minted@opt@g}{#2}}%
    {\minted@configlang{#1}%
      \setkeys{minted@opt@lang}{#2}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setmintedinline}
% Set global or language-level options, but only for inline (|\mintinline|) content.  These settings will override the corresponding |\setminted| settings.
%    \begin{macrocode}
\newcommand{\setmintedinline}[2][]{%
  \ifthenelse{\equal{#1}{}}%
    {\setkeys{minted@opt@g@i}{#2}}%
    {\minted@configlang{#1}%
      \setkeys{minted@opt@lang@i}{#2}}}
%    \end{macrocode}
% \end{macro}
%
% Now that the settings macros exist, we go ahead and create any needed defaults.
%
% PHP should use |startinline| for |\mintinline|.  Visible tabs should have a specified color so that they don't change colors when used to indent multiline strings or comments.  Leading/trailing empty lines should be preserved by default.
%    \begin{macrocode}
\setmintedinline[php]{startinline=true}
\setminted{tabcolor=black}
\setminted{stripnl=false}
%    \end{macrocode}
%
% \begin{macro}{\usemintedstyle}
%
% Set style.  This is a holdover from version 1, since |\setminted| can now accomplish this, and a hierarchy of style settings are now possible.
%    \begin{macrocode}
\newcommand{\usemintedstyle}[2][]{\setminted[#1]{style=#2}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@defwhitespace@retok}
% The |\mint| and |\mintinline| commands need to be able to retokenize the code they collect, particularly in |draft| mode.  Retokenizeation involves expansion combined with |\scantokens|, with active space and tab characters.  The active characters need to expand to the appropriate \texpkg{fancyvrb} macros, but the macros themselves should not be expanded.  We need a macro that will accomplish the appropriate definitions.
%    \begin{macrocode}
\begingroup
\catcode`\ =\active
\catcode`\^^I=\active
\gdef\minted@defwhitespace@retok{\def {\noexpand\FV@Space}\def^^I{\noexpand\FV@Tab}}%
\endgroup
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\minted@writecmdcode}
% The |\mintinline| and |\mint| commands will need to write the code they capture to a temporary file for highlighting.  It will be convenient to be able to accomplish this via a simple macro, since that makes it simpler to deal with any expansion of what is to be written.  This isn't needed for the |minted| environment, because the (patched) |VerbatimOut| is used.
%    \begin{macrocode}
\newcommand{\minted@writecmdcode}[1]{%
  \immediate\openout\minted@code\minted@jobname.pyg\relax
  \immediate\write\minted@code{\detokenize{#1}}%
  \immediate\closeout\minted@code}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\mintinline}
% Define an inline command.  This is modeled after the reimplemented |\Verb| from \texpkg{fvextra}.  See the \texpkg{fvextra} documentation for details about expansion handling, argument reading, and (re)tokenization.
%
% Pygments emits code wrapped in a |Verbatim| environment.  Getting the inline command to work correctly requires redefining |Verbatim| to be \texpkg{fvextra}'s |VerbEnv| temporarily.
%
% Everything needs to be within a |\begingroup...\endgroup| to prevent settings from escaping.
%
% In the case of |draft| mode, \texpkg{fvextra}'s |\Verb| is used directly.
%    \begin{macrocode}
\def\mintinline{%
  \FVExtraRobustCommand\RobustMintInline\FVExtraUnexpandedReadStarOArgMArgBVArg}
\FVExtrapdfstringdefDisableCommands{%
  \def\RobustMintInline{}}
\newrobustcmd{\RobustMintInline}[2][]{%
  \ifbool{FVExtraRobustCommandExpanded}%
   {\@ifnextchar\bgroup
     {\FVExtraReadVArg{\RobustMintInlineProcess{#1}{#2}}}%
     {\PackageError{minted}%
       {Inline delimiters must be paired curly braces in this context}%
       {Use curly braces as delimiters}}}%
   {\FVExtraReadVArg{\RobustMintInlineProcess{#1}{#2}}}}
\def\RobustMintInlineProcess#1#2#3{%
  \begingroup
  \setboolean{minted@isinline}{true}%
  \minted@configlang{#2}%
  \setkeys{minted@opt@cmd}{#1}%
  \minted@fvset
  \RobustMintInlineProcess@i{#3}}
\ifthenelse{\boolean{minted@draft}}%
 {\def\RobustMintInlineProcess@i#1{%
    \fvset{extra=true}%
    \Verb{#1}%
    \endgroup}}%
 {\def\RobustMintInlineProcess@i#1{%
   \FVExtraDetokenizeVArg{%
     \FVExtraRetokenizeVArg{\RobustMintInlineProcess@ii}{\FV@CatCodes}}{#1}}
  \def\RobustMintInlineProcess@ii#1{%
    \minted@writecmdcode{#1}%
    \let\Verbatim\VerbEnv
    \let\endVerbatim\endVerbEnv
    \expandafter\minted@pygmentize\expandafter{\minted@lang}%
    \endgroup}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\mint}
%
% Highlight a single line of code.  This is essentially a shortcut for the \env{minted} environment when there is only a single line of code.  The implementation follows \cmd{\mintinline} for argument reading and processing, but then typesets the code as an environment rather than command.  The \cmd{\@doendpe} ensures proper paragraph indentation for following text (immediately following text with no intervening blank lines does not begin a new paragraph).
%    \begin{macrocode}
\def\mint{%
  \FVExtraRobustCommand\RobustMint\FVExtraUnexpandedReadStarOArgMArgBVArg}
\FVExtrapdfstringdefDisableCommands{%
  \def\RobustMint{}}
\newrobustcmd{\RobustMint}[2][]{%
  \ifbool{FVExtraRobustCommandExpanded}%
   {\@ifnextchar\bgroup
     {\FVExtraReadVArg{\RobustMintProcess{#1}{#2}}}%
     {\PackageError{minted}%
       {Delimiters must be paired curly braces in this context}%
       {Use curly braces as delimiters}}}%
   {\FVExtraReadVArg{\RobustMintProcess{#1}{#2}}}}
\def\RobustMintProcess#1#2#3{%
  \begingroup
  \minted@configlang{#2}%
  \setkeys{minted@opt@cmd}{#1}%
  \minted@fvset
  \RobustMintProcess@i{#3}}
\begingroup
\catcode`\^^M=\active%
\catcode`\<=1%
\catcode`\>=2%
\catcode`\{=12%
\catcode`\}=12%
\catcode`\!=0%
\catcode`\\=12%
!ifthenelse<!boolean<minted@draft>>%
 <!gdef!RobustMintProcess@i#1<%
    !FVExtraDetokenizeVArg<%
      !FVExtraRetokenizeVArg<!RobustMintProcess@ii><!FV@CatCodes>><#1>>%
  !gdef!RobustMintProcess@ii#1<%
    !minted@langlinenoson%
    !scantokens<%
      \begin{Verbatim}
      #1
      \end{Verbatim}
      !noexpand>%
    !minted@langlinenosoff%
    !endgroup!@doendpe>>%
 <!gdef!RobustMintProcess@i#1<%
    !FVExtraDetokenizeVArg<%
      !FVExtraRetokenizeVArg<!RobustMintProcess@ii><!FV@CatCodes>><#1>>%
  !gdef!RobustMintProcess@ii#1<%
    !minted@writecmdcode<#1>%
    !minted@langlinenoson%
    !expandafter!minted@pygmentize!expandafter<!minted@lang>%
    !minted@langlinenosoff%
    !endgroup!@doendpe>>%
!endgroup
%    \end{macrocode}
% \end{macro}
%
%
% \begin{environment}{minted}
%
% Highlight a longer piece of code inside a verbatim environment.
%    \begin{macrocode}
\ifthenelse{\boolean{minted@draft}}%
  {\newenvironment{minted}[2][]
    {\VerbatimEnvironment
      \minted@configlang{#2}%
      \setkeys{minted@opt@cmd}{#1}%
      \minted@fvset
      \minted@langlinenoson
      \begin{Verbatim}}%
    {\end{Verbatim}%
      \minted@langlinenosoff}}%
  {\newenvironment{minted}[2][]
    {\VerbatimEnvironment
      \let\FVB@VerbatimOut\minted@FVB@VerbatimOut
      \let\FVE@VerbatimOut\minted@FVE@VerbatimOut
      \minted@configlang{#2}%
      \setkeys{minted@opt@cmd}{#1}%
      \minted@fvset
      \begin{VerbatimOut}[codes={\catcode`\^^I=12},firstline,lastline]{\minted@jobname.pyg}}%
    {\end{VerbatimOut}%
        \minted@langlinenoson
        \expandafter\minted@pygmentize\expandafter{\minted@lang}%
        \minted@langlinenosoff}}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\inputminted}
%
% Highlight an external source file.
%    \begin{macrocode}
\ifthenelse{\boolean{minted@draft}}%
  {\newcommand{\inputminted}[3][]{%
    \begingroup
    \minted@configlang{#2}%
    \setkeys{minted@opt@cmd}{#1}%
    \minted@fvset
    \VerbatimInput{#3}%
    \endgroup}}%
  {\newcommand{\inputminted}[3][]{%
    \begingroup
    \minted@configlang{#2}%
    \setkeys{minted@opt@cmd}{#1}%
    \minted@fvset
    \minted@pygmentize[#3]{#2}%
    \endgroup}}
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{Command shortcuts}
%
% We allow the user to define shortcuts for the highlighting commands.
%
% \begin{macro}{\newminted}
%
% Define a new language-specific alias for the |minted| environment.
%
%    \begin{macrocode}
\newcommand{\newminted}[3][]{
%    \end{macrocode}
%
% First, we look whether a custom environment name was given as the first
% optional argument.
% If that's not the case, construct it from the language name (append ``|code|'').
%
%    \begin{macrocode}
  \ifthenelse{\equal{#1}{}}
    {\def\minted@envname{#2code}}
    {\def\minted@envname{#1}}
%    \end{macrocode}
%
% Now, we define two environments.
% The first takes no further arguments.
% The second, starred version, takes an extra argument that specifies option
% overrides.
%
%    \begin{macrocode}
  \newenvironment{\minted@envname}
    {\VerbatimEnvironment
      \begin{minted}[#3]{#2}}
    {\end{minted}}
  \newenvironment{\minted@envname *}[1]
    {\VerbatimEnvironment\begin{minted}[#3,##1]{#2}}
    {\end{minted}}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\newmint}
%
% Define a new language-specific alias for the |\mint| short form.
%    \begin{macrocode}
\newcommand{\newmint}[3][]{%
  \if\relax\detokenize{#1}\relax
    \def\minted@shortname{#2}%
  \else
    \def\minted@shortname{#1}%
  \fi    
  \expandafter\newmint@i\expandafter{\minted@shortname}{#2}{#3}}
\def\newmint@i#1#2#3{%
  \expandafter\newcommand\csname#1\endcsname{%
    \expandafter\FVExtraRobustCommand\csname RobustNewMint#1\endcsname
      \FVExtraUnexpandedReadStarOArgBVArg}%
  \FVExtrapdfstringdefDisableCommands{%
    \expandafter\def\csname RobustNewMint#1\endcsname{}}%
  \expandafter\newrobustcmd\csname RobustNewMint#1\endcsname{%
    \FVExtraReadOArgBeforeVArg{\csname RobustNewMint#1@i\endcsname}}%
  \expandafter\def\csname RobustNewMint#1@i\endcsname##1{%
    \ifbool{FVExtraRobustCommandExpanded}%
     {\@ifnextchar\bgroup
       {\FVExtraReadVArg{\csname RobustNewMint#1@ii\endcsname{##1}}}%
       {\PackageError{minted}%
         {Delimiters must be paired curly braces in this context}%
         {Use curly braces as delimiters}}}%
     {\FVExtraReadVArg{\csname RobustNewMint#1@ii\endcsname{##1}}}}
  \expandafter\def\csname RobustNewMint#1@ii\endcsname##1##2{%
    \RobustMintProcess{#3,##1}{#2}{##2}}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\newmintedfile}
%
% Define a new language-specific alias for |\inputminted|.
%    \begin{macrocode}
\newcommand{\newmintedfile}[3][]{
%    \end{macrocode}
% Here, the default macro name (if none is provided) appends ``|file|'' to the language name.
%    \begin{macrocode}
  \ifthenelse{\equal{#1}{}}
    {\def\minted@shortname{#2file}}
    {\def\minted@shortname{#1}}
%    \end{macrocode}
%
% \dots and define the macro.
%
%    \begin{macrocode}
  \expandafter\newcommand\csname\minted@shortname\endcsname[2][]{
    \inputminted[#3,##1]{#2}{##2}}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\newmintinline}
% Define an alias for |\mintinline|.
%    \begin{macrocode}
\newcommand{\newmintinline}[3][]{%
  \if\relax\detokenize{#1}\relax
    \def\minted@shortname{#2inline}%
  \else
    \def\minted@shortname{#1}%
  \fi
  \expandafter\newmintinline@i\expandafter{\minted@shortname}{#2}{#3}}
\def\newmintinline@i#1#2#3{%
  \expandafter\newcommand\csname#1\endcsname{%
    \expandafter\FVExtraRobustCommand\csname RobustNewMintInline#1\endcsname
      \FVExtraUnexpandedReadStarOArgBVArg}%
  \FVExtrapdfstringdefDisableCommands{%
    \expandafter\def\csname RobustNewMintInline#1\endcsname{}}%
  \expandafter\newrobustcmd\csname RobustNewMintInline#1\endcsname{%
    \FVExtraReadOArgBeforeVArg{\csname RobustNewMintInline#1@i\endcsname}}%
  \expandafter\def\csname RobustNewMintInline#1@i\endcsname##1{%
    \ifbool{FVExtraRobustCommandExpanded}%
     {\@ifnextchar\bgroup
       {\FVExtraReadVArg{\csname RobustNewMintInline#1@ii\endcsname{##1}}}%
       {\PackageError{minted}%
         {Inline delimiters must be paired curly braces in this context}%
         {Use curly braces as delimiters}}}%
     {\FVExtraReadVArg{\csname RobustNewMintInline#1@ii\endcsname{##1}}}}
  \expandafter\def\csname RobustNewMintInline#1@ii\endcsname##1##2{%
    \RobustMintInlineProcess{#3,##1}{#2}{##2}}}
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{Float support}
%
% \begin{environment}{listing}
%
% Define a new floating environment to use for floated listings.  This is defined conditionally based on the |newfloat| package option.
%
%    \begin{macrocode}
\ifthenelse{\boolean{minted@newfloat}}%
 {\@ifundefined{minted@float@within}%
    {\DeclareFloatingEnvironment[fileext=lol,placement=tbp]{listing}}%
    {\def\minted@tmp#1{%
       \DeclareFloatingEnvironment[fileext=lol,placement=tbp, within=#1]{listing}}%
     \expandafter\minted@tmp\expandafter{\minted@float@within}}}%
 {\@ifundefined{minted@float@within}%
    {\newfloat{listing}{tbp}{lol}}%
    {\newfloat{listing}{tbp}{lol}[\minted@float@within]}}
%    \end{macrocode}
% \end{environment}
%
% The following macros only apply when |listing| is created with the \texpkg{float} package.  When |listing| is created with \texpkg{newfloat}, its properties should be modified using \texpkg{newfloat}'s |\SetupFloatingEnvironment|.
%    \begin{macrocode}
\ifminted@newfloat\else
%    \end{macrocode}
%
% \begin{macro}{\listingcaption}
%
% The name that is displayed before each individual listings caption and its number.
% The macro |\listingscaption| can be redefined by the user.
%
%    \begin{macrocode}
\newcommand{\listingscaption}{Listing}
%    \end{macrocode}
%
% The following definition should not be changed by the user.
%
%    \begin{macrocode}
\floatname{listing}{\listingscaption}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\listoflistingscaption}
%
% The caption that is displayed for the list of listings.
%
%    \begin{macrocode}
\newcommand{\listoflistingscaption}{List of Listings}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\listoflistings}
%
% Used to produce a list of listings (like |\listoffigures| etc.).
% This may well clash with other packages (for example, \texpkg{listings}) but we choose to ignore this
% since these two packages shouldn't be used together in the first place.
%
%    \begin{macrocode}
\providecommand{\listoflistings}{\listof{listing}{\listoflistingscaption}}
%    \end{macrocode}
% \end{macro}
%
% Again, the preceding macros only apply when \texpkg{float} is used to create listings, so we need to end the conditional.
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% \subsection{Epilogue}
%
% Check whether LaTeX was invoked with |-shell-escape| option, set the default style, and make sure |pygmentize| exists.  Checking for |pygmentize| must wait until the end of the preamble, in case it is specified via |\MintedPygmentize| (which would typically be after the package is loaded).
%
%    \begin{macrocode}
\AtEndOfPackage{%
  \ifthenelse{\boolean{minted@draft}}%
   {}%
   {%
    \ifthenelse{\boolean{minted@frozencache}}{}{%
      \ifnum\pdf@shellescape=1\relax\else
        \PackageError{minted}%
         {You must invoke LaTeX with the
          -shell-escape flag}%
         {Pass the -shell-escape flag to LaTeX. Refer to the minted.sty
          documentation for more information.}%
      \fi}%
   }%
}
\AtEndPreamble{%
  \ifthenelse{\boolean{minted@draft}}%
   {}%
   {%
    \ifthenelse{\boolean{minted@frozencache}}{}{%
      \TestAppExists{\MintedPygmentize}%
      \ifAppExists\else
        \PackageError{minted}%
         {You must have `pygmentize' installed
          to use this package}%
         {Refer to the installation instructions in the minted
          documentation for more information.}%
      \fi}%
  }%
}
%    \end{macrocode}
%
%
%
% \subsection{Final cleanup}
%
% Clean up temp files.  What actually needs to be done depends on caching and engine.
%    \begin{macrocode}
\AfterEndDocument{%
  \ifthenelse{\boolean{minted@draft}}%
   {}%
   {\ifthenelse{\boolean{minted@frozencache}}%
     {}
     {\ifx\XeTeXinterchartoks\minted@undefined
      \else
        \DeleteFile[\minted@outputdir]{\minted@jobname.mintedcmd}%
        \DeleteFile[\minted@outputdir]{\minted@jobname.mintedmd5}%
      \fi
      \DeleteFile[\minted@outputdir]{\minted@jobname.pyg}%
      \DeleteFile[\minted@outputdir]{\minted@jobname.out.pyg}%
     }%
   }%
}
%    \end{macrocode}
%
% \iffalse
%</package>
% \fi
%
%
%
% \section{Implementation of compatibility package}
% \setcounter{CodelineNo}{0}
%
% \iffalse
%<*packageone>
% \fi
%
% \texpkg{minted} version 2 is designed to be completely compatible with version 1.7.  All of the same options and commands still exist.  As far as most users are concerned, the only difference should be the new commands and options.
%
% However, \texpkg{minted} 2 does require some additional packages compared to \texpkg{minted} 1.7.  More importantly, since \texpkg{minted} 2 has almost completely new internal code, user code that accessed the internals of 1.7 will generally not work with 2.0, at least not without some modification.  For these reasons, a copy of \texpkg{minted} 1.7 is supplied as the package \texpkg{minted1}.  This is intended \emph{only} for compatibility cases when using the current version is too inconvenient.
%
% The code in \texpkg{minted1} is an exact copy of \texpkg{minted} version 1.7, except for two things:  (1) the package has been renamed, and (2) code has been added that allows \texpkg{minted1} to act as (impersonate) \texpkg{minted}, so that it can cooperate with other packages that require \texpkg{minted} to be loaded.\footnote{The approach used for doing this is described at \url{http://tex.stackexchange.com/a/39418/10742}.}  When \texpkg{minted1} is used, it must be loaded \emph{before} any other packages that would require \texpkg{minted}.
%
% All modifications to the original \texpkg{minted} 1.7 source are indicated with comments.  All original code that has been replaced has been commented out rather than deleted.  Any future modifications of \texpkg{minted1} should \emph{only} be for the purpose of allowing it to serve better as a drop-in compatibility substitute for the current release of \texpkg{minted}.
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
%%%% Begin minted1 modification
%%\ProvidesPackage{minted}[2011/09/17 v1.7 Yet another Pygments shim for LaTeX]
\ProvidesPackage{minted1}[2015/01/31 v1.0 minted 1.7 compatibility package]
%%%% End minted1 modification
\RequirePackage{keyval}
\RequirePackage{fancyvrb}
\RequirePackage{xcolor}
\RequirePackage{float}
\RequirePackage{ifthen}
%%%% Begin minted1 modification
\newboolean{mintedone@mintedloaded}
\@ifpackageloaded{minted}%
 {\setboolean{mintedone@mintedloaded}{true}%
  \PackageError{minted1}{The package "minted1" may not be loaded after
      ^^J"minted" has already been loaded--load "minted1" only for "minted"
      ^^Jversion 1.7 compatibility}%
   {Load "minted1" only when "minted" version 1.7 compatibility is required}}%
 {}
\ifmintedone@mintedloaded\else
\@namedef{ver@minted.sty}{2011/09/17 v1.7 Yet another Pygments shim for LaTeX}
\expandafter\let\expandafter\minted@tmp\csname opt@minted1.sty\endcsname
\expandafter\let\csname opt@minted.sty\endcsname\minted@tmp
\let\minted@tmp\relax
%%%% End minted1 modification
\RequirePackage{calc}
\RequirePackage{ifplatform}
\DeclareOption{chapter}{\def\minted@float@within{chapter}}
\DeclareOption{section}{\def\minted@float@within{section}}
\ProcessOptions\relax
\ifwindows
  \providecommand\DeleteFile[1]{\immediate\write18{del #1}}
\else
  \providecommand\DeleteFile[1]{\immediate\write18{rm #1}}
\fi
\newboolean{AppExists}
\newcommand\TestAppExists[1]{
  \ifwindows
    \DeleteFile{\jobname.aex}
    \immediate\write18{for \string^\@percentchar i in (#1.exe #1.bat #1.cmd)
      do set >\jobname.aex <nul: /p x=\string^\@percentchar \string~$PATH:i>>\jobname.aex} %$
    \newread\@appexistsfile
    \immediate\openin\@appexistsfile\jobname.aex
    \expandafter\def\expandafter\@tmp@cr\expandafter{\the\endlinechar}
    \endlinechar=-1\relax
    \readline\@appexistsfile to \@apppathifexists
    \endlinechar=\@tmp@cr
    \ifthenelse{\equal{\@apppathifexists}{}}
     {\AppExistsfalse}
     {\AppExiststrue}
    \immediate\closein\@appexistsfile
    \DeleteFile{\jobname.aex}
\immediate\typeout{file deleted}
  \else
    \immediate\write18{which #1 && touch \jobname.aex}
    \IfFileExists{\jobname.aex}
     {\AppExiststrue
      \DeleteFile{\jobname.aex}}
     {\AppExistsfalse}
  \fi}
\newcommand\minted@resetoptions{}
\newcommand\minted@defopt[1]{
  \expandafter\def\expandafter\minted@resetoptions\expandafter{%
    \minted@resetoptions
    \@namedef{minted@opt@#1}{}}}
\newcommand\minted@opt[1]{
  \expandafter\detokenize%
    \expandafter\expandafter\expandafter{\csname minted@opt@#1\endcsname}}
\newcommand\minted@define@opt[3][]{
  \minted@defopt{#2}
  \ifthenelse{\equal{#1}{}}{
    \define@key{minted@opt}{#2}{\@namedef{minted@opt@#2}{#3}}}
   {\define@key{minted@opt}{#2}[#1]{\@namedef{minted@opt@#2}{#3}}}}
\newcommand\minted@define@switch[3][]{
  \minted@defopt{#2}
  \define@booleankey{minted@opt}{#2}
   {\@namedef{minted@opt@#2}{#3}}
   {\@namedef{minted@opt@#2}{#1}}}
\minted@defopt{extra}
\newcommand\minted@define@extra[1]{
  \define@key{minted@opt}{#1}{
    \expandafter\def\expandafter\minted@opt@extra\expandafter{%
      \minted@opt@extra,#1=##1}}}
\newcommand\minted@define@extra@switch[1]{
  \define@booleankey{minted@opt}{#1}
   {\expandafter\def\expandafter\minted@opt@extra\expandafter{%
      \minted@opt@extra,#1}}
   {\expandafter\def\expandafter\minted@opt@extra\expandafter{%
      \minted@opt@extra,#1=false}}}
\minted@define@switch{texcl}{-P texcomments}
\minted@define@switch{mathescape}{-P mathescape}
\minted@define@switch{linenos}{-P linenos}
\minted@define@switch{startinline}{-P startinline}
\minted@define@switch[-P funcnamehighlighting=False]%
  {funcnamehighlighting}{-P funcnamehighlighting}
\minted@define@opt{gobble}{-F gobble:n=#1}
\minted@define@opt{bgcolor}{#1}
\minted@define@extra{frame}
\minted@define@extra{framesep}
\minted@define@extra{framerule}
\minted@define@extra{rulecolor}
\minted@define@extra{numbersep}
\minted@define@extra{firstnumber}
\minted@define@extra{stepnumber}
\minted@define@extra{firstline}
\minted@define@extra{lastline}
\minted@define@extra{baselinestretch}
\minted@define@extra{xleftmargin}
\minted@define@extra{xrightmargin}
\minted@define@extra{fillcolor}
\minted@define@extra{tabsize}
\minted@define@extra{fontfamily}
\minted@define@extra{fontsize}
\minted@define@extra{fontshape}
\minted@define@extra{fontseries}
\minted@define@extra{formatcom}
\minted@define@extra{label}
\minted@define@extra@switch{numberblanklines}
\minted@define@extra@switch{showspaces}
\minted@define@extra@switch{resetmargins}
\minted@define@extra@switch{samepage}
\minted@define@extra@switch{showtabs}
\minted@define@extra@switch{obeytabs}
\newsavebox{\minted@bgbox}
\newenvironment{minted@colorbg}[1]{
  \def\minted@bgcol{#1}
  \noindent
  \begin{lrbox}{\minted@bgbox}
  \begin{minipage}{\linewidth-2\fboxsep}}
 {\end{minipage}
  \end{lrbox}%
  \colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}}
\newwrite\minted@code
\newcommand\minted@savecode[1]{
  \immediate\openout\minted@code\jobname.pyg
  \immediate\write\minted@code{#1}
  \immediate\closeout\minted@code}
\newcommand\minted@pygmentize[2][\jobname.pyg]{
  \def\minted@cmd{pygmentize -l #2 -f latex -F tokenmerge
    \minted@opt{gobble} \minted@opt{texcl} \minted@opt{mathescape}
    \minted@opt{startinline} \minted@opt{funcnamehighlighting}
    \minted@opt{linenos} -P "verboptions=\minted@opt{extra}"
    -o \jobname.out.pyg #1}
  \immediate\write18{\minted@cmd}
  % For debugging, uncomment:
  %\immediate\typeout{\minted@cmd}
  \ifthenelse{\equal{\minted@opt@bgcolor}{}}
   {}
   {\begin{minted@colorbg}{\minted@opt@bgcolor}}
  \input{\jobname.out.pyg}
  \ifthenelse{\equal{\minted@opt@bgcolor}{}}
   {}
   {\end{minted@colorbg}}
  \DeleteFile{\jobname.out.pyg}}
\newcommand\minted@usedefaultstyle{\usemintedstyle{default}}
\newcommand\usemintedstyle[1]{
  \renewcommand\minted@usedefaultstyle{}
  \immediate\write18{pygmentize -S #1 -f latex > \jobname.pyg}
  \input{\jobname.pyg}}
\newcommand\mint[3][]{
  \DefineShortVerb{#3}
  \minted@resetoptions
  \setkeys{minted@opt}{#1}
  \SaveVerb[aftersave={
    \UndefineShortVerb{#3}
    \minted@savecode{\FV@SV@minted@verb}
    \minted@pygmentize{#2}
    \DeleteFile{\jobname.pyg}}]{minted@verb}#3}
\newcommand\minted@proglang[1]{}
\newenvironment{minted}[2][]
 {\VerbatimEnvironment
  \renewcommand{\minted@proglang}[1]{#2}
  \minted@resetoptions
  \setkeys{minted@opt}{#1}
  \begin{VerbatimOut}[codes={\catcode`\^^I=12}]{\jobname.pyg}}%
 {\end{VerbatimOut}
  \minted@pygmentize{\minted@proglang{}}
  \DeleteFile{\jobname.pyg}}
\newcommand\inputminted[3][]{
  \minted@resetoptions
  \setkeys{minted@opt}{#1}
  \minted@pygmentize[#3]{#2}}
\newcommand\newminted[3][]{
  \ifthenelse{\equal{#1}{}}
   {\def\minted@envname{#2code}}
   {\def\minted@envname{#1}}
  \newenvironment{\minted@envname}
   {\VerbatimEnvironment\begin{minted}[#3]{#2}}
   {\end{minted}}
  \newenvironment{\minted@envname *}[1]
   {\VerbatimEnvironment\begin{minted}[#3,##1]{#2}}
   {\end{minted}}}
\newcommand\newmint[3][]{
  \ifthenelse{\equal{#1}{}}
   {\def\minted@shortname{#2}}
   {\def\minted@shortname{#1}}
  \expandafter\newcommand\csname\minted@shortname\endcsname[2][]{
    \mint[#3,##1]{#2}##2}}
\newcommand\newmintedfile[3][]{
  \ifthenelse{\equal{#1}{}}
   {\def\minted@shortname{#2file}}
   {\def\minted@shortname{#1}}
  \expandafter\newcommand\csname\minted@shortname\endcsname[2][]{
    \inputminted[#3,##1]{#2}{##2}}}
\@ifundefined{minted@float@within}
 {\newfloat{listing}{h}{lol}}
 {\newfloat{listing}{h}{lol}[\minted@float@within]}
\newcommand\listingscaption{Listing}
\floatname{listing}{\listingscaption}
\newcommand\listoflistingscaption{List of listings}
\providecommand\listoflistings{\listof{listing}{\listoflistingscaption}}
\AtBeginDocument{
  \minted@usedefaultstyle}
\AtEndOfPackage{
  \ifnum\pdf@shellescape=1\relax\else
    \PackageError{minted}
     {You must invoke LaTeX with the
      -shell-escape flag}
     {Pass the -shell-escape flag to LaTeX. Refer to the minted.sty
      documentation for more information.}\fi
  \TestAppExists{pygmentize}
  \ifAppExists\else
    \PackageError{minted}
     {You must have `pygmentize' installed
      to use this package}
     {Refer to the installation instructions in the minted
      documentation for more information.}
  \fi}
%%%% Begin minted1 modification
\fi
%%%% End minted1 modification
%    \end{macrocode}
% \iffalse
%</packageone>
% \fi
%
% \Finale
\endinput