Вы находитесь на странице: 1из 2

4.

3 Outputting Sentences instead of Paragraphs


Starting with lipsum v2.0, \lipsum and \lipsum* allow to output sentences of the
Lorem ipsum. . . dummy text instead of paragraphs. To retrieve sentences instead of
paragraphs, specify a
hsentence rangei as the second optional argument of \lipsum and
\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
hrangei-value, using an empty first optional argument is not implemented. As a
consequence \lipsum[][1-3] will fail.
Valid inputs for hsentence rangei are, again, a single number, as
in \lipsum[1][1], which will output the first sentence of the first
paragraph (the famous �Lorem ipsum dolor sit amet, consectetuer
adipiscing elit.�). \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:
� When sentences are output, they are (by default) separated
by \space. The difference between \lipsum and \lipsum* is
the token that terminates the paragraph of sentences: Without a package option (and
changing the defaults), \lipsum
terminates the sequence of senetences by \par, \lipsum* by
\space and vice versa, if nopar is specified as package option.
� Specifying a hsentence rangei which is outside the number of sentences in the
specified hparagraph rangei 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.
3
� If you need a lot of sentences, consider the space option and
\lipsum[1-150]. This should be faster.
5 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,
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 User- and developer-level commands).
\SetLipsumDefault In order to change the default range of paragraphs that is
used by \lipsum and friends, specify \SetLipsumDefault{8} or
\SetLipsumDefault{123-145}.
\LipsumPar To get a single paragraph of the Lorem ipsum. . . dummy text,
use \LipsumPar{8} (for the eighth paragraph). This is similar
to using \lips@viii directly in versions prior to lipsum2.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 Lorem
ipsum. . . paragraphs.
\unpacklipsum The commands \unpacklipsum and \unpacklipsum* work as
\unpacklipsum*
\lipsumexp
\lipsum and \lipsum* and have the same two optional arguments,
but instead of typesetting the Lorem ipsum. . . paragraphs, the
commands store them in the macro \lipsumexp using \edef, thus,
everything which can be expanded is expanded.
5.1 Fine-tuning the output
The output of \lipsum, whether paragraphs or sentences, can be
seen as a hlisti of hitemis, where an item is either a paragraph or a
sentence. As of version 2.0, lipsum allows to fine-tune which tokens
are inserted at the beginning of the hlisti, at the end of the hlisti,
at the beginning and end of each hitemi as well as between the
single hitemsi. The resulting list of tokens can be seen in Figure 1.
\SetLipsumParListStart lipsum allows to specify all of the tokens in the list
indicated
\SetLipsumParListStart*
\SetLipsumParListEnd
\SetLipsumParListEnd*
\SetLipsumSentenceListStart
\SetLipsumSentenceListStart*
\SetLipsumSentenceListEnd
\SetLipsumSentenceListEnd*
above except for the item-specific inner and outer hitemsi (shown
as hitemN ,s-outer/inneri, hitemN ,e-outer/inneri 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 \lipsum and
\unpacklipsum or \lipsum* and \unpacklipsum*, respectively.
The macro \SetLipsumParListStart{htokensi} and its
starred variant insert htokensi at the very beginning of the list of
paragraphs (hlistsi in Figure 1). \SetLipsumSentenceListStart
and \SetLipsumSentenceListStart* do the same for the list
of sentences. The corresponding macros that allow to input htokensi at the very end
of the output (hlistei in Figure 1) are \SetLipsumParListEnd (and its starred
variant)
and \SetLipsumSentenceListEnd (and its starred variant).
As a shorthand, the commands
\SetLipsumParListSurrounders . \SetLipsumParListSurrounders{hstarti}{h

Вам также может понравиться