summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/continue/continue.dtx
blob: 8cc5863465cfc9e5679daf3ddba9c0c54113a815 (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
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
% \iffalse meta-comment
%
% continue.dtx
%
%  Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net
%  Copyright 2015, 2018 Peter R. Wilson, Donald Arseneau and Merciadri Luca
%
%  This work 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 the license is in
%    http://www.latex-project.org/lppl.txt
%  and version 1.3 or later is part of all distributions of
%  LaTeX version 2003/06/01 or later.
%
%  This work has the LPPL maintenance status "unmaintained".
%
%  This work consists of the files listed in the README file.
%
%<*driver>
\documentclass{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\setcounter{StandardModuleDepth}{1}
%%%\usepackage{url}
%%%\usepackage[draft=false,
%%%            plainpages=false,
%%%            pdfpagelabels,
%%%            bookmarksnumbered,
%%%            hyperindex=false
%%%           ]{hyperref}
 \begin{document}
   \DocInput{continue.dtx}
 \end{document}
%</driver>
%
% \fi
%
% \CheckSum{12458}
%
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
% \DoNotIndex{\@centercr,\@cite}
% \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
% \DoNotIndex{\@input,\@ixpt,\@m}
% \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
% \DoNotIndex{\advance,\Alph,\alph}
% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
% \DoNotIndex{\bullet}
% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
% \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
% \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
% \DoNotIndex{\fbox}
% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
% \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
% \DoNotIndex{\input}
% \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
% \DoNotIndex{\NeedsTeXFormat,\newdimen}
% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
% \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
% \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
% \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
% \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
% \DoNotIndex{\wd,\xiipt,\year,\z@}
% \DoNotIndex{\0,\1,\2,\3,\4,\5,\6,\7,\8,\9}
%
% \def\dtxfile{continue.dtx}
% \changes{v0.1}{2015/12/09}{First trial release}
% \def\fileversion{v0.1} \def\filedate{2015/12/09}
% \changes{v0.2}{2018/12/09}{Second trial release, markers can be on all pages and stopped and started at will}
% \def\fileversion{v0.2} \def\filedate{2018/12/09}

% ^^A Flag an option
% \makeatletter
% \newcommand{\OptFont}{\fontencoding\encodingdefault
%   \fontfamily\sfdefault
%   \fontseries\mddefault
%   \fontshape\updefault
%   \small}
% 
% \newcommand{\DescribeOption}{\leavevmode\@bsphack
%   \begingroup\MakePrivateLetters\Describe@Opt}
% \newcommand{\Describe@Opt}[1]{\endgroup
%   \marginpar{\raggedleft\PrintDescribeOption{#1}}%
%   \SpecialOptIndex{#1}\@esphack\ignorespaces}
%   \newcommand*{\PrintDescribeOption}[1]{\strut \OptFont #1\ }
%   \newcommand*{\PrintOptionName}[1]{\strut \OptFont #1\ }
% \newcommand*{\SpecialOptIndex}[1]{\@bsphack
%   \index{#1\actualchar{\protect\sffamily#1}
%     (option)\encapchar usage}%
%   \index{options:\levelchar#1\actualchar
%     {\protect\sffamily#1}\encapchar usage}\@esphack}
% 
% \makeatother
% 
% \providecommand{\phantomsection}{}
% %\OnlyDescription ^^A comment this out for the full glory
% \setcounter{StandardModuleDepth}{1}
% \makeatletter
%   \@mparswitchfalse
% \makeatother
% \renewcommand{\MakeUppercase}[1]{#1}
% \pagestyle{headings}
% \newenvironment{addtomargins}[1]{%
%   \begin{list}{}{%
%     \topsep 0pt%
%     \addtolength{\leftmargin}{#1}%
%     \addtolength{\rightmargin}{#1}%
%     \listparindent \parindent
%     \itemindent \parindent
%     \parsep \parskip}%
%   \item[]}{\end{list}}
% \MakeShortVerb{\|}
%
% \newcommand*{\Lpack}[1]{\textsf {#1}}           ^^A typeset a package
% \newcommand*{\Lopt}[1]{\textsf {#1}}            ^^A typeset an option
% \newcommand*{\file}[1]{\texttt {#1}}            ^^A typeset a file
% \newcommand*{\Lcount}[1]{\textsl {\small#1}}    ^^A typeset a counter
% \newcommand*{\pstyle}[1]{\textsl {#1}}          ^^A typeset a pagestyle
% \newcommand*{\Lenv}[1]{\texttt {#1}}            ^^A typeset an environment
% \newcommand{\BC}{\textsc{bc}}
% \newcommand{\AD}{\textsc{ad}}
%
% \title{\Lpack{Continue}: Continuation marks on (by default odd) pages\thanks{This
%        file (\texttt{\dtxfile}) has version number \fileversion, last revised
%        \filedate.}}
%
% \author{%
% Peter Wilson\thanks{\texttt{herries dot press at earthlink dot net}} with 
% Donald Arseneau and Merciadri Luca \\
% Herries Press
% }
% \date{\filedate}
% \maketitle
% \begin{abstract}
%    The \Lpack{continue} package provides for a variety of continuation indicators on
% pages in a twosided document when the text continues on the following
% page. The default is to only mark odd pages but all pages can be marked or marking
% can be stopped or started at any point.  
% \end{abstract}
% \tableofcontents
%
% 
%
% \section{Introduction}
%
%    In some types of documents it is customary or convenient to indicate at the
% bottom of a page that the text continues on the following page. For example, when
% a two page exam sheet is printed twosided it could be advantageous for the student
% to have an indication on the first page that there are further questions on the back 
% of the page. Another instance is when documents are printed in the expectation
% that they will be read by someone in front of an audience, so in order to minimise
% any hesitation as a page is turned over, the first word on the following page is printed
% at the bottom of the preceeding page.
%
% This manual is typeset according to the conventions of the
% \LaTeX{} \textsc{docstrip} utility which enables the automatic
% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
%
%    Section~\ref{sec:usc} describes the usage of the package.
% Commented package code may be in later sections.
%
%
% \section{The \Lpack{continue} package} \label{sec:usc}
%
%    The \Lpack{continue} package is an amalgam of modified versions of
% two packages --- \Lpack{fwlw} (First Word, Last Word) by Donald 
% Arseneau~\cite{FWLW} which% among other things gets the first word
% on the next page and \Lpack{turnpageetex} by Merciadri Luca~\cite{TURNPAGEETEX}
% for placing something at the bottom of the text block. 
%
% The \Lpack{fwlw} package includes the following statement:
%
%     Copyright (C) 1993,1995 by Donald Arseneau
%     Vancouver, Canada, email asnd@triumf.ca
%     This software package may be freely used, transmitted, reproduced,
%     or modified provided that this notice is left intact.
%
% In this instance I have modified the original package as allowed above.
%
%    With respect to the \Lpack{turnpageetex} package this was released under the
% LaTeX Project Public License and I have taken the liberty of extending its functionality
% slightly, as allowed.
%
%
%
% \subsection{Options}
%
%     There are three options that can be used when calling the package denoting the
% kind and position of the continuation marker.
%
% \DescribeOption{margin}
%    With this option the continuation marker is placed in the margin aligned with
% the bottom of the text block. If the option is not used then the continuation
% marker is placed below the text text block ending at the outer margin.
%
% \DescribeOption{word}
%    With this option the package attempts to use the first `word' on the following
% verso page as the continuation marker. If the option is not used then a user
% specified marker is employed.
%
% \DescribeOption{allpages}
%    With this option the package tries to provide a marker on each page, whether 
% odd or even.
% The default is to only provide markers on odd pages.
%
%  The relevant portions of the introduction to the \Lpack{fwlw} package are: \\
% \begin{quotation}
%  The \Lpack{fwlw} package provides a mechanism to determine ...
%  the first word on the \textit{next} page.  The `words'
%  you see may not be real words, but any unbreakable object.
%
% ...
%
%  ... labelling does not make much sense when |\chapter| generates a page
%  break, so the last page before a |\chapter| (or any |\clearpage|) gets 
%  a blank "next word" ...
%
%  Note that `words' may unfortunately be things like:
% \begin{itemize}
%    \item two~words
%    \item |[ ]|Word  ( |[ ]| represents a parindent box)
%    \item a whole displayed equation
%    \item the first column of an aligned equation
%    \item anomalously blank, if there are |\write|s or split footnotes etc.
%    \item partial words like  par-  or  -tial due to hyphenation.
% \end{itemize}
% \end{quotation}
%
%    In essence, the `word' might not be what you might expect, but for most documents
% the results are good. However, page~3 of the example file |trycontinue.tex| prints
% a blank word as the continuation marker because the first line on the following
% page is the start of a paragraph which starts with a space.
%
%
%
% \subsection{Macros}
%
% When the \Lopt{word} option is not used the following macros are available:
%
% \DescribeMacro{\flagcont}
%    This command defines the continuation mark. Its default specification is: \\
%    |\newcommand*{\flagcont}{Continued}| \\
% It can be changed in the document's preamble to, perhaps: \\
%    |\renewcommand*{\flagcont}{---$>$}| \\
% to print a right pointing arrow.
%
% \DescribeMacro{\flagend}
%    This command defines the continuation mark when the last odd page is the final
% page (i.e. when there is no following recto page). Its default specification is: \\
%    |\newcommand*{\flagend}{End}| \\
% but it can be changed in the document's preamble.
%
% When the \Lopt{word} option is used the following macros are available:
%
% \DescribeMacro{\flagword}
%     This command specifies how the continuation word is formated. Its definition is: \\
%    |\newcommand*{\flagword}{\preflagword\usebox\NextWordBox\postflagword}| \\
% where |\NextWordBox| holds the first word on the next recto page (empty if there
% is no next recto page).
%
% \DescribeMacro{\preflagword}
%    This command is printed before the word continuation marker. Its default definition is: \\
%    |\newcommand*{\preflagword}{}| \\
% but can be redefined in the document preamble to put, perhaps, an opening brace
% before the word like: \\
%    |\renewcommand*{\preflagword}{[}|
%
% \DescribeMacro{\postflagword}
%    Similar to |\preflagword| except that it is printed after the marker. Its default 
%  definition is: \\
%    |\newcommand*{\postflagword}{}| \\
%
% \DescribeMacro{\contsep}
% \DescribeMacro{\contdrop}
%     When the \Lopt{margin} option is used the continuation marker is set a distance
% |\contsep| to the right of the textblock. When \Lopt{margin} is not used then the
% marker is set a distance |\contdrop| below the textblock. Their default values
% are set by: \\
% |\setlength{\contsep}{\marginparsep}| and |\setlength{\contdrop}{0.5\footskip}|
%
% \section{An example document}
%
% You can use the document |trycontinue.tex| to experiment with the options.
% It may take two (pdf)LaTeX runs for the continuation marks to settle down to their
% final values and positions.
%
%    \begin{macrocode}
%<*try>
%% trycontinue.tex  An example usage of the continue package (2018/12/09)
%%
%% The document is set with footnotes on A6 paper (I wanted
%% to get many pages from little text). It is not pretty but does shows 
%% some of the continue package's capabilities. Try modifying it by changing 
%% options, etc., and see what happens.
%% 
%% You can try and contact me, Peter Wilson at herries.press@earthlink.net, if there
%% are problems other than the aesthetics.
%%
\documentclass[%
  twoside,
  a6paper
  ]%
  {memoir}

\usepackage%
%%  [margin]%
%%  [word]%
%%  [margin,word]%
  [margin,word,allpages]%
  {continue}
\usepackage{lipsum}
%%  try this without the word option
%%\renewcommand{\flagcont}{---$>$}

\renewcommand*{\preflagword}{[}

\begin{document}

First\footnote{Foot 1} \lipsum[1]

Second\footnote{Foot 2} \lipsum[2]

Third\footnote{Foot 3} \lipsum[3]

\contstop % stop marking

Fourth\footnote{Foot 4} \lipsum[4]

Fifth\footnote{Foot 5} \lipsum[5]

\contgo % start marking

Sixth\footnote{Foot 6} \lipsum[6]

\end{document}

%</try>
%    \end{macrocode}
%
% \section{The \Lpack{continue} code} \label{sec:code}
%
%    Announce the name and version of the package, which requires
% \LaTeXe{} and the \Lpack{atbegshi}, \Lpack{picture}, \Lpack{zref-abspage} and
% \Lpack{zref-lastpage} packages and has options \Lopt{margin}, \Lopt{word} and \Lopt{allpages}
% (added \Lopt{allpages} 2018/11/30).
%    \begin{macrocode}
%<*usc>
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{continue}[2018/12/09 v0.2 Continues on the following page]
 \PackageInfo{continue}{This is continue using e-TeX.}

%    \end{macrocode}
% \begin{macro}{\ifcontmargin}
% \begin{macro}{\ifcontword}
% Now for the options.
%    \begin{macrocode}
 \newif{\ifcontmargin} \contmarginfalse
 \newif{\ifcontword}   \contwordfalse
 \newif{\ifcontallpages} \contallpagesfalse
 \DeclareOption{margin}{\contmargintrue}
 \DeclareOption{word}{\contwordtrue}
 \DeclareOption{allpages}{\contallpagestrue}
 \ProcessOptions

%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ifc@go}
% \begin{macro}{\contgo}
% \begin{macro}{\contstop}
% Continuation marks will stop after |\contstop| but will continue after |\contgo| 
% (the default)
%    \begin{macrocode}
\newif{\ifc@go} \c@gotrue
\newcommand{\contgo}{\c@gotrue}
\newcommand{\contstop}{\c@gofalse}

%    \end{macrocode}%
% \end{macro}
% \end{macro}
% \end{macro}
%
% And the required packages needed by the original \Lpack{turnpageetex} package.
%
%    \begin{macrocode}
 \RequirePackage{atbegshi}
 \RequirePackage{picture}
 \RequirePackage{zref-abspage}
 \RequirePackage{zref-lastpage}

%    \end{macrocode}
%
% The next chunk of code is a revised version of the \Lpack{fwlw} package. I don't
% really understand it but I have a feeling that certain parts are irrelevant
% to the purposes at hand.
%
%    \begin{macrocode}
% --------------------------------------------------------------------------
%
%    \end{macrocode}
%
% \begin{macro}{\LWC@pen}
% Declare a \textit{unique} penalty flag as a value.
%    \begin{macrocode}
 \mathchardef\LWC@pen 13452
%    \end{macrocode} 
% \end{macro}
%
% \begin{macro}{\FirstWordBox}
% \begin{macro}{\NextWordBox}
% \begin{macro}{\LastWordBox}
% \begin{macro}{\LWC@box}
% \begin{macro}{\LWC@saved}
% Allocate box registers
%    \begin{macrocode}
 \newbox\FirstWordBox     \global\setbox\FirstWordBox\hbox{}
 \newbox\NextWordBox      \global\setbox\NextWordBox\hbox{}
 \newbox\LastWordBox      \global\setbox\LastWordBox\hbox{}
 \newbox\LWC@box           \global\setbox\LWC@box\hbox{}
 \newbox\LWC@saved
%    \end{macrocode} 
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\FWLWCnormal@L@output}
%  Shell around old output routine.  Gets first word from next page by
%  letting TeX continue with |\vsize=0| to get a look at the next line.
%  Values of |\outputpenalty| for |\specialoutput| ( -10001 to -19999 ) are
%  simply run through the output routine.
%  |\supereject| and |\clearpage| give a blank "next word".
%  When called after making a stub-page the stub is returned to the
%  vertical list, the previous page is restored and shipped out normally,
%  but knowing what the next word will be.
%    \begin{macrocode}
 \edef\FWLWCnorm@L@output{\the\output}

 \output{\@tempswafalse
 \ifnum \outputpenalty>-\@MM \ifnum\outputpenalty<-\@M \@tempswatrue\fi\fi
 \if@tempswa % special (float) output
%  \message{Float handler: penalty=\the\outputpenalty}%
    \FWLWCnorm@L@output
 \else
   \ifvoid\LWC@saved % end of real page
%    \message{End of real page}%
      \global\setbox\LWC@saved\copy\@cclv % save page
%\begin{comment}
      \setbox\@tempboxa\vbox{\unvbox\@cclv \unskip\unkern\unpenalty%     
       \unskip\unkern\unpenalty \unskip\unkern\unpenalty
        \setbox\@tempboxa\lastbox
        \LWC@getlast@word\@tempboxa\LastWordBox
      }
%\end{comment}
      \ifnum\outputpenalty>-\@MM % not \supereject
        \xdef\LWC@vsize{\global\vsize\the\vsize 
           \global\holdinginserts\the\holdinginserts}%
        \global\vsize\z@ \global\holdinginserts\@ne 
      \else % \supereject, just output, don't look for word on next page
%      \message{caused by super-eject.}
        \global\setbox\@cclv\box\LWC@saved
        \global\setbox\NextWordBox\hbox{}%
        \FWLWCnorm@L@output
        \global\setbox\FirstWordBox\box\NextWordBox
      \fi
   \else % saved page => just did tiny page to get next word
%    \message{Just got next line:}{\tracingall\showboxdepth2 \showbox\@cclv}%
      \setbox\@tempboxa\vbox{\penalty\LWC@pen\unvcopy\@cclv \LWC@getall@boxes
        \ifvbox\LWC@box \penalty\LWC@pen\unvbox\LWC@box \LWC@getall@boxes\fi
        \ifvbox\LWC@box \global\setbox\NextWordBox\hbox{}\else
          \LWC@getfirst@word\LWC@box\NextWordBox
        \fi}%  Return tiny page to page list:
      \unvbox\@cclv \ifnum\outputpenalty<\@M \penalty\outputpenalty\fi
      \LWC@vsize\relax
      \global\setbox\@cclv\box\LWC@saved
      \FWLWCnorm@L@output
      \global\setbox\FirstWordBox\box\NextWordBox
 \fi\fi}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\LWC@getlast@word}
% Globally get last "word" from a box |#1| into another box |#2|
%
%    \begin{macrocode}
 \def\LWC@getlast@word#1#2{\setbox\@tempboxa\vbox{\hsize\maxdimen \@parboxrestore
   \hyphenpenalty\@M \exhyphenpenalty\@M 
   \rightskip\fill \looseness\@M \linepenalty\z@
   \noindent\unhbox#1\endgraf
   \unskip\unkern\unpenalty \global\setbox\LWC@box\lastbox
   }\LWC@repack{#2}}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\LWC@getfirst@word}
% Globally get first "word" from a box |#1| into another box |#2|
%
%    \begin{macrocode}
 \def\LWC@getfirst@word#1#2{\setbox\@tempboxa\vbox{\@parboxrestore
   \parshape\thr@@ \z@\z@ \z@\z@ \z@\maxdimen \parfillskip\fill
   \hyphenpenalty\@M \exhyphenpenalty\@M 
   \hbadness\@MM \overfullrule\z@ \hfuzz\maxdimen
   \ifhbox#1\noindent
    \vadjust{\penalty\LWC@pen}\penalty-\@M\unhbox#1% eliminate previous \leftskip
   \else\ifvbox#1\penalty\LWC@pen\unvbox#1\fi\fi
   \endgraf
   \@tempcnta\z@  \LWC@getall@boxes}\LWC@repack{#2}}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\LWC@getall@boxes}
% Go through a vertical list that starts with special penalty
%
%    \begin{macrocode}
 \def\LWC@getall@boxes{\global\setbox\LWC@box\lastbox \unskip\unkern \unskip\unkern
   \let\@tempa\relax
   \ifvoid \LWC@box \advance\@tempcnta\@ne \else \@tempcnta\z@ \fi
   \ifnum\lastpenalty=\LWC@pen \else \unpenalty\fi
   \ifnum\lastpenalty=\LWC@pen \else \unpenalty\fi
   \ifnum\lastpenalty=\LWC@pen \else \ifnum\@tempcnta<5
     \let\@tempa\LWC@getall@boxes \fi \fi \unpenalty \@tempa}

%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\LWC@repack}
% Put contents of |\LWC@box| into hbox |#1|
%
%    \begin{macrocode}
 \def\LWC@repack#1{\global\setbox#1\hbox{\ifhbox\LWC@box
    \unhbox\LWC@box\unskip\unskip\unpenalty\unskip
   \else\ifvbox\LWC@box\box\LWC@box\fi\fi}}
%    \end{macrocode} 
% \end{macro}
%
% The next chunk of code is a revised version of the original \Lpack{turnpageetex} package.
%    \begin{macrocode}
% --------------------------------------------------------------------------
%
%    \end{macrocode}
%
% \begin{macro}{\preflagword}
% \begin{macro}{\postflagword}
% \begin{macro}{\flagcont}
% \begin{macro}{\flagend}
% \begin{macro}{\flagword}
% \begin{macro}{\contsep}
% \begin{macro}{\contdrop}
% The user's macros
%
%    \begin{macrocode}

 \newcommand*{\preflagword}{}
 \newcommand*{\postflagword}{}
 \newcommand*{\flagcont}{Continued}
 \newcommand*{\flagend}{End}
 \newcommand*{\flagword}{\preflagword\usebox\NextWordBox\postflagword}
 \newlength{\contsep}\setlength{\contsep}{\marginparsep}
 \newlength{\contdrop}\setlength{\contdrop}{0.5\footskip}
%    \end{macrocode}
% Adjust |\flagcont| when the \Lopt{word} option is used.
%    \begin{macrocode}
 \ifcontword
  \let\flagcont\flagword
 \fi
%    \end{macrocode}
%
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\c@ntoddpagepos}
% |\c@ntoddpagepos| calculates the position of the marker on odd pages.
%    \begin{macrocode}
 \newcommand{\c@ntoddpagepos}{%
     \dimen1=1in
     \advance\dimen1 by \textwidth
     \advance\dimen1 by \oddsidemargin
     \dimen3=1in
     \advance\dimen3 by \topmargin
     \advance\dimen3 by \headheight
     \advance\dimen3 by \headsep
     \advance\dimen3 by \textheight
     \ifcontmargin
       \advance\dimen1 by \contsep
     \else
       \advance\dimen3 by \contdrop
     \fi
 }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\c@ntevenpagepos}
% |\c@ntevenpagepos| calculates the position of the marker on even pages.
%    \begin{macrocode}
 \newcommand{\c@ntevenpagepos}{%
     \dimen1=1in
     \advance\dimen1 by \textwidth
     \advance\dimen1 by \evensidemargin
     \dimen3=1in
     \advance\dimen3 by \topmargin
     \advance\dimen3 by \headheight
     \advance\dimen3 by \headsep
     \advance\dimen3 by \textheight
     \ifcontmargin
       \advance\dimen1 by \contsep
     \else
       \advance\dimen3 by \contdrop
     \fi
 }
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\c@outcontpage}
% Output continued marked page.
%    \begin{macrocode}
\newcommand{\c@outcontpage}{%
  \ifnum\zref@extract{LastPage}{abspage}>\c@abspage
    \ifcontmargin
      \put(\dimen1,-\dimen3){{\flagcont}}%
    \else
      \put(\dimen1,-\dimen3){\llap{\flagcont}}%
    \fi
  \else
    \ifcontmargin
      \put(\dimen1,-\dimen3){{\flagend}}%
    \else
      \put(\dimen1,-\dimen3){\llap{\flagend}}%
    \fi
  \fi
}% end of \c@outcontpage
%    \end{macrocode}
% \end{macro}
%
% Output the page and marks.
%    \begin{macrocode}
\AtBeginShipout{%
\AtBeginShipoutUpperLeft{%
 \ifc@go
  \ifodd\c@page
    \c@ntoddpagepos
    \c@outcontpage
  \else
    \ifcontallpages
      \c@ntevenpagepos
      \c@outcontpage
    \fi
  \fi
 \fi
} % end AtBeginShipoutUpperLeft
} % end AtBeginShipout
%
%</usc>
%    \end{macrocode}
%
%
% \bibliographystyle{alpha}
% \begin{thebibliography}{GMS94}
%
% \bibitem[Ars95]{FWLW}
% Donald Arseneau.
% \newblock \emph{fwlw.sty (First Word, Last Word)}.
% \newblock 1995. (Available from CTAN in \texttt{macros/latex/contrib/fwlw}).
%
% \bibitem[GMS94]{GOOSSENS94}
% Michel Goossens, Frank Mittelbach, and Alexander Samarin.
% \newblock \emph{The LaTeX Companion}.
% \newblock Addison-Wesley Publishing Company, 1994.
%
% \bibitem[Luc15]{TURNPAGEETEX}
% Merciadri Luca.
% \newblock \emph{turnpageetex.sty}.
% \newblock 2011. (Available from CTAN in \texttt{macros/latex/contrib/turnthepage}).
%
% \end{thebibliography}
%
% \PrintIndex
%     
% \Finale
%
% \endinput



%% \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
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}