From c93404fa9c281217409b952e5bdd22149edbfb07 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 2 Aug 2014 16:27:23 +0000 Subject: lipsum git-svn-id: svn://tug.org/texlive/trunk@34800 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/lipsum/lipsum.pdf | Bin 364540 -> 426709 bytes Master/texmf-dist/source/latex/lipsum/lipsum.dtx | 187 +++++++++++++++++++++-- Master/texmf-dist/source/latex/lipsum/lipsum.ins | 4 +- Master/texmf-dist/tex/latex/lipsum/lipsum.sty | 71 ++++++++- 4 files changed, 244 insertions(+), 18 deletions(-) diff --git a/Master/texmf-dist/doc/latex/lipsum/lipsum.pdf b/Master/texmf-dist/doc/latex/lipsum/lipsum.pdf index 327a4aa4812..c3a9873242f 100644 Binary files a/Master/texmf-dist/doc/latex/lipsum/lipsum.pdf and b/Master/texmf-dist/doc/latex/lipsum/lipsum.pdf differ diff --git a/Master/texmf-dist/source/latex/lipsum/lipsum.dtx b/Master/texmf-dist/source/latex/lipsum/lipsum.dtx index 4dbf965568a..9c0b5437b2d 100644 --- a/Master/texmf-dist/source/latex/lipsum/lipsum.dtx +++ b/Master/texmf-dist/source/latex/lipsum/lipsum.dtx @@ -6,7 +6,7 @@ % % Function: Access to 150 paragraphs of the well known Lorem Ipsum dummy text % -% Copyright (C) 2011, Patrick Happel +% Copyright (C) 2014, Patrick Happel % % This program may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.2 @@ -17,19 +17,19 @@ % version 1999/12/01 or later. % % Please send error reports and suggestions for improvements to -% Patrick Happel +% Patrick Happel % % %<*dtx> \ProvidesFile{lipsum.dtx} - [2011/04/14 v1.2 150 paragraphs of Lorem Ipsum dummy text] + [2014/07/27 v1.3 150 paragraphs of Lorem Ipsum dummy text] % %\NeedsTeXFormat{LaTeX2e} -%\ProvidesPackage{lipsum}[2011/04/14 v1.2 150 paragraphs of Lorem Ipsum dummy text] +%\ProvidesPackage{lipsum}[2014/07/27 v1.3 150 paragraphs of Lorem Ipsum dummy text] %\ProvidesFile{lipsum.drv} % \fi % \GetFileInfo{lipsum.dtx} -% \CheckSum{544} +% \CheckSum{684} % %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -74,30 +74,34 @@ % dummy text\thanks{Version: \fileversion}} % \author{\name{Patrick Happel}\thanks{patrick.happel@rub.de}} % \date{\filedate} +% \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).} % \maketitle % \section*{Usage} % To load the package specify % \begin{verbatim} % \usepackage{lipsum} % \end{verbatim} -% in the preamble of your document. This package provides four +% in the preamble of your document. This package provides several % macros. \DescribeMacro{\lipsum}The most important one is % \cmd{\lipsum}. This macro typesets the \emph{Lorem ipsum} % paragraphs. It has an optional argument that allows one to specify the range -% of the paragraphs. For example, \verb|\lipsum[4-57]| would typeset the paragraphs 4 to -% 57 and accordingly, \verb|\lipsum[23]| would typeset the 23\textsuperscript{rd} +% 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 \cmd{\lipsum} without its optional argument typesets % the paragraphs specified by \DescribeMacro{\setlipsumdefault} % \cmd{\setlipsumdefault}. This is the second macro this package -% provides. By default it is set to |1-7|, resulting in a bit more +% provides. By default it is set to |1-7|, which results in a bit more % than one page when used with |a4paper| and the standard or the % \KOMAScript\ classes with default font settings. To change the -% default range use \verb|\setlipsumdefault{131-133}|. Of course, the numbers +% default range use \verb|\setlipsumdefault{131-133}| or similar. Of course, +% the numbers % |131| and |133| are only examples that represent the first and the last % paragraph selected to be typeset by default. % @@ -121,7 +125,8 @@ % Furthermore, a starred version of \verb|\lipsum|, % \DescribeMacro{\lipsum*}\verb|\lipsum*|, exists that, with respect to the % terminating \verb|\par|, does the opposite of \verb|\lipsum|: If no option -% is provided, it omits the insertion of \verb|\par| after each paragraph, if +% is provided, it omits the insertion of \verb|\par| after each paragraph (and +% inserts \verb|\relax| instead), if % the option \option{nopar} is provided, it typesets the paragraphs separated by % \verb|\par|. % @@ -135,10 +140,62 @@ % the output of this package within a single document when it is required to % avoid additional groups. % +% \section*{Advanced macros} +% While I never expected this package, which was intended to provide some +% filling text while testing page layouts or similar things, to provide +% \emph{advanced macros}, I am happy that \paket{lipsum} is used so +% frequently. However, as you can imagine from the sparse updates of the +% package, I'm not spending a lot of time with \TeX\ development any more, hence +% the following macros have not been testet exhaustively and are somewhat +% experimental. Thus, the code of these macros is documented (although +% sparsely, see below). +% +% It turned out that some people need access to the expanded content of the +% \verb|\lipsum| macro, that is, the mere text. The easiest way for this would +% be simply to use one of the internal macros that store the text like +% \verb|\lipsum@i| or similar. Anyway, \name{egreg} posted a solution on +% stackexchange.com\footnote{\href{https://tex.stackexchange.com/questions/26806/expanding-edef-a-lipsum-command}{https://tex.stackexchange.com/questions/26806/expanding-edef-a-lipsum-command}}, +% the macro \verb|\unpacklipsum|, that made (slightly altered) its way into the package now (in +% v1.3). The general idea is the following: First, a macro is called that +% stores the expanded content of the \verb|\lipsum| command in a second +% macro. In contrast to the posting from \name{egreg}, the name of this second +% macro is fixed in \paket{lipsum}, it is +% \DescribeMacro{\lipsumexp}\verb|\lipsumexp|. Therefore, everytime you need +% access to the expanded content of \verb|\lipsum|, use \verb|\lipsumexp|. +% +% To control the content of \verb|\lipsumexp|, \paket{lipsum} provides four +% macros which all take one optional argument. This argument provides the +% paragraphs which should be included in \verb|\lipsumexp| and should have +% the same form as the optional argument of \verb|\lipsum|. If the optional +% argument is omitted, the paragraphs provided by \verb|\setlipsumdefault| +% are used. +% +% \DescribeMacro{\unpacklipsum} The macro \verb|\unpacklipsum| stores the +% content of the paragraphs specified by its optional argument and stores them +% in the macro \verb|\lipsumexp|. Depending on whether \paket{lipsum} was +% loaded with or without the option \verb|nopar|, the paragraphs are separated by either +% \verb|\par| or \verb|\relax| (as long as \verb|\lips@par| was not +% changed). \DescribeMacro{\unpacklipsum*} The starred version +% \verb|\unpacklipsum*| is the corresponding counterpart, as \verb|\lipsum*| is +% for \verb|\lipsum|. +% +% While most users who need the expanded content of \verb|\lipsum| want to get +% rid of the terminating \verb|\par|s, there might be some situations where the +% separating \verb|\relax| is annoying, too. \DescribeMacro{\UnpackLipsum} The +% macro \verb|\UnpackLipsum| terminates the paragraphs of Lorem ipsum by a +% space (independent from the package option \verb|nopar|), hence the content of \verb|\lipsumexp| consists only of characters. +% +% The fourth macro, \DescribeMacro{\UnpackLipsum*}\verb|\UnpackLipsum*|, separates the paragraphs +% of Lorem ipsum by the (unexpanded) macro \verb|\lips@par|. This allows controlling the content of the separating macro when \verb|\lipsumexp| is +% expanded. However, note that redefining \verb|\lips@par| changes the +% behaviour of all \verb|\lipsum| macros in the remaining document, hence keep +% the redefinition local. % \section*{Thanks} % All paragraphs are taken with permission from % \href{http://lipsum.com/}{http://lipsum.com/}. Thanks to \name{James -% Wilson} for his work. +% Wilson} for his work. Furthermore, stackexchange.com user \name{egreg} has to be +% mentioned here for his/her improvements of lipsum on stackexchange which +% eventually made their way into version 1.3 of lipsum.sty. % \StopEventually{} % \clearpage % \section*{Code}\small @@ -160,7 +217,7 @@ \newcommand\lips@dolipsum{% \ifnum\value{lips@count}<\lips@max\relax% \addtocounter{lips@count}{1}% - \csname lipsum@\roman{lips@count}\endcsname% + \csname lipsum@\romannumeral\c@lips@count\endcsname% \lips@dolipsum% \fi } @@ -200,6 +257,110 @@ \else\expandafter\lips@stripmax\lips@max\fi% } +\newcommand\lipsumexp{} + +\newcommand\unpacklipsum{% + \@ifstar\@@unpacklipsum\@unpacklipsum +} +% \end{macrocode} +% \DescribeMacro{\@@unpacklipsum}This macro is called by the starred version \verb|\unpacklipsum*|. It calls +% \verb|\ChangeLipsumPar| in a group and subsequently calls +% \verb|\@unpacklipsum| with its argument. +% \begin{macrocode} +\newcommand\@@unpacklipsum[1][\lips@default]{% + \begingroup + \ChangeLipsumPar + \@unpacklipsum[#1]% + \endgroup +} +% \end{macrocode} +% \DescribeMacro{\@unpacklipsum} This is the true work horse for the +% \verb|\unpacklipsum| and \verb|\unpacklipsum*| macros. The major part +% consists of the loop posted by \name{egreg}. +% \begin{macrocode} + +\newcommand\@unpacklipsum[1][\lips@default]{% + +% \end{macrocode} +% In both the +% package option definition for \verb|nopar| as well as in +% \verb|\ChangeLipsumPar|, \verb|\lips@par| is \verb|\let| to be \verb|\relax| +% and not \verb|\def|ed. Thus, \verb|\lips@par| would not be expanded. I +% use a group, test whether \verb|\ifx\lips@par\relax| is true and then +% locally \verb|\def| \verb|\lips@par| to \verb|\relax|, which subsequently +% can can be expanded: +% \begin{macrocode} + \begingroup + \ifx\lips@par\relax\def\lips@par{\relax}\fi +% \end{macrocode} +% Now process the argument as in \verb|\@lipsum| and set the counter +% \begin{macrocode} + \expandafter\lips@minmax\expandafter{#1}% + \c@lips@count=\lips@min\relax + \advance\c@lips@count\m@ne +% \end{macrocode} +% Since we are in a group, a direct \verb|\edef| of \verb|\lipsumexp| would be +% long, thus I use an internal macro here... +% \begin{macrocode} + \def\@lipsumexp{}% +% \end{macrocode} +% Now start the loop and populate the internal macro with the contents of +% Lorem ipsum. Since we are in a group, I had to polute the global context +% with \verb|\@lipsumexp|\ldots +% \begin{macrocode} + \loop\ifnum\c@lips@count<\lips@max\relax + \advance\c@lips@count\@ne + \global\edef\@lipsumexp{% + \@lipsumexp\csname lipsum@\romannumeral\c@lips@count\endcsname}% + \repeat + \endgroup +% \end{macrocode} +% After the group is closed, \verb|\edef| \verb|\lipsumexp| with the content +% of \verb|\@lipsumexp|. We need \verb|\global| here since +% \verb|\@unpacklipsum| might be called from within a group by \verb|\@@unpacklipsum| +% \begin{macrocode} + \global\edef\lipsumexp{\@lipsumexp}% +} + +\newcommand\UnpackLipsum{% + \@ifstar\@@UnpackLipsum\@UnpackLipsum +} +% \end{macrocode} +% The uppercase versions \verb|\UnpackLipsum| and \verb|\UnpackLipsum*| work +% quite similar in that they redefine \verb|\lips@par| locally. +% \begin{macrocode} + +\newcommand\@UnpackLipsum[1][\lips@default]{% + \begingroup + \def\lips@par{ }% + \expandafter\lips@minmax\expandafter{#1}% + \c@lips@count=\lips@min\relax + \advance\c@lips@count\m@ne + \def\@lipsumexp{}% + \loop\ifnum\c@lips@count<\lips@max\relax + \advance\c@lips@count\@ne + \global\edef\@lipsumexp{\@lipsumexp\csname + lipsum@\romannumeral\c@lips@count\endcsname}% + \repeat + \endgroup + \edef\lipsumexp{\@lipsumexp}% +} +\newcommand\@@UnpackLipsum[1][\lips@default]{% + \begingroup + \let\lips@par\relax% + \expandafter\lips@minmax\expandafter{#1}% + \c@lips@count=\lips@min\relax + \advance\c@lips@count\m@ne + \def\lipsumexp{}% + \loop\ifnum\c@lips@count<\lips@max\relax + \advance\c@lips@count\@ne + \global\edef\lipsumexp{\lipsumexp\csname + lipsum@\romannumeral\c@lips@count\endcsname}% + \repeat + \endgroup +} + +\AtEndOfPackage{\unpacklipsum} \newcommand\lipsum@i{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, diff --git a/Master/texmf-dist/source/latex/lipsum/lipsum.ins b/Master/texmf-dist/source/latex/lipsum/lipsum.ins index 110d55bd0bf..58eb40bcc31 100644 --- a/Master/texmf-dist/source/latex/lipsum/lipsum.ins +++ b/Master/texmf-dist/source/latex/lipsum/lipsum.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2011 by Patrick Happel +%% Copyright (C) 2014 by Patrick Happel %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -18,7 +18,7 @@ This is a generated file. -Copyright (C) 2011 by Patrick Happel +Copyright (C) 2014 by Patrick Happel This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either diff --git a/Master/texmf-dist/tex/latex/lipsum/lipsum.sty b/Master/texmf-dist/tex/latex/lipsum/lipsum.sty index 458515e2173..6a3e5991031 100644 --- a/Master/texmf-dist/tex/latex/lipsum/lipsum.sty +++ b/Master/texmf-dist/tex/latex/lipsum/lipsum.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright (C) 2011 by Patrick Happel +%% Copyright (C) 2014 by Patrick Happel %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -21,7 +21,7 @@ %% LaTeX version 1999/12/01 or later. %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lipsum}[2011/04/14 v1.2 150 paragraphs of Lorem Ipsum dummy text] +\ProvidesPackage{lipsum}[2014/07/27 v1.3 150 paragraphs of Lorem Ipsum dummy text] %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -53,7 +53,7 @@ \newcommand\lips@dolipsum{% \ifnum\value{lips@count}<\lips@max\relax% \addtocounter{lips@count}{1}% - \csname lipsum@\roman{lips@count}\endcsname% + \csname lipsum@\romannumeral\c@lips@count\endcsname% \lips@dolipsum% \fi } @@ -93,6 +93,71 @@ \else\expandafter\lips@stripmax\lips@max\fi% } +\newcommand\lipsumexp{} + +\newcommand\unpacklipsum{% + \@ifstar\@@unpacklipsum\@unpacklipsum +} +\newcommand\@@unpacklipsum[1][\lips@default]{% + \begingroup + \ChangeLipsumPar + \@unpacklipsum[#1]% + \endgroup +} + +\newcommand\@unpacklipsum[1][\lips@default]{% + + \begingroup + \ifx\lips@par\relax\def\lips@par{\relax}\fi + \expandafter\lips@minmax\expandafter{#1}% + \c@lips@count=\lips@min\relax + \advance\c@lips@count\m@ne + \def\@lipsumexp{}% + \loop\ifnum\c@lips@count<\lips@max\relax + \advance\c@lips@count\@ne + \global\edef\@lipsumexp{% + \@lipsumexp\csname lipsum@\romannumeral\c@lips@count\endcsname}% + \repeat + \endgroup + \global\edef\lipsumexp{\@lipsumexp}% +} + +\newcommand\UnpackLipsum{% + \@ifstar\@@UnpackLipsum\@UnpackLipsum +} + +\newcommand\@UnpackLipsum[1][\lips@default]{% + \begingroup + \def\lips@par{ }% + \expandafter\lips@minmax\expandafter{#1}% + \c@lips@count=\lips@min\relax + \advance\c@lips@count\m@ne + \def\@lipsumexp{}% + \loop\ifnum\c@lips@count<\lips@max\relax + \advance\c@lips@count\@ne + \global\edef\@lipsumexp{\@lipsumexp\csname + lipsum@\romannumeral\c@lips@count\endcsname}% + \repeat + \endgroup + \edef\lipsumexp{\@lipsumexp}% +} +\newcommand\@@UnpackLipsum[1][\lips@default]{% + \begingroup + \let\lips@par\relax% + \expandafter\lips@minmax\expandafter{#1}% + \c@lips@count=\lips@min\relax + \advance\c@lips@count\m@ne + \def\lipsumexp{}% + \loop\ifnum\c@lips@count<\lips@max\relax + \advance\c@lips@count\@ne + \global\edef\lipsumexp{\lipsumexp\csname + lipsum@\romannumeral\c@lips@count\endcsname}% + \repeat + \endgroup +} + +\AtEndOfPackage{\unpacklipsum} + \newcommand\lipsum@i{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu -- cgit v1.2.3