/
l3candidates.dtx
5351 lines (5351 loc) · 191 KB
/
l3candidates.dtx
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
% \iffalse meta-comment
%
%% File: l3candidates.dtx Copyright (C) 2012-2018 The LaTeX3 Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
% license or (at your option) any later version. The latest version
% of this license is in the file
%
% https://www.latex-project.org/lppl.txt
%
% This file is part of the "l3kernel bundle" (The Work in LPPL)
% and all files in that bundle must be distributed together.
%
% -----------------------------------------------------------------------
%
% The development version of the bundle can be found at
%
% https://github.com/latex3/latex3
%
% for those people who are interested.
%
%<*driver>
\documentclass[full,kernel]{l3doc}
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \title{^^A
% The \textsf{l3candidates} package\\ Experimental additions to
% \pkg{l3kernel}^^A
% }
%
% \author{^^A
% The \LaTeX3 Project\thanks
% {^^A
% E-mail:
% \href{mailto:latex-team@latex-project.org}
% {latex-team@latex-project.org}^^A
% }^^A
% }
%
% \date{Released 2018-10-17}
%
% \maketitle
%
% \begin{documentation}
%
% \section{Important notice}
%
% This module provides a space in which functions can be added to
% \pkg{l3kernel} (\pkg{expl3}) while still being experimental.
% \begin{quote}
% \bfseries
% As such, the
% functions here may not remain in their current form, or indeed at all,
% in \pkg{l3kernel} in the future.
% \end{quote}
% In contrast to the material in
% \pkg{l3experimental}, the functions here are all \emph{small} additions to
% the kernel. We encourage programmers to test them out and report back on
% the \texttt{LaTeX-L} mailing list.
%
% \medskip
%
% Thus, if you intend to use any of these functions from the candidate module in a public package
% offered to others for productive use (e.g., being placed on CTAN) please consider the following points carefully:
% \begin{itemize}
% \item Be prepared that your public packages might require updating when such functions
% are being finalized.
% \item Consider informing us that you use a particular function in your public package, e.g., by
% discussing this on the \texttt{LaTeX-L}
% mailing list. This way it becomes easier to coordinate any updates necessary without issues
% for the users of your package.
% \item Discussing and understanding use cases for a particular addition or concept also helps to
% ensure that we provide the right interfaces in the final version so please give us feedback
% if you consider a certain candidate function useful (or not).
% \end{itemize}
% We only add functions in this space if we consider them being serious candidates for a final inclusion
% into the kernel. However, real use sometimes leads to better ideas, so functions from this module are
% \textbf{not necessarily stable} and we may have to adjust them!
%
% \section{Additions to \pkg{l3basics}}
%
% \begin{function}[added = 2017-07-16, updated = 2017-08-02]{\debug_on:n, \debug_off:n}
% \begin{syntax}
% \cs{debug_on:n} |{| \meta{comma-separated list} |}|
% \cs{debug_off:n} |{| \meta{comma-separated list} |}|
% \end{syntax}
% Turn on and off within a group various debugging code, some of which
% is also available as \pkg{expl3} load-time options. The items that
% can be used in the \meta{list} are
% \begin{itemize}
% \item \texttt{check-declarations} that checks all \pkg{expl3}
% variables used were previously declared and that local/global
% variables (based on their name or on their first assignment) are
% only locally/globally assigned;
% \item \texttt{check-expressions} that checks integer, dimension,
% skip, and muskip expressions are not terminated prematurely;
% \item \texttt{deprecation} that makes soon-to-be-deprecated commands produce errors;
% \item \texttt{log-functions} that logs function definitions;
% \item \texttt{all} that does all of the above.
% \end{itemize}
% Providing these as switches rather than options allows testing code
% even if it relies on other packages: load all other packages, call
% \cs{debug_on:n}, and load the code that one is interested in
% testing. These functions can only be used in \LaTeXe{} package mode
% loaded with \texttt{enable-debug} or another option implying it.
% \end{function}
%
% \begin{function}[added = 2017-11-28]{\debug_suspend:, \debug_resume:}
% \begin{syntax}
% \cs{debug_suspend:} \ldots{} \cs{debug_resume:}
% \end{syntax}
% Suppress (locally) errors and logging from \texttt{debug} commands,
% except for the \texttt{deprecation} errors or warnings. These pairs
% of commands can be nested. This can be used around pieces of code
% that are known to fail checks, if such failures should be ignored.
% See for instance \pkg{l3coffins}.
% \end{function}
%
% \begin{function}[added = 2017-07-04]{\mode_leave_vertical:}
% \begin{syntax}
% \cs{mode_leave_vertical:}
% \end{syntax}
% Ensures that \TeX{} is not in vertical (inter-paragraph) mode. In
% horizontal or math mode this command has no effect, in vertical mode it
% switches to horizontal mode, and inserts a box of width
% \tn{parindent}, followed by the \tn{everypar} token list.
% \begin{texnote}
% This results in the contents of the \tn{everypar} token register being
% inserted, after \cs{mode_leave_vertical:} is complete. Notice that in
% contrast to the \LaTeXe{} \tn{leavevmode} approach, no box is used
% by the method implemented here.
% \end{texnote}
% \end{function}
%
% \section{Additions to \pkg{l3box}}
%
% \subsection{Viewing part of a box}
%
% \begin{function}{\box_clip:N, \box_clip:c}
% \begin{syntax}
% \cs{box_clip:N} \meta{box}
% \end{syntax}
% Clips the \meta{box} in the output so that only material inside the
% bounding box is displayed in the output. The updated \meta{box} is an
% hbox, irrespective of the nature of the \meta{box} before the clipping is
% applied. The clipping applies within the current \TeX{} group level.
%
% \textbf{These functions require the \LaTeX3 native drivers: they do
% not work with the \LaTeXe{} \pkg{graphics} drivers!}
%
% \begin{texnote}
% Clipping is implemented by the driver, and as such the full content of
% the box is placed in the output file. Thus clipping does not remove
% any information from the raw output, and hidden material can therefore
% be viewed by direct examination of the file.
% \end{texnote}
% \end{function}
%
% \begin{function}{\box_trim:Nnnnn, \box_trim:cnnnn}
% \begin{syntax}
% \cs{box_trim:Nnnnn} \meta{box} \Arg{left} \Arg{bottom} \Arg{right} \Arg{top}
% \end{syntax}
% Adjusts the bounding box of the \meta{box} \meta{left} is removed from
% the left-hand edge of the bounding box, \meta{right} from the right-hand
% edge and so fourth. All adjustments are \meta{dimension expressions}.
% Material outside of the bounding box is still displayed in the output
% unless \cs{box_clip:N} is subsequently applied.
% The updated \meta{box} is an
% hbox, irrespective of the nature of the \meta{box} before the trim
% operation is applied. The adjustment applies within the current \TeX{}
% group level. The behavior of the operation where the trims requested is
% greater than the size of the box is undefined.
% \end{function}
%
% \begin{function}{\box_viewport:Nnnnn, \box_viewport:cnnnn}
% \begin{syntax}
% \cs{box_viewport:Nnnnn} \meta{box} \Arg{llx} \Arg{lly} \Arg{urx} \Arg{ury}
% \end{syntax}
% Adjusts the bounding box of the \meta{box} such that it has lower-left
% co-ordinates (\meta{llx}, \meta{lly}) and upper-right co-ordinates
% (\meta{urx}, \meta{ury}). All four co-ordinate positions are
% \meta{dimension expressions}. Material outside of the bounding box is
% still displayed in the output unless \cs{box_clip:N} is
% subsequently applied.
% The updated \meta{box} is an
% hbox, irrespective of the nature of the \meta{box} before the viewport
% operation is applied. The adjustment applies within the current \TeX{}
% group level.
% \end{function}
%
% \section{Additions to \pkg{l3clist}}
%
% \begin{function}[EXP, added = 2016-12-06]
% {\clist_rand_item:N, \clist_rand_item:n, \clist_rand_item:c}
% \begin{syntax}
% \cs{clist_rand_item:N} \meta{clist~var}
% \cs{clist_rand_item:n} \Arg{comma list}
% \end{syntax}
% Selects a pseudo-random item of the \meta{comma list}. If the
% \meta{comma list} has no item, the result is empty. This not
% yet available in \XeTeX{}.
% \begin{texnote}
% The result is returned within the \tn{unexpanded}
% primitive (\cs{exp_not:n}), which means that the \meta{item}
% does not expand further when appearing in an \texttt{x}-type
% argument expansion.
% \end{texnote}
% \end{function}
%
% \section{Additions to \pkg{l3coffins}}
%
% \begin{function}{\coffin_resize:Nnn, \coffin_resize:cnn}
% \begin{syntax}
% \cs{coffin_resize:Nnn} \meta{coffin} \Arg{width} \Arg{total-height}
% \end{syntax}
% Resized the \meta{coffin} to \meta{width} and \meta{total-height},
% both of which should be given as dimension expressions.
% \end{function}
%
% \begin{function}{\coffin_rotate:Nn, \coffin_rotate:cn}
% \begin{syntax}
% \cs{coffin_rotate:Nn} \meta{coffin} \Arg{angle}
% \end{syntax}
% Rotates the \meta{coffin} by the given \meta{angle} (given in
% degrees counter-clockwise). This process rotates both the
% coffin content and poles. Multiple rotations do not result in
% the bounding box of the coffin growing unnecessarily.
% \end{function}
%
% \begin{function}{\coffin_scale:Nnn, \coffin_scale:cnn}
% \begin{syntax}
% \cs{coffin_scale:Nnn} \meta{coffin} \Arg{x-scale} \Arg{y-scale}
% \end{syntax}
% Scales the \meta{coffin} by a factors \meta{x-scale} and
% \meta{y-scale} in the horizontal and vertical directions,
% respectively. The two scale factors should be given as real numbers.
% \end{function}
%
% \section{Additions to \pkg{l3expan}}
%
% \begin{function}[added = 2017-12-12]{\prg_generate_conditional_variant:Nnn}
% \begin{syntax}
% \cs{prg_generate_conditional_variant:Nnn} \cs[no-index]{\meta{name}:\meta{arg spec}} \Arg{variant argument specifiers} \Arg{condition specifiers}
% \end{syntax}
% Defines argument-specifier variants of conditionals. This is
% equivalent to running \cs{cs_generate_variant:Nn} \meta{conditional}
% \Arg{variant argument specifiers} on each \meta{conditional}
% described by the \meta{condition specifiers}. These base-form
% \meta{conditionals} are obtained from the \meta{name} and \meta{arg
% spec} as described for \cs{prg_new_conditional:Npnn}, and they
% should be defined.
% \end{function}
%
% \begin{function}[added = 2018-04-04]{\exp_args_generate:n}
% \begin{syntax}
% \cs{exp_args_generate:n} \Arg{variant argument specifiers}
% \end{syntax}
% Defines \cs[no-index]{exp_args:N\meta{variant}} functions for each
% \meta{variant} given in the comma list \Arg{variant argument
% specifiers}. Each \meta{variant} should consist of the letters |N|,
% |c|, |n|, |V|, |v|, |o|, |f|, |x|, |p| and the resulting function is
% protected if the letter |x| appears in the \meta{variant}. This is
% only useful for cases where \cs{cs_generate_variant:Nn} is not
% applicable.
% \end{function}
%
% \section{Additions to \pkg{l3fparray}}
%
% \begin{function}[added = 2018-05-05]{\fparray_new:Nn}
% \begin{syntax}
% \cs{fparray_new:Nn} \meta{fparray~var} \Arg{size}
% \end{syntax}
% Evaluates the integer expression \meta{size} and allocates an
% \meta{floating point array variable} with that number of (zero)
% entries. The variable name should start with |\g_| because
% assignments are always global.
% \end{function}
%
% \begin{function}[EXP, added = 2018-05-05]{\fparray_count:N}
% \begin{syntax}
% \cs{fparray_count:N} \meta{fparray~var}
% \end{syntax}
% Expands to the number of entries in the \meta{floating point array
% variable}. This is performed in constant time.
% \end{function}
%
% \begin{function}[added = 2018-05-05]{\fparray_gset:Nnn}
% \begin{syntax}
% \cs{fparray_gset:Nnn} \meta{fparray~var} \Arg{position} \Arg{value}
% \end{syntax}
% Stores the result of evaluating the floating point expression
% \meta{value} into the \meta{floating point array variable} at the
% (integer expression) \meta{position}. If the \meta{position} is not
% between $1$ and the \cs{fparray_count:N}, an error occurs.
% Assignments are always global.
% \end{function}
%
% \begin{function}[added = 2018-05-05]{\fparray_gzero:N}
% \begin{syntax}
% \cs{fparray_gzero:N} \meta{fparray~var}
% \end{syntax}
% Sets all entries of the \meta{floating point array variable} to
% $+0$. Assignments are always global.
% \end{function}
%
% \begin{function}[EXP, added = 2018-05-05]
% {\fparray_item:Nn, \fparray_item_to_tl:Nn}
% \begin{syntax}
% \cs{fparray_item:Nn} \meta{fparray~var} \Arg{position}
% \end{syntax}
% Applies \cs{fp_use:N} or \cs{fp_to_tl:N} (respectively) to the
% floating point entry stored at the (integer expression)
% \meta{position} in the \meta{floating point array variable}. If the
% \meta{position} is not between $1$ and the \cs{fparray_count:N}, an
% error occurs.
% \end{function}
%
% \section{Additions to \pkg{l3file}}
%
% \begin{function}[added = 2017-07-11]{\file_get_mdfive_hash:nN}
% \begin{syntax}
% \cs{file_get_mdfive_hash:nN} \Arg{file name} \meta{str var}
% \end{syntax}
% Searches for \meta{file name} using the current \TeX{} search
% path and the additional paths controlled by \cs{file_path_include:n}.
% If found, sets the \meta{str var} to the MD5 sum generated from the
% content of the file. The file is read as bytes, which means that in
% contrast to most \TeX{} behaviour there will be a difference in result
% depending on the line endings used in text files. The same file will
% produce the same result between different engines: the algorithm used
% is the same in all cases.
% Where the file is not found, the \meta{str var} will be empty.
% \end{function}
%
% \begin{function}[added = 2017-07-09]{\file_get_size:nN}
% \begin{syntax}
% \cs{file_get_size:nN} \Arg{file name} \meta{str var}
% \end{syntax}
% Searches for \meta{file name} using the current \TeX{} search
% path and the additional paths controlled by \cs{file_path_include:n}.
% If found, sets the \meta{str var} to the size of the file in bytes.
% Where the file is not found, the \meta{str var} will be empty.
% \begin{texnote}
% Currently this is not available with \XeTeX{}.
% \end{texnote}
% \end{function}
%
% \begin{function}[added = 2017-07-09]{\file_get_timestamp:nN}
% \begin{syntax}
% \cs{file_get_timestamp:nN} \Arg{file name} \meta{str var}
% \end{syntax}
% Searches for \meta{file name} using the current \TeX{} search
% path and the additional paths controlled by \cs{file_path_include:n}.
% If found, sets the \meta{str var} to the modification timestamp of
% the file in the form |D:|\meta{year}\meta{month}\meta{day}\meta{hour}^^A
% \meta{minute}\meta{second}\meta{offset}, where the latter may be |Z|
% (UTC) or \meta{plus-minus}\meta{hours}|'|\meta{minutes}|'|.
% Where the file is not found, the \meta{str var} will be empty.
% \begin{texnote}
% Currently this is not available with \XeTeX{}.
% \end{texnote}
% \end{function}
%
% \begin{function}[added = 2014-07-02]{\file_if_exist_input:n, \file_if_exist_input:nF}
% \begin{syntax}
% \cs{file_if_exist_input:n} \Arg{file name}
% \cs{file_if_exist_input:nF} \Arg{file name} \Arg{false code}
% \end{syntax}
% Searches for \meta{file name} using the current \TeX{} search
% path and the additional paths controlled by
% \cs{file_path_include:n}. If found then
% reads in the file as additional \LaTeX{} source as described for
% \cs{file_input:n}, otherwise inserts the \meta{false code}.
% Note that these functions do not raise
% an error if the file is not found, in contrast to \cs{file_input:n}.
% \end{function}
%
% \begin{function}[added = 2017-07-07]{\file_input_stop:}
% \begin{syntax}
% \cs{file_input_stop:}
% \end{syntax}
% Ends the reading of a file started by \cs{file_input:n} or similar before
% the end of the file is reached. Where the file reading is being terminated
% due to an error, \cs{msg_critical:nn(nn)} should be preferred.
% \begin{texnote}
% This function must be used on a line on its own: \TeX{} reads files
% line-by-line and so any additional tokens in the \enquote{current} line
% will still be read.
%
% This is also true if the function is hidden inside another function
% (which will be the normal case), i.e., all tokens on the same line
% in the source file are still processed. Putting it on a line by itself
% in the definition doesn't help as it is the line where it is used that
% counts!
% \end{texnote}
% \end{function}
%
% \section{Additions to \pkg{l3flag}}
%
% \begin{function}[EXP, added = 2018-04-02]{\flag_raise_if_clear:n}
% \begin{syntax}
% \cs{flag_raise_if_clear:n} \Arg{flag name}
% \end{syntax}
% Ensures the \meta{flag} is raised by making its height at least~$1$,
% locally.
% \end{function}
%
% \section{Additions to \pkg{l3int}}
%
% \begin{function}[EXP, added = 2018-05-05]{\int_rand:n}
% \begin{syntax}
% \cs{int_rand:n} \Arg{intexpr}
% \end{syntax}
% Evaluates the \meta{integer expression} then produces a
% pseudo-random number between $1$ and the \meta{intexpr} (included).
% This is not yet available in \XeTeX{}.
% \end{function}
%
% \section{Additions to \pkg{l3intarray}}
%
% \begin{function}[EXP, added = 2018-05-05]{\intarray_rand_item:N}
% \begin{syntax}
% \cs{intarray_rand_item:N} \meta{intarray~var}
% \end{syntax}
% Selects a pseudo-random item of the \meta{integer array}. If the
% \meta{integer array} is empty, produce an error. This is not yet
% available in \XeTeX{}.
% \end{function}
%
% \begin{function}[added = 2018-05-05]{\intarray_gset_rand:Nnn, \intarray_gset_rand:Nn}
% \begin{syntax}
% \cs{intarray_gset_rand:Nnn} \meta{intarray~var} \Arg{minimum} \Arg{maximum}
% \cs{intarray_gset_rand:Nn} \meta{intarray~var} \Arg{maximum}
% \end{syntax}
% Evaluates the integer expressions \meta{minimum} and \meta{maximum}
% then sets each entry (independently) of the \meta{integer array
% variable} to a pseudo-random number between the two (with bounds
% included). If the absolute value of either bound is bigger than
% $2^{30}-1$, an error occurs. Entries are generated in the same way
% as repeated calls to \cs{int_rand:nn} or \cs{int_rand:n}
% respectively, in particular for the second function the
% \meta{minimum} is $1$. This is not yet available in \XeTeX{}.
% Assignments are always global.
% \end{function}
%
% \subsection{Working with contents of integer arrays}
%
% \begin{function}[added = 2018-05-04, rEXP]{\intarray_const_from_clist:Nn}
% \begin{syntax}
% \cs{intarray_const_from_clist:Nn} \meta{intarray~var} \meta{intexpr clist}
% \end{syntax}
% Creates a new constant \meta{integer array variable} or raises an
% error if the name is already taken. The \meta{integer array
% variable} is set (globally) to contain as its items the results of
% evaluating each \meta{integer expression} in the \meta{comma list}.
% \end{function}
%
% \begin{function}[added = 2018-05-04, rEXP]{\intarray_to_clist:N}
% \begin{syntax}
% \cs{intarray_to_clist:N} \meta{intarray~var}
% \end{syntax}
% Converts the \meta{intarray} to integer denotations separated by
% commas. All tokens have category code other. If the
% \meta{intarray} has no entry the result is empty; otherwise the
% result has one fewer comma than the number of items.
% \end{function}
%
% \begin{function}[added = 2018-05-04]{\intarray_show:N, \intarray_log:N}
% \begin{syntax}
% \cs{intarray_show:N} \meta{intarray~var}
% \cs{intarray_log:N} \meta{intarray~var}
% \end{syntax}
% Displays the items in the \meta{integer array variable} in the
% terminal or writes them in the log file.
% \end{function}
%
% \section{Additions to \pkg{l3msg}}
%
% In very rare cases it may be necessary to produce errors in an
% expansion-only context. The functions in this section should only be
% used if there is no alternative approach using \cs{msg_error:nnnnnn}
% or other non-expandable commands from the previous section. Despite
% having a similar interface as non-expandable messages, expandable
% errors must be handled internally very differently from normal error
% messages, as none of the tools to print to the terminal or the log
% file are expandable. As a result, the message text and arguments are
% not expanded, and messages must be very short (with default settings,
% they are truncated after approximately 50 characters). It is
% advisable to ensure that the message is understandable even when
% truncated. Another particularity of expandable messages is that they
% cannot be redirected or turned off by the user.
%
% \begin{function}[EXP, added = 2015-08-06]
% {
% \msg_expandable_error:nnnnnn ,
% \msg_expandable_error:nnnnn ,
% \msg_expandable_error:nnnn ,
% \msg_expandable_error:nnn ,
% \msg_expandable_error:nn ,
% \msg_expandable_error:nnffff ,
% \msg_expandable_error:nnfff ,
% \msg_expandable_error:nnff ,
% \msg_expandable_error:nnf ,
% }
% \begin{syntax}
% \cs{msg_expandable_error:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four}
% \end{syntax}
% Issues an \enquote{Undefined error} message from \TeX{} itself
% using the undefined control sequence \cs{::error} then prints
% \enquote{! \meta{module}: }\meta{error message}, which should be
% short. With default settings, anything beyond approximately $60$
% characters long (or bytes in some engines) is cropped. A leading
% space might be removed as well.
% \end{function}
%
% \begin{function}[added = 2017-12-04]{\msg_show_eval:Nn, \msg_log_eval:Nn}
% \begin{syntax}
% \cs{msg_show_eval:Nn} \meta{function} \Arg{expression}
% \end{syntax}
% Shows or logs the \meta{expression} (turned into a string), an equal
% sign, and the result of applying the \meta{function} to the
% \Arg{expression} (with \texttt{f}-expansion). For instance, if the
% \meta{function} is \cs{int_eval:n} and the \meta{expression} is
% |1+2| then this logs |> 1+2=3.|
% \end{function}
%
% \begin{function}[added = 2017-12-04]
% {
% \msg_show:nnnnnn ,
% \msg_show:nnnnn ,
% \msg_show:nnnn ,
% \msg_show:nnn ,
% \msg_show:nn ,
% \msg_show:nnxxxx ,
% \msg_show:nnxxx ,
% \msg_show:nnxx ,
% \msg_show:nnx
% }
% \begin{syntax}
% \cs{msg_show:nnnnnn} \Arg{module} \Arg{message} \Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four}
% \end{syntax}
% Issues \meta{module} information \meta{message}, passing \meta{arg
% one} to \meta{arg four} to the text-creating functions. The
% information text is shown on the terminal and the \TeX{} run is
% interrupted in a manner similar to \cs{tl_show:n}. This is used in
% conjunction with \cs{msg_show_item:n} and similar functions to print
% complex variable contents completely. If the formatted text does
% not contain |>~| at the start of a line, an additional line |>~.|
% will be put at the end. In addition, a final period is added if not
% present.
% \end{function}
%
% \begin{function}[EXP, added = 2017-12-04]
% {\msg_show_item:n, \msg_show_item_unbraced:n, \msg_show_item:nn, \msg_show_item_unbraced:nn}
% \begin{syntax}
% \cs{seq_map_function:NN} \meta{seq} \cs{msg_show_item:n}
% \cs{prop_map_function:NN} \meta{prop} \cs{msg_show_item:nn}
% \end{syntax}
% Used in the text of messages for \cs{msg_show:nnxxxx} to show or log
% a list of items or key--value pairs. The one-argument functions are
% used for sequences, clist or token lists and the others for property
% lists. These functions turn their arguments to strings.
% \end{function}
%
% \section{Additions to \pkg{l3prg}}
%
% \begin{function}[added = 2017-11-28]{\bool_const:Nn, \bool_const:cn}
% \begin{syntax}
% \cs{bool_const:Nn} \meta{boolean} \Arg{boolexpr}
% \end{syntax}
% Creates a new constant \meta{boolean} or raises an error if the name
% is already taken. The value of the \meta{boolean} is set globally to
% the result of evaluating the \meta{boolexpr}.
% \end{function}
%
% \begin{function}[added = 2018-05-10]
% {
% \bool_set_inverse:N , \bool_set_inverse:c ,
% \bool_gset_inverse:N, \bool_gset_inverse:c
% }
% \begin{syntax}
% \cs{bool_set_inverse:N} \meta{boolean}
% \end{syntax}
% Toggles the \meta{boolean} from \texttt{true} to \texttt{false} and
% conversely: sets it to the inverse of its current value.
% \end{function}
%
% \section{Additions to \pkg{l3prop}}
%
% \begin{function}[EXP]{\prop_count:N, \prop_count:c}
% \begin{syntax}
% \cs{prop_count:N} \meta{property list}
% \end{syntax}
% Leaves the number of key--value pairs in the \meta{property list} in
% the input stream as an \meta{integer denotation}.
% \end{function}
%
% \begin{function}[rEXP]
% {\prop_map_tokens:Nn, \prop_map_tokens:cn}
% \begin{syntax}
% \cs{prop_map_tokens:Nn} \meta{property list} \Arg{code}
% \end{syntax}
% Analogue of \cs{prop_map_function:NN} which maps several tokens
% instead of a single function. The \meta{code} receives each
% key--value pair in the \meta{property list} as two trailing brace
% groups. For instance,
% \begin{verbatim}
% \prop_map_tokens:Nn \l_my_prop { \str_if_eq:nnT { mykey } }
% \end{verbatim}
% expands to the value corresponding to \texttt{mykey}: for each
% pair in |\l_my_prop| the function \cs{str_if_eq:nnT} receives
% \texttt{mykey}, the \meta{key} and the \meta{value} as its three
% arguments. For that specific task, \cs{prop_item:Nn} is faster.
% \end{function}
%
% \begin{function}[EXP, added = 2016-12-06]
% {\prop_rand_key_value:N, \prop_rand_key_value:c}
% \begin{syntax}
% \cs{prop_rand_key_value:N} \meta{prop~var}
% \end{syntax}
% Selects a pseudo-random key--value pair from the \meta{property list}
% and returns \Arg{key} and \Arg{value}. If the \meta{property list} is
% empty the result is empty. This is not yet available in \XeTeX{}.
% \begin{texnote}
% The result is returned within the \tn{unexpanded}
% primitive (\cs{exp_not:n}), which means that the \meta{value}
% does not expand further when appearing in an \texttt{x}-type
% argument expansion.
% \end{texnote}
% \end{function}
%
% \begin{function}[added = 2017-11-28]
% {
% \prop_set_from_keyval:Nn, \prop_set_from_keyval:cn,
% \prop_gset_from_keyval:Nn, \prop_gset_from_keyval:cn,
% }
% \begin{syntax}
% \cs{prop_set_from_keyval:Nn} \meta{prop~var}
% \{
% \meta{key1} |=| \meta{value1} |,|
% \meta{key2} |=| \meta{value2} |,| \ldots{}
% \}
% \end{syntax}
% Sets \meta{prop~var} to contain key--value pairs given in the second
% argument.
% \end{function}
%
% \begin{function}[added = 2017-11-28]
% {\prop_const_from_keyval:Nn, \prop_const_from_keyval:cn}
% \begin{syntax}
% \cs{prop_const_from_keyval:Nn} \meta{prop~var}
% \{
% \meta{key1} |=| \meta{value1} |,|
% \meta{key2} |=| \meta{value2} |,| \ldots{}
% \}
% \end{syntax}
% Creates a new constant \meta{prop~var} or raises an error if the
% name is already taken. The \meta{prop~var} is set globally to
% contain key--value pairs given in the second argument.
% \end{function}
%
% \section{Additions to \pkg{l3seq}}
%
% \begin{function}[rEXP]
% {
% \seq_mapthread_function:NNN, \seq_mapthread_function:NcN,
% \seq_mapthread_function:cNN, \seq_mapthread_function:ccN
% }
% \begin{syntax}
% \cs{seq_mapthread_function:NNN} \meta{seq_1} \meta{seq_2} \meta{function}
% \end{syntax}
% Applies \meta{function} to every pair of items
% \meta{seq_1-item}--\meta{seq_2-item} from the two sequences, returning
% items from both sequences from left to right. The \meta{function}
% receives two \texttt{n}-type arguments for each iteration. The mapping
% terminates when
% the end of either sequence is reached (\emph{i.e.}~whichever sequence has
% fewer items determines how many iterations
% occur).
% \end{function}
%
% \begin{function}{\seq_set_filter:NNn, \seq_gset_filter:NNn}
% \begin{syntax}
% \cs{seq_set_filter:NNn} \meta{sequence_1} \meta{sequence_2} \Arg{inline boolexpr}
% \end{syntax}
% Evaluates the \meta{inline boolexpr} for every \meta{item} stored
% within the \meta{sequence_2}. The \meta{inline boolexpr}
% receives the \meta{item} as |#1|. The sequence of all \meta{items}
% for which the \meta{inline boolexpr} evaluated to \texttt{true}
% is assigned to \meta{sequence_1}.
% \begin{texnote}
% Contrarily to other mapping functions, \cs{seq_map_break:} cannot
% be used in this function, and would lead to low-level \TeX{} errors.
% \end{texnote}
% \end{function}
%
% \begin{function}[added = 2011-12-22]
% {\seq_set_map:NNn, \seq_gset_map:NNn}
% \begin{syntax}
% \cs{seq_set_map:NNn} \meta{sequence_1} \meta{sequence_2} \Arg{inline function}
% \end{syntax}
% Applies \meta{inline function} to every \meta{item} stored
% within the \meta{sequence_2}. The \meta{inline function} should
% consist of code which will receive the \meta{item} as |#1|.
% The sequence resulting from \texttt{x}-expanding
% \meta{inline function} applied to each \meta{item}
% is assigned to \meta{sequence_1}. As such, the code
% in \meta{inline function} should be expandable.
% \begin{texnote}
% Contrarily to other mapping functions, \cs{seq_map_break:} cannot
% be used in this function, and would lead to low-level \TeX{} errors.
% \end{texnote}
% \end{function}
%
% \begin{function}[EXP, added = 2016-12-06]{\seq_rand_item:N, \seq_rand_item:c}
% \begin{syntax}
% \cs{seq_rand_item:N} \meta{seq~var}
% \end{syntax}
% Selects a pseudo-random item of the \meta{sequence}. If the
% \meta{sequence} is empty the result is empty. This is not yet
% available in \XeTeX{}.
% \begin{texnote}
% The result is returned within the \tn{unexpanded}
% primitive (\cs{exp_not:n}), which means that the \meta{item}
% does not expand further when appearing in an \texttt{x}-type
% argument expansion.
% \end{texnote}
% \end{function}
%
% \begin{function}[added = 2017-11-28]
% {\seq_const_from_clist:Nn, \seq_const_from_clist:cn}
% \begin{syntax}
% \cs{seq_const_from_clist:Nn} \meta{seq~var} \Arg{comma-list}
% \end{syntax}
% Creates a new constant \meta{seq~var} or raises an error if the name
% is already taken. The \meta{seq~var} is set globally to contain the
% items in the \meta{comma list}.
% \end{function}
%
% \begin{function}[added = 2018-04-06]
% {\seq_set_from_function:NnN, \seq_gset_from_function:NnN}
% \begin{syntax}
% \cs{seq_set_from_function:NnN} \meta{seq~var} \Arg{loop~code} \meta{function}
% \end{syntax}
% Sets the \meta{seq~var} equal to a sequence whose items are obtained
% by \texttt{x}-expanding \meta{loop~code} \meta{function}. This
% expansion must result in successive calls to the \meta{function}
% with no nonexpandable tokens in between. More precisely the
% \meta{function} is replaced by a wrapper function that inserts the
% appropriate separators between items in the sequence. The
% \meta{loop~code} must be expandable; it can be for example
% \cs{tl_map_function:NN} \meta{tl~var} or \cs{clist_map_function:nN}
% \Arg{clist} or \cs{int_step_function:nnnN} \Arg{initial value}
% \Arg{step} \Arg{final value}.
% \end{function}
%
% \begin{function}[added = 2018-04-06]
% {\seq_set_from_inline_x:Nnn, \seq_gset_from_inline_x:Nnn}
% \begin{syntax}
% \cs{seq_set_from_inline_x:Nnn} \meta{seq~var} \Arg{loop~code} \Arg{inline~code}
% \end{syntax}
% Sets the \meta{seq~var} equal to a sequence whose items are obtained
% by \texttt{x}-expanding \meta{loop~code} applied to a
% \meta{function} derived from the \meta{inline~code}. A
% \meta{function} is defined, that takes one argument,
% \texttt{x}-expands the \meta{inline~code} with that argument
% as~|#1|, then adds appropriate separators to turn the result into an
% item of the sequence. The \texttt{x}-expansion of \meta{loop~code}
% \meta{function} must result in successive calls to the
% \meta{function} with no nonexpandable tokens in between. The
% \meta{loop~code} must be expandable; it can be for example
% \cs{tl_map_function:NN} \meta{tl~var} or \cs{clist_map_function:nN}
% \Arg{clist} or \cs{int_step_function:nnnN} \Arg{initial value}
% \Arg{step} \Arg{final value}, but not the analogous \enquote{inline}
% mappings.
% \end{function}
%
% \begin{function}[added = 2018-04-29]{\seq_shuffle:N, \seq_gshuffle:N}
% \begin{syntax}
% \cs{seq_shuffle:N} \meta{seq~var}
% \end{syntax}
% Sets the \meta{seq~var} to the result of placing the items of the
% \meta{seq~var} in a random order. Each item is (roughly) as likely
% to end up in any given position.
% \begin{texnote}
% For sequences with more than $13$ items or so, only a small
% proportion of all possible permutations can be reached, because
% the random seed \cs{sys_rand_seed:} only has $28$-bits. The use
% of \tn{toks} internally means that sequences with more than
% $32767$ or $65535$ items (depending on the engine) cannot be
% shuffled.
% \end{texnote}
% \end{function}
%
% \begin{function}[added = 2018-05-03]{\seq_indexed_map_function:NN}
% \begin{syntax}
% \cs{seq_indexed_map_function:NN} \meta{seq~var} \meta{function}
% \end{syntax}
% Applies \meta{function} to every entry in the \meta{sequence
% variable}. The \meta{function} should have signature |:nn|. It
% receives two arguments for each iteration: the \meta{index} (namely
% |1| for the first entry, then |2| and so on) and the \meta{item}.
% \end{function}
%
% \begin{function}[added = 2018-05-03]{\seq_indexed_map_inline:Nn}
% \begin{syntax}
% \cs{seq_indexed_map_inline:Nn} \meta{seq~var} \Arg{inline function}
% \end{syntax}
% Applies \meta{inline function} to every entry in the \meta{sequence
% variable}. The \meta{inline function} should consist of code which
% receives the \meta{index} (namely |1| for the first entry, then |2|
% and so on) as~|#1| and the \meta{item} as~|#2|.
% \end{function}
%
% \section{Additions to \pkg{l3skip}}
%
% \begin{function}{\skip_split_finite_else_action:nnNN}
% \begin{syntax}
% \cs{skip_split_finite_else_action:nnNN} \Arg{skipexpr} \Arg{action}
% ~~\meta{dimen_1} \meta{dimen_2}
% \end{syntax}
% Checks if the \meta{skipexpr} contains finite glue. If it does then it
% assigns
% \meta{dimen_1} the stretch component and \meta{dimen_2} the shrink
% component. If
% it contains infinite glue set \meta{dimen_1} and \meta{dimen_2} to $0$\,pt
% and place |#2| into the input stream: this is usually an error or
% warning message of some sort.
% \end{function}
%
% \section{Additions to \pkg{l3sys}}
%
% \begin{variable}[added = 2018-05-02]{\c_sys_engine_version_str}
% The version string of the current engine, in the same form as
% given in the banner issued when running a job. For \pdfTeX{}
% and \LuaTeX{} this is of the form
% \begin{quote}
% \meta{major}.\meta{minor}.\meta{revision}
% \end{quote}
% For \XeTeX{}, the form is
% \begin{quote}
% \meta{major}.\meta{minor}
% \end{quote}
% For \pTeX{} and \upTeX{}, only releases since \TeX{} Live 2018
% make the data available, and the form is more complex, as it comprises
% the \pTeX{} version, the \upTeX{} version and the e-\pTeX{} version.
% \begin{quote}
% p\meta{major}.\meta{minor}.\meta{revision}-u\meta{major}.\meta{minor}^^A
% -\meta{epTeX}
% \end{quote}
% where the |u| part is only present for \upTeX{}.
% \end{variable}
%
% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_rand_exist:}
% \begin{syntax}
% \cs{sys_if_rand_exist_p:}
% \cs{sys_if_rand_exist:TF} \Arg{true code} \Arg{false code}
% \end{syntax}
% Tests if the engine has a pseudo-random number generator. Currently
% this is the case in \pdfTeX{}, \LuaTeX{}, \pTeX{} and \upTeX{}.
% \end{function}
%
% \begin{function}[added = 2017-05-27, EXP]{\sys_rand_seed:}
% \begin{syntax}
% \cs{sys_rand_seed:}
% \end{syntax}
% Expands to the current value of the engine's random seed, a
% non-negative integer. In engines without random number support this
% expands to $0$.
% \end{function}
%
% \begin{function}[added = 2017-05-27]{\sys_gset_rand_seed:n}
% \begin{syntax}
% \cs{sys_gset_rand_seed:n} \Arg{intexpr}
% \end{syntax}
% Globally sets the seed for the engine's pseudo-random number
% generator to the \meta{integer expression}. This random seed
% affects all \cs[no-index]{\ldots{}_rand} functions (such as
% \cs{int_rand:nn} or \cs{clist_rand_item:n}) as well as other
% packages relying on the engine's random number generator. In
% engines without random number support this produces an error.
% \begin{texnote}
% While a $32$-bit (signed) integer can be given as a seed, only the
% absolute value is used and any number beyond $2^{28}$ is divided
% by an appropriate power of~$2$. We recommend using an integer in
% $[0,2^{28}-1]$.
% \end{texnote}
% \end{function}
%
% \begin{function}[added = 2018-07-27, EXP, pTF]
% {
% \sys_if_platform_unix:,
% \sys_if_platform_windows:
% }
% \begin{syntax}
% \cs{sys_if_platform_unix:TF} \Arg{true code} \Arg{false code}
% \end{syntax}
% Conditionals which allow platform-specific code to be used. The names
% follow the \Lua{} |os.type()| function, \emph{i.e.}~all Unix-like systems
% are |unix| (including Linux and MacOS).
% \end{function}
%
% \begin{variable}[added = 2018-07-27]{\c_sys_platform_str}
% The current platform given as a lower case string: one of
% |unix|, |windows| or |unknown|.
% \end{variable}
%
% \begin{variable}[added = 2017-05-27]{\c_sys_shell_escape_int}
% This variable exposes the internal triple of the shell escape
% status. The possible values are
% \begin{description}
% \item[0] Shell escape is disabled
% \item[1] Unrestricted shell escape is enabled
% \item[2] Restricted shell escape is enabled
% \end{description}
% \end{variable}
%
% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell:}
% \begin{syntax}
% \cs{sys_if_shell_p:}
% \cs{sys_if_shell:TF} \Arg{true code} \Arg{false code}
% \end{syntax}
% Performs a check for whether shell escape is enabled. This
% returns true if either of restricted or unrestricted shell escape
% is enabled.
% \end{function}
%
% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell_unrestricted:}
% \begin{syntax}
% \cs{sys_if_shell_unrestricted_p:}
% \cs{sys_if_shell_unrestricted:TF} \Arg{true code} \Arg{false code}
% \end{syntax}
% Performs a check for whether \emph{unrestricted} shell escape is
% enabled.
% \end{function}
%
% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell_restricted:}
% \begin{syntax}
% \cs{sys_if_shell_restricted_p:}
% \cs{sys_if_shell_restricted:TF} \Arg{true code} \Arg{false code}
% \end{syntax}
% Performs a check for whether \emph{restricted} shell escape is
% enabled. This returns false if unrestricted shell escape is
% enabled. Unrestricted shell escape is not considered a superset
% of restricted shell escape in this case. To find whether any
% shell escape is enabled use \cs{sys_if_shell:}.
% \end{function}
%
% \begin{function}[added = 2017-05-27]{\sys_shell_now:n, \sys_shell_now:x}
% \begin{syntax}
% \cs{sys_shell_now:n} \Arg{tokens}
% \end{syntax}
% Execute \meta{tokens} through shell escape immediately.
% \end{function}
%
% \begin{function}[added = 2017-05-27]{\sys_shell_shipout:n, \sys_shell_shipout:x}
% \begin{syntax}
% \cs{sys_shell_shipout:n} \Arg{tokens}
% \end{syntax}
% Execute \meta{tokens} through shell escape at shipout.
% \end{function}
%
% \section{Additions to \pkg{l3tl}}
%
% \begin{function}[EXP,pTF]{\tl_if_single_token:n}
% \begin{syntax}
% \cs{tl_if_single_token_p:n} \Arg{token list}
% \cs{tl_if_single_token:nTF} \Arg{token list} \Arg{true code} \Arg{false code}
% \end{syntax}
% Tests if the token list consists of exactly one token, \emph{i.e.}~is
% either a single space character or a single \enquote{normal} token.
% Token groups (|{|\ldots|}|) are not single tokens.
% \end{function}
%
% \begin{function}[EXP]{\tl_reverse_tokens:n}
% \begin{syntax}
% \cs{tl_reverse_tokens:n} \Arg{tokens}
% \end{syntax}
% This function, which works directly on \TeX{} tokens, reverses
% the order of the \meta{tokens}: the first becomes the last and
% the last becomes first. Spaces are preserved. The reversal
% also operates within brace groups, but the braces themselves
% are not exchanged, as this would lead to an unbalanced token
% list. For instance, \cs{tl_reverse_tokens:n} |{a~{b()}}|
% leaves |{)(b}~a| in the input stream. This function requires
% two steps of expansion.
% \begin{texnote}
% The result is returned within the \tn{unexpanded}
% primitive (\cs{exp_not:n}), which means that the token
% list does not expand further when appearing in an \texttt{x}-type
% argument expansion.
% \end{texnote}
% \end{function}
%
% \begin{function}[EXP]{\tl_count_tokens:n}