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
|
\documentclass{ltxdockit}[2010/09/26]
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage[strict]{csquotes}
\usepackage{shortvrb}
\MakeAutoQuote*{<}{>}
\MakeShortVerb{\|}
\titlepage{%
title={The \sty{etoolbox} Package},
subtitle={An \etex Toolbox for Class and Package Authors},
url={http://www.ctan.org/pkg/etoolbox/},
author={Philipp Lehman, Joseph Wright},
email={joseph.wright@morningstar2.co.uk},
revision={v2.5e},
date={2018/08/19}}
\hypersetup{%
pdftitle={The etoolbox Package},
pdfsubject={An e-TeX Toolbox for Class and Package Authors},
pdfauthor={Philipp Lehman, Joseph Wright},
pdfkeywords={tex, e-tex, latex, class, package, programming}}
\begin{document}
\printtitlepage
\tableofcontents
\section{Introduction}
\label{int}
\subsection[About]{About \sty{etoolbox}}
The \sty{etoolbox} package is a toolbox of programming tools geared primarily towards \latex class and package authors. It provides \latex frontends to some of the new primitives provided by \etex as well as some generic tools which are not related to \etex but match the profile of this package.
\subsection{License}
Copyright \textcopyright\ 2007--2011 Philipp Lehman, 2015--2018 Joseph Wright. Permission is granted to copy, distribute and\slash or modify this software under the terms of the \lppl, version 1.3c or later.\fnurl{http://www.latex-project.org/lppl/}
\section{User Commands}
\label{use}
The tools in this section are geared towards regular users as well as class and package authors.
\subsection{Definitions}
\label{use:def}
\begin{ltxsyntax}
\cmditem{newrobustcmd}{command}[arguments][optarg default]{replacement text}
\cmditem*{newrobustcmd*}{command}[arguments][optarg default]{replacement text}
The syntax and behavior of this command is similar to \cmd{newcommand} except that the newly defined \prm{command} will be robust. The behavior of this command differs from the \cmd{DeclareRobustCommand} command from the \latex kernel in that it issues an error rather than just an informational message if the \prm{command} is already defined. Since it uses \etex's low-level protection mechanism rather than the corresponding higher-level \latex facilities, it does not require an additional macro to implement the <robustness>.
\cmditem{renewrobustcmd}{command}[arguments][optarg default]{replacement text}
\cmditem*{renewrobustcmd*}{command}[arguments][optarg default]{replacement text}
The syntax and behavior of this command is similar to \cmd{renewcommand} except that the redefined \prm{command} will be robust.
\cmditem{providerobustcmd}{command}[arguments][optarg default]{replacement text}
\cmditem*{providerobustcmd*}{command}[arguments][optarg default]{replacement text}
The syntax and behavior of this command is similar to \cmd{providecommand} except that the newly defined \prm{command} will be robust. Note that this command will provide a robust definition of the \prm{command} only if it is undefined. It will not make an already defined \prm{command} robust.
\end{ltxsyntax}
\subsection{Patching}
\label{use:pat}
\begin{ltxsyntax}
\cmditem{robustify}{command}
Redefines a \prm{command} defined with \cmd{newcommand} such that it is robust, without altering its parameters, its prefixes, or its replacement text. If the \prm{command} has been defined with \cmd{DeclareRobustCommand}, this will be detected automatically and \latex's high-level protection mechanism will be replaced by the corresponding low-level \etex feature.
\end{ltxsyntax}
\subsection{Protection}
\label{use:pro}
\begin{ltxsyntax}
\cmditem{protecting}{code}
This command applies \latex's protection mechanism, which normally requires prefixing each fragile command with \cmd{protect}, to an entire chunk of arbitrary \prm{code}. Its behavior depends on the current state of \cmd{protect}. Note that the braces around the \prm{code} are mandatory even if it is a single token.
\end{ltxsyntax}
\subsection[Lengths and Counters]{Length and Counter Assignments}
\label{use:cal}
The tools in this section are replacements for \cmd{setcounter} and \cmd{setlength} which support arithmetic expressions.
\begin{ltxsyntax}
\cmditem{defcounter}{counter}{integer expression}
Assigns a value to a \latex \prm{counter} previously initialized with \cmd{newcounter}. This command is similar in concept and syntax to \cmd{setcounter} except for two major differences. 1) The second argument may be an \prm{integer expression} which will be processed with \cmd{numexpr}. The \prm{integer expression} may be any arbitrary code which is valid in this context. The value assigned to the \prm{counter} will be the result of that calculation. 2) In contrast to \cmd{setcounter}, the assignment is local by default but \cmd{defcounter} may be prefixed with \cs{global}. The functional equivalent of \cmd{setcounter} would be \cs{global}\cmd{defcounter}.
\cmditem{deflength}{length}{glue expression}
Assigns a value to a \prm{length} register previously initialized with \cmd{newlength}. This command is similar in concept and syntax to \cmd{setlength} except that the second argument may be a \prm{glue expression} which will be processed with \cmd{glueexpr}. The \prm{glue expression} may be any arbitrary code which is valid in this context. The value assigned to the \prm{length} register will be the result of that calculation. The assignment is local by default but \cmd{deflength} may be prefixed with \cs{global}. This command may be used as a drop-in replacement for \cmd{setlength}.
\end{ltxsyntax}
\subsection[Document Hooks]{Additional Document Hooks}
\label{use:pre}
\latex provides two hooks which defer the execution of code either to the beginning or to the end of the document body. Any \cmd{AtBeginDocument} code is executed towards the beginning of the document body, after the main \file{aux} file has been read for the first time. Any \cmd{AtEndDocument} code is executed at the end of the document body, before the main \file{aux} file is read for the second time. The hooks introduced here are similar in concept but defer the execution of their \prm{code} argument to slightly different locations. The \prm{code} may be arbitrary \tex code. Parameter characters in the \prm{code} argument are permissible and need not be doubled.
\begin{ltxsyntax}
\cmditem{AfterPreamble}{code}
This hook is a variant of \cmd{AtBeginDocument} which may be used in both the preamble and the document body. When used in the preamble, it behaves exactely like \cmd{AtBeginDocument}. When used in the document body, it immediately executes its \prm{code} argument. \cmd{AtBeginDocument} would issue an error in this case. This hook is useful to defer code which needs to write to the main \file{aux} file.
\cmditem{AtEndPreamble}{code}
This hook differs from \cmd{AtBeginDocument} in that the \prm{code} is executed right at the end of the preamble, before the main \file{aux} file (as written on the previous \latex pass) is read and prior to any \cmd{AtBeginDocument} code. Note that it is not possible to write to the \file{aux} file at this point.
\cmditem{AfterEndPreamble}{code}
This hook differs from \cmd{AtBeginDocument} in that the \prm{code} is executed at the very end of |\begin{document}|, after any \cmd{AtBeginDocument} code. Note that commands whose scope has been restricted to the preamble with \cmd{@onlypreamble} are no longer available when this hook is executed.
\cmditem{AfterEndDocument}{code}
This hook differs from \cmd{AtEndDocument} in that the \prm{code} is executed at the very end of the document, after the main \file{aux} file (as written on the current \latex pass) has been read and after any \cmd{AtEndDocument} code.
\end{ltxsyntax}
In a way, \cmd{AtBeginDocument} code is part neither of the preamble nor the document body but located in-between them since it gets executed in the middle of the initialization sequence performed prior to typesetting. It is sometimes desirable to move code to the end of the preamble because all requested packages have been loaded at this point. \cmd{AtBeginDocument} code, however, is executed too late if it is required in the \file{aux} file. In contrast to that, \cmd{AtEndPreamble} code is part of the preamble; \cmd{AfterEndPreamble} code is part of the document body and may contain printable text to be typeset at the very beginning of the document. To sum that up, \latex will perform the following tasks <inside> |\begin{document}|:
\begin{itemize}
\setlength{\itemsep}{0pt}
\item Execute any \cmd{AtEndPreamble} code
\item Start initialization for document body (page layout, default fonts, etc.)
\item Load the main \file{aux} file written on the previous \latex pass
\item Open the main \file{aux} file for writing on the current pass
\item Continue initialization for document body
\item Execute any \cmd{AtBeginDocument} code
\item Complete initialization for document body
\item Disable all \cmd{@onlypreamble} commands
\item Execute any \cmd{AfterEndPreamble} code
\end{itemize}
%
Inside |\end{document}|, \latex will perform the following tasks:
\begin{itemize}
\setlength{\itemsep}{0pt}
\item Execute any \cmd{AtEndDocument} code
\item Perform a final \cmd{clearpage} operation
\item Close the main \file{aux} file for writing
\item Load the main \file{aux} file written on the current \latex pass
\item Perform final tests and issue warnings, if applicable
\item Execute any \cmd{AfterEndDocument} code
\end{itemize}
%
Any \cmd{AtEndDocument} code may be considered as being part of the document body insofar as it is still possible to perform typesetting tasks and write to the main \file{aux} file when it gets executed. \cmd{AfterEndDocument} code is not part of the document body. This hook is useful to evaluate the data in the \file{aux} file at the very end of a \latex pass.
\subsection[Environment Hooks]{Environment Hooks}
\label{use:env}
The tools in this section provide hooks for arbitrary environments. Note that they will not modify the definition of the \prm{environment}. They hook into the \cmd{begin} and \cmd{end} commands instead. Redefining the \prm{environment} will not clear the corresponding hooks. The \prm{code} may be arbitrary \tex code. Parameter characters in the \prm{code} argument are permissible and need not be doubled.
\begin{ltxsyntax}
\cmditem{AtBeginEnvironment}{environment}{code}
Appends arbitrary \prm{code} to a hook executed by the \cmd{begin} command at the beginning of a given \prm{environment}, immediately before \cmd{\prm{environment}}, inside the group opened by \cmd{begin}.
\cmditem{AtEndEnvironment}{environment}{code}
Appends arbitrary \prm{code} to a hook executed by the \cmd{end} command at the end of a given \prm{environment}, immediately before \cmd{end\prm{environment}}, inside the group opened by \cmd{begin}.
\cmditem{BeforeBeginEnvironment}{environment}{code}
Appends arbitrary \prm{code} to a hook executed at a very early point by the \cmd{begin} command, before the group holding the environment is opened.
\cmditem{AfterEndEnvironment}{environment}{code}
Appends arbitrary \prm{code} to a hook executed at a very late point by the \cmd{end} command, after the group holding the environment has been closed.
\end{ltxsyntax}
\section{Author Commands}
The tools in this section are geared towards class and package authors.
\subsection{Definitions}
\subsubsection{Macro Definitions}
\label{aut:def:def}
The tools in this section are simple but frequently required shorthands which extend the scope of the \cmd{@namedef} and \cmd{@nameuse} macros from the \latex kernel.
\begin{ltxsyntax}
\cmditem{csdef}{csname}<arguments>{replacement text}
Similar to the \tex primitive \cmd{def} except that it takes a control sequence name as its first argument. This command is robust and corresponds to \cmd{@namedef}.
\cmditem{csgdef}{csname}<arguments>{replacement text}
Similar to the \tex primitive \cmd{gdef} except that it takes a control sequence name as its first argument. This command is robust.
\cmditem{csedef}{csname}<arguments>{replacement text}
Similar to the \tex primitive \cmd{edef} except that it takes a control sequence name as its first argument. This command is robust.
\cmditem{csxdef}{csname}<arguments>{replacement text}
Similar to the \tex primitive \cmd{xdef} except that it takes a control sequence name as its first argument. This command is robust.
\cmditem{protected@csedef}{csname}<arguments>{replacement text}
Similar to \cmd{csedef} except that \latex's protection mechanism is temporarily enabled. To put it in other words: this command is similar to the \latex kernel command \cmd{protected@edef} except that it takes a control sequence name as its first argument. This command is robust.
\cmditem{protected@csxdef}{csname}<arguments>{replacement text}
Similar to \cmd{csxdef} except that \latex's protection mechanism is temporarily enabled. To put it in other words: this command is similar to the \latex kernel command \cmd{protected@xdef} except that it takes a control sequence name as its first argument. This command is robust.
\cmditem{cslet}{csname}{command}
Similar to the \tex primitive \cmd{let} except that the first argument is a control sequence name. If \prm{command} is undefined, \prm{csname} will be undefined as well after the assignment. This command is robust and may be prefixed with \cs{global}.
\cmditem{letcs}{command}{csname}
Similar to the \tex primitive \cmd{let} except that the second argument is a control sequence name. If \prm{csname} is undefined, the \prm{command} will be undefined as well after the assignment. This command is robust and may be prefixed with \cs{global}.
\cmditem{csletcs}{csname}{csname}
Similar to the \tex primitive \cmd{let} except that both arguments are control sequence names. If the second \prm{csname} is undefined, the first \prm{csname} will be undefined as well after the assignment. This command is robust and may be prefixed with \cs{global}.
\cmditem{csuse}{csname}
Takes a control sequence name as its argument and forms a control sequence token. This command differs from the \cmd{@nameuse} macro in the \latex kernel in that it expands to an empty string if the control sequence is undefined.
\cmditem{undef}<command>
Clears a \prm{command} such that \etex's \cmd{ifdefined} and \cmd{ifcsname} tests will consider it as undefined. This command is robust and may be prefixed with \cs{global}.
\cmditem{gundef}<command>
Similar to \cmd{undef} but acts globally.
\cmditem{csundef}{csname}
Similar to \cmd{undef} except that it takes a control sequence name as its argument. This command is robust and may be prefixed with \cs{global}.
\cmditem{csgundef}{csname}
Similar to \cmd{csundef} but acts globally.
\cmditem{csmeaning}{csname}
Similar to the \tex primitive \cmd{meaning} but takes a control sequence name as its argument. If the control sequence is undefined, this command will not implicitly assign a meaning of \cmd{relax} to it.
\cmditem{csshow}{csname}
Similar to the \tex primitive \cmd{show} but takes a control sequence name as its argument. If the control sequence is undefined, this command will not implicitly assign a meaning of \cmd{relax} to it. This command is robust.
\end{ltxsyntax}
\subsubsection{Arithmetic Definitions}
\label{aut:def:cal}
The tools in this section permit calculations using macros rather than length registers and counters.
\begin{ltxsyntax}
\cmditem{numdef}<command>{integer expression}
Similar to \cmd{edef} except that the \prm{integer expression} is processed with \cmd{numexpr}. The \prm{integer expression} may be any arbitrary code which is valid in this context. The replacement text assigned to the \prm{command} will be the result of that calculation. If the \prm{command} is undefined, it will be initialized to \texttt{0} before the \prm{integer expression} is processed.
\cmditem{numgdef}<command>{integer expression}
Similar to \cmd{numdef} except that the assignment is global.
\cmditem{csnumdef}{csname}{integer expression}
Similar to \cmd{numdef} except that it takes a control sequence name as its first argument.
\cmditem{csnumgdef}{csname}{integer expression}
Similar to \cmd{numgdef} except that it takes a control sequence name as its first argument.
\cmditem{dimdef}<command>{dimen expression}
Similar to \cmd{edef} except that the \prm{dimen expression} is processed with \cmd{dimexpr}. The \prm{dimen expression} may be any arbitrary code which is valid in this context. The replacement text assigned to the \prm{command} will be the result of that calculation. If the \prm{command} is undefined, it will be initialized to \texttt{0pt} before the \prm{dimen expression} is processed.
\cmditem{dimgdef}<command>{dimen expression}
Similar to \cmd{dimdef} except that the assignment is global.
\cmditem{csdimdef}{csname}{dimen expression}
Similar to \cmd{dimdef} except that it takes a control sequence name as its first argument.
\cmditem{csdimgdef}{csname}{dimen expression}
Similar to \cmd{dimgdef} except that it takes a control sequence name as its first argument.
\cmditem{gluedef}<command>{glue expression}
Similar to \cmd{edef} except that the \prm{glue expression} is processed with \cmd{glueexpr}. The \prm{glue expression} may be any arbitrary code which is valid in this context. The replacement text assigned to the \prm{command} will be the result of that calculation. If the \prm{command} is undefined, it will be initialized to \texttt{0pt plus 0pt minus 0pt} before the \prm{glue expression} is processed.
\cmditem{gluegdef}<command>{glue expression}
Similar to \cmd{gluedef} except that the assignment is global.
\cmditem{csgluedef}{csname}{glue expression}
Similar to \cmd{gluedef} except that it takes a control sequence name as its first argument.
\cmditem{csgluegdef}{csname}{glue expression}
Similar to \cmd{gluegdef} except that it takes a control sequence name as its first argument.
\cmditem{mudef}<command>{muglue expression}
Similar to \cmd{edef} except that the \prm{muglue expression} is processed with \cmd{muexpr}. The \prm{muglue expression} may be any arbitrary code which is valid in this context. The replacement text assigned to the \prm{command} will be the result of that calculation. If the \prm{command} is undefined, it will be initialized to \texttt{0mu} before the \prm{muglue expression} is processed.
\cmditem{mugdef}<command>{muglue expression}
Similar to \cmd{mudef} except that the assignment is global.
\cmditem{csmudef}{csname}{muglue expression}
Similar to \cmd{mudef} except that it takes a control sequence name as its first argument.
\cmditem{csmugdef}{csname}{muglue expression}
Similar to \cmd{mugdef} except that it takes a control sequence name as its first argument.
\end{ltxsyntax}
\subsection{Expansion Control}
\label{aut:exp}
The tools in this section are useful to control expansion in an \cmd{edef} or a similar context.
\begin{ltxsyntax}
\cmditem{expandonce}<command>
This command expands a \prm{command} once and prevents further expansion of the replacement text. This command is expandable.
\cmditem{csexpandonce}{csname}
Similar to \cmd{expandonce} except that it takes a control sequence name as its argument.
\end{ltxsyntax}
\subsection{Hook Management}
\label{aut:hok}
The tools in this section are intended for hook management. A \prm{hook} in this context is a plain macro without any parameters and prefixes which is used to collect code to be executed later. These tools may also be useful to patch simple macros by appending code to their replacement text. For more complex patching operations, see section \ref{aut:pat}. All commands in this section will initialize the \prm{hook} if it is undefined.
\subsubsection{Appending to a Hook}
\label{aut:hok:app}
The tools in this section append arbitrary code to a hook.
\begin{ltxsyntax}
\cmditem{appto}<hook>{code}
This command appends arbitrary \prm{code} to a \prm{hook}. If the \prm{code} contains any parameter characters, they need not be doubled. This command is robust.
\cmditem{gappto}<hook>{code}
Similar to \cmd{appto} except that the assignment is global. This command may be used as a drop-in replacement for the \cmd{g@addto@macro} command in the \latex kernel.
\cmditem{eappto}<hook>{code}
This command appends arbitrary \prm{code} to a \prm{hook}. The \prm{code} is expanded at definition"=time. Only the new \prm{code} is expanded, the current replacement text of the \prm{hook} is not. This command is robust.
\cmditem{xappto}<hook>{code}
Similar to \cmd{eappto} except that the assignment is global.
\cmditem{protected@eappto}<hook>{code}
Similar to \cmd{eappto} except that \latex's protection mechanism is temporarily enabled.
\cmditem{protected@xappto}<hook>{code}
Similar to \cmd{xappto} except that \latex's protection mechanism is temporarily enabled.
\cmditem{csappto}{csname}{code}
Similar to \cmd{appto} except that it takes a control sequence name as its first argument.
\cmditem{csgappto}{csname}{code}
Similar to \cmd{gappto} except that it takes a control sequence name as its first argument.
\cmditem{cseappto}{csname}{code}
Similar to \cmd{eappto} except that it takes a control sequence name as its first argument.
\cmditem{csxappto}{csname}{code}
Similar to \cmd{xappto} except that it takes a control sequence name as its first argument.
\cmditem{protected@cseappto}<hook>{code}
Similar to \cmd{protected@eappto} except that it takes a control sequence name as its first argument.
\cmditem{protected@csxappto}<hook>{code}
Similar to \cmd{protected@xappto} except that it takes a control sequence name as its first argument.
\end{ltxsyntax}
\subsubsection{Prepending to a Hook}
\label{aut:hok:pre}
The tools in this section <prepend> arbitrary code to a hook, \ie the code is inserted at the beginning of the hook rather than being added at the end.
\begin{ltxsyntax}
\cmditem{preto}<hook>{code}
Similar to \cmd{appto} except that the \prm{code} is prepended.
\cmditem{gpreto}<hook>{code}
Similar to \cmd{preto} except that the assignment is global.
\cmditem{epreto}<hook>{code}
Similar to \cmd{eappto} except that the \prm{code} is prepended.
\cmditem{xpreto}<hook>{code}
Similar to \cmd{epreto} except that the assignment is global.
\cmditem{protected@epreto}<hook>{code}
Similar to \cmd{epreto} except that \latex's protection mechanism is temporarily enabled.
\cmditem{protected@xpreto}<hook>{code}
Similar to \cmd{xpreto} except that \latex's protection mechanism is temporarily enabled.
\cmditem{cspreto}{csname}{code}
Similar to \cmd{preto} except that it takes a control sequence name as its first argument.
\cmditem{csgpreto}{csname}{code}
Similar to \cmd{gpreto} except that it takes a control sequence name as its first argument.
\cmditem{csepreto}{csname}{code}
Similar to \cmd{epreto} except that it takes a control sequence name as its first argument.
\cmditem{csxpreto}{csname}{code}
Similar to \cmd{xpreto} except that it takes a control sequence name as its first argument.
\cmditem{protected@csepreto}<hook>{code}
Similar to \cmd{protected@epreto} except that it takes a control sequence name as its first argument.
\cmditem{protected@csxpreto}<hook>{code}
Similar to \cmd{protected@xpreto} except that it takes a control sequence name as its first argument.
\end{ltxsyntax}
\subsection{Patching}
\label{aut:pat}
The tools in this section are useful to hook into or modify existing code. All commands presented here preserve the parameters and the prefixes of the patched \prm{command}. Note that \cs{outer} commands may not be patched. Also note that the commands in this section will not automatically issue any error messages if patching fails. Instead, they take a \prm{failure} argument which should provide suitable fallback code or an error message. Issuing \cmd{tracingpatches} in the preamble will cause the commands to write debugging information to the transcript file.
\begin{ltxsyntax}
\cmditem{patchcmd}[prefix]{command}{search}{replace}{success}{failure}
This command extracts the replacement text of a \prm{command}, replaces \prm{search} with \prm{replace}, and reassembles the \prm{command}. The pattern match is category code agnostic and matches the first occurence of the \prm{search} pattern in the replacement text of the \prm{command} to be patched. Note that the patching process involves detokenizing the replacement text of the \prm{command} and retokenizing it under the current category code regime after patching. The category code of the @ sign is temporarily set to 11. If the replacement text of the \prm{command} includes any tokens with non"=standard category codes, the respective category codes must be adjusted prior to patching. If the code to be replaced or inserted refers to the parameters of the \prm{command} to be patched, the parameter characters need not be doubled. If an optional \prm{prefix} is specified, it replaces the prefixes of the \prm{command}. An empty \prm{prefix} argument strips all prefixes from the \prm{command}. The assignment is local. This command implicitly performs the equivalent of an \cmd{ifpatchable} test prior to patching. If this test succeeds, the command applies the patch and executes \prm{success}. If the test fails, it executes \prm{failure} without modifying the original \prm{command}. This command is robust.
\cmditem{ifpatchable}{command}{search}{true}{false}
This command executes \prm{true} if the \prm{command} may be patched with \cmd{patchcmd} and if the \prm{search} pattern is found in its replacement text, and \prm{false} otherwise. This command is robust.
\cmditem*{ifpatchable*}{command}{true}{false}
Similar to \cmd{ifpatchable} except that the starred variant does not require a search pattern. Use this version to check if a command may be patched with \cmd{apptocmd} and \cmd{pretocmd}.
\cmditem{apptocmd}{command}{code}{success}{failure}
This command appends \prm{code} to the replacement text of a \prm{command}. If the \prm{command} is a parameterless macro, it behaves like \cmd{appto} from section \ref{aut:hok:app}. In contrast to \cmd{appto}, \cmd{apptocmd} may also be used to patch commands with parameters. In this case, it will detokenize the replacement text of the \prm{command}, apply the patch, and retokenize it under the current category code regime. The category code of the @ sign is temporarily set to 11. The \prm{code} may refer to the parameters of the \prm{command}. The assignment is local. If patching succeeds, this command executes \prm{success}. If patching fails, it executes \prm{failure} without modifying the original \prm{command}. This command is robust.
\cmditem{pretocmd}{command}{code}{success}{failure}
This command is similar to \cmd{apptocmd} except that the \prm{code} is inserted at the beginning of the replacement text of the \prm{command}. If the \prm{command} is a parameterless macro, it behaves like \cmd{preto} from section \ref{aut:hok:app}. In contrast to \cmd{preto}, \cmd{pretocmd} may also be used to patch commands with parameters. In this case, it will detokenize the replacement text of the \prm{command}, apply the patch, and retokenize it under the current category code regime. The category code of the @ sign is temporarily set to 11. The \prm{code} may refer to the parameters of the \prm{command}. The assignment is local. If patching succeeds, this command executes \prm{success}. If patching fails, it executes \prm{failure} without modifying the original \prm{command}. This command is robust.
\csitem{tracingpatches}
Enables tracing for all patching commands, including \cmd{ifpatchable}. The debugging information will be written to the transcript file. This is useful if the reason why a patch is not applied or \cmd{ifpatchable} yields \prm{false} is not obvious. This command must be issued in the preamble.
\end{ltxsyntax}
\subsection{Boolean Flags}
\label{aut:bol}
This package provides two interfaces to boolean flags which are completely independent of each other. The tools in section \ref{aut:bo1:bol} are a \latex frontend to \cmd{newif}. Those in section \ref{aut:bo1:tgl} use a different mechanism.
\subsubsection{\tex Flags}
\label{aut:bo1:bol}
Since the tools in this section are based on \cmd{newif} internally, they may be used to test and alter the state of flags previously defined with \cmd{newif}. They are also compatible with the boolean tests of the \sty{ifthen} package and may serve as a \latex interface for querying \tex primitives such as \cmd{ifmmode}. The \cmd{newif} approach requires a total of three macros per flag.
\begin{ltxsyntax}
\cmditem{newbool}{name}
Defines a new boolean flag called \prm{name}. If the flag has already been defined, this command issues an error. The initial state of newly defined flags is \texttt{false}. This command is robust.
\cmditem{providebool}{name}
Defines a new boolean flag called \prm{name} unless it has already been defined. This command is robust.
\cmditem{booltrue}{name}
Sets the boolean flag \prm{name} to \texttt{true}. This command is robust and may be prefixed with \cs{global}. It will issue an error if the flag is undefined.
\cmditem{boolfalse}{name}
Sets the boolean flag \prm{name} to \texttt{false}. This command is robust and may be prefixed with \cs{global}. It will issue an error if the flag is undefined.
\cmditem{setbool}{name}{value}
Sets the boolean flag \prm{name} to \prm{value} which may be either \texttt{true} or \texttt{false}. This command is robust and may be prefixed with \cs{global}. It will issue an error if the flag is undefined.
\cmditem{ifbool}{name}{true}{false}
Expands to \prm{true} if the state of the boolean flag \prm{name} is \texttt{true}, and to \prm{false} otherwise. If the flag is undefined, this command issues an error. This command may be used to perform any boolean test based on plain \tex syntax, \ie any test normally employed like this:
\begin{ltxcode}
<<\iftest>> true<<\else>> false<<\fi>>
\end{ltxcode}
This includes all flags defined with \cmd{newif} as well as \tex primitives such as \cmd{ifmmode}. The \cmd{if} prefix is omitted when using the flag or the primitive in the expression. For example:
\begin{ltxcode}
<<\ifmytest>> true\else false\fi
<<\ifmmode>> true\else false\fi
\end{ltxcode}
%
becomes
\begin{ltxcode}
\ifbool{<<mytest>>}{true}{false}
\ifbool{<<mmode>>}{true}{false}
\end{ltxcode}
\cmditem{notbool}{name}{not true}{not false}
Similar to \cmd{ifbool} but negates the test.
\end{ltxsyntax}
\subsubsection{\latex Flags}
\label{aut:bo1:tgl}
In contrast to the flags from section \ref{aut:bo1:bol}, the tools in this section require only one macro per flag. They also use a separate namespace to avoid name clashes with regular macros.
\begin{ltxsyntax}
\cmditem{newtoggle}{name}
Defines a new boolean flag called \prm{name}. If the flag has already been defined, this command issues an error. The initial state of newly defined flags is \texttt{false}. This command is robust.
\cmditem{providetoggle}{name}
Defines a new boolean flag called \prm{name} unless it has already been defined. This command is robust.
\cmditem{toggletrue}{name}
Sets the boolean flag \prm{name} to \texttt{true}. This command is robust and may be prefixed with \cs{global}. It will issue an error if the flag is undefined.
\cmditem{togglefalse}{name}
Sets the boolean flag \prm{name} to \texttt{false}. This command is robust and may be prefixed with \cs{global}. It will issue an error if the flag is undefined.
\cmditem{settoggle}{name}{value}
Sets the boolean flag \prm{name} to \prm{value} which may be either \texttt{true} or \texttt{false}. This command is robust and may be prefixed with \cs{global}. It will issue an error if the flag is undefined.
\cmditem{iftoggle}{name}{true}{false}
Expands to \prm{true} if the state of the boolean flag \prm{name} is \texttt{true}, and to \prm{false} otherwise. If the flag is undefined, this command issues an error.
\cmditem{nottoggle}{name}{not true}{not false}
Similar to \cmd{iftoggle} but negates the test.
\end{ltxsyntax}
\subsection{Generic Tests}
\label{aut:tst}
\subsubsection{Macro Tests}
\label{aut:tst:def}
\begin{ltxsyntax}
\cmditem{ifdef}{control sequence}{true}{false}
Expands to \prm{true} if the \prm{control sequence} is defined, and to \prm{false} otherwise. Note that control sequences will be considered as defined even if their meaning is \cmd{relax}. This command is a \latex wrapper for the \etex primitive \cmd{ifdefined}.
\cmditem{ifcsdef}{csname}{true}{false}
Similar to \cmd{ifdef} except that it takes a control sequence name as its first argument. This command is a \latex wrapper for the \etex primitive \cmd{ifcsname}.
\cmditem{ifundef}{control sequence}{true}{false}
Expands to \prm{true} if the \prm{control sequence} is undefined, and to \prm{false} otherwise. Apart from reversing the logic of the test, this command also differs from \cmd{ifdef} in that commands will be considered as undefined if their meaning is \cmd{relax}.
\cmditem{ifcsundef}{csname}{true}{false}
Similar to \cmd{ifundef} except that it takes a control sequence name as its first argument. This command may be used as a drop-in replacement for the \cmd{@ifundefined} test in the \latex kernel.
\cmditem{ifdefmacro}{control sequence}{true}{false}
Expands to \prm{true} if the \prm{control sequence} is defined and is a macro, and to \prm{false} otherwise.
\cmditem{ifcsmacro}{csname}{true}{false}
Similar to \cmd{ifdefmacro} except that it takes a control sequence name as its first argument.
\cmditem{ifdefparam}{control sequence}{true}{false}
Expands to \prm{true} if the \prm{control sequence} is defined and is a macro with one or more parameters, and to \prm{false} otherwise.
\cmditem{ifcsparam}{csname}{true}{false}
Similar to \cmd{ifdefparam} except that it takes a control sequence name as its first argument.
\cmditem{ifdefprefix}{control sequence}{true}{false}
Expands to \prm{true} if the \prm{control sequence} is defined and is a macro prefixed with \cs{long} and\slash or \cs{protected}, and to \prm{false} otherwise. Note that \cs{outer} macros may not be tested.
\cmditem{ifcsprefix}{csname}{true}{false}
Similar to \cmd{ifdefprefix} except that it takes a control sequence name as its first argument.
\cmditem{ifdefprotected}{control sequence}{true}{false}
Expands to \prm{true} if the \prm{control sequence} is defined and is a macro prefixed with \cs{protected}, and to \prm{false} otherwise.
\cmditem{ifcsprotected}{csname}{true}{false}
Similar to \cmd{ifdefprotected} except that it takes a control sequence name as its first argument.
\cmditem{ifdefltxprotect}{control sequence}{true}{false}
Executes \prm{true} if the \prm{control sequence} is defined and is a \latex protection shell, and \prm{false} otherwise. This command is robust. It will detect commands which have been defined with \cmd{DeclareRobustCommand} or by way of a similar technique.
\cmditem{ifcsltxprotect}{csname}{true}{false}
Similar to \cmd{ifdefltxprotect} except that it takes a control sequence name as its first argument.
\cmditem{ifdefempty}{control sequence}{true}{false}
Expands to \prm{true} if the \prm{control sequence} is defined and is a parameterless macro whose replacement text is empty, and to \prm{false} otherwise. In contrast to \cmd{ifx}, this test ignores the prefixes of the \prm{command}.
\cmditem{ifcsempty}{csname}{true}{false}
Similar to \cmd{ifdefempty} except that it takes a control sequence name as its first argument.
\cmditem{ifdefvoid}{control sequence}{true}{false}
Expands to \prm{true} if the \prm{control sequence} is undefined, or is a control sequence whose meaning is \cmd{relax}, or is a parameterless macro whose replacement text is empty, and to \prm{false} otherwise.
\cmditem{ifcsvoid}{csname}{true}{false}
Similar to \cmd{ifdefvoid} except that it takes a control sequence name as its first argument.
\cmditem{ifdefequal}{control sequence}{control sequence}{true}{false}
Compares two control sequences and expands to \prm{true} if they are equal in the sense of \cmd{ifx}, and to \prm{false} otherwise. In contrast to \cmd{ifx}, this test will also yield \prm{false} if both control sequences are undefined or have a meaning of \cmd{relax}.
\cmditem{ifcsequal}{csname}{csname}{true}{false}
Similar to \cmd{ifdefequal} except that it takes control sequence names as arguments.
\cmditem{ifdefstring}{command}{string}{true}{false}
Compares the replacement text of a \prm{command} to a \prm{string} and executes \prm{true} if they are equal, and \prm{false} otherwise. Neither the \prm{command} nor the \prm{string} is expanded in the test and the comparison is category code agnostic. Control sequence tokens in the \prm{string} argument will be detokenized and treated as strings. This command is robust. Note that it will only consider the replacement text of the \prm{command}. For example, this test
\begin{ltxcode}
\long\edef\mymacro#1#2{\string&}
\ifdefstring{\mymacro}{&}{true}{false}
\end{ltxcode}
%
would yield \prm{true}. The prefix and the parameters of \cmd{mymacro} as well as the category codes in the replacement text are ignored.
\cmditem{ifcsstring}{csname}{string}{true}{false}
Similar to \cmd{ifdefstring} except that it takes a control sequence name as its first argument.
\cmditem{ifdefstrequal}{command}{command}{true}{false}
Performs a category code agnostic string comparison of the replacement text of two commands. This command is similar to \cmd{ifdefstring} except that both arguments to be compared are macros. This command is robust.
\cmditem{ifcsstrequal}{csname}{csname}{true}{false}
Similar to \cmd{ifdefstrequal} except that it takes control sequence names as arguments.
\end{ltxsyntax}
\subsubsection{Counter and Length Tests}
\label{aut:tst:cnt}
\begin{ltxsyntax}
\cmditem{ifdefcounter}{control sequence}{true}{false}
Expands to \prm{true} if the \prm{control sequence} is a \tex \cmd{count} register allocated with \cmd{newcount}, and to \prm{false} otherwise.
\cmditem{ifcscounter}{csname}{true}{false}
Similar to \cmd{ifdefcounter} except that it takes a control sequence name as its first argument.
\cmditem{ifltxcounter}{name}{true}{false}
Expands to \prm{true} if \prm{name} is a \latex counter allocated with \cmd{newcounter}, and to \prm{false} otherwise.
\cmditem{ifdeflength}{control sequence}{true}{false}
Expands to \prm{true} if the \prm{control sequence} is a \tex \cmd{skip} register allocated with \cmd{newskip} or \cmd{newlength}, and to \prm{false} otherwise.
\cmditem{ifcslength}{csname}{true}{false}
Similar to \cmd{ifdeflength} except that it takes a control sequence name as its first argument.
\cmditem{ifdefdimen}{control sequence}{true}{false}
Expands to \prm{true} if the \prm{control sequence} is a \tex \cmd{dimen} register allocated with \cmd{newdimen}, and to \prm{false} otherwise.
\cmditem{ifcsdimen}{csname}{true}{false}
Similar to \cmd{ifdefdimen} except that it takes a control sequence name as its first argument.
\end{ltxsyntax}
\subsubsection{String Tests}
\label{aut:tst:str}
\begin{ltxsyntax}
\cmditem{ifstrequal}{string}{string}{true}{false}
Compares two strings and executes \prm{true} if they are equal, and \prm{false} otherwise. The strings are not expanded in the test and the comparison is category code agnostic. Control sequence tokens in any of the \prm{string} arguments will be detokenized and treated as strings. This command is robust.
\cmditem{ifstrempty}{string}{true}{false}
Expands to \prm{true} if the \prm{string} is empty, and to \prm{false} otherwise. The \prm{string} is not expanded in the test.
\cmditem{ifblank}{string}{true}{false}
Expands to \prm{true} if the \prm{string} is blank (empty or spaces), and to \prm{false} otherwise. The \prm{string} is not expanded in the test.
\cmditem{notblank}{string}{not true}{not false}
Similar to \cmd{ifblank} but negates the test.
\end{ltxsyntax}
\subsubsection{Arithmetic Tests}
\label{aut:tst:num}
\begin{ltxsyntax}
\cmditem{ifnumcomp}{integer expression}{relation}{integer expression}{true}{false}
Compares two integer expressions according to \prm{relation} and expands to \prm{true} or \prm{false} depending on the result. The \prm{relation} may be |<|, |>|, or |=|. Both integer expressions will be processed with \cmd{numexpr}. An \prm{integer expression} may be any arbitrary code which is valid in this context. All arithmetic expressions may contain spaces. Here are some examples:
\begin{ltxcode}
\ifnumcomp{<<3>>}{<<>>>}{<<6>>}{true}{<<false>>}
\ifnumcomp{<<(7 + 5) / 2>>}{<<=>>}{<<6>>}{<<true>>}{false}
\ifnumcomp{<<(7+5) / 4>>}{<<>>>}{<<3*(12-10)>>}{true}{<<false>>}
\newcounter{countA}
\setcounter{countA}{<<6>>}
\newcounter{countB}
\setcounter{countB}{<<5>>}
\ifnumcomp{<<\value{countA} * \value{countB}/2}>>{<<=>>}{<<15>>}{<<true>>}{false}
\ifnumcomp{<<6/2>>}{<<=>>}{<<5/2>>}{<<true>>}{false}
\end{ltxcode}
%
Technically, this command is a \latex wrapper for the \tex primitive \cmd{ifnum}, incorporating \cmd{numexpr}. Note that \cmd{numexpr} will round the result of all integer expressions, \ie both expressions will be processed and rounded prior to being compared. In the last line of the above examples, the result of the second expression is 2.5, which is rounded to 3, hence \cmd{ifnumcomp} will expand to \prm{true}.
\cmditem{ifnumequal}{integer expression}{integer expression}{true}{false}
Alternative syntax for |\ifnumcomp{...}{=}{...}{...}{...}|.
\cmditem{ifnumgreater}{integer expression}{integer expression}{true}{false}
Alternative syntax for |\ifnumcomp{...}{>}{...}{...}{...}|.
\cmditem{ifnumless}{integer expression}{integer expression}{true}{false}
Alternative syntax for |\ifnumcomp{...}{<}{...}{...}{...}|.
\cmditem{ifnumodd}{integer expression}{true}{false}
Evaluates an integer expression and expands to \prm{true} if the result is an odd number, and to \prm{false} otherwise. Technically, this command is a \latex wrapper for the \tex primitive \cmd{ifodd}, incorporating \cmd{numexpr}.
\cmditem{ifdimcomp}{dimen expression}{relation}{dimen expression}{true}{false}
Compares two dimen expressions according to \prm{relation} and expands to \prm{true} or \prm{false} depending on the result. The \prm{relation} may be |<|, |>|, or |=|. Both dimen expressions will be processed with \cmd{dimexpr}. A \prm{dimen expression} may be any arbitrary code which is valid in this context. All arithmetic expressions may contain spaces. Here are some examples:
\begin{ltxcode}
\ifdimcomp{<<1cm>>}{<<=>>}{<<28.45274pt>>}{<<true>>}{false}
\ifdimcomp{<<(7pt + 5pt) / 2>>}{<<<>>}{2pt}{true}{<<false>>}
\ifdimcomp{<<(3.725pt + 0.025pt) * 2>>}{<<<>>}{<<7pt>>}{true}{<<false>>}
\newlength{\lengthA}
\setlength{\lengthA}{<<7.25pt>>}
\newlength{\lengthB}
\setlength{\lengthB}{<<4.75pt>>}
\ifdimcomp{<<(\lengthA + \lengthB) / 2>>}{<<>>>}{<<2.75pt * 2>>}{<<true>>}{false}
\ifdimcomp{<<(\lengthA + \lengthB) / 2>>}{<<>>>}{<<25pt / 6>>}{<<true>>}{false}
\end{ltxcode}
%
Technically, this command is a \latex wrapper for the \tex primitive \cmd{ifdim}, incorporating \cmd{dimexpr}. Since both \cmd{ifdimcomp} and \cmd{ifnumcomp} are expandable, they may also be nested:
\begin{ltxcode}
<<\ifnumcomp>>{<<\ifdimcomp>>{<<5pt+5pt>>}{<<=>>}{<<10pt>>}{<<1>>}{<<0>>}}{<<>>>}{<<0>>}{<<true>>}{false}
\end{ltxcode}
\cmditem{ifdimequal}{dimen expression}{dimen expression}{true}{false}
Alternative syntax for |\ifdimcomp{...}{=}{...}{...}{...}|.
\cmditem{ifdimgreater}{dimen expression}{dimen expression}{true}{false}
Alternative syntax for |\ifdimcomp{...}{>}{...}{...}{...}|.
\cmditem{ifdimless}{dimen expression}{dimen expression}{true}{false}
Alternative syntax for |\ifdimcomp{...}{<}{...}{...}{...}|.
\end{ltxsyntax}
\subsubsection{Boolean Expressions}
\label{aut:tst:bol}
The commands in this section are replacements for the \cmd{ifthenelse} command provided by the \sty{ifthen} package. They serve the same purpose but differ in syntax, concept, and implementation. In contrast to \cmd{ifthenelse}, they do not provide any tests of their own but serve as a frontend to other tests. Any test which satisfies certain syntactical requirements may be used in a boolean expression.
\begin{ltxsyntax}
\cmditem{ifboolexpr}{expression}{true}{false}
Evaluates the \prm{expression} and executes \prm{true} if it is true, and \prm{false} otherwise. The \prm{expression} is evaluated sequentially from left to right. The following elements, discussed in more detail below, are available in the \prm{expression}: the test operators \texttt{togl}, \texttt{bool}, \texttt{test}; the logical operators \texttt{not}, \texttt{and}, \texttt{or}; and the subexpression delimiter \texttt{(...)}. Spaces, tabs, and line endings may be used freely to arrange the \prm{expression} visually. Blank lines are not permissible in the \prm{expression}. This command is robust.
\cmditem{ifboolexpe}{expression}{true}{false}
An expandable version of \cmd{ifboolexpr} which may be processed in an expansion-only context, \eg in an \cmd{edef} or in a \cmd{write} operation. Note that all tests used in the \prm{expression} must be expandable, even if \cmd{ifboolexpe} is not located in an expansion-only context.
\cmditem{whileboolexpr}{expression}{code}
Evaluates the \prm{expression} like \cmd{ifboolexpr} and repeatedly executes the \prm{code} while the expression is true. The \prm{code} may be any valid \tex or \latex code. This command is robust.
\cmditem{unlessboolexpr}{expression}{code}
Similar to \cmd{whileboolexpr} but negates the \prm{expression}, \ie it keeps executing the \prm{code} repeatedly unless the expression is true. This command is robust.
\end{ltxsyntax}
%
The following test operators are available in the \prm{expression}:
\begin{marglist}
\appto\marglistfont{\verbatimfont}
\item[togl]
Use the \texttt{togl} operator to test the state of a flag defined with \cmd{newtoggle}. For example:
\begin{ltxcode}
<<\iftoggle{mytoggle}>>{true}{false}
\end{ltxcode}
%
becomes
\begin{ltxcode}
\ifboolexpr{ <<togl>> {<<mytoggle>>} }{true}{false}
\end{ltxcode}
%
The \texttt{togl} operator may be used with both \cmd{ifboolexpr} and \cmd{ifboolexpe}.
\item[bool]
Use the \texttt{bool} operator to perform a boolean test based on plain \tex syntax, \ie any test normally employed like this:
\begin{ltxcode}
<<\iftest>> true<<\else>> false<<\fi>>
\end{ltxcode}
%
This includes all flags defined with \cmd{newif} as well as \tex primitives such as \cmd{ifmmode}. The \cmd{if} prefix is omitted when using the flag or the primitive in the expression. For example:
\begin{ltxcode}
<<\ifmmode>> true\else false\fi
<<\ifmytest>> true\else false\fi
\end{ltxcode}
%
becomes
\begin{ltxcode}
\ifboolexpr{ <<bool>> {<<mmode>>} }{true}{false}
\ifboolexpr{ <<bool>> {<<mytest>>} }{true}{false}
\end{ltxcode}
%
This also works with flags defined with \cmd{newbool} (see \secref{aut:bo1:bol}). In this case
\begin{ltxcode}
<<\ifbool{mybool}>>{true}{false}
\end{ltxcode}
%
becomes
\begin{ltxcode}
\ifboolexpr{ <<bool>> {<<mybool>>} }{true}{false}
\end{ltxcode}
%
The \texttt{bool} operator may be used with both \cmd{ifboolexpr} and \cmd{ifboolexpe}.
\item[test]
Use the \texttt{test} operator to perform a test based on \latex syntax, \ie any test normally employed like this:
\begin{ltxcode}
<<\iftest>>{<<true>>}{<<false>>}
\end{ltxcode}
%
This applies to all macros based on \latex syntax, \ie the macro must take a \prm{true} and a \prm{false} argument and these must be the final arguments. For example:
\begin{ltxcode}
<<\ifdef>>{\somemacro}<<{true}{false}>>
<<\ifdimless>>{\textwidth}{365pt}<<{true}{false}>>
<<\ifnumcomp>>{\value{somecounter}}{>}{3}<<{true}{false}>>
\end{ltxcode}
When using such tests in the \prm{expression}, their \prm{true} and \prm{false} arguments are omitted. For example:
\begin{ltxcode}
<<\ifcsdef{mymacro}>>{true}{false}
\end{ltxcode}
%
becomes
\begin{ltxcode}
\ifboolexpr{ <<test>> {<<\ifcsdef{mymacro}>>} }{true}{false}
\end{ltxcode}
%
and
\begin{ltxcode}
<<\ifnumcomp{\value{mycounter}}{>}{3}>>{true}{false}
\end{ltxcode}
%
becomes
\begin{ltxcode}
\ifboolexpr{
<<test>> {<<\ifnumcomp{\value{mycounter}}{>}{3}>>}
}
{true}
{false}
\end{ltxcode}
%
The \texttt{test} operator may be used with \cmd{ifboolexpr} without any restrictions. It may also be used with \cmd{ifboolexpe}, provided that the test is expandable. Some of the generic tests in \secref{aut:tst} are robust and may not be used with \cmd{ifboolexpe}, even if \cmd{ifboolexpe} is not located in an expansion-only context. Use \cmd{ifboolexpr} instead if the test is not expandable.
\end{marglist}
Since \cmd{ifboolexpr} and \cmd{ifboolexpe} imply processing overhead, there is generally no benefit in employing them for a single test. The stand-alone tests in \secref{aut:tst} are more efficient than \texttt{test}, \cmd{ifbool} from \secref{aut:bo1:bol} is more efficient than \texttt{bool}, and \cmd{iftoggle} from \secref{aut:bo1:tgl} is more efficient than \texttt{togl}. The point of \cmd{ifboolexpr} and \cmd{ifboolexpe} is that they support logical operators and subexpressions. The following logical operators are available in the \prm{expression}:
\begin{marglist}
\appto\marglistfont{\verbatimfont}
\item[not]
The \texttt{not} operator negates the truth value of the immediately following element. You may prefix \texttt{togl}, \texttt{bool}, \texttt{test}, and subexpressions with \texttt{not}. For example:
\begin{ltxcode}
\ifboolexpr{
<<not>> bool {mybool}
}
{true}
{false}
\end{ltxcode}
%
will yield \prm{true} if \texttt{mybool} is false and \prm{false} if \texttt{mybool} is true, and
\begin{ltxcode}
\ifboolexpr{
<<not (>> bool {boolA} or bool {boolB} <<)>>
}
{true}
{false}
\end{ltxcode}
%
will yield \prm{true} if both \texttt{boolA} and \texttt{boolB} are false.
\item[and]
The \texttt{and} operator expresses a conjunction (both \emph{a} and \emph{b}). The \prm{expression} is true if all elements joined with \texttt{and} are true. For example:
\begin{ltxcode}
\ifboolexpr{
bool {boolA} <<and>> bool {boolB}
}
{true}
{false}
\end{ltxcode}
%
will yield \prm{true} if both \texttt{bool} tests are true. The \texttt{nand} operator (negated \texttt{and}, \ie not both) is not provided as such but may be expressed by using \texttt{and} in a negated subexpression. For example:
\begin{ltxcode}
bool {boolA} <<nand>> bool {boolB}
\end{ltxcode}
%
may be written as
\begin{ltxcode}
<<not>> <<(>> bool {boolA} <<and>> bool {boolB} <<)>>
\end{ltxcode}
\item[or]
The \texttt{or} operator expresses a non-exclusive disjunction (either \emph{a} or \emph{b} or both). The \prm{expression} is true if at least one of the elements joined with \texttt{or} is true. For example:
\begin{ltxcode}
\ifboolexpr{
togl {toglA} <<or>> togl {toglB}
}
{true}
{false}
\end{ltxcode}
%
will yield \prm{true} if either \texttt{togl} test or both tests are true. The \texttt{nor} operator (negated non-exclusive disjunction, \ie neither \emph{a} nor \emph{b} nor both) is not provided as such but may be expressed by using \texttt{or} in a negated subexpression. For example:
\begin{ltxcode}
bool {boolA} <<nor>> bool {boolB}
\end{ltxcode}
%
may be written as
\begin{ltxcode}
<<not>> <<(>> bool {boolA} <<or>> bool {boolB} <<)>>
\end{ltxcode}
\item[(...)]
The parentheses delimit a subexpression in the \prm{expression}. The subexpression is evaluated and the result of this evaluation is treated as a single truth value in the enclosing expression. Subexpressions may be nested. For example, the expression:
\begin{ltxcode}
<<(>> bool {boolA} or bool {boolB} <<)>>
and
<<(>> bool {boolC} or bool {boolD} <<)>>
\end{ltxcode}
%
is true if both subexpressions are true, \ie if at least one of \texttt{boolA}/\texttt{boolB} and at least one of \texttt{boolC}/\texttt{boolD} is true. Subexpressions are generally not required if all elements are joined with \texttt{and} or with \texttt{or}. For example, the expressions
\begin{ltxcode}
bool {boolA} <<and>> bool {boolB} <<and>> {boolC} <<and>> bool {boolD}
bool {boolA} <<or>> bool {boolB} <<or>> {boolC} <<or>> bool {boolD}
\end{ltxcode}
%
will yield the expected results: the first one is true if all elements are true; the second one is true if at least one element is true. However, when combining \texttt{and} and \texttt{or}, it is advisable to always group the elements in subexpressions in order to avoid potential misconceptions which may arise from differences between the semantics of formal boolean expressions and the semantics of natural languages. For example, the following expression
\begin{ltxcode}
bool {<<coffee>>} <<and>> bool {<<milk>>} <<or>> bool {<<sugar>>}
\end{ltxcode}
%
is always true if \texttt{sugar} is true since the \texttt{or} operator will take the result of the \texttt{and} evaluation as input. In contrast to the meaning of this expression when pronounced in English, it is not processed like this
\begin{ltxcode}
bool {<<coffee>>} <<and>> <<(>> bool {<<milk>>} <<or>> bool {<<sugar>>} <<)>>
\end{ltxcode}
%
but evaluated strictly from left to right:
\begin{ltxcode}
<<(>> bool {<<coffee>>} <<and>> bool {<<milk>>} <<)>> <<or>> bool {<<sugar>>}
\end{ltxcode}
%
which is probably not what you meant to order.
\end{marglist}
\subsection{List Processing}
\label{aut:lst}
\subsubsection{User Input}
\label{aut:lst:inp}
The tools in this section are primarily designed to handle user input. When building lists for internal use by a package, using the tools in section \ref{aut:lst:int} may be preferable as they allow testing if an element is in a list.
\begin{ltxsyntax}
\cmditem{DeclareListParser}{command}{separator}
This command defines a list parser similar to the \cmd{docsvlist} command below, which is defined like this:
\begin{ltxcode}
\DeclareListParser{\docsvlist}{,}
\end{ltxcode}
%
Note that the list parsers are sensitive to the category code of the \prm{separator}.
\cmditem*{DeclareListParser*}{command}{separator}
The starred variant of \cmd{DeclareListParser} defines a list parser similar to the \cmd{forcsvlist} command below, which is defined like this:
\begin{ltxcode}
\DeclareListParser*{\forcsvlist}{,}
\end{ltxcode}
\cmditem{docsvlist}{item, item, ...}
This command loops over a comma"=separated list of items and executes the auxiliary command \cmd{do} for every item in the list, passing the item as an argument. In contrast to the \cmd{@for} loop in the \latex kernel, \cmd{docsvlist} is expandable. With a suitable definition of \cmd{do}, lists may be processed in an \cmd{edef} or a comparable context. You may use \cmd{listbreak} at the end of the replacement text of \cmd{do} to stop processing and discard the remaining items in the list. Whitespace after list separators is ignored. If an item contains a comma or starts with a space, it must be wrapped in curly braces. The braces will be removed as the list is processed. Here is a usage example which prints a comma"=separated list as an \env{itemize} environment:
\begin{ltxcode}
\begin{itemize}
\renewcommand*{\do}[1]{\item #1}
\docsvlist{item1, item2, {item3a, item3b}, item4}
\end{itemize}
\end{ltxcode}
%
Here is another example:
\begin{ltxcode}
\renewcommand*{\do}[1]{* #1\MessageBreak}
\PackageInfo{mypackage}{%
Example list:\MessageBreak
\docsvlist{item1, item2, {item3a, item3b}, item4}}
\end{ltxcode}
%
In this example, the list is written to the log file as part of an informational message. The list processing takes place during the \cmd{write} operation.
\cmditem{forcsvlist}{handler}{item, item, ...}
This command is similar to \cmd{docsvlist} except that \cmd{do} is replaced by a \prm{handler} specified at invocation time. The \prm{handler} may also be a sequence of commands, provided that the command given last takes the item as trailing argument. For example, the following code will convert a comma"=separated list of items into an internal list called \cmd{mylist}:
\begin{ltxcode}
\forcsvlist{\listadd\mylist}{item1, item2, item3}
\end{ltxcode}
\end{ltxsyntax}
\subsubsection{Internal Lists}
\label{aut:lst:int}
The tools in this section handle internal lists of data. An <internal list> in this context is a plain macro without any parameters and prefixes which is employed to collect data. These lists use a special character as internal list separator.\footnote{The character \texttt{\string|} with category code 3. Note that you may not typeset a list by saying \cmd{listname}. Use \cmd{show} instead to inspect the list.} When processing user input in list format, see the tools in section \ref{aut:lst:inp}.
\begin{ltxsyntax}
\cmditem{listadd}{listmacro}{item}
This command appends an \prm{item} to a \prm{listmacro}. A blank \prm{item} is not added to the list.
\cmditem{listgadd}{listmacro}{item}
Similar to \cmd{listadd} except that the assignment is global.
\cmditem{listeadd}{listmacro}{item}
Similar to \cmd{listadd} except that the \prm{item} is expanded at definition"=time. Only the new \prm{item} is expanded, the \prm{listmacro} is not. If the expanded \prm{item} is blank, it is not added to the list.
\cmditem{listxadd}{listmacro}{item}
Similar to \cmd{listeadd} except that the assignment is global.
\cmditem{listcsadd}{listcsname}{item}
Similar to \cmd{listadd} except that it takes a control sequence name as its first argument.
\cmditem{listcsgadd}{listcsname}{item}
Similar to \cmd{listcsadd} except that the assignment is global.
\cmditem{listcseadd}{listcsname}{item}
Similar to \cmd{listeadd} except that it takes a control sequence name as its first argument.
\cmditem{listcsxadd}{listcsname}{item}
Similar to \cmd{listcseadd} except that the assignment is global.
\cmditem{listremove}{listmacro}{item}
This command removes an \prm{item} from a \prm{listmacro}. A blank \prm{item} is ignored.
\cmditem{listgremove}{listmacro}{item}
Similar to \cmd{listremove} except that the assignment is global.
\cmditem{listcsremove}{listcsname}{item}
Similar to \cmd{listremove} except that it takes a control sequence name as its first argument.
\cmditem{listcsgremove}{listcsname}{item}
Similar to \cmd{listcsremove} except that the assignment is global.
\cmditem{dolistloop}{listmacro}
This command loops over all items in a \prm{listmacro} and executes the auxiliary command \cmd{do} for every item in the list, passing the item as an argument. The list loop itself is expandable. You may use \cmd{listbreak} at the end of the replacement text of \cmd{do} to stop processing and discard the remaining items in the list. Here is a usage example which prints an internal list called \cmd{mylist} as an \env{itemize} environment:
\begin{ltxcode}
\begin{itemize}
\renewcommand*{\do}[1]{\item #1}
\dolistloop{\mylist}
\end{itemize}
\end{ltxcode}
\cmditem{dolistcsloop}{listcsname}
Similar to \cmd{dolistloop} except that it takes a control sequence name as its argument.
\cmditem{forlistloop}{handler}{listmacro}
This command is similar to \cmd{dolistloop} except that \cmd{do} is replaced by a \prm{handler} specified at invocation time. The \prm{handler} may also be a sequence of commands, provided that the command given last takes the item as trailing argument. For example, the following code will prefix all items in the internal list \cmd{mylist} with \cmd{item}, count the items as the list is processed, and append the item count at the end:
\begin{ltxcode}
\newcounter{itemcount}
\begin{itemize}
\forlistloop{\stepcounter{itemcount}\item}{\mylist}
\item Total: \number\value{itemcount} items
\end{itemize}
\end{ltxcode}
\cmditem{forlistcsloop}{handler}{listcsname}
Similar to \cmd{forlistloop} except that it takes a control sequence name as its second argument.
\cmditem{ifinlist}{item}{listmacro}{true}{false}
This command executes \prm{true} if the \prm{item} is included in a \prm{listmacro}, and \prm{false} otherwise. Note that this test uses pattern matching based on \tex's argument scanner to check if the search string is included in the list. This means that it is usually faster than looping over all items in the list, but it also implies that the items must not include curly braces which would effectively hide them from the scanner. In other words, this macro is most useful when dealing with lists of plain strings rather than printable data. When dealing with printable text, it is safer to use \cmd{dolistloop} to check if an item is in the list as follows:
\begin{ltxcode}
\renewcommand*{\do}[1]{%
\ifstrequal{#1}{<<item>>}
{item found!\listbreak}
{}}
\dolistloop{\mylist}
\end{ltxcode}
\cmditem{xifinlist}{item}{listmacro}{true}{false}
Similar to \cmd{ifinlist} except that the \prm{item} is expanded prior to the test.
\cmditem{ifinlistcs}{item}{listcsname}{true}{false}
Similar to \cmd{ifinlist} except that it takes a control sequence name as its second argument.
\cmditem{xifinlistcs}{item}{listcsname}{true}{false}
Similar to \cmd{xifinlist} except that it takes a control sequence name as its second argument.
\end{ltxsyntax}
\subsection{Miscellaneous Tools}
\label{aut:msc}
\begin{ltxsyntax}
\cmditem{rmntonum}{numeral}
The \tex primitive \cmd{romannumeral} converts an integer to a Roman numeral but \tex or \latex provide no command which goes the opposite way. \cmd{rmntonum} fills this gap. It takes a Roman numeral as its argument and converts it to the corresponding integer. Since it is expandable, it may also be used in counter assignments or arithmetic tests:
\begin{ltxcode}
<<\rmntonum>>{<<mcmxcv>>}
\setcounter{counter}{<<\rmntonum>>{<<CXVI>>}}
\ifnumless{<<\rmntonum>>{<<mcmxcviii>>}}{2000}{true}{false}
\end{ltxcode}
%
The \prm{numeral} argument must be a literal string. It will be detokenized prior to parsing. The parsing of the numeral is case"=insensitive and whitespace in the argument is ignored. If there is an invalid token in the argument, \cmd{rmntonum} will expand to~\texttt{-1}; an empty argument will yield an empty string. Note that \cmd{rmntonum} will not check the numeral for formal validity. For example, both \texttt{V} and \texttt{VX} would yield \texttt{5}, \texttt{IC} would yield \texttt{99}, etc.
\cmditem{ifrmnum}{string}{true}{false}
Expands to \prm{true} if \prm{string} is a Roman numeral, and to \prm{false} otherwise. The \prm{string} will be detokenized prior to performing the test. The test is case"=insensitive and ignores whitespace in the \prm{string}. Note that \cmd{ifrmnum} will not check the numeral for formal validity. For example, both \texttt{V} and \texttt{VXV} will yield \prm{true}. Strictly speaking, what \cmd{ifrmnum} does is parse the \prm{string} in order to find out if it consists of characters which may form a valid Roman numeral, but it will not check if they really are a valid Roman numeral.
\end{ltxsyntax}
\section{Reporting issues}
The development code for \sty{etoolbox} is hosted on GitHub: \url{https://github.com/josephwright/etoolbox}. This is the best place to log any issues with the package.
\section{Revision History}
This revision history is a list of changes relevant to users of this package. Changes of a more technical nature which do not affect the user interface or the behavior of the package are not included in the list. If an entry in the revision history states that a feature has been \emph{improved} or \emph{extended}, this indicates a syntactically backwards compatible modification, such as the addition of an optional argument to an existing command. Entries stating that a feature has been \emph{modified} demand attention. They indicate a modification which may require changes to existing documents in some, hopefully rare, cases. The numbers on the right indicate the relevant section of this manual.
\begin{changelog}
\begin{release}{2.5f}{2018-08-18}
\item Fix issue with \cmd{ifdefempty}, \cmd{ifcsempty}, \cs{ifdefvoid}
and \cmd{ifcsvoid} when applied to macros expanding to space tokens
\end{release}
\begin{release}{2.5e}{2018-02-11}
\item More work on empty list separator in \cmd{DeclareListParser}
\end{release}
\begin{release}{2.5d}{2018-02-10}
\item Allow for empty list separator in \cmd{DeclareListParser}
\end{release}
\begin{release}{2.5c}{2018-02-06}
\item Fix issue with \cmd{forcsvlist} introduced by v2.5b
\end{release}
\begin{release}{2.5b}{2018-02-04}
\item Preserve braces in some internal steps
\item Internal performance improvements in list processors
\end{release}
\begin{release}{2.5a}{2018-02-03}
\item Internal performance improvements in list processors
\end{release}
\begin{release}{2.5}{2017-11-22}
\item Added \cmd{csgundef}\see{aut:def:def}
\item Added \cmd{gundef}\see{aut:def:def}
\item Allow scanning of macros containing new line characters
\end{release}
\begin{release}{2.4}{2017-01-02}
\item Renamed \cmd{listdel} to \cmd{listremove} (name clash)\see{aut:lst:int}
\item Renamed \cmd{listgdel} to \cmd{listgremove} (name clash)\see{aut:lst:int}
\end{release}
\begin{release}{2.3}{2016-12-26}
\item Added \cmd{listdel}\see{aut:lst:int}
\item Added \cmd{listgdel}\see{aut:lst:int}
\end{release}
\begin{release}{2.2b}{2016-12-01}
\item Fixed \cmd{ifdefltxprotect} for some types of \latex robust commands
\item Remove redundant macro after \cmd{robustify} processing
\end{release}
\begin{release}{2.2a}{2015-08-02}
\item Fixed robustness bug in \cmd{ifblank}/\cmd{notblank}
\end{release}
\begin{release}{2.2}{2015-05-04}
\item Added \cmd{csmeaning}\see{aut:def:def}
\end{release}
\begin{release}{2.1d}{2015-03-19}
\item Fixed issue with \sty{bm} and some classes
\end{release}
\begin{release}{2.1c}{2015-03-15}
\item Fixed space bug in \cmd{ifpatchable}
\item Fixed space bug in \cmd{patchcmd}
\item Fixed space bug in \cmd{robustify}
\end{release}
\begin{release}{2.1b}{2015-03-10}
\item Minor documentation fixes
\end{release}
\begin{release}{2.1a}{2015-03-10}
\item New maintainer: Joseph Wright
\item Skip loading \sty{etex} package with newer \latex kernel releases
\end{release}
\begin{release}{2.1}{2011-01-03}
\item Added \cmd{AtBeginEnvironment}\see{use:env}
\item Added \cmd{AtEndEnvironment}\see{use:env}
\item Added \cmd{BeforeBeginEnvironment}\see{use:env}
\item Added \cmd{AfterEndEnvironment}\see{use:env}
\item Added \cmd{ifdefstrequal}\see{aut:tst:def}
\item Added \cmd{ifcsstrequal}\see{aut:tst:def}
\item Added \cmd{ifdefcounter}\see{aut:tst:cnt}
\item Added \cmd{ifcscounter}\see{aut:tst:cnt}
\item Added \cmd{ifltxcounter}\see{aut:tst:cnt}
\item Added \cmd{ifdeflength}\see{aut:tst:cnt}
\item Added \cmd{ifcslength}\see{aut:tst:cnt}
\item Added \cmd{ifdefdimen}\see{aut:tst:cnt}
\item Added \cmd{ifcsdimen}\see{aut:tst:cnt}
\end{release}
\begin{release}{2.0a}{2010-09-12}
\item Fixed bug in \cmd{patchcmd}, \cmd{apptocmd}, \cmd{pretocmd}\see{aut:pat}
\end{release}
\begin{release}{2.0}{2010-08-21}
\item Added \cmd{csshow}\see{aut:def:def}
\item Added \cmd{DeclareListParser*}\see{aut:lst:inp}
\item Added \cmd{forcsvlist}\see{aut:lst:inp}
\item Added \cmd{forlistloop}\see{aut:lst:int}
\item Added \cmd{forlistcsloop}\see{aut:lst:int}
\item Allow testing \cmd{par} in macro tests\see{aut:tst:def}
\item Fixed some bugs
\end{release}
\begin{release}{1.9}{2010-04-10}
\item Improved \cmd{letcs}\see{aut:def:def}
\item Improved \cmd{csletcs}\see{aut:def:def}
\item Improved \cmd{listeadd}\see{aut:lst:int}
\item Improved \cmd{listxadd}\see{aut:lst:int}
\item Added \cmd{notblank}\see{aut:tst:str}
\item Added \cmd{ifnumodd}\see{aut:tst:num}
\item Added \cmd{ifboolexpr}\see{aut:tst:bol}
\item Added \cmd{ifboolexpe}\see{aut:tst:bol}
\item Added \cmd{whileboolexpr}\see{aut:tst:bol}
\item Added \cmd{unlessboolexpr}\see{aut:tst:bol}
\end{release}
\begin{release}{1.8}{2009-08-06}
\item Improved \cmd{deflength}\see{use:cal}
\item Added \cmd{ifnumcomp}\see{aut:tst:num}
\item Added \cmd{ifnumequal}\see{aut:tst:num}
\item Added \cmd{ifnumgreater}\see{aut:tst:num}
\item Added \cmd{ifnumless}\see{aut:tst:num}
\item Added \cmd{ifdimcomp}\see{aut:tst:num}
\item Added \cmd{ifdimequal}\see{aut:tst:num}
\item Added \cmd{ifdimgreater}\see{aut:tst:num}
\item Added \cmd{ifdimless}\see{aut:tst:num}
\end{release}
\begin{release}{1.7}{2008-06-28}
\item Renamed \cmd{AfterBeginDocument} to \cmd{AfterEndPreamble} (name clash)\see{use:pre}
\item Resolved conflict with \sty{hyperref}
\item Rearranged manual slightly
\end{release}
\begin{release}{1.6}{2008-06-22}
\item Improved \cmd{robustify}\see{use:pat}
\item Improved \cmd{patchcmd} and \cmd{ifpatchable}\see{aut:pat}
\item Modified and improved \cmd{apptocmd}\see{aut:pat}
\item Modified and improved \cmd{pretocmd}\see{aut:pat}
\item Added \cmd{ifpatchable*}\see{aut:pat}
\item Added \cmd{tracingpatches}\see{aut:pat}
\item Added \cmd{AfterBeginDocument}\see{use:pre}
\item Added \cmd{ifdefmacro}\see{aut:tst:def}
\item Added \cmd{ifcsmacro}\see{aut:tst:def}
\item Added \cmd{ifdefprefix}\see{aut:tst:def}
\item Added \cmd{ifcsprefix}\see{aut:tst:def}
\item Added \cmd{ifdefparam}\see{aut:tst:def}
\item Added \cmd{ifcsparam}\see{aut:tst:def}
\item Added \cmd{ifdefprotected}\see{aut:tst:def}
\item Added \cmd{ifcsprotected}\see{aut:tst:def}
\item Added \cmd{ifdefltxprotect}\see{aut:tst:def}
\item Added \cmd{ifcsltxprotect}\see{aut:tst:def}
\item Added \cmd{ifdefempty}\see{aut:tst:def}
\item Added \cmd{ifcsempty}\see{aut:tst:def}
\item Improved \cmd{ifdefvoid}\see{aut:tst:def}
\item Improved \cmd{ifcsvoid}\see{aut:tst:def}
\item Added \cmd{ifstrempty}\see{aut:tst:str}
\item Added \cmd{setbool}\see{aut:bo1:bol}
\item Added \cmd{settoggle}\see{aut:bo1:tgl}
\end{release}
\begin{release}{1.5}{2008-04-26}
\item Added \cmd{defcounter}\see{use:cal}
\item Added \cmd{deflength}\see{use:cal}
\item Added \cmd{ifdefstring}\see{aut:tst:def}
\item Added \cmd{ifcsstring}\see{aut:tst:def}
\item Improved \cmd{rmntonum}\see{aut:msc}
\item Added \cmd{ifrmnum}\see{aut:msc}
\item Added extended \pdf bookmarks to this manual
\item Rearranged manual slightly
\end{release}
\begin{release}{1.4}{2008-01-24}
\item Resolved conflict with \sty{tex4ht}
\end{release}
\begin{release}{1.3}{2007-10-08}
\item Renamed package from \sty{elatex} to \sty{etoolbox}\see{int}
\item Renamed \cmd{newswitch} to \cmd{newtoggle} (name clash)\see{aut:bo1:tgl}
\item Renamed \cmd{provideswitch} to \cmd{providetoggle} (consistency)\see{aut:bo1:tgl}
\item Renamed \cmd{switchtrue} to \cmd{toggletrue} (consistency)\see{aut:bo1:tgl}
\item Renamed \cmd{switchfalse} to \cmd{togglefalse} (consistency)\see{aut:bo1:tgl}
\item Renamed \cmd{ifswitch} to \cmd{iftoggle} (consistency)\see{aut:bo1:tgl}
\item Renamed \cmd{notswitch} to \cmd{nottoggle} (consistency)\see{aut:bo1:tgl}
\item Added \cmd{AtEndPreamble}\see{use:pre}
\item Added \cmd{AfterEndDocument}\see{use:pre}
\item Added \cmd{AfterPreamble}\see{use:pre}
\item Added \cmd{undef}\see{aut:def:def}
\item Added \cmd{csundef}\see{aut:def:def}
\item Added \cmd{ifdefvoid}\see{aut:tst:def}
\item Added \cmd{ifcsvoid}\see{aut:tst:def}
\item Added \cmd{ifdefequal}\see{aut:tst:def}
\item Added \cmd{ifcsequal}\see{aut:tst:def}
\item Added \cmd{ifstrequal}\see{aut:tst:str}
\item Added \cmd{listadd}\see{aut:lst:int}
\item Added \cmd{listeadd}\see{aut:lst:int}
\item Added \cmd{listgadd}\see{aut:lst:int}
\item Added \cmd{listxadd}\see{aut:lst:int}
\item Added \cmd{listcsadd}\see{aut:lst:int}
\item Added \cmd{listcseadd}\see{aut:lst:int}
\item Added \cmd{listcsgadd}\see{aut:lst:int}
\item Added \cmd{listcsxadd}\see{aut:lst:int}
\item Added \cmd{ifinlist}\see{aut:lst:int}
\item Added \cmd{xifinlist}\see{aut:lst:int}
\item Added \cmd{ifinlistcs}\see{aut:lst:int}
\item Added \cmd{xifinlistcs}\see{aut:lst:int}
\item Added \cmd{dolistloop}\see{aut:lst:int}
\item Added \cmd{dolistcsloop}\see{aut:lst:int}
\end{release}
\begin{release}{1.2}{2007-07-13}
\item Renamed \cmd{patchcommand} to \cmd{patchcmd} (name clash)\see{aut:pat}
\item Renamed \cmd{apptocommand} to \cmd{apptocmd} (consistency)\see{aut:pat}
\item Renamed \cmd{pretocommand} to \cmd{pretocmd} (consistency)\see{aut:pat}
\item Added \cmd{newbool}\see{aut:bo1:bol}
\item Added \cmd{providebool}\see{aut:bo1:bol}
\item Added \cmd{booltrue}\see{aut:bo1:bol}
\item Added \cmd{boolfalse}\see{aut:bo1:bol}
\item Added \cmd{ifbool}\see{aut:bo1:bol}
\item Added \cmd{notbool}\see{aut:bo1:bol}
\item Added \cmd{newswitch}\see{aut:bo1:tgl}
\item Added \cmd{provideswitch}\see{aut:bo1:tgl}
\item Added \cmd{switchtrue}\see{aut:bo1:tgl}
\item Added \cmd{switchfalse}\see{aut:bo1:tgl}
\item Added \cmd{ifswitch}\see{aut:bo1:tgl}
\item Added \cmd{notswitch}\see{aut:bo1:tgl}
\item Added \cmd{DeclareListParser}\see{aut:lst:inp}
\item Added \cmd{docsvlist}\see{aut:lst:inp}
\item Added \cmd{rmntonum}\see{aut:msc}
\end{release}
\begin{release}{1.1}{2007-05-28}
\item Added \cmd{protected@csedef}\see{aut:def:def}
\item Added \cmd{protected@csxdef}\see{aut:def:def}
\item Added \cmd{gluedef}\see{aut:def:cal}
\item Added \cmd{gluegdef}\see{aut:def:cal}
\item Added \cmd{csgluedef}\see{aut:def:cal}
\item Added \cmd{csgluegdef}\see{aut:def:cal}
\item Added \cmd{mudef}\see{aut:def:cal}
\item Added \cmd{mugdef}\see{aut:def:cal}
\item Added \cmd{csmudef}\see{aut:def:cal}
\item Added \cmd{csmugdef}\see{aut:def:cal}
\item Added \cmd{protected@eappto}\see{aut:hok:app}
\item Added \cmd{protected@xappto}\see{aut:hok:app}
\item Added \cmd{protected@cseappto}\see{aut:hok:app}
\item Added \cmd{protected@csxappto}\see{aut:hok:app}
\item Added \cmd{protected@epreto}\see{aut:hok:pre}
\item Added \cmd{protected@xpreto}\see{aut:hok:pre}
\item Added \cmd{protected@csepreto}\see{aut:hok:pre}
\item Added \cmd{protected@csxpreto}\see{aut:hok:pre}
\item Fixed bug in \cmd{newrobustcmd}\see{use:def}
\item Fixed bug in \cmd{renewrobustcmd}\see{use:def}
\item Fixed bug in \cmd{providerobustcmd}\see{use:def}
\end{release}
\begin{release}{1.0}{2007-05-07}
\item Initial public release
\end{release}
\end{changelog}
\end{document}
|