-
Notifications
You must be signed in to change notification settings - Fork 6
/
etoolbox.sty.tags
1285 lines (1181 loc) · 36 KB
/
etoolbox.sty.tags
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
-- Copyright 2007-2011 Philipp Lehman
-- Copyright 2015-2020 Joseph Wright
-- Copyright 2022 Augusto Stoffel
-- SPDX-License-Identifier: LPPL-1.3c+
--
-- Adapted form the etoolbox package documentation, which can be found at
-- https://ctan.org/pkg/etoolbox.
ctan_package = "etoolbox"
dependencies = {"etex.sty"}
commands = {
AfterEndPreamble = {
arguments = {{meta = "code"}},
details = [[
```latex
\AfterEndPreamble{code}
```
This hook differs from `\AtBeginDocument` in that the `code` is executed
at the very end of `\begin{document}`, after any `\AtBeginDocument`
code. Note that commands whose scope has been restricted to the preamble
with `\@onlypreamble` are no longer available when this hook is
executed.
]]
},
AfterPreamble = {
arguments = {{meta = "code"}},
details = [[
```latex
\AfterPreamble{code}
```
This hook is a variant of `\AtBeginDocument` which may be used in both
the preamble and the document body. When used in the preamble, it
behaves exactely like `\AtBeginDocument`. When used in the document
body, it immediately executes its `code` argument. `\AtBeginDocument`
would issue an error in this case. This hook is useful to defer code
which needs to write to the main `aux` file.
]]
},
AtBeginEnvironment = {
arguments = {{meta = "environment"}, {meta = "code"}},
details = [[
```latex
\AtBeginEnvironment{environment}{code}
```
Appends arbitrary `code` to a hook executed by the `\begin` command at
the beginning of a given `environment`, immediately before
`\environment`, inside the group opened by `\begin`.
]]
},
BeforeBeginEnvironment = {
arguments = {{meta = "environment"}, {meta = "code"}},
details = [[
```latex
\BeforeBeginEnvironment{environment}{code}
```
Appends arbitrary `code` to a hook executed at a very early point by the
`\begin` command, before the group holding the environment is opened.
]]
},
DeclareListParser = {
arguments = {{meta = "command"}, {meta = "separator"}},
details = [[
```latex
\DeclareListParser{command}{separator}
```
This command defines a list parser similar to the `\docsvlist` command
below, which is defined like this:
\DeclareListParser{\docsvlist}{,}
Note that the list parsers are sensitive to the category code of the
`separator`.
]]
},
appto = {
details = [[
```latex
\appto<hook>{code}
```
This command appends arbitrary `code` to a `hook`. If the `code`
contains any parameter characters, they need not be doubled. This
command is robust.
]]
},
booltrue = {
arguments = {{meta = "name"}},
details = [[
```latex
\booltrue{name}
```
Sets the boolean flag `name` to `true`. This command is robust and may
be prefixed with `\global`. It will issue an error if the flag is
undefined.
]]
},
csappto = {
arguments = {{meta = "csname"}, {meta = "code"}},
details = [[
```latex
\csappto{csname}{code}
```
Similar to `\appto` except that it takes a control sequence name as its
first argument.
]]
},
csdef = {
arguments = {{meta = "csname"}},
details = [[
```latex
\csdef{csname}<arguments>{replacement text}
```
Similar to the TeX primitive `\def` except that it takes a control
sequence name as its first argument. This command is robust and
corresponds to `\@namedef`.
]]
},
csdimdef = {
arguments = {{meta = "csname"}, {meta = "dimen expression"}},
details = [[
```latex
\csdimdef{csname}{dimen expression}
```
Similar to `\dimdef` except that it takes a control sequence name as its
first argument.
]]
},
cseappto = {
arguments = {{meta = "csname"}, {meta = "code"}},
details = [[
```latex
\cseappto{csname}{code}
```
Similar to `\eappto` except that it takes a control sequence name as its
first argument.
]]
},
csedef = {
arguments = {{meta = "csname"}},
details = [[
```latex
\csedef{csname}<arguments>{replacement text}
```
Similar to the TeX primitive `\edef` except that it takes a control
sequence name as its first argument. This command is robust.
]]
},
csepreto = {
arguments = {{meta = "csname"}, {meta = "code"}},
details = [[
```latex
\csepreto{csname}{code}
```
Similar to `\epreto` except that it takes a control sequence name as its
first argument.
]]
},
csgluedef = {
arguments = {{meta = "csname"}, {meta = "glue expression"}},
details = [[
```latex
\csgluedef{csname}{glue expression}
```
Similar to `\gluedef` except that it takes a control sequence name as
its first argument.
]]
},
cslet = {
arguments = {{meta = "csname"}, {meta = "command"}},
details = [[
```latex
\cslet{csname}{command}
```
Similar to the TeX primitive `\let` except that the first argument is a
control sequence name. If `command` is undefined, `csname` will be
undefined as well after the assignment. This command is robust and may
be prefixed with `\global`.
]]
},
csletcs = {
arguments = {{meta = "csname"}, {meta = "csname"}},
details = [[
```latex
\csletcs{csname}{csname}
```
Similar to the TeX primitive `\let` except that both arguments are
control sequence names. If the second `csname` is undefined, the first
`csname` will be undefined as well after the assignment. This command is
robust and may be prefixed with `\global`.
]]
},
csmeaning = {
arguments = {{meta = "csname"}},
details = [[
```latex
\csmeaning{csname}
```
Similar to the TeX primitive `\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 `\relax` to it.
]]
},
csmudef = {
arguments = {{meta = "csname"}, {meta = "muglue expression"}},
details = [[
```latex
\csmudef{csname}{muglue expression}
```
Similar to `\mudef` except that it takes a control sequence name as its
first argument.
]]
},
csnumdef = {
arguments = {{meta = "csname"}, {meta = "integer expression"}},
details = [[
```latex
\csnumdef{csname}{integer expression}
```
Similar to `\numdef` except that it takes a control sequence name as its
first argument.
]]
},
cspreto = {
arguments = {{meta = "csname"}, {meta = "code"}},
details = [[
```latex
\cspreto{csname}{code}
```
Similar to `\preto` except that it takes a control sequence name as its
first argument.
]]
},
csundef = {
arguments = {{meta = "csname"}},
details = [[
```latex
\csundef{csname}
```
Similar to `\undef` except that it takes a control sequence name as its
argument. This command is robust and may be prefixed with `\global`.
]]
},
defcounter = {
arguments = {{meta = "counter"}, {meta = "integer expression"}},
details = [[
```latex
\defcounter{counter}{integer expression}
```
Assigns a value to a LaTeX `counter` previously initialized with
`\newcounter`. This command is similar in concept and syntax to
`\setcounter` except for two major differences. 1) The second argument
may be an `integer expression` which will be processed with `\numexpr`.
The `integer expression` may be any arbitrary code which is valid in
this context. The value assigned to the `counter` will be the result of
that calculation. 2) In contrast to `\setcounter`, the assignment is
local by default but `\defcounter` may be prefixed with `\global`. The
functional equivalent of `\setcounter` would be `\global``\defcounter`.
]]
},
dimdef = {
details = [[
```latex
\dimdef<command>{dimen expression}
```
Similar to `\edef` except that the `dimen expression` is processed with
`\dimexpr`. The `dimen expression` may be any arbitrary code which is
valid in this context. The replacement text assigned to the `command`
will be the result of that calculation. If the `command` is undefined,
it will be initialized to `0pt` before the `dimen expression` is
processed.
]]
},
docsvlist = {
arguments = {{meta = "item, item, ..."}},
details = [[
```latex
\docsvlist{item, item, ...}
```
This command loops over a comma-separated list of items and executes the
auxiliary command `\do` for every item in the list, passing the item as
an argument. In contrast to the `\@for` loop in the LaTeX kernel,
`\docsvlist` is expandable. With a suitable definition of `\do`, lists
may be processed in an `\edef` or a comparable context. You may use
`\listbreak` at the end of the replacement text of `\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 `itemize` environment:
\begin{itemize}
\renewcommand*{\do}[1]{\item #1}
\docsvlist{item1, item2, {item3a, item3b}, item4}
\end{itemize}
Here is another example:
\renewcommand*{\do}[1]{* #1\MessageBreak}
\PackageInfo{mypackage}{%
Example list:\MessageBreak
\docsvlist{item1, item2, {item3a, item3b}, item4}}
In this example, the list is written to the log file as part of an
informational message. The list processing takes place during the
`\write` operation.
]]
},
dolistloop = {
arguments = {{meta = "listmacro"}},
details = [[
```latex
\dolistloop{listmacro}
```
This command loops over all items in a `listmacro` and executes the
auxiliary command `\do` for every item in the list, passing the item as
an argument. The list loop itself is expandable. You may use
`\listbreak` at the end of the replacement text of `\do` to stop
processing and discard the remaining items in the list. Here is a usage
example which prints an internal list called `\mylist` as an `itemize`
environment:
\begin{itemize}
\renewcommand*{\do}[1]{\item #1}
\dolistloop{\mylist}
\end{itemize}
]]
},
eappto = {
details = [[
```latex
\eappto<hook>{code}
```
This command appends arbitrary `code` to a `hook`. The `code` is
expanded at definition-time. Only the new `code` is expanded, the
current replacement text of the `hook` is not. This command is robust.
]]
},
epreto = {
details = [[
```latex
\epreto<hook>{code}
```
Similar to `\eappto` except that the `code` is prepended.
]]
},
expandonce = {
details = [[
```latex
\expandonce<command>
```
This command expands a `command` once and prevents further expansion of
the replacement text. This command is expandable.
]]
},
forlistloop = {
arguments = {{meta = "handler"}, {meta = "listmacro"}},
details = [[
```latex
\forlistloop{handler}{listmacro}
```
This command is similar to `\dolistloop` except that `\do` is replaced
by a `handler` specified at invocation time. The `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 `\mylist` with `\item`, count the items
as the list is processed, and append the item count at the end:
\newcounter{itemcount}
\begin{itemize}
\forlistloop{\stepcounter{itemcount}\item}{\mylist}
\item Total: \number\value{itemcount} items
\end{itemize}
]]
},
gluedef = {
details = [[
```latex
\gluedef<command>{glue expression}
```
Similar to `\edef` except that the `glue expression` is processed with
`\glueexpr`. The `glue expression` may be any arbitrary code which is
valid in this context. The replacement text assigned to the `command`
will be the result of that calculation. If the `command` is undefined,
it will be initialized to `0pt plus 0pt minus 0pt` before the
`glue expression` is processed.
]]
},
ifblank = {
arguments = {{meta = "string"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifblank{string}{true}{false}
```
Expands to `true` if the `string` is blank (empty or spaces), and to
`false` otherwise. The `string` is not expanded in the test.
]]
},
ifboolexpr = {
arguments = {{meta = "expression"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifboolexpr{expression}{true}{false}
```
Evaluates the `expression` and executes `true` if it is true, and
`false` otherwise. The `expression` is evaluated sequentially from left
to right. The following elements, discussed in more detail below, are
available in the `expression`: the test operators `togl`, `bool`,
`test`; the logical operators `not`, `and`, `or`; and the subexpression
delimiter `(...)`. Spaces, tabs, and line endings may be used freely to
arrange the `expression` visually. Blank lines are not permissible in
the `expression`. This command is robust.
]]
},
ifcsdimen = {
arguments = {{meta = "csname"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifcsdimen{csname}{true}{false}
```
Similar to `\ifdefdimen` except that it takes a control sequence name as
its first argument.
]]
},
ifcslength = {
arguments = {{meta = "csname"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifcslength{csname}{true}{false}
```
Similar to `\ifdeflength` except that it takes a control sequence name
as its first argument.
]]
},
ifdef = {
arguments = {{meta = "control sequence"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifdef{control sequence}{true}{false}
```
Expands to `true` if the `control sequence` is defined, and to `false`
otherwise. Note that control sequences will be considered as defined
even if their meaning is `\relax`. This command is a LaTeX wrapper for
the e-TeX primitive `\ifdefined`.
]]
},
ifdefcounter = {
arguments = {{meta = "control sequence"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifdefcounter{control sequence}{true}{false}
```
Expands to `true` if the `control sequence` is a TeX `\count` register
allocated with `\newcount`, and to `false` otherwise.
]]
},
ifdefempty = {
arguments = {{meta = "control sequence"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifdefempty{control sequence}{true}{false}
```
Expands to `true` if the `control sequence` is defined and is a
parameterless macro whose replacement text is empty, and to `false`
otherwise. In contrast to `\ifx`, this test ignores the prefixes of the
`command`.
]]
},
ifdefequal = {
arguments = {
{meta = "control sequence"},
{meta = "control sequence"},
{meta = "true"},
{meta = "false"}
},
details = [[
```latex
\ifdefequal{control sequence}{control sequence}{true}{false}
```
Compares two control sequences and expands to `true` if they are equal
in the sense of `\ifx`, and to `false` otherwise. In contrast to `\ifx`,
this test will also yield `false` if both control sequences are
undefined or have a meaning of `\relax`.
]]
},
ifdefltxprotect = {
arguments = {{meta = "control sequence"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifdefltxprotect{control sequence}{true}{false}
```
Executes `true` if the `control sequence` is defined and is a LaTeX
protection shell, and `false` otherwise. This command is robust. It will
detect commands which have been defined with `\DeclareRobustCommand` or
by way of a similar technique.
]]
},
ifdefmacro = {
arguments = {{meta = "control sequence"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifdefmacro{control sequence}{true}{false}
```
Expands to `true` if the `control sequence` is defined and is a macro,
and to `false` otherwise.
]]
},
ifdefparam = {
arguments = {{meta = "control sequence"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifdefparam{control sequence}{true}{false}
```
Expands to `true` if the `control sequence` is defined and is a macro
with one or more parameters, and to `false` otherwise.
]]
},
ifdefprefix = {
arguments = {{meta = "control sequence"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifdefprefix{control sequence}{true}{false}
```
Expands to `true` if the `control sequence` is defined and is a macro
prefixed with `\long` and/or `\protected`, and to `false` otherwise.
Note that `\outer` macros may not be tested.
]]
},
ifdefprotected = {
arguments = {{meta = "control sequence"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifdefprotected{control sequence}{true}{false}
```
Expands to `true` if the `control sequence` is defined and is a macro
prefixed with `\protected`, and to `false` otherwise.
]]
},
ifdefstrequal = {
arguments = {
{meta = "command"},
{meta = "command"},
{meta = "true"},
{meta = "false"}
},
details = [[
```latex
\ifdefstrequal{command}{command}{true}{false}
```
Performs a category code agnostic string comparison of the replacement
text of two commands. This command is similar to `\ifdefstring` except
that both arguments to be compared are macros. This command is robust.
]]
},
ifdefstring = {
arguments = {
{meta = "command"},
{meta = "string"},
{meta = "true"},
{meta = "false"}
},
details = [[
```latex
\ifdefstring{command}{string}{true}{false}
```
Compares the replacement text of a `command` to a `string` and executes
`true` if they are equal, and `false` otherwise. Neither the `command`
nor the `string` is expanded in the test and the comparison is category
code agnostic. Control sequence tokens in the `string` argument will be
detokenized and treated as strings. This command is robust. Note that it
will only consider the replacement text of the `command`. For example,
this test
\long\edef\mymacro#1#2{\string&}
\ifdefstring{\mymacro}{&}{true}{false}
would yield `true`. The prefix and the parameters of `\mymacro` as well
as the category codes in the replacement text are ignored.
]]
},
ifdefvoid = {
arguments = {{meta = "control sequence"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifdefvoid{control sequence}{true}{false}
```
Expands to `true` if the `control sequence` is undefined, or is a
control sequence whose meaning is `\relax`, or is a parameterless macro
whose replacement text is empty, and to `false` otherwise.
]]
},
ifdimequal = {
arguments = {
{meta = "dimen expression"},
{meta = "dimen expression"},
{meta = "true"},
{meta = "false"}
},
details = [[
```latex
\ifdimequal{dimen expression}{dimen expression}{true}{false}
```
Alternative syntax for `\ifdimcomp{...}{=}{...}{...}{...}`.
]]
},
ifdimless = {
arguments = {
{meta = "dimen expression"},
{meta = "dimen expression"},
{meta = "true"},
{meta = "false"}
},
details = [[
```latex
\ifdimless{dimen expression}{dimen expression}{true}{false}
```
Alternative syntax for `\ifdimcomp{...}{<}{...}{...}{...}`.
]]
},
ifinlist = {
arguments = {
{meta = "item"},
{meta = "listmacro"},
{meta = "true"},
{meta = "false"}
},
details = [[
```latex
\ifinlist{item}{listmacro}{true}{false}
```
This command executes `true` if the `item` is included in a `listmacro`,
and `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 `\dolistloop` to check if an item is in the list as
follows:
\renewcommand*{\do}[1]{%
\ifstrequal{#1}{<<item>>}
{item found!\listbreak}
{}}
\dolistloop{\mylist}
]]
},
ifinlistcs = {
arguments = {
{meta = "item"},
{meta = "listcsname"},
{meta = "true"},
{meta = "false"}
},
details = [[
```latex
\ifinlistcs{item}{listcsname}{true}{false}
```
Similar to `\ifinlist` except that it takes a control sequence name as
its second argument.
]]
},
ifltxcounter = {
arguments = {{meta = "name"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifltxcounter{name}{true}{false}
```
Expands to `true` if `name` is a LaTeX counter allocated with
`\newcounter`, and to `false` otherwise.
]]
},
ifnumcomp = {
arguments = {
{meta = "integer expression"},
{meta = "relation"},
{meta = "integer expression"},
{meta = "true"},
{meta = "false"}
},
details = [[
```latex
\ifnumcomp{integer expression}{relation}{integer expression}{true}{false}
```
Compares two integer expressions according to `relation` and expands to
`true` or `false` depending on the result. The `relation` may be `<`,
`>`, or `=`. Both integer expressions will be processed with `\numexpr`.
An `integer expression` may be any arbitrary code which is valid in this
context. All arithmetic expressions may contain spaces. Here are some
examples:
\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}
Technically, this command is a LaTeX wrapper for the TeX primitive
`\ifnum`, incorporating `\numexpr`. Note that `\numexpr` will round the
result of all integer expressions, i.e. 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 `\ifnumcomp` will expand to `true`.
]]
},
ifnumgreater = {
arguments = {
{meta = "integer expression"},
{meta = "integer expression"},
{meta = "true"},
{meta = "false"}
},
details = [[
```latex
\ifnumgreater{integer expression}{integer expression}{true}{false}
```
Alternative syntax for `\ifnumcomp{...}{>}{...}{...}{...}`.
]]
},
ifnumodd = {
arguments = {{meta = "integer expression"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifnumodd{integer expression}{true}{false}
```
Evaluates an integer expression and expands to `true` if the result is
an odd number, and to `false` otherwise. Technically, this command is a
LaTeX wrapper for the TeX primitive `\ifodd`, incorporating `\numexpr`.
]]
},
ifpatchable = {
arguments = {
{literal = "*", optional = true},
{meta = "command"},
{meta = "true"},
{meta = "false"}
},
details = [[
```latex
\ifpatchable*{command}{true}{false}
```
Similar to `\ifpatchable` except that the starred variant does not
require a search pattern. Use this version to check if a command may be
patched with `\apptocmd` and `\pretocmd`.
]]
},
ifstrequal = {
arguments = {
{meta = "string"},
{meta = "string"},
{meta = "true"},
{meta = "false"}
},
details = [[
```latex
\ifstrequal{string}{string}{true}{false}
```
Compares two strings and executes `true` if they are equal, and `false`
otherwise. The strings are not expanded in the test and the comparison
is category code agnostic. Control sequence tokens in any of the
`string` arguments will be detokenized and treated as strings. This
command is robust.
]]
},
ifundef = {
arguments = {{meta = "control sequence"}, {meta = "true"}, {meta = "false"}},
details = [[
```latex
\ifundef{control sequence}{true}{false}
```
Expands to `true` if the `control sequence` is undefined, and to `false`
otherwise. Apart from reversing the logic of the test, this command also
differs from `\ifdef` in that commands will be considered as undefined
if their meaning is `\relax`.
]]
},
listadd = {
arguments = {{meta = "listmacro"}, {meta = "item"}},
details = [[
```latex
\listadd{listmacro}{item}
```
This command appends an `item` to a `listmacro`. A blank `item` is not
added to the list.
]]
},
listcsadd = {
arguments = {{meta = "listcsname"}, {meta = "item"}},
details = [[
```latex
\listcsadd{listcsname}{item}
```
Similar to `\listadd` except that it takes a control sequence name as
its first argument.
]]
},
listcseadd = {
arguments = {{meta = "listcsname"}, {meta = "item"}},
details = [[
```latex
\listcseadd{listcsname}{item}
```
Similar to `\listeadd` except that it takes a control sequence name as
its first argument.
]]
},
listcsremove = {
arguments = {{meta = "listcsname"}, {meta = "item"}},
details = [[
```latex
\listcsremove{listcsname}{item}
```
Similar to `\listremove` except that it takes a control sequence name as
its first argument.
]]
},
listeadd = {
arguments = {{meta = "listmacro"}, {meta = "item"}},
details = [[
```latex
\listeadd{listmacro}{item}
```
Similar to `\listadd` except that the `item` is expanded at
definition-time. Only the new `item` is expanded, the `listmacro` is
not. If the expanded `item` is blank, it is not added to the list.
]]
},
listremove = {
arguments = {{meta = "listmacro"}, {meta = "item"}},
details = [[
```latex
\listremove{listmacro}{item}
```
This command removes an `item` from a `listmacro`. A blank `item` is
ignored.
]]
},
mudef = {
details = [[
```latex
\mudef<command>{muglue expression}
```
Similar to `\edef` except that the `muglue expression` is processed with
`\muexpr`. The `muglue expression` may be any arbitrary code which is
valid in this context. The replacement text assigned to the `command`
will be the result of that calculation. If the `command` is undefined,
it will be initialized to `0mu` before the `muglue expression` is
processed.
]]
},
newbool = {
arguments = {{meta = "name"}},
details = [[
```latex
\newbool{name}
```
Defines a new boolean flag called `name`. If the flag has already been
defined, this command issues an error. The initial state of newly
defined flags is `false`. This command is robust.
]]
},
newrobustcmd = {
arguments = {
{literal = "*", optional = true},
{meta = "command"},
{delimiters = {"[", "]"}, meta = "arguments", optional = true},
{
delimiters = {"[", "]"},
meta = "optarg default",
optional = true
},
{meta = "replacement text"}
},
details = [[
```latex
\newrobustcmd{command}[arguments][optarg default]{replacement text}
\newrobustcmd*{command}[arguments][optarg default]{replacement text}
```
The syntax and behavior of this command is similar to `\newcommand`
except that the newly defined `command` will be robust. The behavior of
this command differs from the `\DeclareRobustCommand` command from the
LaTeX kernel in that it issues an error rather than just an
informational message if the `command` is already defined. Since it uses
e-TeX 's low-level protection mechanism rather than the corresponding
higher-level LaTeX facilities, it does not require an additional macro
to implement the <robustness>.
]]
},
newtoggle = {
arguments = {{meta = "name"}},
details = [[
```latex
\newtoggle{name}
```
Defines a new boolean flag called `name`. If the flag has already been
defined, this command issues an error. The initial state of newly
defined flags is `false`. This command is robust.
]]
},
notbool = {
arguments = {{meta = "name"}, {meta = "not true"}, {meta = "not false"}},
details = [[
```latex
\notbool{name}{not true}{not false}
```
Similar to `\ifbool` but negates the test.
]]
},
nottoggle = {
arguments = {{meta = "name"}, {meta = "not true"}, {meta = "not false"}},
details = [[
```latex
\nottoggle{name}{not true}{not false}
```
Similar to `\iftoggle` but negates the test.
]]
},
numdef = {
details = [[
```latex
\numdef<command>{integer expression}
```
Similar to `\edef` except that the `integer expression` is processed
with `\numexpr`. The `integer expression` may be any arbitrary code
which is valid in this context. The replacement text assigned to the
`command` will be the result of that calculation. If the `command` is
undefined, it will be initialized to `0` before the `integer expression`
is processed.