-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlipsum.dtx
More file actions
5622 lines (5591 loc) · 302 KB
/
Copy pathlipsum.dtx
File metadata and controls
5622 lines (5591 loc) · 302 KB
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
%
% This file is part of the package lipsum for use with LaTeX2e.
%
% Function: Access to 150 paragraphs of the well known Lorem Ipsum dummy text.
%
% This program may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% Please send error reports and suggestions for improvements to
% Patrick Happel <patrick.happel@rub.de>.
%
% Alternatively, use github:
% https://github.com/patta42/lipsum
%
%<*driver>
\ProvidesFile{lipsum.dtx}[2019/01/02 v2.2 Access to 150 of Lorem Ipsum dummy text]
\documentclass{l3doc}
\usepackage[a4paper,
top=2cm, left=8.8cm, right=2cm, bottom=3cm,
marginparwidth=6.3cm, marginparsep=.5cm,
]{geometry}
\newlength\fullmargin
\setlength\fullmargin\marginparwidth
\addtolength\fullmargin\marginparsep
\usepackage{mdframed}
\mdfdefinestyle{expl}{%
backgroundcolor=black!5!white,
linewidth=0pt,
middlelinewidth=0pt
}
\newmdenv[style=expl]{explbox}
\newmdenv[%
style=expl,
subtitlebackgroundcolor=yellow!5!white,
frametitlebackgroundcolor=yellow!5!white,
frametitle={Code},
] {exploutputbox}
\usepackage{lipsum,multicol}
\usepackage[latin, english]{babel}
\makeatletter
\newcommand\@subtitle{}
\newcommand\subtitle[1]{%
\renewcommand\@subtitle{#1}}
\renewcommand\maketitle[1]{
\noindent
\hspace{-\fullmargin}%
\begin{minipage}{\textwidth+\fullmargin}
\renewcommand\thefootnote{\fnsymbol{footnote}}
\let\thanks\footnote
{
\centering
{\LARGE \@title}\\[.8\baselineskip]
{\LARGE \@subtitle}\\[2\baselineskip]
{\Large \@author}\\[\baselineskip]
{\Large \@date}\\[\baselineskip]
}
\ifx\\#1\\\else
\begin{multicols}{2}[%
\subsection*{\hfill\abstractname\hfill\null}]
\setlength{\columnsep}{.5cm}%
#1
\end{multicols}
\fi
\end{minipage}
}
\makeatother
\newenvironment{wide}{
\hspace{-.75\fullmargin}
\begin{minipage}{\textwidth+.75\fullmargin}
}{
\end{minipage}
}
\newenvironment{widefigure}
{
\begin{figure}
\begin{wide}
}
{
\end{wide}
\end{figure}
}
\newlist{macrolist}{itemize}{1}%
\setlist[macrolist]{%
label=$\triangleright$,
labelindent=0cm,
itemsep=.15\baselineskip,
leftmargin=.75\parindent
}
\newcommand\opt[1]{\textsf{#1}} % l3doc does not have some markup for package options...
\newcommand\lips{\emph{Lorem ipsum\ldots}}
\renewcommand\topfraction{.85}
\renewcommand\textfraction{.15}
\renewcommand\floatpagefraction{.85}
\emergencystretch 2em
\begin{document}
\DocInput{lipsum.dtx}
\end{document}
%</driver>
%<*package>
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}[2018/10/31]
\RequirePackage{xparse}
\ProvidesExplPackage
{lipsum}
{2019/01/02}
{2.2}
{150 paragraphs of Lorem Ipsum dummy text}
%</package>
%<*lipsum>
\ProvidesFile{lipsum.ltd.tex}[2019/01/02 v2.2 The Lorem ipsum dummy text]
%</lipsum>
%<*cicero>
\ProvidesFile{cicero.ltd.tex}[2019/01/02 v2.2 Text of Cicero's speech]
%</cicero>
% \fi
%
% \title{\pkg{lipsum}}
% \subtitle{Access to 150 paragraphs of Lorem Ipsum dummy
% text\thanks{Version: 2.2}}
% \author{Patrick Happel\thanks{patrick.happel@rub.de}}
% \date{\today}
% \RecordChanges
% \changes{v1.0}{2004/05/15}{First release}
% \changes{v1.1}{2011/02/08}{Added support for typesetting dummy text without
% paragraphs in between.}
% \changes{v1.2}{2011/04/14}{Bug fix (thanks to Florent Chervet and Ulrike
% Fischer for reporting).}
% \changes{v1.3}{2014/07/19}{Introduced some improvements and provided some
% new macros (thanks to tex.stackexchange user egreg).}
% \changes{v1.3a}{2017/08/10}{Fixed a type in the documentation (thanks to
% Vincent Belaïche). This version never made its way on CTAN due to some
% version naming conflicts. Since the change here was only in the
% documentation, I first didn't want it to be 1.3a and later had no time to
% update it properly.}
% \changes{v2.0}{2018/11/07}{Added the possibility to fetch a number of sentences from the
% lipsum paragraphs (thanks to Frank Mittelbach).}
% \changes{v2.0}{2018/11/07}{Rewritten code in \pkg{expl3} syntax.}
% \changes{v2.1}{2018/11/18}{Changed defaults, now nothing is typeset at the
% end of any list.}
% \changes{v2.1a}{2018/11/24}{Added forgotten ins-file to CTAN. This requires
% a new version number.}
% \changes{v2.2}{2018/12/25}{replaced \cs{tex_par:D} by \cs{par} to avoid
% incompatibilities with \LaTeX2e's |list|-environment. Thanks to Karl Hagen
% for reporting. See \url{ttps://github.com/patta42/lipsum/issues/12}.}
%
% \maketitle{\pkg{lipsum} is a \LaTeX{} package that produces dummy text
% to be used in test documents or examples. The paragraphs are taken with
% permission from \url{https://www.lipsum.com/}, thanks to James Wilson for
% this work. Furthermore, the following people contributed to \pkg{lipsum} by
% suggesting improvements, correcting bugs or finding typos in the
% documentation: Florent Chervet, Ulrike Fischer, Vincent Belaïche, Enrico
% Gregorio, Frank Mittelbach, Karl Hagen.
%
% \hspace{1em} Please, file bug reports, typos in the documentation or
% feature requests as an issue on
% \url{https://github.com/patta42/lipsum/issues}.}
% \begin{documentation}
%
% \section{Quick usage overview}
% To load the package specify
% \begin{verbatim}
% \usepackage{lipsum}
% \end{verbatim}
% in the preamble of your document. This package provides several
% macros. \DescribeMacro{\lipsum}The most important one is
% \cs{lipsum}. This macro typesets the \emph{Lorem ipsum}
% paragraphs. It has two optional arguments. The first one allows to specify the range
% of the paragraphs. For example, \verb|\lipsum[4-57]| typesets the paragraphs 4 to
% 57 and accordingly, \verb|\lipsum[23]| typesets the 23\textsuperscript{rd}
% paragraph. Using \cs{lipsum} without its optional argument typesets
% the paragraphs 1--7 of \lips
%
% As of version 2.0, \cs{lipsum} has a second optional argument which allows
% selecting a range of sentences from the paragraphs. To get the sentences
% four to eight from paragraphs three to nine, use |\lipsum[3-9][4-8]|.
%
% \section{Foreword to Version 2.0}\label{sec:foreword2.0}
% Version 2.0 of \pkg{lipsum} is a complete (well, nearly complete) rewrite
% of the code in \pkg{expl3}
% syntax. I have never used \pkg{expl3} before and thus the code might be too
% complicated, might use wrong or badly chosen data types or weird function
% names. I am happy to receive comments on this.
%
% Due the complete rewrite, some internals have changed which might impact
% older documents. Since, however, I guess that \pkg{lipsum} is not used for
% documents with true, important, content, I think potentially breaking up old
% documents is not a big issue here. The changes are:
% \begin{itemize}
% \item The package option \opt{nopar} now uses a \cs{space} as terminator,
% instead of \cs{relax}.
% \item The commands \cs{UnpackLipsum} and \cs{UnpackLipsum*} are no longer
% available. The effect of \cs{UnpackLipsum} now is default for
% \cs{unpacklipsum} (or \cs{unpacklipsum*}, depending on the package
% option). The effect of \cs{UnpackLipsum*} can be mimicked by using
% \cs{LipsumProtect}\Arg{command}, as in the following example:
% \begin{explbox}
% \begin{verbatim}
% \documentclass{article}
% \usepackage{lipsum,xcolor}
% \newcommand\foo{}
% \SetLipsumParListItemEnd{\LipsumProtect{\foo}}
%
% \begin{document}
% \renewcommand\foo{\color{.!75!red}}
% { \lipsumexp }
%
% \newcounter{mycnt}\setcounter{mycnt}{1}
% \renewcommand\foo{%
% (\themycnt)\stepcounter{mycnt}}
% \lipsumexp
%
% \end{document}
%
% \end{verbatim}
% \end{explbox}
% \item The internal macros \cs{lips@i}, \cs{lips@ii}, \cs{lips@iii}, \ldots,
% \cs{lips@cl} are no longer available.
% \item All other internal macros (with one exception) are no longer available,
% too.
% \end{itemize}
% \section{Foreword to version 2.2}
% As of version 2.2, \pkg{lipsum} provides a simple interface to define other
% texts to be used as output of the \cs{lipsum}-family of commands. This was
% heavily inspired by an issue raised by
% \emph{svenper} on
% github\footnote{\url{https://github.com/patta42/lipsum/issues/13}}. However,
% the implementation of this interface might not match the needs of everyone
% who wants to provide a dummy text in another language. Comments and
% suggestions on this are very welcome.
%
% Please note that the documentation still only refers to the \lips-text.
%
% \section{Usage}
% \pkg{lipsum} was intended to quickly provide a way to fill a page or two to
% analyze the page
% layout\footnote{\url{https://groups.google.com/d/topic/de.comp.text.tex/oPeLOjkrLfk/discussion}}.
% While it has grown in the meanwhile and now provides some more advanced
% features, it still is only intended to quickly provide text. If you want more
% features, look at the \pkg{blindtext}-package.
%
% \subsection{Package Options}
% \pkg{lipsum} outputs a range of paragraphs taken from the \lips\ dummy
% text. The package option controls how the single paragraphs of \lips\ are
% separated. The default is to separate the paragaraph with \cs{par}. One
% option is available to change the default behaviour:
% \begin{description}
% \item[\opt{nopar}:] Instead of \cs{par}, \cs{space} is used to
% separate the paragraphs.
% \end{description}
%
% \subsection{User Commands}
% \DescribeMacro{\lipsum}\DescribeMacro{\lipsum*}
% \begin{quote}
% \cs{lipsum}\oarg{paragraph range}\oarg{sentence range}\\
% \cs{lipsum*}\oarg{paragraph range}\oarg{sentence range}
% \end{quote}
% \cs{lipsum} (and \cs{lipsum*}) uses a \meta{range} as input. A \meta{range}
% consists either of a single \meta{number} or two numbers separated by a dash
% (|-|), as in \meta{number_1}-\meta{number_2}. While syntactically correct,
% \cs{lipsum} (and related commands) might fail if
% $\meta{number_2} < \meta{number_1}$.
%
% If used without an argument, \cs{lipsum} outputs the paragraphs 1--7 of
% \lips\ (as long as the default has not been overwritten, see
% below). \cs{lipsum} terminates every paragraph depending on the package
% option (using \cs{par} is the default). \cs{lipsum*} does the same, but
% uses a different termination (default is to use a blank space) for each
% paragraph. \emph{As a simplified rule of thumb, \cs{lipsum} prints the
% paragraphs as multiple paragraphs, \cs{lipsum*} prints them as a single
% paragraph}.
%
% To change the range of the paragraphs, specify a \meta{paragraph range}, which
% can either be a single number, as in |\lipsum[23]| (which will output the
% 23\textsuperscript{rd} paragraph), or two numbers separated by a dash, as in
% |\lipsum*[9-12]|, which will output the paragraphs nine to
% twelve. \pkg{lipsum} provides 150 paragraphs of \lips\, thus |150| is the
% maximum that should be specified.
%
% \subsection{Outputting Sentences instead of Paragraphs}
% Starting with \pkg{lipsum} v2.0, \cs{lipsum} and \cs{lipsum*} allow to
% output sentences of the \lips\ dummy text instead of paragraphs. To retrieve
% sentences instead of paragraphs, specify a \meta{sentence range} as the second
% optional argument of \cs{lipsum} and \cs{lipsum*}. Note: To be able to
% specify a second optional argument, the first optional argument has to be
% provided and is thus not really optional anymore. Furthermore, it must be
% set to some \meta{range}-value, using an empty first optional argument is
% not implemented. As a consequence |\lipsum[][1-3]| will fail.
%
% Valid inputs for \meta{sentence range} are, again, a single number, as in
% |\lipsum[1][1]|, which will output the first sentence of the first paragraph
% (the famous {\SetLipsumSentenceListEnd{}\itshape»\lipsum[1][1]«}). |\lipsum*[3-7][7-8]| will output the
% seventh and eighth sentence of the paragraphs three to seven.
%
% There are some limitations and remarks on selecting sentences as described
% in the following:
% \begin{itemize}
% \item When sentences are output, they are (by default) separated by
% \cs{space}. The difference between \cs{lipsum} and \cs{lipsum*} is the
% token that terminates the paragraph of sentences: Without a package option
% (and changing the defaults), \cs{lipsum} terminates the sequence of
% senetences by \cs{par}, \cs{lipsum*} by \cs{space} and vice versa, if
% \opt{nopar} is specified as package option.
% \item Specifying a \meta{sentence range} which is outside the number of
% sentences in the specified \meta{paragraph range} will not lead to an
% error. Instead, sentences which are not available are ignored and nothing
% is output. For example, |\lipsum[104][9-20]| will only output two
% sentences since paragraph \#104 consists only of 10 sentences. For the
% same reason, |\lipsum[104][11-20]| will output nothing.
% \item If you need a lot of sentences, consider the \opt{space} option and
% |\lipsum[1-150]|. This should be faster.
% \end{itemize}
%
% \section{Advanced or Developer Macros}
% To distinguish between macros for users and macros for, for example, package
% developers, it has been discussed to use different naming schemes. One
% option is that user level macros are all lowercase, while developer-level
% commands are CamelCase. Until version 2.0, \pkg{lipsum} has not yet followed
% this convention. Thus, the old lowercase commands are still available, but
% considered deprecated. They are not described in this section, but in the
% corresponding section in the documented code (section
% \nameref{sec:code:commands}).
%
% \DescribeMacro{\SetLipsumDefault} In order to change the default range of
% paragraphs that is used by \cs{lipsum} and friends, specify
% |\SetLipsumDefault{8}| or |\SetLipsumDefault{123-145}|.
%
% \DescribeMacro{\LipsumPar} To get a single paragraph of the \lips\ dummy
% text, use |\LipsumPar{8}| (for the eighth paragraph). This is similar to
% using |\lips@viii| directly in versions prior to \pkg{lipsum}2.0. the
% difference between |\LipsumPar{8}| and |\lipsum[8]| is that the first directly
% accesses the internal macro that stores the corresponding paragraph, while
% the latter runs the loop that selects the \lips\ paragraphs.
%
% \DescribeMacro{\unpacklipsum} \DescribeMacro{\unpacklipsum*}
% \DescribeMacro{\lipsumexp} The commands \cs{unpacklipsum} and
% \cs{unpacklipsum*} work as \cs{lipsum} and \cs{lipsum*} and have the same
% two optional arguments, but instead of typesetting the \lips\ paragraphs,
% the commands store them in the macro \cs{lipsumexp} using \tn{edef}, thus,
% everything which can be expanded is expanded.
%
% \subsection{Fine-tuning the output}
% The output of \cs{lipsum}, whether paragraphs or sentences, can be seen as a
% \meta{list} of \meta{item}s, where an item is either a paragraph or a
% sentence. As of version 2.0, \pkg{lipsum} allows to fine-tune which tokens
% are inserted at the beginning of the \meta{list}, at the end of the
% \meta{list}, at the beginning and end of each \meta{item} as well as between
% the single \meta{items}. The resulting list of tokens can be seen in
% Figure~\ref{fig:tokens}.
% \begin{widefigure}
% % { \raggedright
% \meta{list_s}\dotfill\cs{SetLipsumParListStart}\Arg{tokens}\\
% \hspace*{1em}\meta{item_1_,_s-outer}{\color{gray}\dotfill
% \cs{SetLipsumParListOuterItemStart}\Arg{item spec}\Arg{tokens}}\\
% \hspace*{2em}\meta{item_s}\dotfill\cs{SetLipsumParListItemStart}\Arg{tokens}\\
% \hspace*{3em}\meta{item_1_,_s-inner}{\color{gray}\dotfill
% \cs{SetLipsumParListInnerItemStart}\Arg{item spec}\Arg{tokens}}\\
% \hspace*{4em}\textbf{\meta{item_1}}\\
% \hspace*{3em}\meta{item_1_,_e-inner}{\color{gray}\dotfill
% \cs{SetLipsumParListInnerItemEnd}\Arg{item spec}\Arg{tokens}}\\
% \hspace*{2em}\meta{item_e}\dotfill\cs{SetLipsumParListItemEnd}\Arg{tokens}\\
% \hspace*{1em}\meta{item_1_,_e-outer}{\color{gray}\dotfill
% \cs{SetLipsumParListOuterItemEnd}\Arg{item spec}\Arg{tokens}}\\
% \meta{item-separator}\dotfill\cs{SetLipsumParListItemSeparator}\Arg{tokens}\\[.5\baselineskip]
% \hspace{1em}\ldots\hfill\hfill\hfill $\uparrow$ {\small lists of paragraphs}
% $\uparrow$ --- $\downarrow$ {\small
% lists of sentences} $\downarrow$\\[.5\baselineskip]
% \meta{item-separator}\dotfill\cs{SetLipsumSentenceListItemSeparator}\Arg{tokens}\\
% \hspace{1em}\meta{item_N_,_s-outer}{\color{gray}\dotfill
% \cs{SetLipsumSentenceListOuterItemStart}\Arg{item spec}\Arg{tokens}}\\
% \hspace{2em}\meta{item_s}\dotfill\cs{SetLipsumSentenceListItemStart}\Arg{tokens}\\
% \hspace{3em}\meta{item_N_,_s-inner}{\color{gray}\dotfill
% \cs{SetLipsumSentenceListInnerItemStart}\Arg{item spec}\Arg{tokens}}\\
% \hspace*{4em}\textbf{\meta{item_N}}\\
% \hspace*{3em}\meta{item_N_,_e-inner}{\color{gray}\dotfill
% \cs{SetLipsumSentenceListInnerItemEnd}\Arg{item spec}\Arg{tokens}}\\
% \hspace*{2em}\meta{item_e}\dotfill\cs{SetLipsumSentenceListItemEnd}\Arg{tokens}\\
% \hspace*{1em}\meta{item_N_,_e-outer}{\color{gray}\dotfill
% \cs{SetLipsumSentenceListOuterItemEnd}\Arg{item spec}\Arg{tokens}}\\
% \meta{list_e}\dotfill\cs{SetLipsumSentenceListEnd}\Arg{tokens}
% }
% \begin{multicols}{2}\sffamily\bfseries
% \caption{Places where additional tokens can be inserted in the output. $N$
% indicates the last \meta{item}, `\ldots' indicate the same structure as for the
% first and last \meta{item}. Commands colored gray are not yet implemented. The
% upper part displays the commands for lists of paragraphs, the lower part for
% lists of sentences (also indicated by the labelled arrows in the middle). }
% \label{fig:tokens}
% \end{multicols}
%
%
% \end{widefigure}
% \DescribeMacro{\SetLipsumParListStart}\DescribeMacro{\SetLipsumParListStart*}
% \DescribeMacro{\SetLipsumParListEnd}\DescribeMacro{\SetLipsumParListEnd*}
% \DescribeMacro{\SetLipsumSentenceListStart}\DescribeMacro{\SetLipsumSentenceListStart*}
% \DescribeMacro{\SetLipsumSentenceListEnd}\DescribeMacro{\SetLipsumSentenceListEnd*}
% \pkg{lipsum} allows to specify all of the tokens in the list indicated
% above except for the item-specific inner and outer \meta{items} (shown as
% \meta{item_N_,_s-outer/inner}, \meta{item_N_,_e-outer/inner} above), which
% remain to be implemented.
%
% The macros that enable setting these tokens are all available in a normal
% and in a starred version, they apply to \cs{lipsum} and \cs{unpacklipsum} or
% \cs{lipsum*} and \cs{unpacklipsum*}, respectively.
%
%
% The macro \cs{SetLipsumParListStart}\Arg{tokens} and its starred variant
% insert \meta{tokens} at the very beginning of the list of paragraphs
% (\meta{list_s} in Figure~\ref{fig:tokens}). \cs{SetLipsumSentenceListStart}
% and \cs{SetLipsumSentenceListStart*} do the same for the list of
% sentences. The corresponding macros that allow to input \meta{tokens} at the
% very end of the output (\meta{list_e} in Figure~\ref{fig:tokens}) are
% \cs{SetLipsumParListEnd} (and its starred variant) and
% \cs{SetLipsumSentenceListEnd} (and its starred variant).
%
% As a shorthand, the commands
% \begin{macrolist}
% \item \cs{SetLipsumParListSurrounders}\Arg{start}\Arg{end}\DescribeMacro{\SetLipsumParListSurrounders}
% \item \cs{SetLipsumParListSurrounders*}\Arg{start}\Arg{end}\DescribeMacro{\SetLipsumParListSurrounders*}
% \item \cs{SetLipsumSentenceListSurrounders}\Arg{start}\Arg{end}\DescribeMacro{\SetLipsumSentenceListSurrounders}
% \item \cs{SetLipsumSentenceListSurrounders*}\Arg{start}\Arg{end}\DescribeMacro{\SetLipsumSentenceListSurrounders*}
% \end{macrolist}
% are available to set the \meta{tokens} for the start and end position with a
% single command.
%
% \DescribeMacro{\SetLipsumParListItemStart}
% \DescribeMacro{\SetLipsumParListItemStart*}
% \DescribeMacro{\SetLipsumParListItemEnd} \DescribeMacro{\SetLipsumParListItemEnd*}
% \DescribeMacro{\SetLipsumSentenceListItemStart}
% \DescribeMacro{\SetLipsumSentenceListItemStart*}
% \DescribeMacro{\SetLipsumSentenceListItemEnd}
% \DescribeMacro{\SetLipsumSentenceListItemEnd*}
% To add \meta{tokens} in front of every \meta{item}, the commands
% \cs{SetLipsumParListItemStart} (and its starred variant) and
% \cs{SetLipsumSentenceListItemStart} are available. To add tokens after every
% \meta{item}, the corresponding commands are \cs{SetLipsumParListItemEnd}
% (and its starred variant) and \cs{SetLipsumSentenceListItemStart} (and its
% starred variant).
%
% Again, there are
% commands that allow to set a pair of \meta{tokens} to surround every item:
% \begin{macrolist}
% \item \cs{SetLipsumParListItemSurrounders}\Arg{start}\Arg{end}\DescribeMacro{\SetLipsumParListItemSurrounders}
% \item \cs{SetLipsumParListItemSurrounders*}\Arg{start}\Arg{end}\DescribeMacro{\SetLipsumParListItemSurrounders*}
% \item \cs{SetLipsumSentenceListItemSurrounders}\Arg{start}\Arg{end}\DescribeMacro{\SetLipsumSentenceListItemSurrounders}
% \item \DescribeMacro{\SetLipsumSentenceListItemSurrounders*} \cs{SetLipsumSentenceListItemSurrounders*}\Arg{start}\Arg{end}
%
% \end{macrolist}
%
% \DescribeMacro{\SetLipsumParListItemSeparator}
% \DescribeMacro{\SetLipsumParListItemSeparator*}
% \DescribeMacro{\SetLipsumSentenceListItemSeparator}
% \DescribeMacro{\SetLipsumSentenceListItemSeparator*} To insert \meta{tokens}
% between the single \meta{item}s, the commands
% \cs{SetLipsumParListItemSeparator} (with its starred variant) and
% \cs{SetLipsumSentenceListItemSeparator} (also with its starred variant) are
% available. As can be seen in Figure~\ref{fig:tokens}, these tokens are
% inserted after the tokens inserted by |\...ListItemEnd| and before the
% following |\...ListItemStart|.
%
% \DescribeMacro{\LipsumProtect} To insert \meta{tokens} that survive the
% expansion by \cs{unpacklipsum} and \cs{unpacklipsum*}, \pkg{lipsum} provides
% \cs{LipsumProtect}\Arg{tokens}. See the example in the
% \nameref{sec:foreword2.0}.
%
% The macros introduced above can be used to turn the output of \cs{lipsum},
% for example, into a list, as exemplified in Figure~\ref{fig:list-expl}.
% \begin{widefigure}
% \begin{exploutputbox}
% \begin{verbatim}
%
% \SetLipsumSentenceListSurrounders{\begin{itemize}}{\end{itemize}}
% \SetLipsumSentenceListItemStart{\item}
% \lipsum[10][1-2]
% \end{verbatim}
% \mdfsubtitle{Output}
% \SetLipsumSentenceListSurrounders{\begin{itemize}}{\end{itemize}}
% \SetLipsumSentenceListItemStart{\item}
% \lipsum[10][1-2]
% \end{exploutputbox}
% \sffamily\bfseries
% \caption{Turning the output of \cs{lipsum} into a list using inserted tokens.}
% \label{fig:list-expl}
% \end{widefigure}
% The gray commands in Figure~\ref{fig:tokens} are thought to allow inserting
% \meta{tokens} around a specific \meta{item}, but they remain to be implemented. One
% way to access a specific \meta{item} in a list is shown in
% Figure~\ref{fig:seconditem}, but other, maybe more elegant ways are
% conceivable.
%
% To quickly reset the \meta{tokens} inserted by the above commands to their
% default values, \pkg{lipsum} provides \DescribeMacro{\LipsumRestoreParList}
% \cs{LipsumRestoreParList} (for lists of paragraphs),
% \DescribeMacro{\LipsumRestoreSentenceList} \cs{LipsumRestoreSentenceList} (for lists of
% sentences) and \DescribeMacro{\LipsumRestoreAll} \cs{LipsumRestoreAll} for
% both lists.
% \begin{widefigure}
% \begin{exploutputbox}
% \begin{verbatim}
% \newcounter{itemcount}
% \setcounter{itemcount}{0}
% \SetLipsumParListItemSurrounders{%
% \stepcounter{itemcount}
% \ifnum\value{itemcount}=2\begingroup\sffamily\fi
% }{
% \ifnum\value{itemcount}=2\endgroup\fi
% }
% \lipsum[110-112]
% \end{verbatim}
% \mdfsubtitle{Output}
% \newcounter{itemcount}
% \setcounter{itemcount}{0}
% \SetLipsumParListItemSurrounders{%
% \stepcounter{itemcount}
% \ifnum\value{itemcount}=2\begingroup\sffamily\fi
% }{
% \ifnum\value{itemcount}=2\endgroup\fi
% }
% \setlength{\parindent}{1em}\small
% \lipsum[110-112]
% \end{exploutputbox}\sffamily\bfseries
% \caption{Styling the second \meta{item} of a list.}\label{fig:seconditem}
% \end{widefigure}
% \subsection{Loading and defining different texts}\label{sec:other-texts}
% Starting with \pkg{lipsum}2.2, a simple interface is provided to define and
% load other texts for the output of \cs{lipsum} and friends. This interface
% can, for example, be used to implement dummy texts in different languages
% without re-coding the logic implemented by \pkg{lipsum}. In order to provide
% a new text that will be used by lipsum, define the text by using a set of
% \DescribeMacro{\NewLipsumPar}\cs{NewLipsumPar}\Arg{paragraph} commands in a
% file with the ending |.ltd.tex| (|ltd| means \emph{lipsum text
% definition}\footnote{To avoid name clashes with files using general
% languages as names, I chose to introduce the |.ltd.tex| file ending. I did
% not find a file with this ending in my |texmf|-tree, so I guess it is
% safe.}) to a location where your \TeX-system will find it. The
% \meta{paragraph}-argument is a single paragraph of the new text. Thus, the
% first occurence of \cs{NewLipsumPar} defines the first paragraph, the second
% occurence the second paragraph and so on.
%
% To specify the new text as output for \cs{lipsum} and friends, use
% \DescribeMacro{\SetLipsumText}\cs{SetLipsumText}\Arg{filename}, where
% \meta{filename} is the name of the file without the ending |.ltd.tex|.
%
% \pkg{lipsum} ships with two texts, |lipsum.ltd.tex| which contains the
% \lips-dummy text and which is loaded by default, and, thanks to github-user
% \emph{svenper}, |cicero.ltd.tex|, which contains the speech by Cicero which
% inspired the \lips-dummy text. In contrast to the default \lips\ text,
% the |cicero| text, which can be selected by |\SetLipsumText{cicero}|, is true
% latin, and thus is properly hyphenated by, for example, the \pkg{babel}
% package with the language |latin| loaded (and
% selected). Figure~\ref{fig:cicero} shows how to load and use the text of
% Cicero's speech (note that the use of babel is optional).
%
% \begin{widefigure}
% \begin{exploutputbox}
% \begin{verbatim}
% \lipsum[1][1]
% \SetLipsumText{cicero}
% \selectlanguage{latin} % optional, requires babel.sty with option latin.
% \lipsum[1]
% \end{verbatim}
% \mdfsubtitle{Output}
% \lipsum[1][1]
% \MakePercentComment\SetLipsumText{cicero}\MakePercentIgnore
% \selectlanguage{latin}
% \hspace*{1em}\lipsum[1]
% \end{exploutputbox}
% \MakePercentComment\SetLipsumText{lipsum}\MakePercentIgnore
% \sffamily\bfseries
% \caption{Selecting and using the text of Cicero's speech.}
% \label{fig:cicero}
% \end{widefigure}
% \subsubsection{Limitations of and comments on the interface}
% \cs{SetLipsumText} more or less just uses an \cs{input} or, to be more
% precise, the \LaTeX3-variant \cs{file_input:n}, to load the |.ltd.tex|
% file. This means, that the file is not necessarily loaded in the preamble of
% the document and thus the contents of the file underlie the respective
% restrictions. Most importantly, no additional packages can be loaded. Thus,
% if your text requires additional packages, the documentation should state
% that the user has to load the packages. Since \pkg{lipsum} is a package for
% developers and commonly used for examples, it will not load any packages
% except the ones required by \pkg{lipsum} itself to be usable for a maximum
% of developers.
%
% Futhermore, the commands used to typeset the new texts are still
% \cs{lipsum}, \cs{lipsum*}, \cs{unpacklipsum} and so on and the commands to
% tune the output are still \cs{SetLipsumParListStart} and friends and no way
% is provided to easily generate a set of commands where the
% |lipsum| (or |Lipsum|) part of the command names is exchanged by, for
% example, |cicero| or |Cicero|.
%
% Nonetheless, if you want to write a new package instead of just providing a
% new dummy text, maybe because it requires a certain package to be loaded, or
% because you want to have a different command than \cs{lipsum}, this can be
% as easy as this\footnote{The following code has never been tested, it was
% just written from mind as an example.}:
% \begin{verbatim}
% \ProvidesPackage{mydummytext}
% \RequirePackage{lipsum}
% \SetLipsumText{mydummytext}
% \end{verbatim}
% To make the text accesible via a command \cs{mydummytext}, simply use
% \cs{let} to copy the definition of \cs{lipsum}:
% \begin{verbatim}
% \let\mydummytext\lipsum
% \end{verbatim}
% Note that this works fine with one exception: \cs{unpacklipsum} and
% \cs{unpacklipsum*} store their content in \cs{lipsumexp}, and they will keep
% doing so if you simply copy them using \cs{let}. Thus, to change
% \cs{lipsumexp} to, for example, \cs{ciceroexp}, you will have to re-code the
% \cs{unpacklipsum} command.
%
% I would, however, suggest to keep the \cs{lipsum}-commands since they are
% known to provide dummy text and one can easily refer to this
% documentation. But in the end this decision---of course---remains to
% the author of the new package.
% \end{documentation}
% \begin{implementation}
% \section{\pkg{lipsum} Implementation}
% \begin{macrocode}
%<*package>
% \end{macrocode}
% \begin{macrocode}
%<@@=lipsum>
% \end{macrocode}
%
% A check to make sure that \pkg{expl3} is not too old
% \begin{macrocode}
\@ifpackagelater { expl3 } { 2018/10/31 }
{ }
{
\PackageError { lipsum } { Package~expl3~too~old }
{
You~need~to~update~your~installation~of~the~bundles~
'l3kernel'~and~'l3packages'.\MessageBreak
Loading~lipsum~will~abort!
}
\tex_endinput:D
}
% \end{macrocode}
% \subsection{Command Variants}
% To parse \meta{range}-like arguments, that is, arguments consisting either
% of a single number, as in |8|, or of a range, as in |9-11|, we use the
% argument processor \cs{SplitArgument} of \pkg{xparse}. However, the argument
% can either be a range as specified above, or a token list containing a
% range. Thus, the argument has to be expanded before it is analyzed. This use
% case is not available in \pkg{xparse} (at least not in the release
% 2018-10-17). Thus, we have to touch \pkg{xparse}'s internal and generate
% such a variant. We copy it to a \pkg{lipsum} internal variant to avoid name
% clashes with future versions of \pkg{xparse}.
% \begin{function}{\__lipsum_split_argument_expanded:nne
% ,\__xparse_split_argument:nne}
% \begin{syntax}
% \cs{__lipsum_split_argument_expanded:nne}\Arg{number}\Arg{token}\Arg{argument}
% \end{syntax}
% \begin{arguments}
% \item See documentation for \cs{SplitArgument} in
% \pkg{xparse}
% \item See documentation for \cs{SplitArgument} in
% \pkg{xparse}
% \item The argument fed to the function, which is expanded
% in this case
% \end{arguments}
% \begin{macrocode}
\cs_generate_variant:Nn \__xparse_split_argument:nnn {nne}
\cs_new_eq:NN
\__lipsum_split_argument_expanded:nne
\__xparse_split_argument:nne
% \end{macrocode}
% \end{function}
% \begin{function}{str_if_eq:VnTF}
% Allows to compare a string value and a string:
% \begin{macrocode}
\cs_generate_variant:Nn \str_if_eq:nnTF {VnTF}
% \end{macrocode}
% \end{function}
%
% \subsection{Messages}
% Starting from \pkg{lipsum}2.0, some commands from previous versions are
% considered deprecated and issue a warning when used. This is the
% corresponding message.
% \begin{macrocode}
\msg_new:nnnn{lipsum}{DeprecatedCommand}
{\string#1\msg_line_context:\\
\string#1~should~be~substituted~by~\string#2.}
{ The~command~\string#1~is~deprecated~
and~should~be~substituted~by~
\string#2.~
\string#1~might~not~be~available~in~a~
future~version~of~lipsum.sty.}
% \end{macrocode}
%
% \subsection{Variables}
% \begin{variable}{\g_@@_paragraph_seq}
% The sequence that stores all the paragraphs.
% \begin{macrocode}
\seq_new:N\g_@@_paragraph_seq
% \end{macrocode}
% \end{variable}
% \begin{variable}{\g_lipsum_default_range_tl}
% The default range for lipsum paragraphs.
% \begin{macrocode}
\tl_new:N \g_lipsum_default_range_tl %
% \end{macrocode}
% \end{variable}
% \begin{variable}{\l__lipsum_pars_tl}
% This variables is used to store the token list containing the selected paragraphs.
% \begin{macrocode}
\tl_new:N \l__lipsum_pars_tl
% \end{macrocode}
% \end{variable}
% \begin{variable}{\l__lipsum_sentences_tl}
% This variables is used to store the token list containing the selected sentences.
% \begin{macrocode}
\tl_new:N \l__lipsum_sentences_tl
% \end{macrocode}
% \end{variable}
% \begin{variable}{
% \l__lipsum_sentences_seq
% }
% In this sequence, the sentence list is stored.
% \begin{macrocode}
\seq_new:N \l__lipsum_sentences_seq
% \end{macrocode}
% \end{variable}
% \begin{variable}{\l_@@_par_list_start_nostar_tl,
% \l_@@_par_list_end_nostar_tl, \l_@@_sentence_list_start_nostar_tl,
% \l_@@_sentence_list_end_nostar_tl, \l_@@_par_list_start_star_tl,
% \l_@@_par_list_end_star_tl, \l_@@_sentence_star_list_start_tl,
% \l_@@_sentence_star_list_end_tl}
% Next are the variables used to store the tokens between the list items for
% lists of paragraph and lists of sentences.
%
% \begin{macrocode}
\tl_new:N \l_@@_par_list_start_nostar_tl
\tl_new:N \l_@@_par_list_end_nostar_tl
\tl_new:N \l_@@_sentence_list_start_nostar_tl
\tl_new:N \l_@@_sentence_list_end_nostar_tl
\tl_new:N \l_@@_par_list_start_star_tl
\tl_new:N \l_@@_par_list_end_star_tl
\tl_new:N \l_@@_sentence_list_start_star_tl
\tl_new:N \l_@@_sentence_list_end_star_tl
% \end{macrocode}
% \end{variable}
% \begin{variable}{\l_@@_par_list_itemseparator_nostar_tl,
% \l_@@_sentence_list_itemseparator_nostar_tl,
% \l_@@_par_list_itemseparator_star_tl,
% \l_@@_sentence_list_itemseparator_star_tl}
% The variables to store the tokens that separate the single items of the
% paragraph or sentence list.
% \begin{macrocode}
\tl_new:N \l_@@_par_list_itemseparator_nostar_tl
\tl_new:N \l_@@_sentence_list_itemseparator_nostar_tl
\tl_new:N \l_@@_par_list_itemseparator_star_tl
\tl_new:N \l_@@_sentence_list_itemseparator_star_tl
% \end{macrocode}
% \end{variable}
% \begin{variable}{\l_@@_par_list_itemstart_nostar_tl,
% \l_@@_par_list_itemend_nostar_tl, \l_@@_sentence_list_itemstart_nostar_tl,
% \l_@@_sentence_list_itemend_nostar_tl, \l_@@_par_list_itemstart_star_tl,
% \l_@@_par_list_itemend_star_tl, \l_@@_sentence_list_itemstart_star_tl,
% \l_@@_sentence_list_itemend_star_tl}
% The variables that surround each single item of a paragraph or sentence list.
% \begin{macrocode}
\tl_new:N \l_@@_par_list_itemstart_nostar_tl
\tl_new:N \l_@@_par_list_itemend_nostar_tl
\tl_new:N \l_@@_sentence_list_itemstart_nostar_tl
\tl_new:N \l_@@_sentence_list_itemend_nostar_tl
\tl_new:N \l_@@_par_list_itemstart_star_tl
\tl_new:N \l_@@_par_list_itemend_star_tl
\tl_new:N \l_@@_sentence_list_itemstart_star_tl
\tl_new:N \l_@@_sentence_list_itemend_star_tl
% \end{macrocode}
% \end{variable}
% \begin{variable}{\l_@@_par_list_start_tl,
% \l_@@_par_list_end_tl,
% \l_@@_sentence_list_start_tl,
% \l_@@_sentence_list_end_tl,
% \l_@@_par_list_itemseparator_tl,
% \l_@@_sentence_list_itemseparator_tl,
% \l_@@_par_list_itemstart_tl,
% \l_@@_par_list_itemend_tl,
% \l_@@_sentence_list_itemstart_tl,
% \l_@@_sentence_list_itemend_tl}
% These variables store a copy of either the \cs{\meta{name}_star_tl} or
% \cs{\meta{name}_nostar_tl}, depending on whether the calling function was
% called with or without a star. The content of these variables is then used
% by the functions that generate the \lips\meta{list}.
% \begin{macrocode}
\tl_new:N\l_@@_par_list_start_tl
\tl_new:N\l_@@_par_list_end_tl
\tl_new:N\l_@@_sentence_list_start_tl
\tl_new:N\l_@@_sentence_list_end_tl
\tl_new:N\l_@@_par_list_itemseparator_tl
\tl_new:N\l_@@_sentence_list_itemseparator_tl
\tl_new:N\l_@@_par_list_itemstart_tl
\tl_new:N\l_@@_par_list_itemend_tl
\tl_new:N\l_@@_sentence_list_itemstart_tl
\tl_new:N\l_@@_sentence_list_itemend_tl
% \end{macrocode}
%
% \end{variable}
% \begin{variable}{\g_@@_text_str}
% Holds the current text loaded for the output of \cs{lipsum} and
% friends. Used to avoid loading the same text definition if it is already used.
% \begin{macrocode}
\str_new:N\g_@@_text_str
% \end{macrocode}
% \end{variable}
%
% \subsection{Developer interface}
% \begin{function}{\lipsum_store_as_temp_ints:nn}
% \begin{syntax}
% \cs{lipsum_store_as_temp_ints:nn}\Arg{number_1}\Arg{number_2}
% \end{syntax}
% \begin{arguments}
% \item A number.
% \item A number or |-NoValue-| as produced by the argument
% processing of \pkg{xparse}.
% \end{arguments}
% Stores \meta{number_1} in \cs{l_tmpa_int}. If \meta{number_2} is
% |-NoValue-|, stores \meta{number_1} in \cs{l_tmpb_int}, otherwise stores
% \meta{number_2} in \cs{l_tmpb_int}.
% \begin{macrocode}
\cs_new:Npn \lipsum_store_as_temp_ints:nn #1#2{
\int_set:Nn\l_tmpa_int{#1}
\IfNoValueTF{#2}
{
\int_set:Nn\l_tmpb_int{#1}
}
{
\int_set:Nn\l_tmpb_int{#2}
}
}
% \end{macrocode}
% \end{function}
% \begin{function}{\lipsum_get_non_terminated_par:n,
% \lipsum_get_terminated_par:n}
% These two commands are used to retrieve paragraph \meta{number} from the
% \lips\ dummy text. \cs{lipsum_get_terminated_par:n} additionally adds
% \cs{par}.
%
% \begin{syntax}
% \cs{lipsum_get_non_terminated_par:n} \Arg{number}\\
% \cs{lipsum_get_terminated_par:n} \Arg{number}\\
% \end{syntax}
% The single paragraphs are stored as constant token lists. \cs{tl_use:c} is
% used to construct a command sequence from |c_lipsum_par_|, |_tl| and the
% \meta{number}. This is different from versions prior to v2.0, where the
% paragraphs were stored in \cs{lipsum@i}, \cs{lipsum@ii}, \ldots.
% \begin{macrocode}
\cs_new:Npn \lipsum_get_non_terminated_par:n #1{
\seq_item:Nn \g_@@_paragraph_seq{#1}
}
\cs_new:Npn \lipsum_get_terminated_par:n #1 {
\lipsum_get_non_terminated_par:n{#1}\par
}
% \end{macrocode}
% \end{function}
% \begin{function}{\lipsum_add_to_tokenlist:n}
% Adds a paragraph \meta{item} to the list of paragraphs
% (\cs{l_@@_pars_tl}) and surrounds it by
% the user-defined \meta{tokens}
% .
% \begin{syntax}
% \cs{lipsum_add_to_tokenlist:n}\Arg{number}
% \end{syntax}
% \begin{macrocode}
\cs_new:Npn \lipsum_add_to_tokenlist:n #1 {
\tl_put_right:NV
\l__lipsum_pars_tl
\l_@@_par_list_itemstart_tl
\tl_put_right:Nn \l__lipsum_pars_tl {
\lipsum_get_non_terminated_par:n{#1}
}
\tl_put_right:NV
\l__lipsum_pars_tl
\l_@@_par_list_itemend_tl
}
\cs_generate_variant:Nn
\lipsum_add_to_tokenlist:n { V }
% \end{macrocode}
% \end{function}
% \begin{function}{\lipsum_range_to_tokenlist:VV}
% \begin{syntax}
% \cs{lipsum_range_to_tokenlist:VV}\Arg{number_1}\Arg{number_2}
% \end{syntax}
% Adds the paragraphs specified by \meta{number_1} to \meta{number_2}
% to the token list \cs{l_@@_pars_tl}.
% \begin{macrocode}
\cs_new:Npn \lipsum_range_to_tokenlist:nn #1#2 {
\tl_clear:N \l_@@_pars_tl
\tl_put_right:NV
\l_@@_pars_tl
\l_@@_par_list_start_tl
\int_set:Nn \l_tmpa_int {#1}
\int_do_until:nNnn
{\l_tmpa_int} > {#2}
{
\int_compare:nNnT
\l_tmpa_int > {#1}
{
\tl_put_right:NV
\l_@@_pars_tl
\l_@@_par_list_itemseparator_tl
}
\lipsum_add_to_tokenlist:V {\l_tmpa_int}
\int_incr:N\l_tmpa_int
}
\tl_put_right:NV
\l_@@_pars_tl
\l_@@_par_list_end_tl
}
\cs_generate_variant:Nn
\lipsum_range_to_tokenlist:nn { VV }
%
% \end{macrocode}
% \end{function}
% \begin{function}{\@@_expanded_paragraphs_terminated_with_space:}
% To be able to parse the list of paragraphs into a list of sentences, we need
% a list with defined tokens in between. This is stored locally in this macro.
% \begin{macrocode}
\cs_new_nopar:Nn
\@@_expanded_paragraphs_terminated_with_space:{}
% \end{macrocode}
% \end{function}
% \begin{function}{\lipsum_sentences_to_tokenlist:VV}
% \begin{syntax}
% \cs{lipsum_sentences_to_tokenlist:VV}\Arg{number_1}\Arg{number_2}
% \end{syntax}
% Puts the sentences specified by \meta{sentence range} from the paragraphs
% specified by \meta{paragraph range} on the token list
% \cs{l_@@_sentences_tl} and surrounds the \meta{tokens} set by the user.
% \begin{macrocode}
%
\cs_new:Npn \lipsum_sentences_to_tokenlist:nnn #1#2#3{
% \end{macrocode}
% Now, we only need to put the sentences within \meta{sentence range} into
% \cs{l_@@_sentences_tl}. First we clear
% the token list.
% \begin{macrocode}
\tl_clear:N \l__lipsum_sentences_tl
% \end{macrocode}
% Using a regexp turned out to be rather slow for large \meta{paragraph
% range}s. Thus, I use a loop similar to the one used by
% \cs{clist_item:Nn}. Since it might be that the \meta{sentence range}
% specifies a range not within the number of sentences in the paragraphs, an
% end has to be indicated. Since empty elements cannot occur, |..| can be used
% as end element.
% \begin{macrocode}
\int_compare:nT {#2 >= #1}
{
\__lipsum_put_sentence_on_tokenlist:nnnw
{#1}
{#2}
{1}
#3 .. \q_stop
}
\tl_put_left:NV
\l_@@_sentences_tl
\l_@@_sentence_list_start_tl
\tl_put_right:NV
\l_@@_sentences_tl
\l_@@_sentence_list_end_tl
}
\cs_generate_variant:Nn
\lipsum_sentences_to_tokenlist:nnn { VVf }
% \end{macrocode}
% \end{function}
% \begin{function}{\@@_put_sentence_on_tokenlist:nnnw}
% \begin{syntax}
% \cs{@@_put_sentence_on_tokenlist:nnnw}\Arg{start}\Arg{end}\Arg{current}\Arg{sentences tl}
% \end{syntax}
% \begin{arguments}
% \item Start number of the range to be selected.
% \item End number of the range to be selected.
% \item the loop counter indicating the current item.
% \item The token list containing the (remaining) sentences.
% \end{arguments}
% The implementation is quite simple: If \meta{sentences tl} is empty, gobble the remaining
% list ans stop. Otherwise, test if $\meta{start} > \meta{end}$,