Debian Codegraph @

texmf-dist/source/latex/epigraph/epigraph.dtx

raw
1 % \iffalse meta-comment
2 % epigraph.dtx
3 % Author: Peter Wilson, Herries Press
4 % Maintainer: Will Robertson (will dot robertson at latex-project dot org)
5 % Copyright 1998--2004 Peter R. Wilson
6 % Copyright 2011 Will Robertson
7 %
8 % This work may be distributed and/or modified under the
9 % conditions of the LaTeX Project Public License, either
10 % version 1.3c of this license or (at your option) any
11 % later version: <http://www.latex-project.org/lppl.txt>
12 %
13 % This work has the LPPL maintenance status "maintained".
14 % The Current Maintainer of this work is Will Robertson.
15 %
16 % This work consists of the files listed in the README file.
17 %
18 %
19 %<*driver>
20 \documentclass{ltxdoc}
21 \EnableCrossrefs
22 \CodelineIndex
23 \setcounter{StandardModuleDepth}{1}
24 \begin{document}
25 \DocInput{epigraph.dtx}
26 \end{document}
27 %</driver>
28 %
29 % \fi
30 %
31 % \CheckSum{244}
32 %
33 % \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
34 % \DoNotIndex{\@centercr,\@cite}
35 % \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
36 % \DoNotIndex{\@input,\@ixpt,\@m}
37 % \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
38 % \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
39 % \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
40 % \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
41 % \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
42 % \DoNotIndex{\advance,\Alph,\alph}
43 % \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
44 % \DoNotIndex{\bullet}
45 % \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
46 % \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
47 % \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
48 % \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
49 % \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
50 % \DoNotIndex{\fbox}
51 % \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
52 % \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
53 % \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
54 % \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
55 % \DoNotIndex{\input}
56 % \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
57 % \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
58 % \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
59 % \DoNotIndex{\NeedsTeXFormat,\newdimen}
60 % \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
61 % \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
62 % \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
63 % \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
64 % \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
65 % \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
66 % \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
67 % \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
68 % \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
69 % \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
70 % \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
71 % \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
72 % \DoNotIndex{\wd,\xiipt,\year,\z@}
73 %
74 % \changes{v1.0}{1998/11/15}{First public release}
75 % \changes{v1.1}{1998/11/29}{Added epigraphs before chapter headings}
76 % \changes{v1.2}{1999/09/12}{Added cleartoevenpage and extended documentation}
77 % \changes{v1.2a}{1999/12/01}{Extended documentation for epigraphs on Part pages}
78 % \changes{v1.3}{1999/12/01}{Added \cs{dropchapter} and \cs{undodrop} commands}
79 % \changes{v1.4}{2000/01/16}{Added flushleftright environment}
80 % \changes{v1.5}{2000/02/20}{Generalised \cs{cleartoevenpage} command}
81 % \changes{v1.5a}{2002/10/22}{Fixed class with ccaption package}
82 % \changes{v1.5b}{2004/04/22}{Updated license and contact details}
83 % \changes{v1.5c}{2009/09/02}{New maintainer (Will Robertson)}
84 % \changes{v1.5d}{2011/08/07}{Load package `nextpage' for \cs{cleartoevenpage}}
85 %
86 % \def\dtxfile{epigraph.dtx}
87 % \def\fileversion{v1.5} \def\filedate{2000/02/20}
88 % \def\fileversion{v1.5a} \def\filedate{2002/10/22}
89 % \def\fileversion{v1.5b} \def\filedate{2004/04/22}
90 % \def\fileversion{v1.5c} \def\filedate{2009/09/02}
91 % \def\fileversion{v1.5d} \def\filedate{2011/08/07}
92 % \def\fileversion{v1.5e} \def\filedate{2020/01/02}
93 % \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
94 % \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
95 % \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file
96 % \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter
97 % \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle
98 % \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment
99 % ^^A fake a rhsepigraph for demo purposes
100 % \newcommand{\tepi}[2]{\vspace{.5\baselineskip}\begin{flushright}\small
101 % \begin{minipage}{2.5in}
102 % \begin{minipage}{2.5in}\begin{flushleft} #1\\
103 % \rule[.5ex]{2.5in}{.4pt}
104 % \end{flushleft}\end{minipage} \\
105 % \begin{minipage}{2.5in}\begin{flushright} #2
106 % \end{flushright}\end{minipage}
107 % \end{minipage}\end{flushright}\vspace{.5\baselineskip}}
108 %
109 % \title{The \Lpack{epigraph} package\thanks{This
110 % file (\texttt{\dtxfile}) has version number \fileversion, last revised
111 % \filedate.}}
112 %
113 % \author{%
114 % Author: Peter Wilson, Herries Press\\
115 % Maintainer: Will Robertson\\
116 % \texttt{will dot robertson at latex-project dot org}
117 % }
118 % \date{\fileversion\qquad\filedate}
119 % \maketitle
120 % \begin{abstract}
121 % The \Lpack{epigraph} package can be used to typeset a relevant
122 % quotation or saying as an \emph{epigraph}, usually just after a
123 % sectional heading. Various handles are provided to tweak the appearance.
124 % \end{abstract}
125 % \tableofcontents
126 %
127 % \StopEventually{}
128 %
129 %
130 %
131 % \section{Introduction}
132 %
133 % \tepi{My soul, seek not the life of immortals; but enjoy to the full
134 % the resources that are within your reach}
135 % {\textit{Pythian Odes \\ Pindar}}
136 %
137 % Some authors like to add an interesting quotation at either the start
138 % or end of a section. The \Lpack{epigraph} package provides commands
139 % to assist in the typesetting of a single epigraph. Other authors like to
140 % add many such quotations and the package provides environments to
141 % cater for these as well.
142 %
143 % This manual is typeset according to the conventions of the
144 % \LaTeX{} \textsc{docstrip} utility which enables the automatic
145 % extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
146 %
147 % Section~\ref{sec:usc} describes the usage of the package.
148 % Commented source code for the package is in Section~\ref{sec:code}.
149 %
150 % \section{The \Lpack{epigraph} package} \label{sec:usc}
151 %
152 % \tepi{The whole is more than the sum of the parts.}
153 % {\textit{Metaphysica \\ Aristotle}}
154 %
155 % The \Lpack{epigraph} package provides commands for typesetting
156 % a single epigraph and environments for typesetting a list of epigraphs.
157 % Epigraphs can be typeset at either the left, the center or the right of
158 % the typeblock. A few example epigraphs are exhibited here, and
159 % others can be found in an article by
160 % Christina Thiele~\cite{TTC199}.
161 %
162 % \subsection{The \texttt{epigraph} command}
163 %
164 % The original inspiration for |\epigraph| was Doug Schenck's
165 % for the epigraphs in our book~\cite{EBOOK}. That was hard wired for
166 % the purpose at hand. The version here provides much more flexibility.
167 %
168 %
169 %
170 % \DescribeMacro{\epigraph}
171 % The command |\epigraph{|\meta{text}|}{|\meta{source}|}|
172 % typesets
173 % an epigraph using \meta{text} as the main text of the epigraph and
174 % \meta{source} being the original author (or book, article, etc.)
175 % of the quoted text. By default the epigraph is placed at the right hand
176 % side of the textblock, and the \meta{source} is typeset at the bottom
177 % right of the \meta{text}.
178 %
179 %
180 % \subsection{The \texttt{epigraphs} environment}
181 %
182 % \DescribeEnv{epigraphs}
183 % The |epigraphs| environment typesets a list of epigraphs, and by default
184 % places them at the right hand side of the textblock.
185 %
186 % \DescribeMacro{\qitem}
187 % Each epigraph in the list is specified by a
188 % |\qitem{|\meta{text}|}{|\meta{source}|}| command (analogous to the |\item|
189 % command in ordinary list environments).
190 % By default, the \meta{source} is typeset at the bottom right of the
191 % \meta{text}.
192 %
193 %
194 %
195 % \subsection{General}
196 %
197 % \tepi{Example is the school of mankind, and they will learn at no other.}
198 % {\textit{Letters on a Regicide Peace}\\ \textsc{Edmund Burke}}
199 %
200 % The commands described in this section apply to both the |\epigraph|
201 % command and the |epigraphs| environment.
202 %
203 % An epigraph immediately after a heading will cause the first paragraph
204 % of the following text to be indented.
205 % If you want the initial paragraph
206 % to have no indentation, then start it with the |\noindent| command, or
207 % \DescribeMacro{\epigraphnoindent}
208 % add |\epigraphnoindent| to your document preamble.
209 % (|\epigraphnoindentfalse| will reverse the setting.)
210 % This command only affects the |\epigraph| command; for the |epigraphs| environment
211 % the |\noindent| approach must still be used.
212 %
213 % \DescribeMacro{\epigraphwidth}
214 % The epigraphs are typeset in a minipage of width |\epigraphwidth|. The default
215 % value for this can be changed using the |\setlength| command. Typically,
216 % epigraphs are typeset in a measure much less than the width of the textblock.
217 %
218 % \DescribeMacro{\textflush}
219 % In order to avoid bad line breaks, the \meta{text} is normally typeset
220 % ragged right.
221 % The |\textflush| command controls the \meta{text} typesetting style,
222 % and it can be redefined from its default value of
223 % \texttt{flushleft} (which produces ragged right). The sensible values
224 % are \texttt{center} for centered text, \texttt{flushright} for ragged left
225 % text, and \texttt{flushepinormal} for normal justified text.
226 %
227 % If by any chance you want the \meta{text} to be typeset in some
228 % other layout style, the easiest
229 % way to do this is by defining a new environment which sets the paragraphing
230 % parameters to your desired values. For example, as the \meta{text} is
231 % typeset in a minipage, there is no paragraph indentation. If you
232 % want the paragraphs to be indented and justified then define
233 % a new environment like:\\
234 % |\newenvironment{myparastyle}{\setlength{\parindent}{1em}}{}| \\
235 % and use it as: \\
236 % |\renewcommand{\textflush}{myparastyle}|.
237 %
238 % \DescribeMacro{\epigraphflush}
239 % As noted, the default position of epigraphs is at the right hand side
240 % of the textblock. The positioning is controlled by |\epigraphflush|
241 % whose default value is \texttt{flushright}. This can be changed
242 % to \texttt{flushleft} for positioning at the left hand side or to
243 % \texttt{center} for positioning at the center of the textblock.
244 %
245 % \DescribeMacro{\sourceflush}
246 % The |\sourceflush| command controls the position of the \meta{source}.
247 % The default value is \texttt{flushright}. It can be changed to
248 % \texttt{flushleft}, \texttt{center} or \texttt{flushepinormal}.
249 %
250 % For example, to have epigraphs centered with the \meta{source} at the left,
251 % add the following to your
252 % document (after loading the \Lpack{epigraph} package):
253 % \begin{verbatim}
254 % \renewcommand{\epigraphflush}{center}
255 % \renewcommand{\sourceflush}{flushleft}
256 % \end{verbatim}
257 %
258 % \DescribeMacro{\epigraphsize}
259 % Epigraphs are often typeset in a smaller font than the main text. The
260 % |\epigraphsize| command sets the font size to be used.
261 % If you don't like the default value, change it by redefining the command,
262 % for example: \\
263 % | \renewcommand{\epigraphsize}{\footnotesize}|
264 %
265 % \DescribeMacro{\epigraphrule}
266 % By default, a rule is drawn between the \meta{text} and \meta{source},
267 % with the rule thickness being given by the value of |\epigraphrule|.
268 % The value can be changed by using the \LaTeX{} |\setlength| command.
269 % A value of \texttt{0pt} will eliminate the rule. Personally, I dislike
270 % the rule in the list environments.
271 %
272 % \DescribeMacro{\beforeepigraphskip}
273 % \DescribeMacro{\afterepigraphskip}
274 % The two |...skip| commands specify the amount of vertical space inserted
275 % before and after typeset epigraphs. Again, these can be changed by
276 % |\setlength|. It is desirable that the sum of their values should be an
277 % integer multiple of the |\baselineskip|.
278 %
279 % Note that you can use normal \LaTeX{} commands in the \meta{text} and
280 % \meta{source} arguments. You may wish to use different fonts for the
281 % \meta{text} (say roman) and the \meta{source} (say italic).
282 %
283 % The epigraph at the start of this section can be specified as:
284 % \begin{verbatim}
285 % \epigraph{Example is the school of mankind,
286 % and they will learn at no other.}%
287 % {\textit{Letters on a Regicide Peace}\\ \textsc{Edmund Burke}}
288 % \end{verbatim}
289 %
290 % \subsection{Epigraphs before chapter headings}
291 %
292 % The |\epigraph| command and the |epigraphs| environment typeset
293 % an epigraph at the point in the text where they are placed. The
294 % first thing that a |\chapter| command does is to start off a new page,
295 % so another mechanism is provided for placing an epigraph just before
296 % a chapter heading.
297 %
298 % \DescribeMacro{\epigraphhead}
299 % The |\epigraphhead[|\meta{distance}|]{|\meta{text}|}| stores \meta{text}
300 % for printing at \meta{distance} below the header on a page.
301 % \meta{text} can be ordinary text or, more likely, can be either an
302 % |\epigraph| command or an |epigraphs| environment. By default, the
303 % epigraph will be typeset at the right-hand margin.
304 % If the command is immediately preceded by a |\chapter| or |\chapter*|
305 % command, the epigraph is typeset on the chapter title page.
306 %
307 % The default value for the optional \meta{distance} argument is set so
308 % that an |\epigraph| consisting of a single line of quotation and a single
309 % line denoting the source is aligned with the bottom of the `Chapter X'
310 % line produced by the |\chapter| command. In other cases you will
311 % have to experiment with the \meta{distance} value. The value for
312 % \meta{distance} can be either a integer or a real number. The units
313 % are in terms of the current value for |\unitlength|. A typical value
314 % for \meta{distance} for a single line quotation and source for
315 % a |\chapter*| might be about 70 (points). A positive value
316 % of \meta{distance} places the epigraph below the page heading and a negative
317 % value will raise it above the page heading.
318 %
319 % Here's some example code:
320 % \begin{verbatim}
321 % \chapter*{Celestial navigation}
322 % \epigraphhead[70]{\epigraph{Star crossed lovers.}{\textit{The Bard}}}
323 % \end{verbatim}
324 %
325 % The |\epigraphhead| command changes the page style for the page on
326 % which it is specified, so there should be no text between the
327 % |\chapter| and the |\epigraphhead| commands.
328 %
329 % The \meta{text} argument is put into a minipage of width |\epigraphwidth|.
330 % If you use something other than |\epigraph| or |epigraphs| for the
331 % \meta{text} argument, you may have to so some positioning of the text
332 % yourself so that it is properly located in the minipage. For example
333 % \begin{verbatim}
334 % \chapter{Short}
335 % \renewcommand{\epigraphflush}{center}
336 % \epigraphhead{\centerline{Short quote}}
337 % \end{verbatim}
338 %
339 % \changes{v1.3}{1999/12/01}{Added description of dropchapter and undodrop}
340 % \DescribeMacro{\dropchapter}
341 % \DescribeMacro{\undodrop}
342 % If a long epigraph is placed before a chapter title it is possible that the
343 % bottom of the epigraph may interfere with the chapter title. The command
344 % |\dropchapter{|\meta{length}|}| will lower any subsequent chapter titles by
345 % \meta{length}; a negative \meta{length} will raise the titles.
346 % The command |\undodrop| restores subsequent chapter titles to their default
347 % positions. For example:
348 % \begin{verbatim}
349 % \dropchapter{2in}
350 % \chapter{Title}
351 % \epigraphhead{long epigraph}
352 % \undodrop
353 % \end{verbatim}
354 %
355 % \changes{v1.2}{1999/09/12}{Added description of cleartoevenpage uses}
356 % \DescribeMacro{\cleartoevenpage}
357 % On occasions it may be desirable to put something (e.g., an epigraph, a map,
358 % a picture) on the page facing the start
359 % of a chapter, where the something belongs to the chapter that is about to
360 % start rather than the chapter that has just ended. In order to do this
361 % in a document that is going to be printed
362 % double-sided, the chapter must start on an odd numbered page and the
363 % pre-chapter material put on the immediately preceding even numbered page.
364 % The |\cleartoevenpage| command is like the |\cleardoublepage| except
365 % that the page following the command will be an even numbered page, and the
366 % command takes an optional argument, i.e., |\cleartoevenpage{|[arg|]|,
367 % which is applied to the skipped page (if any).
368 % This command is provided by the \texttt{nextpage} package.
369 %
370 % Here is an example:
371 % \begin{verbatim}
372 % ... end previous chapter.
373 % \cleartoevenpage
374 % \begin{center}
375 % \begin{picture}... \end{picture}
376 % \end{center}
377 % \chapter{Next chapter}
378 % \end{verbatim}
379 % If the style is such that chapter headings are put at the top of the pages,
380 % then it would be advisable to include |\thispagestyle{empty}| (or |plain|)
381 % immediately after |\cleartoevenpage| to avoid a heading related to the
382 % previous chapter from appearing on the page.
383 %
384 % If the something is like a figure with a numbered caption and the numbering
385 % depends on the chapter numbering, then the numbers have to be hand set (unless
386 % you define a special chapter command for the purpose). For example:
387 % \begin{verbatim}
388 % ... end previous chapter.
389 % \cleartoevenpage[\thispagestyle{empty}] % skipped page, if any, to be empty
390 % \thispagestyle{plain}
391 % \addtocounter{chapter}{1} % increment the chapter number
392 % \setcounter{figure}{0} % initialise figure counter
393 % \begin{figure}
394 % ...
395 % \caption{Pre chapter figure}
396 % \end{figure}
397 %
398 % \addtocounter{chapter}{-1} % decrement the chapter number
399 % \chapter{Next chapter} % increments chapter number, initialises figure number
400 % \addtocounter{figure}{1} % to account for pre-chapter figure
401 % \end{verbatim}
402 %
403 %
404 % \subsection{Epigraphs on Part pages}
405 %
406 % The \Lpack{epigraph} package as it stands cannot put an epigraph on the
407 % same page as a |\part| or |\part*| title page in
408 % a \Lpack{book} or \Lpack{report} class. This is because the |\part| command
409 % internally does some page flipping before and after the title page.
410 % However, it is easy enough to put epigraphs on part pages.
411 %
412 % \begin{itemize}
413 % \item Create a file called, say, \file{epipart.sty} which looks like this:
414 % \begin{verbatim}
415 % % epipart.sty
416 % \let\@epipart\@endpart
417 % \renewcommand{\@endpart}{\thispagestyle{epigraph}\@epipart}
418 % \endinput
419 % \end{verbatim}
420 %
421 % \item Start your document like:
422 % \begin{verbatim}
423 % \documentclass[...]{...}
424 % \usepackage{epigraph}
425 % \usepackage{epipart}
426 % \end{verbatim}
427 %
428 % \item Immediately \emph{before} each |\part| command put an
429 % |\epigraphhead| command. For example:
430 % \begin{verbatim}
431 % \epigraphhead[300]{Epigraph text}
432 % \part{Part title}
433 % \end{verbatim}
434 % The value of the optional argument may need changing to vertically adjust
435 % the position of the epigraph. If there is any |\part| that does not have an
436 % epigraph then an empty |\epigraphhead| command (i.e., |\epigraphhead{}|)
437 % must be placed immediately before the |\part| command.
438 %
439 % \end{itemize}
440 %
441 % A similar scheme may be used for epigraphs on other kinds of pages.
442 % The essential
443 % trick is to make sure that the \pstyle{epigraph} pagestyle is used for
444 % the page.
445 %
446 %
447 % \subsection{Epigraphed bibliographies}
448 % \changes{v1.2}{1999/09/12}{Added application of an epigraph to a bibliography}
449 % One author asked how to associate an epigraph with his bibliography. The
450 % following is one way to do it (the example is based on the book class).
451 % \begin{enumerate}
452 % \item Copy the definition of the |thebibliography| environment from
453 % \file{book.cls} to your own file called, say \file{epibib.sty}.
454 %
455 % \item Edit \file{epibib.sty} to include the definition of a vacuous
456 % command called, say, |\bibadd|. Edit the definition of the |thebibliography|
457 % to include |\bibadd| immediately before the |\list| command. The relevant
458 % portions of \file{epibib.sty} will look like this:
459 % \begin{verbatim}
460 % % epibib.sty
461 % ...
462 % \newcommand{\bibadd}{}
463 % \renewenvironment{thebibliography}[1]
464 % {\chapter*{\bibname
465 % \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}}%
466 % \bibadd
467 % \list{\@biblabel .....
468 % \end{verbatim}
469 %
470 % \item In your document, start it off like this:
471 % \begin{verbatim}
472 % \documentclass...
473 % \usepackage{epigraph}
474 % \usepackage{epibib}
475 % \end{verbatim}
476 % At the point where the bibliography is to go, do something like the following:
477 % \begin{verbatim}
478 % ...
479 % \newcommand{\bepi}{<definition of epigraph>}
480 % \renewcommand{\bibadd}{\bepi}
481 % \bepi % seems to be required if using \epigraphhead in \bepi
482 % \begin{thebibliography}{...} % or \bibliography{...}
483 % ...
484 % \end{verbatim}
485 % \end{enumerate}
486 % The same idea can be applied to document elements like an abstract or an
487 % index. Of course |\bibadd| can be defined to be anything you want to typeset
488 % between the bibliography heading and the start of the reference list.
489 %
490 %
491 % \section{The package code} \label{sec:code}
492 %
493 % \tepi{And now for something completely different.}{\textit{Monty Python}}
494 %
495 % Announce the name and version of the package, which requires
496 % \LaTeXe.
497 % \begin{macrocode}
498 %<*usc>
499 \NeedsTeXFormat{LaTeX2e}
500 \ProvidesPackage{epigraph}[2020/01/02 v1.5e typesetting epigraphs]
501 \RequirePackage{nextpage}
502 % \end{macrocode}
503 %
504 % \begin{macro}{\beforeepigraphskip}
505 % \begin{macro}{\afterepigraphskip}
506 % \begin{macro}{\epigraphwidth}
507 % \begin{macro}{\epigraphrule}
508 % The several length commands, which can be changed by the user with
509 % |\setlength|.
510 % \begin{macrocode}
511 \newlength{\beforeepigraphskip}
512 \setlength{\beforeepigraphskip}{.5\baselineskip}
513 \newlength{\afterepigraphskip}
514 \setlength{\afterepigraphskip}{.5\baselineskip}
515 \newlength{\epigraphwidth}
516 \setlength{\epigraphwidth}{.4\textwidth}
517 \newlength{\epigraphrule}
518 \setlength{\epigraphrule}{.4\p@}
519 % \end{macrocode}
520 % \end{macro}
521 % \end{macro}
522 % \end{macro}
523 % \end{macro}
524 %
525 % \begin{macro}{\epigraphsize}
526 % The size of the font to be used.
527 % \begin{macrocode}
528 \newcommand{\epigraphsize}{\small}
529 % \end{macrocode}
530 % \end{macro}
531 %
532 % \begin{macro}{\epigraphnoindent}
533 % \begin{macro}{\ifepigraphnoindent}
534 % Whether to add \cs{noindent} (false by default for backwards compatibility).
535 % \begin{macrocode}
536 \newif\ifepigraphnoindent
537 \newcommand\epigraphnoindent{\epigraphnoindenttrue}
538 % \end{macrocode}
539 % \end{macro}
540 % \end{macro}
541 %
542 % \begin{macro}{\epigraphflush}
543 % \begin{macro}{\textflush}
544 % \begin{macro}{\sourceflush}
545 % The three commands to position epigraphs in the textblock and to position
546 % the components of the epigraph.
547 % \begin{macrocode}
548 \newcommand{\epigraphflush}{flushright}
549 \newcommand{\textflush}{flushleft}
550 \newcommand{\sourceflush}{flushright}
551
552 % \end{macrocode}
553 % \end{macro}
554 % \end{macro}
555 % \end{macro}
556 %
557 % \begin{environment}{flushleftright}
558 % An environment for |\textflush| to use normal minipage typesetting. It
559 % is vacuous. Defining this was a mistake as the \Lpack{ccaption}
560 % package also defines |\flushleftright|.
561 % \changes{v1.5a}{2002/10/22}{Made flushleftright environment an error}
562 % \begin{macrocode}
563 \AtBeginDocument{%
564 \@ifundefined{flushleftright}{%
565 \newenvironment{flushleftright}{%
566 \PackageError{epigraph}%
567 {The flushleftright environment has been removed.\MessageBreak
568 Use the flushepinormal environment instead}{\@ehc}}{}}%
569 {\PackageWarningNoLine{epigraph}%
570 {flushleftright has been previously defined.\MessageBreak
571 Use flushepinormal for epigraphs instead}}}
572
573 % \end{macrocode}
574 % \end{environment}
575 %
576 % \begin{environment}{flushepinormal}
577 % An environment for |\textflush| to use normal minipage typesetting. It
578 % is vacuous.
579 % \changes{v1.5a}{2002/10/22}{Added flushepinormal environment}
580 % \begin{macrocode}
581 \newenvironment{flushepinormal}{}{}
582
583 % \end{macrocode}
584 % \end{environment}
585 %
586 %
587 % \begin{macro}{\@epirule}
588 % The internal command to draw a rule between text and source.
589 % \begin{macrocode}
590 \newcommand{\@epirule}{\rule[.5ex]{\epigraphwidth}{\epigraphrule}}
591 % \end{macrocode}
592 % \end{macro}
593 %
594 % \begin{macro}{\@epitext}
595 % The internal command to typeset the \meta{text}. Put it into a minipage of the
596 % right size and typeset per |\textflush|.
597 % \begin{macrocode}
598 \newcommand{\@epitext}[1]{%
599 \begin{minipage}{\epigraphwidth}\begin{\textflush} #1\\
600 % \end{macrocode}
601 % Draw a rule if it will be visible, otherwise add some extra vertical space.
602 % \begin{macrocode}
603 \ifdim\epigraphrule>\z@ \@epirule \else \vspace*{1ex} \fi
604 \end{\textflush}\end{minipage}}
605 % \end{macrocode}
606 % \end{macro}
607 %
608 % \begin{macro}{\@episource}
609 % The internal command for typesetting the \meta{source}, which is put
610 % into a minipage and typeset according to |\sourceflush|.
611 % \begin{macrocode}
612 \newcommand{\@episource}[1]{%
613 \begin{minipage}{\epigraphwidth}\begin{\sourceflush} #1\end{\sourceflush}
614 \end{minipage}}
615 % \end{macrocode}
616 % \end{macro}
617 %
618 % \begin{macro}{\epigraph}
619 % Having got the preliminaries out of the way, here's the user command
620 % for a single epigraph. This is set in a minipage to prevent breaking
621 % across a page. Position it according to |\epigraphflush|.
622 % \begin{macrocode}
623 \newcommand{\epigraph}[2]{%
624 \vspace{\beforeepigraphskip}
625 \vbox{%
626 \epigraphsize
627 \begin{\epigraphflush}
628 \begin{minipage}{\epigraphwidth}
629 \@epitext{#1}\\
630 \@episource{#2}%
631 \end{minipage}%
632 \end{\epigraphflush}%
633 }%
634 \nointerlineskip
635 \vspace*{\afterepigraphskip}%
636 \ifepigraphnoindent\@afterheading\fi
637 }
638 % \end{macrocode}
639 % \end{macro}
640 %
641 %
642 % \begin{macro}{\qitem}
643 % \begin{macro}{\qitemlabel}
644 % |\qitem| is the epigraph list version of |\item|.
645 % Set everything inside a minipage.
646 % \begin{macrocode}
647 \newcommand{\qitem}[2]{{\raggedright\item \begin{minipage}{\epigraphwidth}
648 \@epitext{#1}\\ \@episource{#2}
649 \end{minipage}}}
650 % \end{macrocode}
651 % |\qitemlabel| is needed for a list as well. It is not going to
652 % typeset anything.
653 % \begin{macrocode}
654 \newcommand{\qitemlabel}[1]{\hfill}
655 % \end{macrocode}
656 % \end{macro}
657 % \end{macro}
658 %
659 %
660 % \begin{environment}{epigraphs}
661 % Now for the epigraph list. This is defined in terms of a |list|
662 % environment.
663 % \begin{macrocode}
664 \newenvironment{epigraphs}{%
665 % \end{macrocode}
666 % Do the vertical space, set the font size, position according to
667 % |\epigraphflush|, and put everyting into a minipage.
668 % \begin{macrocode}
669 \vspace{\beforeepigraphskip}\begin{\epigraphflush}
670 \epigraphsize
671 \begin{minipage}{\epigraphwidth}
672 \list{}%
673 % \end{macrocode}
674 % Make the list just fit the minipage (i.e., no indents).
675 % \begin{macrocode}
676 {\itemindent\z@ \labelwidth\z@ \labelsep\z@
677 \leftmargin\z@ \rightmargin\z@
678 \let\makelabel\qitemlabel}}%
679 {\endlist\end{minipage}\end{\epigraphflush}
680 \vspace{\afterepigraphskip}%
681 }
682 % \end{macrocode}
683 % \end{environment}
684 %
685 % \subsection{Epigraphs before a chapter title}
686 %
687 % \begin{macro}{\@epichapapp}
688 % \begin{macro}{\dropchapter}
689 % \begin{macro}{\undodrop}
690 % \changes{v1.3}{1999/12/01}{Defined chapter dropping and support commands}
691 % Commands to drop and restore positions of chapter titles. Dropping is
692 % accomplished by inserting vertical space before the |\@chapapp| command.
693 % \begin{macrocode}
694 \newcommand{\dropchapter}[1]{%
695 \let\@epichapapp\@chapapp
696 \renewcommand{\@chapapp}{\vspace*{#1}\@epichapapp}}
697 \newcommand{\undodrop}{\let\@chapapp\@epichapapp}
698 % \end{macrocode}
699 % \end{macro}
700 % \end{macro}
701 % \end{macro}
702 %
703 % Placing an epigraph before a chapter title uses the scheme outlined
704 % by Piet van Oostrum~\cite{OOSTRUM96}. This is to put a zero sized
705 % picture into the page header.
706 %
707 % \begin{macro}{\if@epirhs}
708 % \begin{macro}{\if@epicenter}
709 % Two booleans for testing whether an epigraph is to be at the RH margin,
710 % centered, or at the LH margin. The default is RH margin.
711 % \begin{macrocode}
712 \newif\if@epirhs \@epirhstrue
713 \newif\if@epicenter \@epicentertrue
714 % \end{macrocode}
715 % \end{macro}
716 % \end{macro}
717 %
718 % \begin{macro}{\@epipos}
719 % This routine sets the |\if@epi...| booleans according to the value of
720 % |\epigraphflush|. If |\epigraphflush| is neither |center| nor |flushleft|
721 % then it defaults to |flushright|. We have to use this to be upward
722 % compatible with |\epigraphflush| being set by the user with |\renewcommand|.
723 % \begin{macrocode}
724 \newcommand{\@epipos}{
725 \long\def\@ept{flushleft}
726 \ifx\epigraphflush\@ept
727 \@epirhsfalse \@epicenterfalse
728 \else
729 \long\def\@ept{center}
730 \ifx\epigraphflush\@ept
731 \@epirhsfalse \@epicentertrue
732 \else
733 \@epirhstrue \@epicenterfalse
734 \fi
735 \fi}
736 % \end{macrocode}
737 % \end{macro}
738 %
739 %
740 % \begin{macro}{\epigraphhead}
741 % |\epigraphhead[|\meta{distance}|]{|\meta{text}|}| puts \meta{text} at
742 % \meta{distance} (a number, not a length) below the header at the
743 % page position specified by |\epigraphflush|.
744 % \begin{macrocode}
745 \newcommand{\epigraphhead}[2][95]{%
746 % \end{macrocode}
747 % We have to use |\def| instead of the normal \LaTeX{} definition commands
748 % as we will keep on
749 % (re)defining things. For reasons that are not fully clear to me \LaTeX{}
750 % doesn't seem to like me using a |\savebox| for storing the epigraph text,
751 % so I'll use a command instead.
752 % \begin{macrocode}
753 \def\@epitemp{\begin{minipage}{\epigraphwidth}#2\end{minipage}}
754 % \end{macrocode}
755 % Define an |epigraph| page style.
756 % \begin{macrocode}
757 \def\ps@epigraph{\let\@mkboth\@gobbletwo
758 % \end{macrocode}
759 % There are three possible definitions for |\@oddhead| depending on the
760 % value of |\epigraphflush|. We call |\@epipos| to decide which one to do.
761 % \begin{macrocode}
762 \@epipos
763 \if@epirhs
764 \def\@oddhead{\hfil\begin{picture}(0,0)
765 \put(0,-#1){\makebox(0,0)[r]{\@epitemp}}
766 \end{picture}}
767 \else
768 \if@epicenter
769 \def\@oddhead{\hfil\begin{picture}(0,0)
770 \put(0,-#1){\makebox(0,0)[b]{\@epitemp}}
771 \end{picture}\hfil}
772 \else
773 \def\@oddhead{\begin{picture}(0,0)
774 \put(0,-#1){\makebox(0,0)[l]{\@epitemp}}
775 \end{picture}\hfil}
776 \fi
777 \fi
778 \let\@evenhead\@oddhead
779 \def\@oddfoot{\reset@font\hfil\thepage\hfil}
780 \let\@evenfoot\@oddfoot}
781 % \end{macrocode}
782 % Make |epigraph| be the page style for this page.
783 % \begin{macrocode}
784 \thispagestyle{epigraph}}
785 % \end{macrocode}
786 % \end{macro}
787 %
788 %
789 % The end of this package.
790 % \begin{macrocode}
791 %</usc>
792 % \end{macrocode}
793 %
794 %
795 % \bibliographystyle{alpha}
796 %
797 % \begin{thebibliography}{GMS94}
798 %
799 % \bibitem[GMS94]{GOOSSENS94}
800 % Michel Goossens, Frank Mittelbach, and Alexander Samarin.
801 % \newblock {\em The LaTeX Companion}.
802 % \newblock Addison-Wesley Publishing Company, 1994.
803 %
804 % \bibitem[vO96]{OOSTRUM96}
805 % Piet van Oostrum
806 % \newblock {\em Page layout in \LaTeX}, June 1996.
807 % \newblock (Available from CTAN as file \texttt{fancyhdr.tex}).
808 %
809 % \bibitem[SW94]{EBOOK}
810 % Douglas Schenck and Peter Wilson.
811 % \newblock {\em Information Modeling the EXPRESS Way}.
812 % \newblock Oxford University Press, 1994 (ISBN 0-19-508714-3).
813 %
814 % \bibitem[Thi99]{TTC199}
815 % Christina Thiele.
816 % \newblock \emph{The Treasure Chest: Package tours from CTAN},
817 % \newblock TUGboat, vol.~20, no.~1, pp~53--58, March 1999.
818 %
819 % \end{thebibliography}
820 %
821 %
822 % \Finale
823 % \PrintIndex
824 %
825 \endinput
826
827 %% \CharacterTable
828 %% {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
829 %% 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
830 %% Digits \0\1\2\3\4\5\6\7\8\9
831 %% Exclamation \! Double quote \" Hash (number) \#
832 %% Dollar \$ Percent \% Ampersand \&
833 %% Acute accent \' Left paren \( Right paren \)
834 %% Asterisk \* Plus \+ Comma \,
835 %% Minus \- Point \. Solidus \/
836 %% Colon \: Semicolon \; Less than \<
837 %% Equals \= Greater than \> Question mark \?
838 %% Commercial at \@ Left bracket \[ Backslash \\
839 %% Right bracket \] Circumflex \^ Underscore \_
840 %% Grave accent \` Left brace \{ Vertical bar \|
841 %% Right brace \} Tilde \~}
842
843