summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx')
-rw-r--r--Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx269
1 files changed, 239 insertions, 30 deletions
diff --git a/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx b/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx
index afe3325bb00..76df59f8a53 100644
--- a/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx
+++ b/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: kantlipsum.dtx (C) Copyright 2011 Enrico Gregorio
+%% File: kantlipsum.dtx (C) Copyright 2011-2012 Enrico Gregorio
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -24,7 +24,7 @@
\usepackage{bookmark}
%</driver>
%<*driver|package>
-\GetIdInfo$Id: kantlipsum.dtx 0.5 2011-12-23 12:00:00Z Enrico $
+\GetIdInfo$Id: kantlipsum.dtx 0.6 2012-10-14 12:00:00Z Enrico $
{Dummy text in Kantian style}
%</driver|package>
%<*driver>
@@ -68,7 +68,7 @@
%
% \section{Options}
%
-% The package has three document options, the first two of which are
+% The package has four document options, the first two of which are
% alternative to each other:
% \begin{itemize}[font=\ttfamily]
% \item[par$\,\vert\,$nopar] With the default \texttt{par} all pieces
@@ -79,6 +79,12 @@
% number (such as in ``1~\textbullet~As any dedicated reader can
% clearly see\dots''), which can be useful for better control of what
% is produced.
+% \item[index] Each paragraph will generate an index entry; a
+% |\makeindex| command will be needed, with a suitable package for
+% making the index, and |\printindex| for printing it. However the
+% index entry may be off by one, since the |\index| command is issued
+% at the beginning of the paragraph. Also there is no guarantee that
+% the indexed word really belongs to the paragraph.
% \end{itemize}
%
% \section{Commands}
@@ -126,6 +132,16 @@
% in some places (in particular a sequence is used to store the
% phrases, rather than many token lists).
%
+% \subsection*{Changes from version 0.5}
+%
+% Some changes in \LaTeX3 introduced some misfeatures, which this
+% version corrects. Some kernel function names were also changed; here
+% |\prg_stepwise_function:nnnN| that became |\int_step_function:nnnN|.
+% Some functions have been made |protected|.
+%
+% The most striking change is the possibility to generate an index:
+% each paragraph indexes one of its words or phrases.
+%
% \end{documentation}
%
% \begin{implementation}
@@ -143,7 +159,7 @@
%
% A check to make sure that \pkg{expl3} is not too old
% \begin{macrocode}
-\@ifpackagelater { expl3 } { 2011/10/09 }
+\@ifpackagelater { expl3 } { 2012/07/15 }
{ }
{
\PackageError { kantlipsum } { Support~package~l3kernel~too~old. }
@@ -164,16 +180,24 @@
% \begin{macrocode}
\DeclareOption { par }
{
- \cs_set:Nn \kgl_star: { \c_space_tl }
- \cs_set:Nn \kgl_nostar: { \par }
+ \cs_set_protected:Nn \kgl_star: { \c_space_tl }
+ \cs_set_protected:Nn \kgl_nostar: { \par }
}
+
\DeclareOption{ nopar }
{
- \cs_set:Nn \kgl_star: { \par }
- \cs_set:Nn \kgl_nostar: { \c_space_tl }
+ \cs_set_protected:Nn \kgl_star: { \par }
+ \cs_set_protected:Nn \kgl_nostar: { \c_space_tl }
}
+
\DeclareOption{ numbers }
- { \cs_set:Nn \kgl_number:n { #1\nobreakspace\textbullet\nobreakspace } }
+ { \cs_set_protected:Nn \kgl_number:n { #1\nobreakspace\textbullet\nobreakspace } }
+
+\bool_new:N \g_kgl_makeindex_bool
+\bool_gset_false:N \g_kgl_makeindex_bool
+\DeclareOption{ index }
+ { \bool_gset_true:N \g_kgl_makeindex_bool }
+
\cs_new_eq:NN \kgl_number:n \use_none:n
\ExecuteOptions{par}
\ProcessOptions \scan_stop:
@@ -199,23 +223,23 @@
% \subsection{Variables and constants}
% The |\l_kgl_start_int| variable will contain the starting number for
% processing, while |\l_kgl_end_int| the ending number. The
-% |\g_kgl_pars_seq| sequence will contain the pseudokantian sentences.
-% Since we'll start counting them from one, we add a bogus zeroth element.
+% |\g_kgl_pars_seq| sequence will contain the pseudokantian sentences
+% and |\g_kgl_words_seq| that contains the words to index.
% \begin{macrocode}
\int_new:N \l_kgl_start_int
\int_new:N \l_kgl_end_int
\seq_new:N \g_kgl_pars_seq
-\seq_gput_right:Nx \g_kgl_pars_seq {This~is~the~Kant~lipsum~generator.}
+\seq_new:N \g_kgl_words_seq
% \end{macrocode}
%
% \subsection{User level commands}
% There are two user level commands, \cs{kant} (with a *-variant) and \cs{kantdef}.
%
% \begin{function}{\kant}
-% The (optional) argument is described as before. We use the
-% \cs{SplitArgument} feature provided by \pkg{xparse} to decide
-% whether the `range form' has been specified. In the \cs{kant*}
-% form we reverse the logic.
+% The (optional) argument is described as before. We use the
+% \cs{SplitArgument} feature provided by \pkg{xparse} to decide
+% whether the `range form' has been specified. In the \cs{kant*} form
+% we reverse the logic.
% \begin{macrocode}
\NewDocumentCommand{\kant}{s>{\SplitArgument{1}{-}}O{1-7}}
{
@@ -246,10 +270,12 @@
\cs_set_eq:NN \kgl_par: \prg_do_nothing:
\cs_if_exist:NTF #1
{
- \msg_error:nnx {kantlipsum}{already-defined}
- {\token_to_str:N #1}
+ \msg_error:nnn {kantlipsum} {already-defined} {#1}
+ }
+ {
+ \tl_set:Nx \l_tmpa_tl { \seq_item:Nn \g_kgl_pars_seq {#2} }
+ \cs_new:Npx #1 { \l_tmpa_tl }
}
- { \cs_new:Npx #1 { \kgl_use:n {#2} } }
\group_end:
}
% \end{macrocode}
@@ -264,7 +290,7 @@
% argument was |[|$m$|]| we set both variables to $m$, otherwise it
% was in the form |[|$m$|-|$n$|]| and we do the obvious action.
% \begin{macrocode}
-\cs_new:Nn \kgl_process:nn
+\cs_new_protected:Nn \kgl_process:nn
{
\int_set:Nn \l_kgl_start_int {#1}
\IfNoValueTF{#2}
@@ -278,19 +304,24 @@
% The printing routine is in the function |\kgl_print:|; we start a
% loop printing item number $x$ in the sequence |\g_kgl_pars_seq| for
% all numbers $x$ in the specified range. The function |\kgl_use:n|
-% function is a wrapper to be used with |\prg_stepwise_function:nnnN|
-% that's also useful in the defining command |\kantdef|: it's passed a
-% number as argument, builds the constant name corresponding to it and
-% produces the text.
+% function is a wrapper to be used with |\int_step_function:nnnN|:
+% it's passed a number as argument, builds the constant name
+% corresponding to it and produces the text. If the index entry is to
+% be issued, the appropriate element from |\g_kgl_words_seq| is used;
+% the page reference might not be correct, though.
% \begin{macrocode}
-\cs_new:Nn \kgl_print:
+\cs_new_protected:Nn \kgl_print:
{
- \prg_stepwise_function:nnnN
+ \int_step_function:nnnN
{\l_kgl_start_int} {1} {\l_kgl_end_int} \kgl_use:n
}
\cs_new:Nn \kgl_use:n
{
\kgl_number:n {#1}
+ \bool_if:NT \g_kgl_makeindex_bool
+ {
+ \use:x { \exp_not:N \index{ \seq_item:Nn \g_kgl_words_seq {#1} } }
+ }
\seq_item:Nn \g_kgl_pars_seq {#1}
}
% \end{macrocode}
@@ -300,11 +331,20 @@
% The |\kgl_newpara:n| appends a new item to the sequence |\g_kgl_pars_seq|
% consisting of, say, \meta{text of the 42nd sentence}|\kgl_par:|
% \begin{macrocode}
-\cs_new:Nn \kgl_newpara:n
+\cs_new_protected:Nn \kgl_newpara:n
{ \seq_gput_right:Nn \g_kgl_pars_seq {#1\kgl_par:} }
% \end{macrocode}
% \end{function}
%
+% \begin{function}{\kgl_newword:n}
+% The |\kgl_newword:n| appends a new item to the sequence |\g_kgl_words_seq|
+% consisting of one word from the corresponding paragraph.
+% \begin{macrocode}
+\cs_new_protected:Nn \kgl_newword:n
+ { \seq_gput_right:Nn \g_kgl_words_seq {#1} }
+% \end{macrocode}
+% \end{function}
+%
% \subsection{Defining the sentences}
% We start a group where we set |\l_tmpa_int| to 0 and the category
% code of the space to 10 so as not to be forced to write |~| for
@@ -2671,7 +2711,7 @@ Categories connected together? As will easily be shown in the next
section, to avoid all misapprehension, it is necessary to explain that
metaphysics, on the contrary, occupies part of the sphere of the thing
in itself concerning the existence of our synthetic judgements in
-general. }
+general.}
\kgl_newpara:n {As is evident upon close examination, I assert that,
so far as regards metaphysics, our knowledge proves the validity of,
@@ -3226,13 +3266,182 @@ whole content of philosophy.}
% \end{macrocode}
%
+% Now we define the sequence of index words.
+% \begin{macrocode}
+\kgl_newword:n {Ideal}
+\kgl_newword:n {noumena}
+\kgl_newword:n {Aristotle}
+\kgl_newword:n {transcendental}
+\kgl_newword:n {metaphysics}
+\kgl_newword:n {reason}
+\kgl_newword:n {science}
+\kgl_newword:n {necessity}
+\kgl_newword:n {Categories}
+\kgl_newword:n {philosophy}
+\kgl_newword:n {knowledge}
+\kgl_newword:n {regress}
+\kgl_newword:n {paralogism}
+\kgl_newword:n {empirical}
+\kgl_newword:n {space}
+\kgl_newword:n {manifold}
+\kgl_newword:n {understanding}
+\kgl_newword:n {aesthetic}
+\kgl_newword:n {noumena}
+\kgl_newword:n {sphere}
+\kgl_newword:n {time}
+\kgl_newword:n {practical reason}
+\kgl_newword:n {perception}
+\kgl_newword:n {things in themselves}
+\kgl_newword:n {doctrine}
+\kgl_newword:n {regress}
+\kgl_newword:n {mystery}
+\kgl_newword:n {existence}
+\kgl_newword:n {contradiction}
+\kgl_newword:n {a priori}
+\kgl_newword:n {natural causes}
+\kgl_newword:n {analysis}
+\kgl_newword:n {apperception}
+\kgl_newword:n {Antinomies}
+\kgl_newword:n {Transcendental Deduction}
+\kgl_newword:n {phenomena}
+\kgl_newword:n {formal logic}
+\kgl_newword:n {soul}
+\kgl_newword:n {misapprehension}
+\kgl_newword:n {elsewhere}
+\kgl_newword:n {theology}
+\kgl_newword:n {employment}
+\kgl_newword:n {logic}
+\kgl_newword:n {practical reason}
+\kgl_newword:n {theoretical sciences}
+\kgl_newword:n {a posteriori}
+\kgl_newword:n {mystery}
+\kgl_newword:n {philosophy}
+\kgl_newword:n {things in themselves}
+\kgl_newword:n {experience}
+\kgl_newword:n {contradictory}
+\kgl_newword:n {Categories}
+\kgl_newword:n {perceptions}
+\kgl_newword:n {Galileo}
+\kgl_newword:n {apperception}
+\kgl_newword:n {empirical objects}
+\kgl_newword:n {judgements}
+\kgl_newword:n {phenomena}
+\kgl_newword:n {power}
+\kgl_newword:n {hypothetical principles}
+\kgl_newword:n {transcendental logic}
+\kgl_newword:n {doctrine}
+\kgl_newword:n {understanding}
+\kgl_newword:n {totality}
+\kgl_newword:n {manifold}
+\kgl_newword:n {inductive judgements}
+\kgl_newword:n {Transcendental Deduction}
+\kgl_newword:n {analytic unity}
+\kgl_newword:n {Hume}
+\kgl_newword:n {canon}
+\kgl_newword:n {knowledge}
+\kgl_newword:n {universal}
+\kgl_newword:n {section}
+\kgl_newword:n {body}
+\kgl_newword:n {ignorance}
+\kgl_newword:n {sense perceptions}
+\kgl_newword:n {natural reason}
+\kgl_newword:n {exception}
+\kgl_newword:n {ampliative judgements}
+\kgl_newword:n {experience}
+\kgl_newword:n {Categories}
+\kgl_newword:n {analysis}
+\kgl_newword:n {philosophy}
+\kgl_newword:n {apperception}
+\kgl_newword:n {paralogism}
+\kgl_newword:n {ignorance}
+\kgl_newword:n {true}
+\kgl_newword:n {space}
+\kgl_newword:n {Ideal}
+\kgl_newword:n {accordance}
+\kgl_newword:n {regress}
+\kgl_newword:n {experience}
+\kgl_newword:n {a priori}
+\kgl_newword:n {disjunctive}
+\kgl_newword:n {soul}
+\kgl_newword:n {understanding}
+\kgl_newword:n {analytic unity}
+\kgl_newword:n {phenomena}
+\kgl_newword:n {practical reason}
+\kgl_newword:n {cause}
+\kgl_newword:n {manuals}
+\kgl_newword:n {dedicated reader}
+\kgl_newword:n {a posteriori}
+\kgl_newword:n {employment}
+\kgl_newword:n {natural theology}
+\kgl_newword:n {manifold}
+\kgl_newword:n {transcendental aesthetic}
+\kgl_newword:n {close}
+\kgl_newword:n {full}
+\kgl_newword:n {Aristotle}
+\kgl_newword:n {clue}
+\kgl_newword:n {me}
+\kgl_newword:n {account}
+\kgl_newword:n {things}
+\kgl_newword:n {sense}
+\kgl_newword:n {intelligible}
+\kgl_newword:n {understanding}
+\kgl_newword:n {Categories}
+\kgl_newword:n {never}
+\kgl_newword:n {apperception}
+\kgl_newword:n {Ideal}
+\kgl_newword:n {need}
+\kgl_newword:n {space}
+\kgl_newword:n {virtue}
+\kgl_newword:n {Hume}
+\kgl_newword:n {still}
+\kgl_newword:n {whatsoever}
+\kgl_newword:n {even}
+\kgl_newword:n {sphere}
+\kgl_newword:n {position}
+\kgl_newword:n {ignorance}
+\kgl_newword:n {word}
+\kgl_newword:n {phenomena}
+\kgl_newword:n {theology}
+\kgl_newword:n {mystery}
+\kgl_newword:n {Categories}
+\kgl_newword:n {perception}
+\kgl_newword:n {power}
+\kgl_newword:n {experience}
+\kgl_newword:n {never-ending}
+\kgl_newword:n {analytic}
+\kgl_newword:n {itself}
+\kgl_newword:n {a priori}
+\kgl_newword:n {rule}
+\kgl_newword:n {Transcendental Deduction}
+\kgl_newword:n {empirical conditions}
+\kgl_newword:n {knowledge}
+\kgl_newword:n {disjunctive}
+\kgl_newword:n {transcendental}
+\kgl_newword:n {science}
+\kgl_newword:n {falsified}
+\kgl_newword:n {reader}
+\kgl_newword:n {blind}
+\kgl_newword:n {employment}
+\kgl_newword:n {discipline}
+\kgl_newword:n {function}
+\kgl_newword:n {careful}
+\kgl_newword:n {Aristotle}
+\kgl_newword:n {Categories}
+\kgl_newword:n {part}
+\kgl_newword:n {noumena}
+\kgl_newword:n {doubt}
+\kgl_newword:n {duck}
+\kgl_newword:n {Kant}
+% \end{macrocode}
+%
% Finally we close the group and issue a message in the log file
% stating how many sentences are available.
% \begin{macrocode}
\group_end:
-\msg_info:nnx{kantlipsum}{how-many}
- { \int_eval:n {\seq_length:N \g_kgl_pars_seq - 1} }
+\msg_info:nnx {kantlipsum} {how-many}
+ { \int_eval:n {\seq_count:N \g_kgl_pars_seq} }
% \end{macrocode}
+%
% \iffalse
%</package>
% \fi