| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% continue.dtx |
| 4 |
% |
| 5 |
% Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net |
| 6 |
% Copyright 2015, 2018 Peter R. Wilson, Donald Arseneau and Merciadri Luca |
| 7 |
% |
| 8 |
% This work may be distributed and/or modified under the |
| 9 |
% conditions of the Latex Project Public License, either |
| 10 |
% version 1.3 of this license or (at your option) any |
| 11 |
% later version. |
| 12 |
% The latest version of the license is in |
| 13 |
% http://www.latex-project.org/lppl.txt |
| 14 |
% and version 1.3 or later is part of all distributions of |
| 15 |
% LaTeX version 2003/06/01 or later. |
| 16 |
% |
| 17 |
% This work has the LPPL maintenance status "unmaintained". |
| 18 |
% |
| 19 |
% This work consists of the files listed in the README file. |
| 20 |
% |
| 21 |
%<*driver> |
| 22 |
\documentclass{ltxdoc} |
| 23 |
\EnableCrossrefs |
| 24 |
\CodelineIndex |
| 25 |
\setcounter{StandardModuleDepth}{1} |
| 26 |
%%%\usepackage{url} |
| 27 |
%%%\usepackage[draft=false, |
| 28 |
%%% plainpages=false, |
| 29 |
%%% pdfpagelabels, |
| 30 |
%%% bookmarksnumbered, |
| 31 |
%%% hyperindex=false |
| 32 |
%%% ]{hyperref} |
| 33 |
\begin{document} |
| 34 |
\DocInput{continue.dtx} |
| 35 |
\end{document} |
| 36 |
%</driver> |
| 37 |
% |
| 38 |
% \fi |
| 39 |
% |
| 40 |
% \CheckSum{12458} |
| 41 |
% |
| 42 |
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath} |
| 43 |
% \DoNotIndex{\@centercr,\@cite} |
| 44 |
% \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue} |
| 45 |
% \DoNotIndex{\@input,\@ixpt,\@m} |
| 46 |
% \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint} |
| 47 |
% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb} |
| 48 |
% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt} |
| 49 |
% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt} |
| 50 |
% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace} |
| 51 |
% \DoNotIndex{\advance,\Alph,\alph} |
| 52 |
% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box} |
| 53 |
% \DoNotIndex{\bullet} |
| 54 |
% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption} |
| 55 |
% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass} |
| 56 |
% \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist} |
| 57 |
% \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup} |
| 58 |
% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter} |
| 59 |
% \DoNotIndex{\fbox} |
| 60 |
% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef} |
| 61 |
% \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule} |
| 62 |
% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi} |
| 63 |
% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi} |
| 64 |
% \DoNotIndex{\input} |
| 65 |
% \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark} |
| 66 |
% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright} |
| 67 |
% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment} |
| 68 |
% \DoNotIndex{\NeedsTeXFormat,\newdimen} |
| 69 |
% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number} |
| 70 |
% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@} |
| 71 |
% \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip} |
| 72 |
% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions} |
| 73 |
% \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright} |
| 74 |
% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font} |
| 75 |
% \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman} |
| 76 |
% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength} |
| 77 |
% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space} |
| 78 |
% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase} |
| 79 |
% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt} |
| 80 |
% \DoNotIndex{\viipt,\vipt,\vskip,\vspace} |
| 81 |
% \DoNotIndex{\wd,\xiipt,\year,\z@} |
| 82 |
% \DoNotIndex{\0,\1,\2,\3,\4,\5,\6,\7,\8,\9} |
| 83 |
% |
| 84 |
% \def\dtxfile{continue.dtx} |
| 85 |
% \changes{v0.1}{2015/12/09}{First trial release} |
| 86 |
% \def\fileversion{v0.1} \def\filedate{2015/12/09} |
| 87 |
% \changes{v0.2}{2018/12/09}{Second trial release, markers can be on all pages and stopped and started at will} |
| 88 |
% \def\fileversion{v0.2} \def\filedate{2018/12/09} |
| 89 |
|
| 90 |
% ^^A Flag an option |
| 91 |
% \makeatletter |
| 92 |
% \newcommand{\OptFont}{\fontencoding\encodingdefault |
| 93 |
% \fontfamily\sfdefault |
| 94 |
% \fontseries\mddefault |
| 95 |
% \fontshape\updefault |
| 96 |
% \small} |
| 97 |
% |
| 98 |
% \newcommand{\DescribeOption}{\leavevmode\@bsphack |
| 99 |
% \begingroup\MakePrivateLetters\Describe@Opt} |
| 100 |
% \newcommand{\Describe@Opt}[1]{\endgroup |
| 101 |
% \marginpar{\raggedleft\PrintDescribeOption{#1}}% |
| 102 |
% \SpecialOptIndex{#1}\@esphack\ignorespaces} |
| 103 |
% \newcommand*{\PrintDescribeOption}[1]{\strut \OptFont #1\ } |
| 104 |
% \newcommand*{\PrintOptionName}[1]{\strut \OptFont #1\ } |
| 105 |
% \newcommand*{\SpecialOptIndex}[1]{\@bsphack |
| 106 |
% \index{#1\actualchar{\protect\sffamily#1} |
| 107 |
% (option)\encapchar usage}% |
| 108 |
% \index{options:\levelchar#1\actualchar |
| 109 |
% {\protect\sffamily#1}\encapchar usage}\@esphack} |
| 110 |
% |
| 111 |
% \makeatother |
| 112 |
% |
| 113 |
% \providecommand{\phantomsection}{} |
| 114 |
% %\OnlyDescription ^^A comment this out for the full glory |
| 115 |
% \setcounter{StandardModuleDepth}{1} |
| 116 |
% \makeatletter |
| 117 |
% \@mparswitchfalse |
| 118 |
% \makeatother |
| 119 |
% \renewcommand{\MakeUppercase}[1]{#1} |
| 120 |
% \pagestyle{headings} |
| 121 |
% \newenvironment{addtomargins}[1]{% |
| 122 |
% \begin{list}{}{% |
| 123 |
% \topsep 0pt% |
| 124 |
% \addtolength{\leftmargin}{#1}% |
| 125 |
% \addtolength{\rightmargin}{#1}% |
| 126 |
% \listparindent \parindent |
| 127 |
% \itemindent \parindent |
| 128 |
% \parsep \parskip}% |
| 129 |
% \item[]}{\end{list}} |
| 130 |
% \MakeShortVerb{\|} |
| 131 |
% |
| 132 |
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package |
| 133 |
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option |
| 134 |
% \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file |
| 135 |
% \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter |
| 136 |
% \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle |
| 137 |
% \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment |
| 138 |
% \newcommand{\BC}{\textsc{bc}} |
| 139 |
% \newcommand{\AD}{\textsc{ad}} |
| 140 |
% |
| 141 |
% \title{\Lpack{Continue}: Continuation marks on (by default odd) pages\thanks{This |
| 142 |
% file (\texttt{\dtxfile}) has version number \fileversion, last revised |
| 143 |
% \filedate.}} |
| 144 |
% |
| 145 |
% \author{% |
| 146 |
% Peter Wilson\thanks{\texttt{herries dot press at earthlink dot net}} with |
| 147 |
% Donald Arseneau and Merciadri Luca \\ |
| 148 |
% Herries Press |
| 149 |
% } |
| 150 |
% \date{\filedate} |
| 151 |
% \maketitle |
| 152 |
% \begin{abstract} |
| 153 |
% The \Lpack{continue} package provides for a variety of continuation indicators on |
| 154 |
% pages in a twosided document when the text continues on the following |
| 155 |
% page. The default is to only mark odd pages but all pages can be marked or marking |
| 156 |
% can be stopped or started at any point. |
| 157 |
% \end{abstract} |
| 158 |
% \tableofcontents |
| 159 |
% |
| 160 |
% |
| 161 |
% |
| 162 |
% \section{Introduction} |
| 163 |
% |
| 164 |
% In some types of documents it is customary or convenient to indicate at the |
| 165 |
% bottom of a page that the text continues on the following page. For example, when |
| 166 |
% a two page exam sheet is printed twosided it could be advantageous for the student |
| 167 |
% to have an indication on the first page that there are further questions on the back |
| 168 |
% of the page. Another instance is when documents are printed in the expectation |
| 169 |
% that they will be read by someone in front of an audience, so in order to minimise |
| 170 |
% any hesitation as a page is turned over, the first word on the following page is printed |
| 171 |
% at the bottom of the preceeding page. |
| 172 |
% |
| 173 |
% This manual is typeset according to the conventions of the |
| 174 |
% \LaTeX{} \textsc{docstrip} utility which enables the automatic |
| 175 |
% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}. |
| 176 |
% |
| 177 |
% Section~\ref{sec:usc} describes the usage of the package. |
| 178 |
% Commented package code may be in later sections. |
| 179 |
% |
| 180 |
% |
| 181 |
% \section{The \Lpack{continue} package} \label{sec:usc} |
| 182 |
% |
| 183 |
% The \Lpack{continue} package is an amalgam of modified versions of |
| 184 |
% two packages --- \Lpack{fwlw} (First Word, Last Word) by Donald |
| 185 |
% Arseneau~\cite{FWLW} which% among other things gets the first word |
| 186 |
% on the next page and \Lpack{turnpageetex} by Merciadri Luca~\cite{TURNPAGEETEX} |
| 187 |
% for placing something at the bottom of the text block. |
| 188 |
% |
| 189 |
% The \Lpack{fwlw} package includes the following statement: |
| 190 |
% |
| 191 |
% Copyright (C) 1993,1995 by Donald Arseneau |
| 192 |
% Vancouver, Canada, email [email protected] |
| 193 |
% This software package may be freely used, transmitted, reproduced, |
| 194 |
% or modified provided that this notice is left intact. |
| 195 |
% |
| 196 |
% In this instance I have modified the original package as allowed above. |
| 197 |
% |
| 198 |
% With respect to the \Lpack{turnpageetex} package this was released under the |
| 199 |
% LaTeX Project Public License and I have taken the liberty of extending its functionality |
| 200 |
% slightly, as allowed. |
| 201 |
% |
| 202 |
% |
| 203 |
% |
| 204 |
% \subsection{Options} |
| 205 |
% |
| 206 |
% There are three options that can be used when calling the package denoting the |
| 207 |
% kind and position of the continuation marker. |
| 208 |
% |
| 209 |
% \DescribeOption{margin} |
| 210 |
% With this option the continuation marker is placed in the margin aligned with |
| 211 |
% the bottom of the text block. If the option is not used then the continuation |
| 212 |
% marker is placed below the text text block ending at the outer margin. |
| 213 |
% |
| 214 |
% \DescribeOption{word} |
| 215 |
% With this option the package attempts to use the first `word' on the following |
| 216 |
% verso page as the continuation marker. If the option is not used then a user |
| 217 |
% specified marker is employed. |
| 218 |
% |
| 219 |
% \DescribeOption{allpages} |
| 220 |
% With this option the package tries to provide a marker on each page, whether |
| 221 |
% odd or even. |
| 222 |
% The default is to only provide markers on odd pages. |
| 223 |
% |
| 224 |
% The relevant portions of the introduction to the \Lpack{fwlw} package are: \\ |
| 225 |
% \begin{quotation} |
| 226 |
% The \Lpack{fwlw} package provides a mechanism to determine ... |
| 227 |
% the first word on the \textit{next} page. The `words' |
| 228 |
% you see may not be real words, but any unbreakable object. |
| 229 |
% |
| 230 |
% ... |
| 231 |
% |
| 232 |
% ... labelling does not make much sense when |\chapter| generates a page |
| 233 |
% break, so the last page before a |\chapter| (or any |\clearpage|) gets |
| 234 |
% a blank "next word" ... |
| 235 |
% |
| 236 |
% Note that `words' may unfortunately be things like: |
| 237 |
% \begin{itemize} |
| 238 |
% \item two~words |
| 239 |
% \item |[ ]|Word ( |[ ]| represents a parindent box) |
| 240 |
% \item a whole displayed equation |
| 241 |
% \item the first column of an aligned equation |
| 242 |
% \item anomalously blank, if there are |\write|s or split footnotes etc. |
| 243 |
% \item partial words like par- or -tial due to hyphenation. |
| 244 |
% \end{itemize} |
| 245 |
% \end{quotation} |
| 246 |
% |
| 247 |
% In essence, the `word' might not be what you might expect, but for most documents |
| 248 |
% the results are good. However, page~3 of the example file |trycontinue.tex| prints |
| 249 |
% a blank word as the continuation marker because the first line on the following |
| 250 |
% page is the start of a paragraph which starts with a space. |
| 251 |
% |
| 252 |
% |
| 253 |
% |
| 254 |
% \subsection{Macros} |
| 255 |
% |
| 256 |
% When the \Lopt{word} option is not used the following macros are available: |
| 257 |
% |
| 258 |
% \DescribeMacro{\flagcont} |
| 259 |
% This command defines the continuation mark. Its default specification is: \\ |
| 260 |
% |\newcommand*{\flagcont}{Continued}| \\ |
| 261 |
% It can be changed in the document's preamble to, perhaps: \\ |
| 262 |
% |\renewcommand*{\flagcont}{---$>$}| \\ |
| 263 |
% to print a right pointing arrow. |
| 264 |
% |
| 265 |
% \DescribeMacro{\flagend} |
| 266 |
% This command defines the continuation mark when the last odd page is the final |
| 267 |
% page (i.e. when there is no following recto page). Its default specification is: \\ |
| 268 |
% |\newcommand*{\flagend}{End}| \\ |
| 269 |
% but it can be changed in the document's preamble. |
| 270 |
% |
| 271 |
% When the \Lopt{word} option is used the following macros are available: |
| 272 |
% |
| 273 |
% \DescribeMacro{\flagword} |
| 274 |
% This command specifies how the continuation word is formated. Its definition is: \\ |
| 275 |
% |\newcommand*{\flagword}{\preflagword\usebox\NextWordBox\postflagword}| \\ |
| 276 |
% where |\NextWordBox| holds the first word on the next recto page (empty if there |
| 277 |
% is no next recto page). |
| 278 |
% |
| 279 |
% \DescribeMacro{\preflagword} |
| 280 |
% This command is printed before the word continuation marker. Its default definition is: \\ |
| 281 |
% |\newcommand*{\preflagword}{}| \\ |
| 282 |
% but can be redefined in the document preamble to put, perhaps, an opening brace |
| 283 |
% before the word like: \\ |
| 284 |
% |\renewcommand*{\preflagword}{[}| |
| 285 |
% |
| 286 |
% \DescribeMacro{\postflagword} |
| 287 |
% Similar to |\preflagword| except that it is printed after the marker. Its default |
| 288 |
% definition is: \\ |
| 289 |
% |\newcommand*{\postflagword}{}| \\ |
| 290 |
% |
| 291 |
% \DescribeMacro{\contsep} |
| 292 |
% \DescribeMacro{\contdrop} |
| 293 |
% When the \Lopt{margin} option is used the continuation marker is set a distance |
| 294 |
% |\contsep| to the right of the textblock. When \Lopt{margin} is not used then the |
| 295 |
% marker is set a distance |\contdrop| below the textblock. Their default values |
| 296 |
% are set by: \\ |
| 297 |
% |\setlength{\contsep}{\marginparsep}| and |\setlength{\contdrop}{0.5\footskip}| |
| 298 |
% |
| 299 |
% \section{An example document} |
| 300 |
% |
| 301 |
% You can use the document |trycontinue.tex| to experiment with the options. |
| 302 |
% It may take two (pdf)LaTeX runs for the continuation marks to settle down to their |
| 303 |
% final values and positions. |
| 304 |
% |
| 305 |
% \begin{macrocode} |
| 306 |
%<*try> |
| 307 |
%% trycontinue.tex An example usage of the continue package (2018/12/09) |
| 308 |
%% |
| 309 |
%% The document is set with footnotes on A6 paper (I wanted |
| 310 |
%% to get many pages from little text). It is not pretty but does shows |
| 311 |
%% some of the continue package's capabilities. Try modifying it by changing |
| 312 |
%% options, etc., and see what happens. |
| 313 |
%% |
| 314 |
%% You can try and contact me, Peter Wilson at [email protected], if there |
| 315 |
%% are problems other than the aesthetics. |
| 316 |
%% |
| 317 |
\documentclass[% |
| 318 |
twoside, |
| 319 |
a6paper |
| 320 |
]% |
| 321 |
{memoir} |
| 322 |
|
| 323 |
\usepackage% |
| 324 |
%% [margin]% |
| 325 |
%% [word]% |
| 326 |
%% [margin,word]% |
| 327 |
[margin,word,allpages]% |
| 328 |
{continue} |
| 329 |
\usepackage{lipsum} |
| 330 |
%% try this without the word option |
| 331 |
%%\renewcommand{\flagcont}{---$>$} |
| 332 |
|
| 333 |
\renewcommand*{\preflagword}{[} |
| 334 |
|
| 335 |
\begin{document} |
| 336 |
|
| 337 |
First\footnote{Foot 1} \lipsum[1] |
| 338 |
|
| 339 |
Second\footnote{Foot 2} \lipsum[2] |
| 340 |
|
| 341 |
Third\footnote{Foot 3} \lipsum[3] |
| 342 |
|
| 343 |
\contstop % stop marking |
| 344 |
|
| 345 |
Fourth\footnote{Foot 4} \lipsum[4] |
| 346 |
|
| 347 |
Fifth\footnote{Foot 5} \lipsum[5] |
| 348 |
|
| 349 |
\contgo % start marking |
| 350 |
|
| 351 |
Sixth\footnote{Foot 6} \lipsum[6] |
| 352 |
|
| 353 |
\end{document} |
| 354 |
|
| 355 |
%</try> |
| 356 |
% \end{macrocode} |
| 357 |
% |
| 358 |
% \section{The \Lpack{continue} code} \label{sec:code} |
| 359 |
% |
| 360 |
% Announce the name and version of the package, which requires |
| 361 |
% \LaTeXe{} and the \Lpack{atbegshi}, \Lpack{picture}, \Lpack{zref-abspage} and |
| 362 |
% \Lpack{zref-lastpage} packages and has options \Lopt{margin}, \Lopt{word} and \Lopt{allpages} |
| 363 |
% (added \Lopt{allpages} 2018/11/30). |
| 364 |
% \begin{macrocode} |
| 365 |
%<*usc> |
| 366 |
\NeedsTeXFormat{LaTeX2e} |
| 367 |
\ProvidesPackage{continue}[2018/12/09 v0.2 Continues on the following page] |
| 368 |
\PackageInfo{continue}{This is continue using e-TeX.} |
| 369 |
|
| 370 |
% \end{macrocode} |
| 371 |
% \begin{macro}{\ifcontmargin} |
| 372 |
% \begin{macro}{\ifcontword} |
| 373 |
% Now for the options. |
| 374 |
% \begin{macrocode} |
| 375 |
\newif{\ifcontmargin} \contmarginfalse |
| 376 |
\newif{\ifcontword} \contwordfalse |
| 377 |
\newif{\ifcontallpages} \contallpagesfalse |
| 378 |
\DeclareOption{margin}{\contmargintrue} |
| 379 |
\DeclareOption{word}{\contwordtrue} |
| 380 |
\DeclareOption{allpages}{\contallpagestrue} |
| 381 |
\ProcessOptions |
| 382 |
|
| 383 |
% \end{macrocode} |
| 384 |
% \end{macro} |
| 385 |
% \end{macro} |
| 386 |
% |
| 387 |
% \begin{macro}{\ifc@go} |
| 388 |
% \begin{macro}{\contgo} |
| 389 |
% \begin{macro}{\contstop} |
| 390 |
% Continuation marks will stop after |\contstop| but will continue after |\contgo| |
| 391 |
% (the default) |
| 392 |
% \begin{macrocode} |
| 393 |
\newif{\ifc@go} \c@gotrue |
| 394 |
\newcommand{\contgo}{\c@gotrue} |
| 395 |
\newcommand{\contstop}{\c@gofalse} |
| 396 |
|
| 397 |
% \end{macrocode}% |
| 398 |
% \end{macro} |
| 399 |
% \end{macro} |
| 400 |
% \end{macro} |
| 401 |
% |
| 402 |
% And the required packages needed by the original \Lpack{turnpageetex} package. |
| 403 |
% |
| 404 |
% \begin{macrocode} |
| 405 |
\RequirePackage{atbegshi} |
| 406 |
\RequirePackage{picture} |
| 407 |
\RequirePackage{zref-abspage} |
| 408 |
\RequirePackage{zref-lastpage} |
| 409 |
|
| 410 |
% \end{macrocode} |
| 411 |
% |
| 412 |
% The next chunk of code is a revised version of the \Lpack{fwlw} package. I don't |
| 413 |
% really understand it but I have a feeling that certain parts are irrelevant |
| 414 |
% to the purposes at hand. |
| 415 |
% |
| 416 |
% \begin{macrocode} |
| 417 |
% -------------------------------------------------------------------------- |
| 418 |
% |
| 419 |
% \end{macrocode} |
| 420 |
% |
| 421 |
% \begin{macro}{\LWC@pen} |
| 422 |
% Declare a \textit{unique} penalty flag as a value. |
| 423 |
% \begin{macrocode} |
| 424 |
\mathchardef\LWC@pen 13452 |
| 425 |
% \end{macrocode} |
| 426 |
% \end{macro} |
| 427 |
% |
| 428 |
% \begin{macro}{\FirstWordBox} |
| 429 |
% \begin{macro}{\NextWordBox} |
| 430 |
% \begin{macro}{\LastWordBox} |
| 431 |
% \begin{macro}{\LWC@box} |
| 432 |
% \begin{macro}{\LWC@saved} |
| 433 |
% Allocate box registers |
| 434 |
% \begin{macrocode} |
| 435 |
\newbox\FirstWordBox \global\setbox\FirstWordBox\hbox{} |
| 436 |
\newbox\NextWordBox \global\setbox\NextWordBox\hbox{} |
| 437 |
\newbox\LastWordBox \global\setbox\LastWordBox\hbox{} |
| 438 |
\newbox\LWC@box \global\setbox\LWC@box\hbox{} |
| 439 |
\newbox\LWC@saved |
| 440 |
% \end{macrocode} |
| 441 |
% \end{macro} |
| 442 |
% \end{macro} |
| 443 |
% \end{macro} |
| 444 |
% \end{macro} |
| 445 |
% \end{macro} |
| 446 |
% |
| 447 |
% \begin{macro}{\FWLWCnormal@L@output} |
| 448 |
% Shell around old output routine. Gets first word from next page by |
| 449 |
% letting TeX continue with |\vsize=0| to get a look at the next line. |
| 450 |
% Values of |\outputpenalty| for |\specialoutput| ( -10001 to -19999 ) are |
| 451 |
% simply run through the output routine. |
| 452 |
% |\supereject| and |\clearpage| give a blank "next word". |
| 453 |
% When called after making a stub-page the stub is returned to the |
| 454 |
% vertical list, the previous page is restored and shipped out normally, |
| 455 |
% but knowing what the next word will be. |
| 456 |
% \begin{macrocode} |
| 457 |
\edef\FWLWCnorm@L@output{\the\output} |
| 458 |
|
| 459 |
\output{\@tempswafalse |
| 460 |
\ifnum \outputpenalty>-\@MM \ifnum\outputpenalty<-\@M \@tempswatrue\fi\fi |
| 461 |
\if@tempswa % special (float) output |
| 462 |
% \message{Float handler: penalty=\the\outputpenalty}% |
| 463 |
\FWLWCnorm@L@output |
| 464 |
\else |
| 465 |
\ifvoid\LWC@saved % end of real page |
| 466 |
% \message{End of real page}% |
| 467 |
\global\setbox\LWC@saved\copy\@cclv % save page |
| 468 |
%\begin{comment} |
| 469 |
\setbox\@tempboxa\vbox{\unvbox\@cclv \unskip\unkern\unpenalty% |
| 470 |
\unskip\unkern\unpenalty \unskip\unkern\unpenalty |
| 471 |
\setbox\@tempboxa\lastbox |
| 472 |
\LWC@getlast@word\@tempboxa\LastWordBox |
| 473 |
} |
| 474 |
%\end{comment} |
| 475 |
\ifnum\outputpenalty>-\@MM % not \supereject |
| 476 |
\xdef\LWC@vsize{\global\vsize\the\vsize |
| 477 |
\global\holdinginserts\the\holdinginserts}% |
| 478 |
\global\vsize\z@ \global\holdinginserts\@ne |
| 479 |
\else % \supereject, just output, don't look for word on next page |
| 480 |
% \message{caused by super-eject.} |
| 481 |
\global\setbox\@cclv\box\LWC@saved |
| 482 |
\global\setbox\NextWordBox\hbox{}% |
| 483 |
\FWLWCnorm@L@output |
| 484 |
\global\setbox\FirstWordBox\box\NextWordBox |
| 485 |
\fi |
| 486 |
\else % saved page => just did tiny page to get next word |
| 487 |
% \message{Just got next line:}{\tracingall\showboxdepth2 \showbox\@cclv}% |
| 488 |
\setbox\@tempboxa\vbox{\penalty\LWC@pen\unvcopy\@cclv \LWC@getall@boxes |
| 489 |
\ifvbox\LWC@box \penalty\LWC@pen\unvbox\LWC@box \LWC@getall@boxes\fi |
| 490 |
\ifvbox\LWC@box \global\setbox\NextWordBox\hbox{}\else |
| 491 |
\LWC@getfirst@word\LWC@box\NextWordBox |
| 492 |
\fi}% Return tiny page to page list: |
| 493 |
\unvbox\@cclv \ifnum\outputpenalty<\@M \penalty\outputpenalty\fi |
| 494 |
\LWC@vsize\relax |
| 495 |
\global\setbox\@cclv\box\LWC@saved |
| 496 |
\FWLWCnorm@L@output |
| 497 |
\global\setbox\FirstWordBox\box\NextWordBox |
| 498 |
\fi\fi} |
| 499 |
|
| 500 |
% \end{macrocode} |
| 501 |
% \end{macro} |
| 502 |
% |
| 503 |
% \begin{macro}{\LWC@getlast@word} |
| 504 |
% Globally get last "word" from a box |#1| into another box |#2| |
| 505 |
% |
| 506 |
% \begin{macrocode} |
| 507 |
\def\LWC@getlast@word#1#2{\setbox\@tempboxa\vbox{\hsize\maxdimen \@parboxrestore |
| 508 |
\hyphenpenalty\@M \exhyphenpenalty\@M |
| 509 |
\rightskip\fill \looseness\@M \linepenalty\z@ |
| 510 |
\noindent\unhbox#1\endgraf |
| 511 |
\unskip\unkern\unpenalty \global\setbox\LWC@box\lastbox |
| 512 |
}\LWC@repack{#2}} |
| 513 |
|
| 514 |
% \end{macrocode} |
| 515 |
% \end{macro} |
| 516 |
% \begin{macro}{\LWC@getfirst@word} |
| 517 |
% Globally get first "word" from a box |#1| into another box |#2| |
| 518 |
% |
| 519 |
% \begin{macrocode} |
| 520 |
\def\LWC@getfirst@word#1#2{\setbox\@tempboxa\vbox{\@parboxrestore |
| 521 |
\parshape\thr@@ \z@\z@ \z@\z@ \z@\maxdimen \parfillskip\fill |
| 522 |
\hyphenpenalty\@M \exhyphenpenalty\@M |
| 523 |
\hbadness\@MM \overfullrule\z@ \hfuzz\maxdimen |
| 524 |
\ifhbox#1\noindent |
| 525 |
\vadjust{\penalty\LWC@pen}\penalty-\@M\unhbox#1% eliminate previous \leftskip |
| 526 |
\else\ifvbox#1\penalty\LWC@pen\unvbox#1\fi\fi |
| 527 |
\endgraf |
| 528 |
\@tempcnta\z@ \LWC@getall@boxes}\LWC@repack{#2}} |
| 529 |
|
| 530 |
% \end{macrocode} |
| 531 |
% \end{macro} |
| 532 |
% |
| 533 |
% \begin{macro}{\LWC@getall@boxes} |
| 534 |
% Go through a vertical list that starts with special penalty |
| 535 |
% |
| 536 |
% \begin{macrocode} |
| 537 |
\def\LWC@getall@boxes{\global\setbox\LWC@box\lastbox \unskip\unkern \unskip\unkern |
| 538 |
\let\@tempa\relax |
| 539 |
\ifvoid \LWC@box \advance\@tempcnta\@ne \else \@tempcnta\z@ \fi |
| 540 |
\ifnum\lastpenalty=\LWC@pen \else \unpenalty\fi |
| 541 |
\ifnum\lastpenalty=\LWC@pen \else \unpenalty\fi |
| 542 |
\ifnum\lastpenalty=\LWC@pen \else \ifnum\@tempcnta<5 |
| 543 |
\let\@tempa\LWC@getall@boxes \fi \fi \unpenalty \@tempa} |
| 544 |
|
| 545 |
% \end{macrocode} |
| 546 |
% \end{macro} |
| 547 |
% |
| 548 |
% \begin{macro}{\LWC@repack} |
| 549 |
% Put contents of |\LWC@box| into hbox |#1| |
| 550 |
% |
| 551 |
% \begin{macrocode} |
| 552 |
\def\LWC@repack#1{\global\setbox#1\hbox{\ifhbox\LWC@box |
| 553 |
\unhbox\LWC@box\unskip\unskip\unpenalty\unskip |
| 554 |
\else\ifvbox\LWC@box\box\LWC@box\fi\fi}} |
| 555 |
% \end{macrocode} |
| 556 |
% \end{macro} |
| 557 |
% |
| 558 |
% The next chunk of code is a revised version of the original \Lpack{turnpageetex} package. |
| 559 |
% \begin{macrocode} |
| 560 |
% -------------------------------------------------------------------------- |
| 561 |
% |
| 562 |
% \end{macrocode} |
| 563 |
% |
| 564 |
% \begin{macro}{\preflagword} |
| 565 |
% \begin{macro}{\postflagword} |
| 566 |
% \begin{macro}{\flagcont} |
| 567 |
% \begin{macro}{\flagend} |
| 568 |
% \begin{macro}{\flagword} |
| 569 |
% \begin{macro}{\contsep} |
| 570 |
% \begin{macro}{\contdrop} |
| 571 |
% The user's macros |
| 572 |
% |
| 573 |
% \begin{macrocode} |
| 574 |
|
| 575 |
\newcommand*{\preflagword}{} |
| 576 |
\newcommand*{\postflagword}{} |
| 577 |
\newcommand*{\flagcont}{Continued} |
| 578 |
\newcommand*{\flagend}{End} |
| 579 |
\newcommand*{\flagword}{\preflagword\usebox\NextWordBox\postflagword} |
| 580 |
\newlength{\contsep}\setlength{\contsep}{\marginparsep} |
| 581 |
\newlength{\contdrop}\setlength{\contdrop}{0.5\footskip} |
| 582 |
% \end{macrocode} |
| 583 |
% Adjust |\flagcont| when the \Lopt{word} option is used. |
| 584 |
% \begin{macrocode} |
| 585 |
\ifcontword |
| 586 |
\let\flagcont\flagword |
| 587 |
\fi |
| 588 |
% \end{macrocode} |
| 589 |
% |
| 590 |
% \end{macro} |
| 591 |
% \end{macro} |
| 592 |
% \end{macro} |
| 593 |
% \end{macro} |
| 594 |
% \end{macro} |
| 595 |
% \end{macro} |
| 596 |
% \end{macro} |
| 597 |
% |
| 598 |
% \begin{macro}{\c@ntoddpagepos} |
| 599 |
% |\c@ntoddpagepos| calculates the position of the marker on odd pages. |
| 600 |
% \begin{macrocode} |
| 601 |
\newcommand{\c@ntoddpagepos}{% |
| 602 |
\dimen1=1in |
| 603 |
\advance\dimen1 by \textwidth |
| 604 |
\advance\dimen1 by \oddsidemargin |
| 605 |
\dimen3=1in |
| 606 |
\advance\dimen3 by \topmargin |
| 607 |
\advance\dimen3 by \headheight |
| 608 |
\advance\dimen3 by \headsep |
| 609 |
\advance\dimen3 by \textheight |
| 610 |
\ifcontmargin |
| 611 |
\advance\dimen1 by \contsep |
| 612 |
\else |
| 613 |
\advance\dimen3 by \contdrop |
| 614 |
\fi |
| 615 |
} |
| 616 |
% \end{macrocode} |
| 617 |
% \end{macro} |
| 618 |
% |
| 619 |
% \begin{macro}{\c@ntevenpagepos} |
| 620 |
% |\c@ntevenpagepos| calculates the position of the marker on even pages. |
| 621 |
% \begin{macrocode} |
| 622 |
\newcommand{\c@ntevenpagepos}{% |
| 623 |
\dimen1=1in |
| 624 |
\advance\dimen1 by \textwidth |
| 625 |
\advance\dimen1 by \evensidemargin |
| 626 |
\dimen3=1in |
| 627 |
\advance\dimen3 by \topmargin |
| 628 |
\advance\dimen3 by \headheight |
| 629 |
\advance\dimen3 by \headsep |
| 630 |
\advance\dimen3 by \textheight |
| 631 |
\ifcontmargin |
| 632 |
\advance\dimen1 by \contsep |
| 633 |
\else |
| 634 |
\advance\dimen3 by \contdrop |
| 635 |
\fi |
| 636 |
} |
| 637 |
% \end{macrocode} |
| 638 |
% \end{macro} |
| 639 |
% |
| 640 |
% |
| 641 |
% \begin{macro}{\c@outcontpage} |
| 642 |
% Output continued marked page. |
| 643 |
% \begin{macrocode} |
| 644 |
\newcommand{\c@outcontpage}{% |
| 645 |
\ifnum\zref@extract{LastPage}{abspage}>\c@abspage |
| 646 |
\ifcontmargin |
| 647 |
\put(\dimen1,-\dimen3){{\flagcont}}% |
| 648 |
\else |
| 649 |
\put(\dimen1,-\dimen3){\llap{\flagcont}}% |
| 650 |
\fi |
| 651 |
\else |
| 652 |
\ifcontmargin |
| 653 |
\put(\dimen1,-\dimen3){{\flagend}}% |
| 654 |
\else |
| 655 |
\put(\dimen1,-\dimen3){\llap{\flagend}}% |
| 656 |
\fi |
| 657 |
\fi |
| 658 |
}% end of \c@outcontpage |
| 659 |
% \end{macrocode} |
| 660 |
% \end{macro} |
| 661 |
% |
| 662 |
% Output the page and marks. |
| 663 |
% \begin{macrocode} |
| 664 |
\AtBeginShipout{% |
| 665 |
\AtBeginShipoutUpperLeft{% |
| 666 |
\ifc@go |
| 667 |
\ifodd\c@page |
| 668 |
\c@ntoddpagepos |
| 669 |
\c@outcontpage |
| 670 |
\else |
| 671 |
\ifcontallpages |
| 672 |
\c@ntevenpagepos |
| 673 |
\c@outcontpage |
| 674 |
\fi |
| 675 |
\fi |
| 676 |
\fi |
| 677 |
} % end AtBeginShipoutUpperLeft |
| 678 |
} % end AtBeginShipout |
| 679 |
% |
| 680 |
%</usc> |
| 681 |
% \end{macrocode} |
| 682 |
% |
| 683 |
% |
| 684 |
% \bibliographystyle{alpha} |
| 685 |
% \begin{thebibliography}{GMS94} |
| 686 |
% |
| 687 |
% \bibitem[Ars95]{FWLW} |
| 688 |
% Donald Arseneau. |
| 689 |
% \newblock \emph{fwlw.sty (First Word, Last Word)}. |
| 690 |
% \newblock 1995. (Available from CTAN in \texttt{macros/latex/contrib/fwlw}). |
| 691 |
% |
| 692 |
% \bibitem[GMS94]{GOOSSENS94} |
| 693 |
% Michel Goossens, Frank Mittelbach, and Alexander Samarin. |
| 694 |
% \newblock \emph{The LaTeX Companion}. |
| 695 |
% \newblock Addison-Wesley Publishing Company, 1994. |
| 696 |
% |
| 697 |
% \bibitem[Luc15]{TURNPAGEETEX} |
| 698 |
% Merciadri Luca. |
| 699 |
% \newblock \emph{turnpageetex.sty}. |
| 700 |
% \newblock 2011. (Available from CTAN in \texttt{macros/latex/contrib/turnthepage}). |
| 701 |
% |
| 702 |
% \end{thebibliography} |
| 703 |
% |
| 704 |
% \PrintIndex |
| 705 |
% |
| 706 |
% \Finale |
| 707 |
% |
| 708 |
% \endinput |
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
%% \CharacterTable |
| 713 |
%% {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 |
| 714 |
%% 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 |
| 715 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 716 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 717 |
%% Dollar \$ Percent \% Ampersand \& |
| 718 |
%% Acute accent \' Left paren \( Right paren \) |
| 719 |
%% Asterisk \* Plus \+ Comma \, |
| 720 |
%% Minus \- Point \. Solidus \/ |
| 721 |
%% Colon \: Semicolon \; Less than \< |
| 722 |
%% Equals \= Greater than \> Question mark \? |
| 723 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 724 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 725 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 726 |
%% Right brace \} Tilde \~} |