summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lipsum/lipsum.ins
blob: e22af4b0c8ae12cba396375e98851f038165e03a (plain)
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
%%
%% Copyright (C) 2014-2019 by Patrick Happel
%% Copyright (C) 2021 by Phelype Oleinik
%%
%% This file 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.
%%
\input docstrip.tex
\askforoverwritefalse
\keepsilent
\preamble

This file is part of the package lipsum for use with LaTeX2e.

Function: Access to 150 paragraphs of 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
    https://github.com/PhelypeOleinik/lipsum

\endpreamble
\postamble
\endpostamble

\generate{\file{lipsum.sty}{\from{lipsum.dtx}{package}}}

\newread\lipsread
\newread\lipswrite
\newcount\parno
\newif\ifinpar
\def\empty{}%
\def\line{}%
\edef\lb{\string{}%
\edef\rb{\string}}%
\begingroup\lccode`\?=`\%
\lowercase{\endgroup\def\pc{?}}%
\def\wline{\immediate\write\lipswrite}%
\def\genlipsum#1#2#3{%
  \begingroup
    \def\inFileName{lipsum-#1.txt}%
    \def\outFileName{#2.ltd.tex}%
    \openin\lipsread\inFileName\space
    \immediate\openout\lipswrite\outFileName\space
    \inparfalse
    \parno=0
    \endlinechar=-1
    \def\~{ }%
    \def\ReferenceLines{%
      \MetaPrefix ^^J%
      \MetaPrefix\~The original source files were:^^J%
      \MetaPrefix ^^J%
      \MetaPrefix\~\inFileName^^J}%
    \immediate\write\lipswrite{\defaultpreamble}%
    \immediate\write\lipswrite{\string\SetLipsumLanguage{#3}}%
    \genlipsumaux\genlipsumaux
    \closein\lipsread
    \immediate\closeout\lipswrite
  \endgroup}
\def\genlipsumaux#1\genlipsumaux{%
  \ifeof\lipsread\let\line\empty
  \else \read\lipsread to \line \fi
  \toks0{#1}%
  \ifx\line\empty
    \ifinpar
      \wline{\the\toks0 \rb\pc^^J\pc}%
      \inparfalse
    \fi
  \else
    \ifinpar
      \wline{\the\toks0 }%
    \else
      \inpartrue
      \advance\parno by 1
      \wline{\string\NewLipsumPar\lb\pc~{\the\parno}}%
    \fi
  \fi
  \ifeof\lipsread\expandafter\genlipsumend\fi
  \expandafter\genlipsumaux\line\genlipsumaux}
\def\genlipsumend#1\genlipsumaux#2\genlipsumaux{}

\genlipsum{la}{lipsum}{latin}
\genlipsum{cs}{lipsum-cs}{czech}
\genlipsum{cicero}{cicero}{latin}

\catcode`\ =13 \edef {\space}%
\Msg{****************************************************}
\Msg{*                                                  *}
\Msg{* To finish the installation you have to move the  *}
\Msg{* following files into a directory searched        *}
\Msg{* by TeX:                                          *}
\Msg{*                                                  *}
\Msg{* lipsum.sty                                       *}
\Msg{* lipsum.ltd.tex                                   *}
\Msg{* lipsum-cs.ltd.tex                                *}
\Msg{* cicero.ltd.tex                                   *}
\Msg{*                                                  *}
\Msg{* To produce the documentation run the file        *}
\Msg{* lipsum.dtx through XeLaTeX or LuaLaTeX.          *}
\Msg{*                                                  *}
\Msg{* Happy TeXing!                                    *}
\Msg{*                                                  *}
\Msg{****************************************************}

\endbatchfile