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
|
%%
%% This file contains the code that is common to the Tufte-LaTeX document classes.
%%
\ProvidesFile{tufte-common.def}[2015/06/21 v3.5.2 Common code for the Tufte-LaTeX styles]
%%
% The `xkeyval' package simplifies the user interface for the document class options
\RequirePackage{xkeyval}
%%
% We use the `xifthen' package to handle our package option switches
\RequirePackage{xifthen}
%%
% Define some shortcut macros for error/warning/info logging.
\RequirePackage{hardwrap}
\GenerateClassLogMacros[@tufte]{\@tufte@pkgname}
\newcommand{\@tufte@debug@info}[1]{\ifthenelse{\boolean{@tufte@debug}}{\@tufte@info{#1}}{}}
\newcommand{\@tufte@debug@info@noline}[1]{\ifthenelse{\boolean{@tufte@debug}}{\@tufte@info@noline{#1}}{}}
%%
% `debug' option -- provides more information in the .log file for use in
% troubleshooting problems
\newboolean{@tufte@debug}
\DeclareOptionX[tufte]<common>{debug}{\setboolean{@tufte@debug}{true}}
%%
% `nofonts' option -- doesn't load any fonts
% `fonts' option -- tries to load fonts
\newboolean{@tufte@loadfonts}\setboolean{@tufte@loadfonts}{true}
\DeclareOptionX[tufte]<common>{fonts}{\setboolean{@tufte@loadfonts}{true}}
\DeclareOptionX[tufte]<common>{nofonts}{\setboolean{@tufte@loadfonts}{false}}
%%
% `nols' option -- doesn't configure letterspacing
% `ls' option -- configures letterspacing
\newboolean{@tufte@letterspace}\setboolean{@tufte@letterspace}{true}
\DeclareOptionX[tufte]<common>{ls}{\setboolean{@tufte@letterspace}{true}}
\DeclareOptionX[tufte]<common>{nols}{\setboolean{@tufte@letterspace}{false}}
%%
% `nobib' option -- doesn't load natbib or adjust the \cite command
\newboolean{@tufte@loadnatbib}\setboolean{@tufte@loadnatbib}{true}
\DeclareOptionX[tufte]<common>{nobib}{\setboolean{@tufte@loadnatbib}{false}}
%%
% `titlepage' option -- creates a full title page with \maketitle
\newboolean{@tufte@titlepage}
\DeclareOptionX[tufte]<common>{titlepage}{\setboolean{@tufte@titlepage}{true}}
\DeclareOptionX[tufte]<common>{notitlepage}{\setboolean{@tufte@titlepage}{false}}
%%
% `a4paper' option
\newboolean{@tufte@afourpaper}
\DeclareOptionX[tufte]<common>{a4paper}{\setboolean{@tufte@afourpaper}{true}}
%%
% `b5paper' option
\newboolean{@tufte@bfivepaper}
\DeclareOptionX[tufte]<common>{b5paper}{\setboolean{@tufte@bfivepaper}{true}}
%%
% `sfsidenotes' option -- typesets sidenotes in sans serif typeface
\newboolean{@tufte@sfsidenotes}
\DeclareOptionX[tufte]<common>{sfsidenotes}{\setboolean{@tufte@sfsidenotes}{true}}
%%
% `symmetric' option -- puts marginpar space to the outside edge of the page
% Note: this option forces the twoside option (see the .cls files)
\newboolean{@tufte@symmetric}
\DeclareOptionX[tufte]<common>{symmetric}{
\setboolean{@tufte@symmetric}{true}
\@tufte@info@noline{The `symmetric' option implies `twoside'}
\ExecuteOptionsX[tufte]<common>{twoside}
}
%%
% `twoside' option -- alternates running heads
\newboolean{@tufte@twoside}
\DeclareOptionX[tufte]<common>{twoside}{%
\setboolean{@tufte@twoside}{true}
\@tufte@info@noline{Passing the `twoside' option to the `\@tufte@class' class}
\PassOptionsToClass{twoside}{\@tufte@class}
}
%%
% `notoc' option -- suppresses the Tufte-style table of contents
\newboolean{@tufte@toc}
\setboolean{@tufte@toc}{true}
\DeclareOptionX[tufte]<common>{notoc}{\setboolean{@tufte@toc}{false}}
\DeclareOptionX[tufte]<common>{toc}{\setboolean{@tufte@toc}{true}}
%%
% `justified' option -- uses fully justified text (flush left and flush
% right) instead of ragged right.
\newboolean{@tufte@justified}
\DeclareOptionX[tufte]<common>{justified}{\setboolean{@tufte@justified}{true}}
%%
% `bidi' option -- loads the bidi package for bi-directional text
\newboolean{@tufte@loadbidi}
\DeclareOptionX[tufte]<common>{bidi}{\setboolean{@tufte@loadbidi}{true}}
\DeclareOptionX[tufte]<common>{nobidi}{\setboolean{@tufte@loadbidi}{false}}
%%
% `nohyper' option -- suppresses loading of the hyperref package
\newboolean{@tufte@loadhyper}
\setboolean{@tufte@loadhyper}{true}
\DeclareOptionX[tufte]<common>{hyper}{\setboolean{@tufte@loadhyper}{true}}
\DeclareOptionX[tufte]<common>{nohyper}{\setboolean{@tufte@loadhyper}{false}}
%%
% `sidenote', `marginnote', `caption', `citation', `marginals' options
% Each allows one of {justified,raggedleft,raggedright,raggedouter,auto}.
\newcommand*{\@tufte@sidenote@justification}{\@tufte@justification@autodetect}
\define@choicekey*+[tufte]{common}{sidenote}[\@tufte@kvtext\@tufte@kvnum]{justified,raggedleft,raggedright,raggedouter,auto}[auto]{%
\ifcase\@tufte@kvnum\relax
\renewcommand*{\@tufte@sidenote@justification}{\justifying}% justified
\or
\renewcommand*{\@tufte@sidenote@justification}{\RaggedLeft}% ragged left
\or
\renewcommand*{\@tufte@sidenote@justification}{\RaggedRight}% ragged right
\or
\renewcommand*{\@tufte@sidenote@justification}{\@tufte@justification@outer}% ragged outer (flush right on verso pages, flush left on recto pages)
\or
\renewcommand*{\@tufte@sidenote@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
\fi
}{%
\@tufte@warning@noline{Invalid option `#1' for sidenote key. Must be one of: justified, raggedleft, raggedright, raggedouter, auto}
\renewcommand*{\@tufte@sidenote@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
}
\newcommand*{\@tufte@marginnote@justification}{\@tufte@justification@autodetect}
\define@choicekey*+[tufte]{common}{marginnote}[\@tufte@kvtext\@tufte@kvnum]{justified,raggedleft,raggedright,raggedouter,auto}[auto]{%
\ifcase\@tufte@kvnum\relax
\renewcommand*{\@tufte@marginnote@justification}{\justifying}% justified
\or
\renewcommand*{\@tufte@marginnote@justification}{\RaggedLeft}% ragged left
\or
\renewcommand*{\@tufte@marginnote@justification}{\RaggedRight}% ragged right
\or
\renewcommand*{\@tufte@marginnote@justification}{\@tufte@justification@outer}% ragged outer (flush right on verso pages, flush left on recto pages)
\or
\renewcommand*{\@tufte@marginnote@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
\fi
}{%
\@tufte@warning@noline{Invalid option `#1' for marginnote key. Must be one of: justified, raggedleft, raggedright, raggedouter, auto}
\renewcommand*{\@tufte@marginnote@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
}
\newcommand*{\@tufte@caption@justification}{\@tufte@justification@autodetect}
\define@choicekey*+[tufte]{common}{caption}[\@tufte@kvtext\@tufte@kvnum]{justified,raggedleft,raggedright,raggedouter,auto}[auto]{%
\ifcase\@tufte@kvnum\relax
\renewcommand*{\@tufte@caption@justification}{\justifying}% justified
\or
\renewcommand*{\@tufte@caption@justification}{\RaggedLeft}% ragged left
\or
\renewcommand*{\@tufte@caption@justification}{\RaggedRight}% ragged right
\or
\renewcommand*{\@tufte@caption@justification}{\@tufte@justification@caption@outer}% ragged outer (flush right on verso pages, flush left on recto pages)
\or
\renewcommand*{\@tufte@caption@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
\fi
}{%
\@tufte@warning@noline{Invalid option `#1' for caption key. Must be one of: justified, raggedleft, raggedright, raggedouter, auto}
\renewcommand*{\@tufte@caption@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
}
\newcommand*{\@tufte@citation@justification}{\@tufte@justification@autodetect}
\define@choicekey*+[tufte]{common}{citation}[\@tufte@kvtext\@tufte@kvnum]{justified,raggedleft,raggedright,raggedouter,auto}[auto]{%
\ifcase\@tufte@kvnum\relax
\renewcommand*{\@tufte@citation@justification}{\justifying}% justified
\or
\renewcommand*{\@tufte@citation@justification}{\RaggedLeft}% ragged left
\or
\renewcommand*{\@tufte@citation@justification}{\RaggedRight}% ragged right
\or
\renewcommand*{\@tufte@citation@justification}{\@tufte@justification@outer}% ragged outer (flush right on verso pages, flush left on recto pages)
\or
\renewcommand*{\@tufte@citation@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
\fi
}{%
\@tufte@warning@noline{Invalid option `#1' for citation key. Must be one of: justified, raggedleft, raggedright, raggedouter, auto}
\renewcommand*{\@tufte@citation@justification}{\@tufte@justification@autodetect}% autodetects best justification mode based on all class options
}
% The ``marginals'' key simultaneously sets the same justification for all marginal material
\define@choicekey*+[tufte]{common}{marginals}[\@tufte@kvtext\@tufte@kvnum]{justified,raggedleft,raggedright,raggedouter,auto}[auto]{%
\ifcase\@tufte@kvnum\relax
\ExecuteOptionsX[tufte]<common>{citation=justified,sidenote=justified,caption=justified,marginnote=justified}% justified
\or
\ExecuteOptionsX[tufte]<common>{citation=raggedleft,sidenote=raggedleft,caption=raggedleft,marginnote=raggedleft}% ragged left
\or
\ExecuteOptionsX[tufte]<common>{citation=raggedright,sidenote=raggedright,caption=raggedright,marginnote=raggedright}% ragged right
\or
\ExecuteOptionsX[tufte]<common>{citation=raggedouter,sidenote=raggedouter,caption=raggedouter,marginnote=raggedouter}% ragged outer (flush right on verso pages, flush left on recto pages)
\or
\ExecuteOptionsX[tufte]<common>{citation=auto,sidenote=auto,caption=auto,marginnote=auto}% autodetects best justification mode based on all class options
\fi
}{%
\@tufte@warning@noline{Invalid option `#1' for marginals key. Must be one of: justified, raggedleft, raggedright, raggedouter, auto}
\ExecuteOptionsX[tufte]<common>{citation=auto,sidenote=auto,caption=auto,marginnote=auto}% autodetects best justification mode based on all class options
}
%%
% Unsupported options
\newcommand{\@tufte@unsupported@option}[1]{\@tufte@warning@noline{Option `#1' is not supported -- ignoring option}\OptionNotUsed}
\DeclareOptionX[tufte]<common>{10pt}{\@tufte@unsupported@option{\CurrentOption}}
\DeclareOptionX[tufte]<common>{11pt}{\@tufte@unsupported@option{\CurrentOption}}
\DeclareOptionX[tufte]<common>{12pt}{\@tufte@unsupported@option{\CurrentOption}}
\DeclareOptionX[tufte]<common>{a5paper}{\@tufte@unsupported@option{\CurrentOption}}
\DeclareOptionX[tufte]<common>{executivepaper}{\@tufte@unsupported@option{\CurrentOption}}
\DeclareOptionX[tufte]<common>{legalpaper}{\@tufte@unsupported@option{\CurrentOption}}
\DeclareOptionX[tufte]<common>{landscape}{\@tufte@unsupported@option{\CurrentOption}}
\DeclareOptionX[tufte]<common>{onecolumn}{\@tufte@unsupported@option{\CurrentOption}}
\DeclareOptionX[tufte]<common>{twocolumn}{\@tufte@unsupported@option{\CurrentOption}}
%%
% Default `book' and `handout' options
\ifthenelse{\equal{\@tufte@pkgname}{tufte-book}}
{\ExecuteOptionsX[tufte]<common>{titlepage}}
{\ExecuteOptionsX[tufte]<common>{notitlepage}}
\DeclareOptionX*{%
\@tufte@info@noline{Passing \CurrentOption\space to the `\@tufte@class' class.}%
\PassOptionsToClass{\CurrentOption}{\@tufte@class}%
}
\ProcessOptionsX*[tufte]<common>\relax
%%
% Load the appropriate base class
\@tufte@info@noline{Loading the base class `\@tufte@class'}
\LoadClass{\@tufte@class}
%%
% Detect whether we're in two-side mode or not. (Used to set up running
% heads later.)
\ifthenelse{\boolean{@twoside}}
{\setboolean{@tufte@twoside}{true}}
{}
%%
% Detect if we're using pdfLaTeX
\newboolean{@tufte@pdf}
\IfFileExists{ifpdf.sty}{%
\RequirePackage{ifpdf}
\ifthenelse{\boolean{pdf}}
{\setboolean{@tufte@pdf}{true}}
{\setboolean{@tufte@pdf}{false}}
}{% assume we're not using pdfTex?
\setboolean{@tufte@pdf}{false}
}
%%
% Detect if we're using XeLaTeX
\newboolean{@tufte@xetex}
\IfFileExists{ifxetex.sty}{%
\RequirePackage{ifxetex}
\ifthenelse{\boolean{xetex}}
{\setboolean{@tufte@xetex}{true}}
{\setboolean{@tufte@xetex}{false}}
}{% not using xelatex
\setboolean{@tufte@xetex}{false}
}
\ifthenelse{\boolean{@tufte@xetex}}{%
\RequirePackage{xltxtra}% xltxtra loads xunicode and fontspec; must be loaded before bidi
}{}
%%
% Detect if we're using LuaTeX
\newboolean{@tufte@luatex}
\IfFileExists{ifluatex.sty}{%
\RequirePackage{ifluatex}
\ifthenelse{\boolean{luatex}}
{\setboolean{@tufte@luatex}{true}}
{\setboolean{@tufte@luatex}{false}}
}{% not using luatex
\setboolean{@tufte@luatex}{false}
}
\ifthenelse{\boolean{@tufte@luatex}}{%
\RequirePackage{fontspec}
\RequirePackage[osf,sc]{mathpazo}
\setmainfont[Renderer=Basic, Numbers=OldStyle, Scale = 1.0]{TeX Gyre Pagella}
\setsansfont[Renderer=Basic, Scale=0.90]{TeX Gyre Heros}
\setmonofont[Renderer=Basic]{TeX Gyre Cursor}
}{}
%%
% Globally sets the length
\newcommand*{\gsetlength}[2]{%
\setlength{#1}{#2}%
\global#1=#1\relax%
}
%%
% Globally sets a boolean
\newcommand*{\gsetboolean}[2]{% based on code from ifthen pkg
\lowercase{\def\@tempa{#2}}%
\@ifundefined{@tempswa\@tempa}%
{\PackageError{ifthen}{You can only set a boolean to `true' or `false'}\@ehc}%
{\@ifundefined{#1\@tempa}%
{\PackageError{ifthen}{Boolean #1 undefined}\@ehc}%
{\global\csname#1\@tempa\endcsname}%
}%
}
%%
% The titlesec and titletoc packages are used to change the style of the
% section headings. These packages should be loaded before the hyperref
% package.
\RequirePackage{titlesec,titletoc}
%%%
%% Loads the hyperref package and sets some default options.
\newcommand{\TufteLoadHyperref}{%
\ifthenelse{\boolean{@tufte@xetex}}
{\RequirePackage[unicode,hyperfootnotes=false,xetex]{hyperref}}
{\RequirePackage[unicode,hyperfootnotes=false]{hyperref}}
\hypersetup{%
pdfborder = {0 0 0},
bookmarksdepth = section,
citecolor = DarkGreen,
linkcolor = DarkBlue,
urlcolor = DarkGreen,
}%
}
%%%
%% Load the `hyperref' package.
\ifthenelse{\boolean{@tufte@loadhyper}}{%
\TufteLoadHyperref%
}{% hyperfootnotes override our modifications to the \footnote* and \@footnote* commands.
\PassOptionsToPackage{hyperfootnotes=false}{hyperref}
}
%%
% Set the font sizes and baselines to match Tufte's books
\renewcommand\normalsize{%
\@setfontsize\normalsize\@xpt{14}%
\abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
\abovedisplayshortskip \z@ \@plus3\p@
\belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
\belowdisplayskip \abovedisplayskip
\let\@listi\@listI}
\normalbaselineskip=14pt
\normalsize
\renewcommand\small{%
\@setfontsize\small\@ixpt{12}%
\abovedisplayskip 8.5\p@ \@plus3\p@ \@minus4\p@
\abovedisplayshortskip \z@ \@plus2\p@
\belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@
\def\@listi{\leftmargin\leftmargini
\topsep 4\p@ \@plus2\p@ \@minus2\p@
\parsep 2\p@ \@plus\p@ \@minus\p@
\itemsep \parsep}%
\belowdisplayskip \abovedisplayskip
}
\renewcommand\footnotesize{%
\@setfontsize\footnotesize\@viiipt{10}%
\abovedisplayskip 6\p@ \@plus2\p@ \@minus4\p@
\abovedisplayshortskip \z@ \@plus\p@
\belowdisplayshortskip 3\p@ \@plus\p@ \@minus2\p@
\def\@listi{\leftmargin\leftmargini
\topsep 3\p@ \@plus\p@ \@minus\p@
\parsep 2\p@ \@plus\p@ \@minus\p@
\itemsep \parsep}%
\belowdisplayskip \abovedisplayskip
}
\renewcommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt}
\renewcommand\tiny{\@setfontsize\tiny\@vpt\@vipt}
\renewcommand\large{\@setfontsize\large\@xipt{15}}
\renewcommand\Large{\@setfontsize\Large\@xiipt{16}}
\renewcommand\LARGE{\@setfontsize\LARGE\@xivpt{18}}
\renewcommand\huge{\@setfontsize\huge\@xxpt{30}}
\renewcommand\Huge{\@setfontsize\Huge{24}{36}}
\setlength\leftmargini {1pc}
\setlength\leftmarginii {1pc}
\setlength\leftmarginiii {1pc}
\setlength\leftmarginiv {1pc}
\setlength\leftmarginv {1pc}
\setlength\leftmarginvi {1pc}
\setlength\labelsep {.5pc}
\setlength\labelwidth {\leftmargini}
\addtolength\labelwidth{-\labelsep}
%%
% \RaggedRight allows hyphenation
\setlength{\parindent}{1.0pc}%
\setlength{\parskip}{0pt}%
\RequirePackage{ragged2e}
\setlength{\RaggedRightRightskip}{\z@ plus 0.08\hsize}
% Paragraph indentation and separation for normal text
\newcommand{\@tufte@reset@par}{%
\setlength{\RaggedRightParindent}{1.0pc}%
\setlength{\JustifyingParindent}{1.0pc}%
\setlength{\parindent}{1pc}%
\setlength{\parskip}{0pt}%
}
\@tufte@reset@par
% Paragraph indentation and separation for marginal text
\newcommand{\@tufte@margin@par}{%
\setlength{\RaggedRightParindent}{0.5pc}%
\setlength{\JustifyingParindent}{0.5pc}%
\setlength{\parindent}{0.5pc}%
\setlength{\parskip}{0pt}%
}
%%
% Set page layout geometry
\RequirePackage[letterpaper,left=1in,top=1in,headsep=2\baselineskip,textwidth=26pc,marginparsep=2pc,marginparwidth=12pc,textheight=44\baselineskip,headheight=\baselineskip]{geometry}
\ifthenelse{\boolean{@tufte@afourpaper}}
{\geometry{a4paper,left=24.8mm,top=27.4mm,headsep=2\baselineskip,textwidth=107mm,marginparsep=8.2mm,marginparwidth=49.4mm,textheight=49\baselineskip,headheight=\baselineskip}}
{}
\ifthenelse{\boolean{@tufte@bfivepaper}}
{\geometry{paperwidth=176mm,paperheight=250mm,left=14.66mm,top=13.88mm,textwidth=102.66mm,marginparsep=7.33mm,marginparwidth=36.66mm,textheight=38\baselineskip,includehead}}
{}
\ifthenelse{\boolean{@tufte@symmetric}}
{}
{\geometry{asymmetric}}% forces internal LaTeX `twoside'
%%
% Separation marginpars by a line's worth of space.
\setlength\marginparpush{10pt}
%%
% Font for margin items
\ifthenelse{\boolean{@tufte@sfsidenotes}}
{\newcommand{\@tufte@marginfont}{\normalfont\footnotesize\sffamily}}
{\newcommand{\@tufte@marginfont}{\normalfont\footnotesize}}
\newcommand*{\@tufte@sidenote@font}{\@tufte@marginfont}
\newcommand*{\@tufte@caption@font}{\@tufte@marginfont}
\newcommand*{\@tufte@marginnote@font}{\@tufte@marginfont}
\newcommand*{\@tufte@citation@font}{\@tufte@marginfont}
\newcommand*{\setsidenotefont}[1]{\renewcommand*{\@tufte@sidenote@font}{#1}}
\newcommand*{\setcaptionfont}[1]{\renewcommand*{\@tufte@caption@font}{#1}}
\newcommand*{\setmarginnotefont}[1]{\renewcommand*{\@tufte@marginnote@font}{#1}}
\newcommand*{\setcitationfont}[1]{\renewcommand*{\@tufte@citation@font}{#1}}
%%
% Set the justification baesed on the `justified' class option
\newcommand{\@tufte@justification}{%
\ifthenelse{\boolean{@tufte@justified}}%
{\justifying}%
{\RaggedRight}%
}
%%
% Turn off section numbering
\setcounter{secnumdepth}{-1}
%%
% Tighten up space between displays (e.g., a figure or table) and make symmetric
\setlength\abovedisplayskip{6pt plus 2pt minus 4pt}
\setlength\belowdisplayskip{6pt plus 2pt minus 4pt}
%%
% To implement full-width display environments
\newboolean{@tufte@changepage}
\IfFileExists{changepage.sty}{%
\@tufte@debug@info@noline{Found changepage.sty}
\RequirePackage[strict]{changepage}
\setboolean{@tufte@changepage}{true}
}{%
\@tufte@debug@info@noline{Found chngpage.sty}
\RequirePackage[strict]{chngpage}
\setboolean{@tufte@changepage}{false}
}
% Write our own aliases for the \checkoddpage and \ifoddpage or \ifcpoddpage commands
\newboolean{@tufte@odd@page}
\setboolean{@tufte@odd@page}{true}
\newcommand*{\@tufte@checkoddpage}{%
\checkoddpage%
\ifthenelse{\boolean{@tufte@changepage}}{%
\ifoddpage%
\setboolean{@tufte@odd@page}{true}%
\else%
\setboolean{@tufte@odd@page}{false}%
\fi%
}{%
\ifcpoddpage%
\setboolean{@tufte@odd@page}{true}%
\else%
\setboolean{@tufte@odd@page}{false}%
\fi%
}%
}
%%
% Compute lengths used for full-width displays
\newlength{\@tufte@overhang}% used by the fullwidth environment and the running heads
\newlength{\@tufte@fullwidth}
\newlength{\@tufte@caption@fill}
\newcommand{\TufteRecalculate}{%
\setlength{\@tufte@overhang}{\marginparwidth}
\addtolength{\@tufte@overhang}{\marginparsep}
\setlength{\@tufte@fullwidth}{\textwidth}
\addtolength{\@tufte@fullwidth}{\marginparsep}
\addtolength{\@tufte@fullwidth}{\marginparwidth}
\setlength{\@tufte@caption@fill}{\textwidth}
\addtolength{\@tufte@caption@fill}{\marginparsep}
}
\AtBeginDocument{\TufteRecalculate}
%%
% Modified \title, \author, and \date commands. These store the
% (footnote-less) values in \plaintitle, \plainauthor, and \thedate, respectively.
\newcommand{\plaintitle}{}% plain-text-only title
\newcommand{\plainauthor}{}% plain-text-only author
\newcommand{\plainpublisher}{}% plain-text-only publisher
\newcommand{\thanklesstitle}{}% full title text minus \thanks{}
\newcommand{\thanklessauthor}{}% full author text minus \thanks{}
\newcommand{\thanklesspublisher}{}% full publisher minus \thanks{}
\newcommand{\@publisher}{}% full publisher with \thanks{}
\newcommand{\thedate}{\today}
% TODO Fix it so that \thanks is not spaced out (with `soul') and can be
% used in \maketitle when the `sfsidenotes' option is provided.
\renewcommand{\thanks}[1]{\NoCaseChange{\footnote{#1}}}
\renewcommand{\title}[2][]{%
\gdef\@title{#2}%
\begingroup%
% TODO store contents of \thanks command
\renewcommand{\thanks}[1]{}% swallow \thanks contents
\protected@xdef\thanklesstitle{#2}%
\endgroup%
\ifthenelse{\isempty{#1}}%
{\renewcommand{\plaintitle}{\thanklesstitle}}% use thankless title
{\renewcommand{\plaintitle}{#1}}% use provided plain-text title
\ifthenelse{\isundefined{\hypersetup}}%
{}% hyperref is not loaded; do nothing
{\hypersetup{pdftitle={\plaintitle}}}% set the PDF metadata title
}
\let\@author\@empty% suppress default latex.ltx ``no author'' warning
\renewcommand{\author}[2][]{%
\ifthenelse{\isempty{#2}}{}{\gdef\@author{#2}}%
\begingroup%
% TODO store contents of \thanks command
\renewcommand{\thanks}[1]{}% swallow \thanks contents
\protected@xdef\thanklessauthor{#2}%
\endgroup%
\ifthenelse{\isempty{#1}}%
{\renewcommand{\plainauthor}{\thanklessauthor}}% use thankless author
{\renewcommand{\plainauthor}{#1}}% use provided plain-text author
\ifthenelse{\isundefined{\hypersetup}}%
{}% hyperref is not loaded; do nothing
{\hypersetup{pdfauthor={\plainauthor}}}% set the PDF metadata author
}
\renewcommand{\date}[1]{%
\gdef\@date{#1}%
\begingroup%
% TODO store contents of \thanks command
\renewcommand{\thanks}[1]{}% swallow \thanks contents
\protected@xdef\thedate{#1}%
\endgroup%
}
%%
% Provides a \publisher command to set the publisher
\newcommand{\publisher}[2][]{%
\gdef\@publisher{#2}%
\begingroup%
\renewcommand{\thanks}[1]{}% swallow \thanks contents
\protected@xdef\thanklesspublisher{#2}%
\endgroup%
\ifthenelse{\isempty{#1}}
{\renewcommand{\plainpublisher}{\thanklesspublisher}}% use thankless publisher
{\renewcommand{\plainpublisher}{#1}}% use provided plain-text publisher
}
% TODO: Test \hypersetup{pdfauthor,pdftitle} with DVI and XeTeX
%%
% Require paralist package for tighter lists
\RequirePackage{paralist}
% Add rightmargin to compactenum
\def\@compactenum@{%
\expandafter\list\csname label\@enumctr\endcsname{%
\usecounter{\@enumctr}%
\rightmargin=2em% added this
\parsep\plparsep
\itemsep\plitemsep
\topsep\pltopsep
\partopsep\plpartopsep
\def\makelabel##1{\hss\llap{##1}}}}
%%
% Improved letterspacing of small caps and all-caps text.
%
% First, try to use the `microtype' package, if it's available.
% Failing that, try to use the `soul' package, if it's available.
% Failing that, well, I give up.
\DeclareTextFontCommand{\textsmallcaps}{\scshape}
\RequirePackage{textcase} % provides \MakeTextUppercase and \MakeTextLowercase
\def\allcapsspacing{\@tufte@warning{Proper spacing of ALL-CAPS letters has not been set up.}}
\def\smallcapsspacing{\@tufte@warning{Proper spacing of small-caps letters has not been set up.}}
\newcommand{\allcaps}[1]{\allcapsspacing{\MakeTextUppercase{#1}}}
\newcommand{\smallcaps}[1]{\smallcapsspacing{\MakeTextLowercase{#1}}}
% If we're using pdfLaTeX v1.40+, use the letterspace package.
% If we're using pdfLaTex < v1.40, use the soul package.
% If we're using XeLaTeX, use XeLaTeX letterspacing options.
% Otherwise fall back on the soul package.
\ifthenelse{\boolean{@tufte@pdf}}
{\@tufte@debug@info@noline{ifpdf = true}}
{\@tufte@debug@info@noline{ifpdf = false}}
\ifthenelse{\boolean{@tufte@xetex}}
{\@tufte@debug@info@noline{ifxetex = true}}
{\@tufte@debug@info@noline{ifxetex = false}}
% Check pdfLaTeX version
\def\@tufte@pdftexversion{0}
\ifx\normalpdftexversion\@undefined \else
\let\pdftexversion \normalpdftexversion
\let\pdftexrevision\normalpdftexrevision
\let\pdfoutput \normalpdfoutput
\fi
\ifx\pdftexversion\@undefined \else
\ifx\pdftexversion\relax \else
\def\@tufte@pdftexversion{6}
\ifnum\pdftexversion < 140
\def\@tufte@pdftexversion{5}
\fi
\fi
\fi
\newboolean{@tufte@letterspace@pkg@prereqs}
\setboolean{@tufte@letterspace@pkg@prereqs}{true}
\ifnum\@tufte@pdftexversion<6
\setboolean{@tufte@letterspace@pkg@prereqs}{false}
\fi
\newcommand{\@tufte@letterspacing@soul}{%
\RequirePackage{soul}%
\sodef\allcapsspacing{}{0.15em}{0.65em}{0.6em}%
\sodef\smallcapsspacing{}{0.075em}{0.5em}{0.6em}%
\sodef\sotextsc{\scshape}{0.075em}{0.5em}{0.6em}%
\renewcommand{\allcaps}[1]{\allcapsspacing{\MakeTextUppercase{##1}}}%
\renewcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeTextLowercase{##1}}}%
\renewcommand{\textsc}[1]{\sotextsc{##1}}%
}
\newcommand{\@tufte@letterspacing@letterspace}{%
\@tufte@debug@info@noline{Modern version of pdfTeX detected. Using `letterspace' package}%
\RequirePackage{letterspace}%
% Set up letterspacing (using microtype package) -- requires pdfTeX v1.40+
\renewcommand{\allcapsspacing}[1]{\textls[200]{##1}}%
\renewcommand{\smallcapsspacing}[1]{\textls[50]{##1}}%
\renewcommand{\allcaps}[1]{\allcapsspacing{\MakeTextUppercase{##1}}}%
\renewcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeTextLowercase{##1}}}%
\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{##1}}}%
}
\ifthenelse{\boolean{@tufte@letterspace}}{%
\ifthenelse{\boolean{@tufte@pdf}\AND\boolean{@tufte@letterspace@pkg@prereqs}\AND\NOT\boolean{@tufte@xetex}}{%
% load letterspace pkg
\IfFileExists{letterspace.sty}{%
\@tufte@letterspacing@letterspace
}{}%
}{}%
% load soul pkg
\@ifpackageloaded{letterspace}{}{%
\IfFileExists{soul.sty}{%
\@tufte@letterspacing@soul
}{%
\@tufte@warning@noline{Couldn't locate `soul' package}%
}% soul not installed... giving up.
}%
}{}
%\ifthenelse{\boolean{@tufte@letterspace}}{%
%\ifthenelse{\boolean{pdf}}{%
%\ifthenelse{\NOT\boolean{@tufte@letterspace@pkg@prereqs}}{%
%% pdfLaTeX version is too old or not using pdfLaTeX
%\ifthenelse{\boolean{@tufte@xetex}}{%
%% TODO use xetex letterspacing
%\@tufte@debug@info@noline{XeTeX detected. Reverting to `soul' package for letterspacing}%
%\@tufte@loadsoul%
%}{%
%% use `soul' package for letterspacing
%\@tufte@debug@info@noline{Old version of pdfTeX detected. Reverting to `soul' package for letterspacing}%
%\@tufte@loadsoul%
%}
%}{%
%\IfFileExists{letterspace.sty}{%
%\@tufte@debug@info@noline{Modern version of pdfTeX detected. Using `letterspace' package}
%\RequirePackage{letterspace}
%% Set up letterspacing (using microtype package) -- requires pdfTeX v1.40+
%\renewcommand{\allcapsspacing}[1]{\textls[200]{##1}}
%\renewcommand{\smallcapsspacing}[1]{\textls[50]{##1}}
%\renewcommand{\allcaps}[1]{\textls[200]{\MakeTextUppercase{##1}}}
%\renewcommand{\smallcaps}[1]{\smallcapsspacing{\MakeTextLowercase{##1}}}
%\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{##1}}}
%}{% microtype failed, check for soul
%\@tufte@debug@info@noline{Modern version of pdfTeX detected, but `letterspace' package not installed. Reverting to `soul' package for letterspacing}
%\@tufte@loadsoul
%}%
%}%
%}{%
%\@tufte@debug@info@noline{Plain LaTeX detected. Using `soul' package for letterspacing}
%\@tufte@loadsoul
%}
%}{%
%% we're not to load letterspacing, so do nothing
%}
%%
% An environment for paragraph-style section
\providecommand\newthought[1]{%
\tuftebreak
\noindent\textsc{#1}%
}
%%
% Redefine the display environments (quote, quotation, etc.)
\renewenvironment{verse}
{\let\\\@centercr
\list{}{\itemsep \z@
\itemindent -1pc%
\listparindent\itemindent
\rightmargin \leftmargin
\advance\leftmargin 1pc}%
\small%
\item\relax}
{\endlist}
\renewenvironment{quotation}
{\list{}{\listparindent 1pc%
\itemindent \listparindent
\rightmargin \leftmargin
\parsep \z@ \@plus\p@}%
\small%
\item\relax\noindent\ignorespaces}
{\endlist}
\renewenvironment{quote}
{\list{}{\rightmargin\leftmargin}%
\small%
\item\relax}
{\endlist}
%%
% Italicize description run-in headings (instead of the default bold)
\renewcommand*\descriptionlabel[1]{\hspace\labelsep\normalfont\em #1}
%%
% Used for doublespacing, and other linespacing
\RequirePackage{setspace}
%%
% Color
\RequirePackage[dvipsnames,svgnames]{xcolor}% load before bidi
%%
% Load the bidi package if instructed to do so. This package must be loaded
% prior to our redefining the \footnote and \cite commands.
\ifthenelse{\boolean{@tufte@loadbidi}}{%
\AtBeginDocument{%
\RequirePackage{bidi}
\@tufte@pkghook@post@bidi%
}%
}{}
%%
% A function that removes leading and trailling spaces from the supplied macro.
% Based on code written by Michael Downes (See ``Around the Bend'', #15.)
% Executing \@tufte@trim@spaces\xyzzy will result in the contents of \xyzzy
% being trimmed of leading and trailing white space.
\catcode`\Q=3
\def\@tufte@trim@spaces#1{%
% Use grouping to emulate a multi-token afterassignment queue
\begingroup%
% Put `\toks 0 {' into the afterassignment queue
\aftergroup\toks\aftergroup0\aftergroup{%
% Apply \trimb to the replacement text of #1, adding a leading
% \noexpand to prevent brace stripping and to serve another purpose
% later.
\expandafter\@tufte@trim@b\expandafter\noexpand#1Q Q}%
% Transfer the trimmed text back into #1.
\edef#1{\the\toks0}%
}
% \trimb removes a trailing space if present, then calls \@tufte@trim@c to
% clean up any leftover bizarre Qs, and trim a leading space. In
% order for \trimc to work properly we need to put back a Q first.
\def\@tufte@trim@b#1 Q{\@tufte@trim@c#1Q}
% Execute \vfuzz assignment to remove leading space; the \noexpand
% will now prevent unwanted expansion of a macro or other expandable
% token at the beginning of the trimmed text. The \endgroup will feed
% in the \aftergroup tokens after the \vfuzz assignment is completed.
\def\@tufte@trim@c#1Q#2{\afterassignment\endgroup \vfuzz\the\vfuzz#1}
\catcode`\Q=11
%%
% Citations should go in the margin as sidenotes
\ifthenelse{\boolean{@tufte@loadnatbib}}{%
\RequirePackage{natbib}%
\RequirePackage{bibentry}% allows bibitems to be typeset outside thebibliography environment
% Redefine the \BR@b@bibitem command to fix a bug with bibentry+chicago style
\renewcommand\BR@b@bibitem[2][]{%
\ifthenelse{\isempty{#1}}%
{\BR@bibitem{#2}}%
{\BR@bibitem[#1]{#2}}%
\BR@c@bibitem{#2}%
}%
\nobibliography*% pre-loads the bibliography keys
\providecommand{\doi}[1]{\textsc{doi:} #1}% pre-defining this so it may be used before the \bibliography command it issued
}{}
%%
% Normal \cite behavior
\newcounter{@tufte@num@bibkeys}%
\newcommand{\@tufte@normal@cite}[2][0pt]{%
% Snag the last bibentry in the list for later comparison
\let\@temp@last@bibkey\@empty%
\@for\@temp@bibkey:=#2\do{\let\@temp@last@bibkey\@temp@bibkey}%
\sidenote[][#1]{%
% Loop through all the bibentries, separating them with semicolons and spaces
\normalsize\normalfont\@tufte@citation@font%
\setcounter{@tufte@num@bibkeys}{0}%
\@for\@temp@bibkeyx:=#2\do{%
\ifthenelse{\equal{\@temp@last@bibkey}{\@temp@bibkeyx}}%
{\ifthenelse{\equal{\value{@tufte@num@bibkeys}}{0}}{}{and\ }%
\@tufte@trim@spaces\@temp@bibkeyx% trim spaces around bibkey
\bibentry{\@temp@bibkeyx}}%
{\@tufte@trim@spaces\@temp@bibkeyx% trim spaces around bibkey
\bibentry{\@temp@bibkeyx};\ }%
\stepcounter{@tufte@num@bibkeys}%
}%
}%
}
%%
% Macros for holding the list of cite keys until after the \sidenote
\gdef\@tufte@citations{}% list of cite keys
\newcommand\@tufte@add@citation[1]{\relax% adds a new bibkey to the list of cite keys
\ifx\@tufte@citations\@empty\else
\g@addto@macro\@tufte@citations{,}% separate by commas
\fi
\g@addto@macro\@tufte@citations{#1}
}
\newcommand{\@tufte@print@citations}[1][0pt]{% puts the citations in a margin note
% Snag the last bibentry in the list for later comparison
\let\@temp@last@bibkey\@empty%
\@for\@temp@bibkey:=\@tufte@citations\do{\let\@temp@last@bibkey\@temp@bibkey}%
\marginpar{%
\hbox{}\vspace*{#1}%
\@tufte@citation@font%
\@tufte@citation@justification%
\@tufte@margin@par% use parindent and parskip settings for marginal text
\vspace*{-1\baselineskip}%
% Loop through all the bibentries, separating them with semicolons and spaces
\setcounter{@tufte@num@bibkeys}{0}%
\@for\@temp@bibkeyx:=\@tufte@citations\do{%
\ifthenelse{\equal{\@temp@last@bibkey}{\@temp@bibkeyx}}%
{\ifthenelse{\equal{\value{@tufte@num@bibkeys}}{0}}{}{and\ }%
\@tufte@trim@spaces\@temp@bibkeyx% trim spaces around bibkey
\bibentry{\@temp@bibkeyx}}%
{\@tufte@trim@spaces\@temp@bibkeyx% trim spaces around bibkey
\bibentry{\@temp@bibkeyx};\ }%
\stepcounter{@tufte@num@bibkeys}%
}%
}%
}
%%
% \cite behavior when executed within a sidenote
\newcommand{\@tufte@sidenote@citations}{}% contains list of \cites in sidenote
\newcommand{\@tufte@infootnote@cite}[1]{%
\@tufte@add@citation{#1}
}
%%
% Set the default \cite style. This is set and reset by the \sidenote command.
\ifthenelse{\boolean{@tufte@loadnatbib}}{%
\let\cite\@tufte@normal@cite
}{}
%%
% Transform existing \footnotes into \sidenotes
% Sidenote: ``Where God meant footnotes to go.'' ---Tufte
\RequirePackage{optparams}% for our new sidenote commands -- provides multiple optional arguments for commands
\providecommand{\footnotelayout}{\@tufte@sidenote@font\@tufte@sidenote@justification}
\renewcommand{\footnotelayout}{\@tufte@sidenote@font\@tufte@sidenote@justification}
% Override footmisc's definition to set the sidenote marks (numbers) inside the
% sidenote's text block.
\long\def\@makefntext#1{\@textsuperscript{\@tufte@sidenote@font\tiny\@thefnmark}\,\footnotelayout#1}
% Set the in-text footnote mark in the same typeface as the body text itself.
\def\@makefnmark{\hbox{\@textsuperscript{\normalfont\footnotesize\@thefnmark}}}
\providecommand*{\multiplefootnotemarker}{3sp}
\providecommand*{\multfootsep}{,}
\renewcommand{\@footnotemark}{%
\leavevmode%
\ifhmode%
\edef\@x@sf{\the\spacefactor}%
\@tufte@check@multiple@sidenotes%
\nobreak%
\fi%
\@makefnmark%
\ifhmode\spacefactor\@x@sf\fi%
\relax%
}
\newcommand{\@tufte@check@multiple@sidenotes}{%
\ifdim\lastkern=\multiplefootnotemarker\relax%
\edef\@x@sf{\the\spacefactor}%
\unkern%
\textsuperscript{\multfootsep}%
\spacefactor\@x@sf\relax%
\fi
}
\renewcommand\@footnotetext[2][0pt]{%
\marginpar{%
\hbox{}\vspace*{#1}%
\def\baselinestretch {\setspace@singlespace}%
\reset@font\footnotesize%
\@tufte@margin@par% use parindent and parskip settings for marginal text
\vspace*{-1\baselineskip}\noindent%
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark%
}%
\color@begingroup%
\@makefntext{%
\ignorespaces#2%
}%
\color@endgroup%
}%
}%
% Ensure this is run after the bidi package has been loaded
\def\@tufte@pkghook@post@bidi{}%
\g@addto@macro{\@tufte@pkghook@post@bidi}{%
\renewcommand\@footnotetext[2][0pt]{%
\marginpar{%
\hbox{}\vspace*{#1}%
\def\baselinestretch {\setspace@singlespace}%
\if@rl@footnote\@rltrue\else\@rlfalse\fi%
\reset@font\footnotesize%
\@tufte@margin@par% use parindent and parskip settings for marginal text
\vspace*{-1\baselineskip}\noindent%
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark%
}%
\color@begingroup%
\@makefntext{%
\ignorespaces#2%
}%
\color@endgroup%
}%
}%
}%
%
% Define \sidenote command. Can handle \cite.
\newlength{\@tufte@sidenote@vertical@offset}
\setlength{\@tufte@sidenote@vertical@offset}{0pt}
% #1 = footnote num, #2 = vertical offset, #3 = footnote text
\long\def\@tufte@sidenote[#1][#2]#3{%
\ifthenelse{\boolean{@tufte@loadnatbib}}{%
\let\cite\@tufte@infootnote@cite% use the in-sidenote \cite command
}{}%
\gdef\@tufte@citations{}% clear out any old citations
\ifthenelse{\NOT\isempty{#2}}{%
\gsetlength{\@tufte@sidenote@vertical@offset}{#2}%
}{%
\gsetlength{\@tufte@sidenote@vertical@offset}{0pt}%
}%
\ifthenelse{\isempty{#1}}{%
% no specific footnote number provided
\stepcounter\@mpfn%
\protected@xdef\@thefnmark{\thempfn}%
\@footnotemark\@footnotetext[\@tufte@sidenote@vertical@offset]{#3}%
}{%
% specific footnote number provided
\begingroup%
\csname c@\@mpfn\endcsname #1\relax%
\unrestored@protected@xdef\@thefnmark{\thempfn}%
\endgroup%
\@footnotemark\@footnotetext[\@tufte@sidenote@vertical@offset]{#3}%
}%
\@tufte@print@citations% print any citations
\ifthenelse{\boolean{@tufte@loadnatbib}}{%
\let\cite\@tufte@normal@cite% go back to using normal in-text \cite command
}{}%
\unskip\ignorespaces% remove extra white space
\kern-\multiplefootnotemarker% remove \kern left behind by sidenote
\kern\multiplefootnotemarker\relax% add new \kern here to replace the one we yanked
}
\newcommand{\sidenote}{\optparams{\@tufte@sidenote}{[][0pt]}}
\renewcommand{\footnote}{\optparams{\@tufte@sidenote}{[][0pt]}}
%%
% Sidenote without the footnote mark
\newcommand\marginnote[2][0pt]{%
\ifthenelse{\boolean{@tufte@loadnatbib}}{%
\let\cite\@tufte@infootnote@cite% use the in-sidenote \cite command
}{}%
\gdef\@tufte@citations{}% clear out any old citations
\marginpar{\hbox{}\vspace*{#1}\@tufte@marginnote@font\@tufte@marginnote@justification\@tufte@margin@par\vspace*{-1\baselineskip}\noindent #2}%
\@tufte@print@citations% print any citations
\ifthenelse{\boolean{@tufte@loadnatbib}}{%
\let\cite\@tufte@normal@cite% go back to using normal in-text \cite command
}{}%
}
%%
% The placeins package provides the \FloatBarrier command. This forces
% LaTeX to place all of the floats before proceeding. We'll use this to
% keep the float (figure and table) numbers in sequence.
\RequirePackage{placeins}
%%
% Margin float environment
\newsavebox{\@tufte@margin@floatbox}
\newenvironment{@tufte@margin@float}[2][-1.2ex]%
{\FloatBarrier% process all floats before this point so the figure/table numbers stay in order.
\begin{lrbox}{\@tufte@margin@floatbox}%
\begin{minipage}{\marginparwidth}%
\@tufte@caption@font%
\def\@captype{#2}%
\hbox{}\vspace*{#1}%
\@tufte@caption@justification%
\@tufte@margin@par%
\noindent%
}
{\end{minipage}%
\end{lrbox}%
\marginpar{\usebox{\@tufte@margin@floatbox}}%
}
%%
% Margin figure environment
\newenvironment{marginfigure}[1][-1.2ex]%
{\begin{@tufte@margin@float}[#1]{figure}}
{\end{@tufte@margin@float}}
%%
% Margin table environment
\newenvironment{margintable}[1][-1.2ex]%
{\begin{@tufte@margin@float}[#1]{table}}
{\end{@tufte@margin@float}}
%%
% Auto-detects the proper text alignment based on the various class options
\newcommand*{\@tufte@justification@autodetect}{%
\ifthenelse{\boolean{@tufte@justified}}%
{\justifying}%
{\RaggedRight}%
}
%%
% Forces the outer edge of the caption to be set ragged.
% Therefore, on verso pages it's ragged left, and on recto pages it's ragged right.
\newcommand*{\@tufte@justification@caption@outer}{%
\ifthenelse{\boolean{@tufte@float@recto}}%
{\RaggedRight}%
{\RaggedLeft}%
}
\newcommand*{\@tufte@justification@outer}{%
\@tufte@checkoddpage%
\ifthenelse{\boolean{@tufte@odd@page}}%
{\RaggedRight}%
{\RaggedLeft}%
}
%%
% A collection of macros to be used with the new Tufte-style float environments.
% \setfloatalignment forces the caption placement to be treated as top, bottom, etc.
% \forcerectofloat forces the float to be treated as if it were appearing on a recto page.
% \forceversofloat does the same, but for verso pages.
\newcommand{\@tufte@float@debug@info}{}% contains debug info generated as the float is processed
\newcommand{\@tufte@float@debug}[1]{% adds debug info to the queue for output
\ifthenelse{\equal{\@tufte@float@debug@info}{}}%
{\def\@tufte@float@debug@info{#1}}%
{\g@addto@macro\@tufte@float@debug@info{\MessageBreak#1}}%
}
\newcommand{\floatalignment}{x}% holds the current float alignment (t, b, h, p)
\newcommand{\setfloatalignment}[1]{\global\def\floatalignment{#1}\@tufte@float@debug{Forcing position: [#1]}}% manually sets the float alignment
\newboolean{@tufte@float@recto}
\newcommand{\forcerectofloat}{\gsetboolean{@tufte@float@recto}{true}\@tufte@float@debug{Forcing page: [recto]}}
\newcommand{\forceversofloat}{\gsetboolean{@tufte@float@recto}{false}\@tufte@float@debug{Forcing page: [verso]}}
% Boxes to temporarily store our float and caption
\newsavebox{\@tufte@figure@box}
\newsavebox{\@tufte@caption@box}
% Save original LaTeX float environment
\let\@tufte@orig@float\@float
\let\@tufte@orig@endfloat\end@float
% New length for tweaking float captions
\newlength{\@tufte@caption@vertical@offset}
\setlength{\@tufte@caption@vertical@offset}{0pt}
% Store the caption and label contents
\newcommand{\@tufte@stored@shortcaption}{}
\newcommand{\@tufte@stored@caption}{}
\newcommand{\@tufte@stored@label}{}
\long\def\@tufte@caption[#1][#2]#3{%
\ifthenelse{\isempty{#1}}%
{\gdef\@tufte@stored@shortcaption{#3}}%
{\gdef\@tufte@stored@shortcaption{#1}}%
\gsetlength{\@tufte@caption@vertical@offset}{-#2}% we want a positive offset to lower captions
\gdef\@tufte@stored@caption{#3}%
}
\newcommand{\@tufte@label}[1]{%
\gdef\@tufte@stored@label{#1}%
}
\newcommand{\@tufte@fps}{}
\newboolean{@tufte@float@star}
\newlength{\@tufte@float@contents@width}
%%
% Define a float environment to place the captions in the margin space
\newenvironment{@tufte@float}[3][htbp]%
{% begin @tufte@float
% Should this float be full-width or just text-width?
\ifthenelse{\equal{#3}{star}}%
{\gsetboolean{@tufte@float@star}{true}}%
{\gsetboolean{@tufte@float@star}{false}}%
% Check page side (recto/verso) and store detected value -- can be overriden in environment contents
\@tufte@checkoddpage%
\ifthenelse{\boolean{@tufte@odd@page}}%
{\gsetboolean{@tufte@float@recto}{true}\@tufte@float@debug{Detected page: [recto/odd]}}%
{\gsetboolean{@tufte@float@recto}{false}\@tufte@float@debug{Detected page: [verso/even]}}%
% If the float placement specifier is 'b' and only 'b', then bottom-align the mini-pages, otherwise top-align them.
\renewcommand{\@tufte@fps}{#1}%
\@tufte@float@debug{Allowed positions: [#1]}%
\ifthenelse{\equal{#1}{b}\OR\equal{#1}{B}}%
{\renewcommand{\floatalignment}{b}\@tufte@float@debug{Presumed position: [bottom]}}%
{\renewcommand{\floatalignment}{t}\@tufte@float@debug{Presumed position: [top]}}%
% Capture the contents of the \caption and \label commands to use later
\global\let\@tufte@orig@caption\caption%
\global\let\@tufte@orig@label\label%
\renewcommand{\caption}{\optparams{\@tufte@caption}{[][0pt]}}%
\renewcommand{\label}[1]{\@tufte@label{##1}}%
% Handle subfigure package compatibility
\ifthenelse{\boolean{@tufte@packages@subfigure}}{%
% don't move the label while inside a \subfigure or \subtable command
\global\let\label\@tufte@orig@label%
}{}% subfigure package is not loaded
\@tufte@orig@float{#2}[#1]%
\ifthenelse{\boolean{@tufte@float@star}}%
{\setlength{\@tufte@float@contents@width}{\@tufte@fullwidth}}%
{\setlength{\@tufte@float@contents@width}{\textwidth}}%
\begin{lrbox}{\@tufte@figure@box}%
\begin{minipage}[\floatalignment]{\@tufte@float@contents@width}\hbox{}%
}{% end @tufte@float
\par\hbox{}\vspace{-\baselineskip}\ifthenelse{\prevdepth>0}{\vspace{-\prevdepth}}{}% align baselines of boxes
\end{minipage}%
\end{lrbox}%
% build the caption box
\begin{lrbox}{\@tufte@caption@box}%
\begin{minipage}[\floatalignment]{\marginparwidth}\hbox{}%
\ifthenelse{\NOT\equal{\@tufte@stored@caption}{}}{\@tufte@orig@caption[\@tufte@stored@shortcaption]{\@tufte@stored@caption}}{}%
\ifthenelse{\NOT\equal{\@tufte@stored@label}{}}{\@tufte@orig@label{\@tufte@stored@label}}{}%
\par\vspace{-\prevdepth}%% TODO: DOUBLE-CHECK FOR SAFETY
\end{minipage}%
\end{lrbox}%
% now typeset the stored boxes
\begin{fullwidth}%
\begin{minipage}[\floatalignment]{\linewidth}%
\ifthenelse{\boolean{@tufte@float@star}}%
{\@tufte@float@fullwidth[\@tufte@caption@vertical@offset]{\@tufte@figure@box}{\@tufte@caption@box}}%
{\@tufte@float@textwidth[\@tufte@caption@vertical@offset]{\@tufte@figure@box}{\@tufte@caption@box}}%
\end{minipage}%
\end{fullwidth}%
\@tufte@orig@endfloat% end original LaTeX float environment
% output debug info
\ifthenelse{\boolean{@tufte@debug}}{%
\typeout{^^J^^J----------- Tufte-LaTeX float information ----------}%
\ifthenelse{\equal{\@tufte@stored@label}{}}%
{\typeout{Warning: Float unlabeled!}}%
{\typeout{Float label: [\@tufte@stored@label]}}%
\typeout{Page number: [\thepage]}%
\def\MessageBreak{^^J}%
\typeout{\@tufte@float@debug@info}%
\ifthenelse{\boolean{@tufte@symmetric}}%
{\typeout{Symmetric: [true]}}%
{\typeout{Symmetric: [false]}}%
\typeout{----------------------------------------------------^^J^^J}%
}{}%
% reset commands and temp boxes and captions
\gdef\@tufte@float@debug@info{}%
\let\caption\@tufte@orig@caption%
\let\label\@tufte@orig@label%
\begin{lrbox}{\@tufte@figure@box}\hbox{}\end{lrbox}%
\begin{lrbox}{\@tufte@caption@box}\hbox{}\end{lrbox}%
\gdef\@tufte@stored@shortcaption{}%
\gdef\@tufte@stored@caption{}%
\gdef\@tufte@stored@label{}%
\gsetlength{\@tufte@caption@vertical@offset}{0pt}% reset caption offset
}
\newcommand{\@tufte@float@textwidth}[3][0pt]{%
\ifthenelse{\NOT\boolean{@tufte@symmetric}\OR\boolean{@tufte@float@recto}}{%
% asymmetric or page is odd, so caption is on the right
\hbox{%
\usebox{#2}%
\hspace{\marginparsep}%
\smash{\raisebox{#1}{\usebox{#3}}}%
}%
\@tufte@float@debug{Caption position: [right]}%
}{% symmetric pages and page is even, so caption is on the left
\hbox{%
\smash{\raisebox{#1}{\usebox{#3}}}%
\hspace{\marginparsep}%
\usebox{#2}%
}%
\@tufte@float@debug{Caption position: [left]}%
}%
}
\newcommand{\@tufte@float@fullwidth}[3][0pt]{%
\ifthenelse{\equal{\floatalignment}{b}}%
{% place caption above figure
\ifthenelse{\NOT\boolean{@tufte@symmetric}\OR\boolean{@tufte@float@recto}}%
{\hfill\smash{\raisebox{#1}{\usebox{#3}}}\par\usebox{#2}\@tufte@float@debug{Caption position: [above right]}}% caption on the right
{\smash{\raisebox{#1}{\usebox{#3}}}\hfill\par\usebox{#2}\@tufte@float@debug{Caption position: [above left]}}% caption on the left
}{% place caption below figure
\ifthenelse{\NOT\boolean{@tufte@symmetric}\OR\boolean{@tufte@float@recto}}%
{\usebox{#2}\par\hfill\smash{\raisebox{#1}{\usebox{#3}}}\@tufte@float@debug{Caption position: [below right]}}% caption on the right
{\usebox{#2}\par\smash{\raisebox{#1}{\usebox{#3}}}\hfill\@tufte@float@debug{Caption position: [below left]}}% caption on the left
}%
}
%%
% Redefine the figure environment to place the captions in the margin space
\renewenvironment{figure}[1][htbp]%
{\ifvmode\else\unskip\fi\begin{@tufte@float}[#1]{figure}{}}
{\end{@tufte@float}}
%%
% Redefine the table environment to place the captions in the margin space
\renewenvironment{table}[1][htbp]
{\ifvmode\else\unskip\fi\begin{@tufte@float}[#1]{table}{}}
{\end{@tufte@float}}
%%
% Full-width figure
\renewenvironment{figure*}[1][htbp]%
{\ifvmode\else\unskip\fi\begin{@tufte@float}[#1]{figure}{star}}
{\end{@tufte@float}}
%%
% Full-width table
\renewenvironment{table*}[1][htbp]%
{\ifvmode\else\unskip\fi\begin{@tufte@float}[#1]{table}{star}}
{\end{@tufte@float}}
%%
% Full-page-width area
\newenvironment{fullwidth}
{\ifthenelse{\boolean{@tufte@symmetric}}%
{\ifthenelse{\boolean{@tufte@changepage}}{\begin{adjustwidth*}{}{-\@tufte@overhang}}{\begin{adjustwidth}[]{}{-\@tufte@overhang}}}%
{\begin{adjustwidth}{}{-\@tufte@overhang}}%
}%
{\ifthenelse{\boolean{@tufte@symmetric}}%
{\ifthenelse{\boolean{@tufte@changepage}}{\end{adjustwidth*}}{\end{adjustwidth}}}%
{\end{adjustwidth}}%
}
%%
% Format the captions in a style similar to the sidenotes
\long\def\@caption#1[#2]#3{%
\par%
\addcontentsline{\csname ext@#1\endcsname}{#1}%
{\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
\begingroup%
\@parboxrestore%
\if@minipage%
\@setminipage%
\fi%
\@tufte@caption@font\@tufte@caption@justification%
\noindent\csname fnum@#1\endcsname: \ignorespaces#3\par%
%\@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
\endgroup}
%%
% If we're NOT using XeLaTeX and the `nofonts' class option was NOT provided,
% we should load the Palatino, Helvetica, and Bera Mono fonts (if they are
% installed.)
\ifthenelse{\boolean{@tufte@loadfonts}\AND\NOT\boolean{@tufte@xetex}\AND\NOT\boolean{@tufte@luatex}}{%
\IfFileExists{mathpazo.sty}{\RequirePackage[osf,sc]{mathpazo}}{}
\IfFileExists{helvet.sty}{\RequirePackage[scaled=0.90]{helvet}}{}
\IfFileExists{beramono.sty}{\RequirePackage[scaled=0.85]{beramono}}{}
\RequirePackage[T1]{fontenc}
\RequirePackage{textcomp}
}{}
%%
% Turns newlines into spaces. Based on code from the `titlesec' package.
\DeclareRobustCommand{\@tufte@newlinetospace}{%
\@ifstar{\@tufte@newlinetospace@i}{\@tufte@newlinetospace@i}%
}
\def\@tufte@newlinetospace@i{%
\ifdim\lastskip>\z@\else\space\fi
\ignorespaces%
}
\DeclareRobustCommand{\newlinetospace}[1]{%
\let\@tufte@orig@cr\\% save the original meaning of \\
\def\\{\@tufte@newlinetospace}% turn \\ and \\* into \space
\let\newline\\% turn \newline into \space
#1%
\let\\\@tufte@orig@cr% revert to original meaning of \\
}
%%
% Sets up the running heads and folios.
\RequirePackage{fancyhdr}
% Set the default page style to 'fancy'
\pagestyle{fancy}
% Set the header/footer width to be the body text block plus the margin
% note area.
\AtBeginDocument{%
\ifthenelse{\boolean{@tufte@symmetric}}
{\fancyhfoffset[LE,RO]{\@tufte@overhang}}
{\fancyhfoffset[RE,RO]{\@tufte@overhang}}
}
% The running heads/feet don't have rules
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
% The 'fancy' page style is the default style for all pages.
\fancyhf{} % clear header and footer fields
\ifthenelse{\boolean{@tufte@twoside}}
{\fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\plainauthor}}}%
\fancyhead[RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}}
{\fancyhead[RE,RO]{\smallcaps{\newlinetospace{\plaintitle}}\quad\thepage}}
% The `plain' page style is used on chapter opening pages.
% In Tufte's /Beautiful Evidence/ he never puts page numbers at the
% bottom of pages -- the folios are unexpressed.
\fancypagestyle{plain}{
\fancyhf{} % clear header and footer fields
% Uncomment the following five lines of code if you want the opening page
% of the chapter to express the folio in the lower outside corner.
%\ifthenelse{\boolean{@tufte@twoside}}
% {\fancyfoot[LE,RO]{\thepage}}
% {\fancyfoot[RE,RO]{\thepage}}
}
% The `empty' page style suppresses all headers and footers.
% It's used on title pages and `intentionally blank' pages.
\fancypagestyle{empty}{
\fancyhf{} % clear header and footer fields
}
%%
% Set raggedright and paragraph indentation for document
\AtBeginDocument{\@tufte@justification}
%%
% Prints the list of class options and their states.
\newcommand{\typeoutbool}[2]{%
\ifthenelse{\boolean{#2}}
{\typeout{\space\space#1: true}}
{\typeout{\space\space#1: false}}
}
\newcommand{\typeoutstr}[2]{%
\typeout{\space\space#1: #2}
}
\newcommand{\PrintTufteSettings}{%
\typeout{-------------------- Tufte-LaTeX settings ----------}
\typeout{Class: \@tufte@pkgname}
\typeout{}
\typeout{Class options:}
\typeoutbool{a4paper}{@tufte@afourpaper}
\typeoutbool{b5paper}{@tufte@bfivepaper}
\typeoutbool{load fonts}{@tufte@loadfonts}
\typeoutbool{fully-justified}{@tufte@justified}
\typeoutbool{letterspacing}{@tufte@letterspace}
\typeoutbool{sans-serif sidenotes}{@tufte@sfsidenotes}
\typeoutbool{symmetric margins}{@tufte@symmetric}
\typeoutbool{titlepage}{@tufte@titlepage}
\typeoutbool{twoside}{@tufte@twoside}
\typeoutbool{debug}{@tufte@debug}
\typeout{}
\typeout{Internal variables:}
\typeoutbool{[twoside]}{@twoside}
\typeoutbool{pdflatex}{@tufte@pdf}
\typeoutbool{xelatex}{@tufte@xetex}
\typeout{----------------------------------------------------}
}
%%
% Amount of space to skip before \newthought or after title block
\newskip\tufteskipamount
\tufteskipamount=1.0\baselineskip plus 0.5ex minus 0.2ex
\newcommand{\tuftebreak}{\par\ifdim\lastskip<\tufteskipamount
\removelastskip\penalty-100\tufteskip\fi}
\newcommand{\tufteskip}{\vspace\tufteskipamount}
%%
% Produces a full title page
\newcommand{\maketitlepage}[0]{%
\cleardoublepage%
{%
\sffamily%
\begin{fullwidth}%
\fontsize{18}{20}\selectfont\par\noindent\textcolor{darkgray}{\allcaps{\thanklessauthor}}%
\vspace{11.5pc}%
\fontsize{36}{40}\selectfont\par\noindent\textcolor{darkgray}{\allcaps{\thanklesstitle}}%
\vfill%
\fontsize{14}{16}\selectfont\par\noindent\allcaps{\thanklesspublisher}%
\end{fullwidth}%
}
\thispagestyle{empty}%
\clearpage%
}
%%
% Title block
\renewcommand{\maketitle}{%
\newpage
\global\@topnum\z@% prevent floats from being placed at the top of the page
\begingroup
\setlength{\parindent}{0pt}%
\setlength{\parskip}{4pt}%
\let\@@title\@empty
\let\@@author\@empty
\let\@@date\@empty
\ifthenelse{\boolean{@tufte@sfsidenotes}}{%
\gdef\@@title{\sffamily\LARGE\allcaps{\@title}\par}%
\gdef\@@author{\sffamily\Large\allcaps{\@author}\par}%
\gdef\@@date{\sffamily\Large\allcaps{\@date}\par}%
}{%
\gdef\@@title{\LARGE\itshape\@title\par}%
\gdef\@@author{\Large\itshape\@author\par}%
\gdef\@@date{\Large\itshape\@date\par}%
}%
\@@title
\@@author
\@@date
\endgroup
\thispagestyle{plain}% suppress the running head
\tuftebreak% add some space before the text begins
\@afterindentfalse\@afterheading% suppress indentation of the next paragraph
}
%%
% Title page (if the `titlepage' option was passed to the tufte-handout
% class.)
\ifthenelse{\boolean{@tufte@titlepage}}
{\renewcommand{\maketitle}{\maketitlepage}}
{}
%%
% When \cleardoublepage is called, produce a blank (empty) page -- i.e.,
% without headers and footers
\def\cleardoublepage{\clearpage\if@twoside\ifodd\c@page\else
\hbox{}
%\vspace*{\fill}
%\begin{center}
% This page intentionally contains only this sentence.
%\end{center}
%\vspace{\fill}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
%%
% Make Tuftian-style section headings and TOC formatting
\titleformat{\chapter}%
[display]% shape
{\relax\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\begin{fullwidth}}{}}% format applied to label+text
{\itshape\huge\thechapter}% label
{0pt}% horizontal separation between label and title body
{\huge\rmfamily\itshape}% before the title body
[\ifthenelse{\NOT\boolean{@tufte@symmetric}}{\end{fullwidth}}{}]% after the title body
\titleformat{\section}%
[hang]% shape
{\normalfont\Large\itshape}% format applied to label+text
{\thesection}% label
{1em}% horizontal separation between label and title body
{}% before the title body
[]% after the title body
\titleformat{\subsection}%
[hang]% shape
{\normalfont\large\itshape}% format applied to label+text
{\thesubsection}% label
{1em}% horizontal separation between label and title body
{}% before the title body
[]% after the title body
\titleformat{\paragraph}%
[runin]% shape
{\normalfont\itshape}% format applied to label+text
{\theparagraph}% label
{1em}% horizontal separation between label and title body
{}% before the title body
[]% after the title body
\titlespacing*{\chapter}{0pt}{50pt}{40pt}
\titlespacing*{\section}{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\titlespacing*{\subsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus.2ex}
% Subsubsection and following section headings shouldn't be used.
% See Bringhurst's _The Elements of Typography_, section 4.2.2.
\renewcommand\subsubsection{%
\@tufte@error{\string\subsubsection is undefined by this class.
See Robert Bringhurst's _The Elements of
Typographic Style_, section 4.2.2.
\string\subsubsection was used}
{From Bringhurst's _The Elements of Typographic Style_, section 4.2.2: Use as
many levels of headings as you need, no more and no fewer. Also see the many
related threads on Ask E.T. at http://www.edwardtufte.com/.}
}
\renewcommand\subparagraph{%
\@tufte@error{\string\subparagraph is undefined by this class.%
See Robert Bringhurst's _The Elements of
Typographic Style_, section 4.2.2.
\string\subparagraph was used}
{From Bringhurst's _The Elements of Typographic Style_, section 4.2.2: Use as
many levels of headings as you need, no more and no fewer. Also see the many
related threads on Ask E.T. at http://www.edwardtufte.com/.}
}
% Formatting for main TOC (printed in front matter)
% {section} [left] {above} {before w/label} {before w/o label} {filler + page} [after]
\ifthenelse{\boolean{@tufte@toc}}{%
\titlecontents{part}% FIXME
[0em] % distance from left margin
{\vspace{1.5\baselineskip}\begin{fullwidth}\LARGE\rmfamily\itshape} % above (global formatting of entry)
{\contentslabel{2em}} % before w/label (label = ``II'')
{} % before w/o label
{\rmfamily\upshape\qquad\thecontentspage} % filler + page (leaders and page num)
[\end{fullwidth}] % after
\titlecontents{chapter}%
[0em] % distance from left margin
{\vspace{1.5\baselineskip}\begin{fullwidth}\LARGE\rmfamily\itshape} % above (global formatting of entry)
{\hspace*{0em}\contentslabel{2em}} % before w/label (label = ``2'')
{\hspace*{0em}} % before w/o label
{\rmfamily\upshape\qquad\thecontentspage} % filler + page (leaders and page num)
[\end{fullwidth}] % after
\titlecontents{section}% FIXME
[0em] % distance from left margin
{\vspace{0\baselineskip}\begin{fullwidth}\Large\rmfamily\itshape} % above (global formatting of entry)
{\hspace*{2em}\contentslabel{2em}} % before w/label (label = ``2.6'')
{\hspace*{2em}} % before w/o label
{\rmfamily\upshape\qquad\thecontentspage} % filler + page (leaders and page num)
[\end{fullwidth}] % after
\titlecontents{subsection}% FIXME
[0em] % distance from left margin
{\vspace{0\baselineskip}\begin{fullwidth}\large\rmfamily\itshape} % above (global formatting of entry)
{\hspace*{4em}\contentslabel{4em}} % before w/label (label = ``2.6.1'')
{\hspace*{4em}} % before w/o label
{\rmfamily\upshape\qquad\thecontentspage} % filler + page (leaders and page num)
[\end{fullwidth}] % after
\titlecontents{paragraph}% FIXME
[0em] % distance from left margin
{\vspace{0\baselineskip}\begin{fullwidth}\normalsize\rmfamily\itshape} % above (global formatting of entry)
{\hspace*{6em}\contentslabel{2em}} % before w/label (label = ``2.6.0.0.1'')
{\hspace*{6em}} % before w/o label
{\rmfamily\upshape\qquad\thecontentspage} % filler + page (leaders and page num)
[\end{fullwidth}] % after
}{}
%%
% Format lists of figures/tables
\renewcommand\listoffigures{%
\ifthenelse{\equal{\@tufte@class}{book}}%
{\chapter*{\listfigurename}}%
{\section*{\listfigurename}}%
% \begin{fullwidth}%
\@starttoc{lof}%
% \end{fullwidth}%
}
\renewcommand\listoftables{%
\ifthenelse{\equal{\@tufte@class}{book}}%
{\chapter*{\listtablename}}%
{\section*{\listtablename}}%
% \begin{fullwidth}%
\@starttoc{lot}%
% \end{fullwidth}%
}
\newcommand{\@tufte@lof@line}[2]{%
% #1 is the figure/table number and its caption text
% #2 is the page number on which the figure/table appears
\leftskip 0.0em
\rightskip 0em
\parfillskip 0em plus 1fil
\parindent 0.0em
\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\@tempdima 2.0em
\advance\leftskip\@tempdima
\null\nobreak\hskip -\leftskip
{#1}\nobreak\qquad\nobreak#2%
\par%
}
\renewcommand*\l@figure{\@tufte@lof@line}
\let\l@table\l@figure
%%
% A handy command to disable hyphenation for short bits of text.
% Borrowed from Peter Wilson's `hyphenat' package.
\AtBeginDocument{%
\@ifpackageloaded{hyphenat}{}{%
\newlanguage\langwohyphens% define a language without hyphenation rules
\providecommand{\nohyphens}[1]{{\language\langwohyphens #1}}% used for short bits of text
\providecommand{\nohyphenation}{\language\langwohyphens}% can be used inside environments for longer text
}%
}
%%
% Redefine \bibsection to not mark the running heads.
% (Code modified from natbib.sty.)
\ifthenelse{\boolean{@tufte@loadnatbib}}{%
\@ifundefined{chapter}{%
\renewcommand\bibsection{\section*{\refname}}%
}{%
\@ifundefined{NAT@sectionbib}{%
\renewcommand\bibsection{\chapter{\bibname}}%
}{%
\renewcommand\bibsection{\section*{\bibname}}%
}%
}%
}
%%
% An index environment to mimic Tufte's indexes
\RequirePackage{multicol}
\renewenvironment{theindex}{%
\ifthenelse{\equal{\@tufte@class}{book}}%
{\chapter{\indexname}}%
{\section*{\indexname}}%
\begin{fullwidth}%
\small%
\parskip0pt%
\parindent0pt%
\let\item\@idxitem%
\begin{multicols}{3}%
}{%
\end{multicols}%
\end{fullwidth}%
}
\renewcommand\@idxitem{\par\hangindent 2em}
\renewcommand\subitem{\par\hangindent 3em\hspace*{1em}}
\renewcommand\subsubitem{\par\hangindent 4em\hspace*{2em}}
\renewcommand\indexspace{\par\addvspace{1.0\baselineskip plus 0.5ex minus 0.2ex}\relax}%
\newcommand{\lettergroup}[1]{}% swallow the letter heading in the index
%%
% A couple commands to incresae the number of floats you can use at a time.
\def\morefloats{% provides a total of 52 floats
\ifthenelse{\isundefined{\bx@S}}{%
\@tufte@debug@info@noline{Adding 34 more float slots.}
\newinsert\bx@S
\newinsert\bx@T
\newinsert\bx@U
\newinsert\bx@V
\newinsert\bx@W
\newinsert\bx@X
\newinsert\bx@Y
\newinsert\bx@Z
\newinsert\bx@a
\newinsert\bx@b
\newinsert\bx@c
\newinsert\bx@d
\newinsert\bx@e
\newinsert\bx@f
\newinsert\bx@g
\newinsert\bx@h
\newinsert\bx@i
\newinsert\bx@j
\newinsert\bx@k
\newinsert\bx@l
\newinsert\bx@m
\newinsert\bx@n
\newinsert\bx@o
\newinsert\bx@p
\newinsert\bx@q
\newinsert\bx@r
\newinsert\bx@s
\newinsert\bx@t
\newinsert\bx@u
\newinsert\bx@v
\newinsert\bx@w
\newinsert\bx@x
\newinsert\bx@y
\newinsert\bx@z
\gdef\@freelist{\@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E
\@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt\bx@I\@elt\bx@J
\@elt\bx@K\@elt\bx@L\@elt\bx@M\@elt\bx@N
\@elt\bx@O\@elt\bx@P\@elt\bx@Q\@elt\bx@R
\@elt\bx@S\@elt\bx@T\@elt\bx@U\@elt\bx@V
\@elt\bx@W\@elt\bx@X\@elt\bx@Y\@elt\bx@Z
\@elt\bx@a\@elt\bx@b\@elt\bx@c\@elt\bx@d\@elt\bx@e
\@elt\bx@f\@elt\bx@g\@elt\bx@h\@elt\bx@i\@elt\bx@j
\@elt\bx@k\@elt\bx@l\@elt\bx@m\@elt\bx@n
\@elt\bx@o\@elt\bx@p\@elt\bx@q\@elt\bx@r
\@elt\bx@s\@elt\bx@t\@elt\bx@u\@elt\bx@v
\@elt\bx@w\@elt\bx@x\@elt\bx@y\@elt\bx@z}%
}{% we've already added another 34 floats, so we'll add 26 more, but that's it!
\ifthenelse{\isundefined{\bx@AA}}{%
\@tufte@debug@info@noline{Adding 26 more float slots.}
\newinsert\bx@AA
\newinsert\bx@BB
\newinsert\bx@CC
\newinsert\bx@DD
\newinsert\bx@EE
\newinsert\bx@FF
\newinsert\bx@GG
\newinsert\bx@HH
\newinsert\bx@II
\newinsert\bx@JJ
\newinsert\bx@KK
\newinsert\bx@LL
\newinsert\bx@MM
\newinsert\bx@NN
\newinsert\bx@OO
\newinsert\bx@PP
\newinsert\bx@QQ
\newinsert\bx@RR
\newinsert\bx@SS
\newinsert\bx@TT
\newinsert\bx@UU
\newinsert\bx@VV
\newinsert\bx@WW
\newinsert\bx@XX
\newinsert\bx@YY
\newinsert\bx@ZZ
\gdef\@freelist{\@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E
\@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt\bx@I\@elt\bx@J
\@elt\bx@K\@elt\bx@L\@elt\bx@M\@elt\bx@N
\@elt\bx@O\@elt\bx@P\@elt\bx@Q\@elt\bx@R
\@elt\bx@S\@elt\bx@T\@elt\bx@U\@elt\bx@V
\@elt\bx@W\@elt\bx@X\@elt\bx@Y\@elt\bx@Z
\@elt\bx@a\@elt\bx@b\@elt\bx@c\@elt\bx@d\@elt\bx@e
\@elt\bx@f\@elt\bx@g\@elt\bx@h\@elt\bx@i\@elt\bx@j
\@elt\bx@k\@elt\bx@l\@elt\bx@m\@elt\bx@n
\@elt\bx@o\@elt\bx@p\@elt\bx@q\@elt\bx@r
\@elt\bx@s\@elt\bx@t\@elt\bx@u\@elt\bx@v
\@elt\bx@w\@elt\bx@x\@elt\bx@y\@elt\bx@z
\@elt\bx@AA\@elt\bx@BB\@elt\bx@CC\@elt\bx@DD\@elt\bx@EE
\@elt\bx@FF\@elt\bx@GG\@elt\bx@HH\@elt\bx@II\@elt\bx@JJ
\@elt\bx@KK\@elt\bx@LL\@elt\bx@MM\@elt\bx@NN
\@elt\bx@OO\@elt\bx@PP\@elt\bx@QQ\@elt\bx@RR
\@elt\bx@SS\@elt\bx@TT\@elt\bx@UU\@elt\bx@VV
\@elt\bx@WW\@elt\bx@XX\@elt\bx@YY\@elt\bx@ZZ}%
}{%
\@tufte@error{You may only call \string\morefloats\space twice. See the Tufte-LaTeX documentation for other workarounds}
{There are already 78 float slots allocated. Try using \string\FloatBarrier\space or \string\clearpage\space to place some floats before creating more.}
}%
}%
}
%%
% Detect if the subfigure package has been loaded
\newboolean{@tufte@packages@subfigure}
\setboolean{@tufte@packages@subfigure}{false}
\AtBeginDocument{%
\@ifpackageloaded{subfigure}
{\gsetboolean{@tufte@packages@subfigure}{true}}
{\gsetboolean{@tufte@packages@subfigure}{false}}%
}
%%
% Detect of the float package has been loaded
\AtBeginDocument{%
\@ifpackageloaded{float}{%
% Save the redefined float environment (instead of the LaTeX float environment)
\let\@tufte@orig@float\@float
\let\@tufte@orig@endfloat\end@float
% Define Tuftian float styles (with the caption in the margin)
\newcommand{\floatc@tufteplain}[2]{%
\begin{lrbox}{\@tufte@caption@box}%
\begin{minipage}[\floatalignment]{\marginparwidth}\hbox{}%
\@tufte@caption@font{\@fs@cfont #1:} #2\par%
\end{minipage}%
\end{lrbox}%
\smash{\hspace{\@tufte@caption@fill}\usebox{\@tufte@caption@box}}%
}
\newcommand{\fs@tufteplain}{%
\def\@fs@cfont{\@tufte@caption@font}%
\let\@fs@capt\floatc@tufteplain%
\def\@fs@pre{}%
\def\@fs@post{}%
\def\@fs@mid{}%
\let\@fs@iftopcapt\iftrue%
}
\let\fs@tufteplaintop=\fs@tufteplain
\let\floatc@tufteplaintop=\floatc@tufteplain
\newcommand\floatc@tufteruled[2]{%
{\@fs@cfont #1} #2\par%
}
\newcommand\fs@tufteruled{%
\def\@fs@cfont{\@tufte@caption@font}%
\let\@fs@capt\floatc@tufteplain%
\def\@fs@pre{\hrule height.8pt depth0pt width\textwidth \kern2pt}%
\def\@fs@post{\kern2pt\hrule width\textwidth\relax}%
\def\@fs@mid{}%
\let\@fs@iftopcapt\iftrue%
}
\newcommand\fs@tufteboxed{%
\def\@fs@cfont{}%
\let\@fs@capt\floatc@tufteplain%
\def\@fs@pre{%
\setbox\@currbox\vbox{\hbadness10000
\moveleft3.4pt\vbox{\advance\hsize by6.8pt
\hrule \hbox to\hsize{\vrule\kern3pt
\vbox{\kern3pt\box\@currbox\kern3pt}\kern3pt\vrule}\hrule}}
}%
\def\@fs@mid{\kern2pt}%
\def\@fs@post{}%
\let\@fs@iftopcapt\iftrue%
}
}{%
% Nothing to do
}
}
\AtBeginDocument{%
\@ifpackageloaded{algorithm}{%
% Set the float style to the Tuftian version
\ifthenelse{\equal{\ALG@floatstyle}{plain}\OR\equal{\ALG@floatstyle}{ruled}\OR\equal{\ALG@floatstyle}{boxed}}{%
\@tufte@info@noline{Switching algorithm float style from \ALG@floatstyle\space to tufte\ALG@floatstyle}%
\floatstyle{tufte\ALG@floatstyle}%
\restylefloat{algorithm}%
}{}%
}{%
% Nothing to do
}
}
%%
% For compatibility with the subfig package, we'll set captions=false so that
% it doesn't load the caption package (which modifies our own caption
% formatting).
\PassOptionsToPackage{caption=false}{subfig}
%%
% If debugging is enabled, print the Tufte-LaTeX options and the list of
% files.
\ifthenelse{\boolean{@tufte@debug}}
{\PrintTufteSettings\listfiles}
{}
%%
% If there is a `tufte-common-local.tex' file, load it up.
\IfFileExists{tufte-common-local.tex}
{\input{tufte-common-local.tex}%
\@tufte@info@noline{Loading tufte-common-local.tex}}
{}
%%
% End of file
\endinput
|