| 1 |
% \iffalse |
| 2 |
% +AMDG This document was begun on E October 11EE, the |
| 3 |
% feast of the Maternity of the Blessed Virgin Mary, and it |
| 4 |
% is humbly dedicated to her and to her Immaculate Heart for |
| 5 |
% her prayers, and to the Sacred Heart of Jesus for His |
| 6 |
% mercy. |
| 7 |
% |
| 8 |
% This document is copyright 2015 by Donald P. Goodman, and is |
| 9 |
% released publicly under the LaTeX Project Public License. The |
| 10 |
% distribution and modification of this work is constrained by the |
| 11 |
% conditions of that license. See |
| 12 |
% http://www.latex-project.org/lppl.txt |
| 13 |
% for the text of the license. This document is released |
| 14 |
% under version 1.3 of that license, and this work may be distributed |
| 15 |
% or modified under the terms of that license or, at your option, any |
| 16 |
% later version. |
| 17 |
% |
| 18 |
% This work has the LPPL maintenance status 'maintained'. |
| 19 |
% |
| 20 |
% The Current Maintainer of this work is Donald P. Goodman |
| 21 |
% ([email protected]). |
| 22 |
% |
| 23 |
% This work consists of xellipsis.dtx, xellipsis.ins, and |
| 24 |
% derived files xellipsis.sty and xellipsis.pdf. |
| 25 |
% \fi |
| 26 |
|
| 27 |
% \iffalse |
| 28 |
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] |
| 29 |
%<package>\ProvidesPackage{xellipsis}[2015/11/01 v2.0 support for highly configurable ellipses of arbitrary symbol, number, and distance] |
| 30 |
%<*driver> |
| 31 |
\documentclass{ltxdoc} |
| 32 |
|
| 33 |
\usepackage{doc} |
| 34 |
\usepackage{array} |
| 35 |
\usepackage{lettrine} |
| 36 |
\setcounter{DefaultLines}{3} |
| 37 |
\setlength{\DefaultFindent}{2pt} |
| 38 |
\renewcommand{\LettrineFontHook}{\color{red}} |
| 39 |
\usepackage{url} |
| 40 |
\usepackage{spverbatim} |
| 41 |
\usepackage[typeone]{dozenal} |
| 42 |
\usepackage{lmodern} |
| 43 |
\usepackage[]{xellipsis} |
| 44 |
\usepackage[colorlinks]{hyperref} |
| 45 |
\usepackage{makeidx} |
| 46 |
\EnableCrossrefs |
| 47 |
\PageIndex |
| 48 |
\CodelineNumbered |
| 49 |
\RecordChanges |
| 50 |
\makeindex |
| 51 |
|
| 52 |
\long\def\example#1#2{% |
| 53 |
\bigskip% |
| 54 |
\hrule% |
| 55 |
\hbox to\linewidth{% |
| 56 |
\hbox to0.5\linewidth{% |
| 57 |
\vbox to2in{\vfil#1\vfil}% |
| 58 |
}\hbox to0.5\linewidth{% |
| 59 |
\vbox to2in{\vfil#2\vfil}% |
| 60 |
}% |
| 61 |
}% |
| 62 |
\hrule% |
| 63 |
\bigskip% |
| 64 |
} |
| 65 |
|
| 66 |
\tracingmacros=3 \begin{document} \DocInput{xellipsis.dtx} |
| 67 |
\end{document} |
| 68 |
%</driver> \fi |
| 69 |
% |
| 70 |
% \title{The |xellipsis| Package, v2.0} \author{Donald P.\ |
| 71 |
% Goodman III} \date{\today} |
| 72 |
% |
| 73 |
% \maketitle |
| 74 |
% |
| 75 |
% \begin{abstract} \TeX\ users have long been remarking that |
| 76 |
% the default characteristics of ellipses, whether produced |
| 77 |
% by |\dots|, |\ldots|, or some other command, just aren't |
| 78 |
% quite right. While some packages have attempted to |
| 79 |
% resolve this issue (e.g., |lips| and |ellipsis|), these |
| 80 |
% have never quite fit my use cases. |xellipsis| attempts |
| 81 |
% to fill this gap by providing absurdly configurable |
| 82 |
% ellipses, along with preconfigured options for the Chicago |
| 83 |
% Manual of Style (and Turabian), MLA, and the Bluebook. \end{abstract} |
| 84 |
% |
| 85 |
% \tableofcontents |
| 86 |
% |
| 87 |
% \section{Introduction} |
| 88 |
% |
| 89 |
% Typography has long made use of these strange sequences of |
| 90 |
% (usually) dots called \emph{ellipses} (singular |
| 91 |
% \emph{ellipsis}). An ellipsis typically indicates an |
| 92 |
% omission from a quotation (indeed, the Greek root means |
| 93 |
% ``omission''), but they have also been used in a huge |
| 94 |
% variety of other ways over the years: |
| 95 |
% |
| 96 |
% \begin{itemize} \item The aforementioned omission. ``Four |
| 97 |
% score and\xelip seven years ago.'' \item An unfinished |
| 98 |
% thought. ``Our forefathers brought forth\xelip I don't |
| 99 |
% know; something, I guess.'' \item Indications of preceding |
| 100 |
% matter. ``\xelip a new nation, conceived in liberty.'' |
| 101 |
% \item A pause. ``I think\xelip therefore, I am.'' \item |
| 102 |
% Probably lots of other things, as well. \end{itemize} |
| 103 |
% |
| 104 |
% \LaTeX, by default, produces ellipses with the |\dots| |
| 105 |
% (\dots) or |\ldots| (\ldots) commands. These are fine, as |
| 106 |
% far as they go; however, they suffer a few clear faults. |
| 107 |
% For example, there is much less space at the beginning |
| 108 |
% than at the end, which many people don't like; they are |
| 109 |
% fairly close together, which not only do many people not |
| 110 |
% like, but which goes against some important style manuals; |
| 111 |
% they cannot have four or more dots, which some style |
| 112 |
% manuals require in certain circumstances; and their |
| 113 |
% spacing is not in any way configurable. |
| 114 |
% |
| 115 |
% So |xellipsis| gives you all the configuration options for |
| 116 |
% your ellipses that you could possibly want, and probably |
| 117 |
% lots more than you'll ever need. It also comes |
| 118 |
% prepackaged with a few common formats, which are selected |
| 119 |
% as package options at load time. |
| 120 |
% |
| 121 |
% |xellipsis| is packaged according to the \LaTeX\ |
| 122 |
% \textsc{docstrip} utility, which allows automatic |
| 123 |
% extraction of code and documentation from the same files. |
| 124 |
% |
| 125 |
% \section{Preconfigured Formats} |
| 126 |
% \label{sect:preconf} |
| 127 |
% |
| 128 |
% |xellipsis| comes with some preconfigured ellipsis formats |
| 129 |
% for the convenience of users. These are all set as |
| 130 |
% package options; so, for example, when loading the package |
| 131 |
% one states |\usepackage{xellipsis}| for the default |
| 132 |
% behavior, but |\usepackage[latex]{xellipsis}| to specify |
| 133 |
% the |latex| format. |
| 134 |
% |
| 135 |
% Please note that the usage of these ellipses is not always |
| 136 |
% clear, even according to the manuals. I've done my best |
| 137 |
% to get them right here, but if they're wrong on some |
| 138 |
% detail, please let me know and I'll try to fix them. |
| 139 |
% |xellipsis| offers ample configuration options to get |
| 140 |
% these things right. |
| 141 |
% |
| 142 |
% \DescribeMacro{latex} |
| 143 |
% The |latex| option sets up |\xelip| to behave identically |
| 144 |
% to the default \LaTeX\ setting of |\dots| or |\ldots|. |
| 145 |
% (The \LaTeX\ kernel defines |\ldots| as |
| 146 |
% |\let\ldots=\dots|, so the two are the same.) In a |
| 147 |
% convoluted way, |\dots| is defined in terms of |
| 148 |
% |\textellipsis|, which itself is simply three dots |
| 149 |
% separated by the current font's |\fontdimen3|, which is |
| 150 |
% the stretchability of interword space. Not the interword |
| 151 |
% space itself, mind you, but just the stretchability of |
| 152 |
% that space. This leads to pretty tightly spaced ellipses |
| 153 |
% for most fonts; but there we are. It also specifies no |
| 154 |
% particular space before the ellipsis, but the same space |
| 155 |
% as the gaps afterwards. This option yields the following: |
| 156 |
% \begin{quote} |
| 157 |
% {\xelipbef=0pt\xelipaft=\fontdimen3\font\xelipgap=\fontdimen3\font |
| 158 |
% This is\xelip pretty tight, really. (|\xelip|) |
| 159 |
% |
| 160 |
% This is\ldots pretty tight, really. (|\ldots|) |
| 161 |
% } |
| 162 |
% \end{quote} |
| 163 |
% |
| 164 |
% \DescribeMacro{chicago} |
| 165 |
% \textit{The Chicago Manual of Style} has some very |
| 166 |
% specific rules about ellipses; specifically, that they |
| 167 |
% should be three periods plus two nonbreaking spaces. So |
| 168 |
% |xellipsis| defines them precisely that way, in terms of |
| 169 |
% |\fontdimen2| (the non-glue portion of the interword space |
| 170 |
% for the font), and adds no space before the first dot. |
| 171 |
% The \textsc{cmos} also specifies that, at the end of a |
| 172 |
% natural sentence, the period of the sentence should remain |
| 173 |
% \emph{prior} to the ellipsis; this works fine with our |
| 174 |
% definition. |
| 175 |
% This system yields: |
| 176 |
% \begin{quote} |
| 177 |
% {\xelipbef=0pt\xelipaft=\fontdimen2\font\xelipgap=\fontdimen2\font |
| 178 |
% This is\xelip pretty loose, really. (|\xelip|) |
| 179 |
% |
| 180 |
% I like that.\ \xelip It makes some sense. (|.\ \xelip|) |
| 181 |
% } |
| 182 |
% \end{quote} |
| 183 |
% |
| 184 |
% \DescribeMacro{mla} |
| 185 |
% The \textsc{mla} advises similar ellipses to the \textsc{cmos}, |
| 186 |
% except that there should always be a space before the |
| 187 |
% first period. |
| 188 |
% \begin{quote} |
| 189 |
% {\xelipbef=\fontdimen2\font\xelipaft=\fontdimen2\font\xelipgap=\fontdimen2\font |
| 190 |
% This is\xelip pretty loose, really. (|\xelip|) |
| 191 |
% } |
| 192 |
% \end{quote} |
| 193 |
% |
| 194 |
% \DescribeMacro{oldmla} |
| 195 |
% The \textsc{mla} formerly advised that ellipses indicating |
| 196 |
% omissions should be surrounded by square brackets ([]). |
| 197 |
% The materials I've seen seem to indicate that this might |
| 198 |
% still be required when the quotation already contains |
| 199 |
% ellipses in the original material; however, usually they |
| 200 |
% are not required. Either way, here's the option: |
| 201 |
% \begin{quote} |
| 202 |
% {\xelipbef=\fontdimen2\font\xelipaft=\fontdimen2\font\xelipgap=\fontdimen2\font\def\xelipprechar{[}\def\xelippostchar{]}\xelipprebef=\fontdimen2\font\xelippostaft=\fontdimen2\font |
| 203 |
% This is\xelip how it's supposed to work, I guess? (|\xelip|) |
| 204 |
% } |
| 205 |
% \end{quote} |
| 206 |
% |
| 207 |
% \DescribeMacro{bluebook} |
| 208 |
% Finally, in the United States legal citations are governed |
| 209 |
% by our overlords at the Harvard Law Review, who publish |
| 210 |
% \textit{The Bluebook}. Their ellipses are formatted just |
| 211 |
% like the \textsc{mla} ellipses: |
| 212 |
% \begin{quote} |
| 213 |
% {\xelipbef=\fontdimen2\font\xelipaft=\fontdimen2\font\xelipgap=\fontdimen2\font |
| 214 |
% This is\xelip pretty loose, really. (|\xelip|) |
| 215 |
% } |
| 216 |
% \end{quote} |
| 217 |
% |
| 218 |
% Finally, there is a special command |
| 219 |
% \DescribeMacro{\xelipend}|\xelipend|. This is identical |
| 220 |
% to |\xelip| except that the closing space is omitted. |
| 221 |
% |
| 222 |
% \begin{quote} |
| 223 |
% ``This is pretty neat\xelipend'' (|\xelipend|) |
| 224 |
% |
| 225 |
% ``This is pretty neat\xelip'' (|\xelip|) |
| 226 |
% \end{quote} |
| 227 |
% |
| 228 |
% |\xelipend| is primarily useful immediately preceding some |
| 229 |
% quoting character; some people prefer there to be no or |
| 230 |
% much more limited spacing in this location. Use |
| 231 |
% |\xelipend| if you prefer this type of behavior. |
| 232 |
% |
| 233 |
% \section{The Nitty-Gritty: Configuration} |
| 234 |
% \label{sect:nittygritty} |
| 235 |
% |
| 236 |
% We've already seen examples of the |xellipsis| defaults |
| 237 |
% used (any time in this document that we haven't been |
| 238 |
% explicitly demonstrating something else), so let's get |
| 239 |
% down-and-dirty with the internals and do some customizing. |
| 240 |
% |
| 241 |
% The first is the most obvious: the character from which |
| 242 |
% the ellipsis is constructed. This defaults to ``.'' (a |
| 243 |
% period), and is held in the variable |
| 244 |
% \DescribeMacro{\xelipchar}|\xelipchar|. Simply redefine |
| 245 |
% |\xelipchar| in the normal way to get something different |
| 246 |
% from the ordinary: |
| 247 |
% |
| 248 |
% \bigskip \hbox to\linewidth{% \hfil% \hbox |
| 249 |
% to0.4\linewidth{% \hfil% \vbox{% |
| 250 |
% \hbox{|\def\xelipchar{*}|} \hbox{|\xelip|} } \hfil% }\hbox |
| 251 |
% to0.4\linewidth{% \hfil% \vbox{% \def\xelipchar{*}\xelip } |
| 252 |
% \hfil% } \hfil% } \bigskip |
| 253 |
% |
| 254 |
% \def\xelipchar{*} This was actually quite common in older |
| 255 |
% legal documents (using asterisks for ellipses, that is): |
| 256 |
% ``And the ruling of the lower court\xelip is hereby |
| 257 |
% \textsc{affirmed}.'' \def\xelipchar{.} So this sort of |
| 258 |
% thing has some real functionality at times. |
| 259 |
% |
| 260 |
% The same effect can be achieved by using the |
| 261 |
% \DescribeMacro{char}|char| package option; e.g., by |
| 262 |
% loading |xellipsis| with |\usepackage[char=*]{xellipsis}|. |
| 263 |
% Indeed, as of version 2.0, all these settings can be made |
| 264 |
% at the time of package loading. |
| 265 |
% |
| 266 |
% The \emph{number} of characters in an ellipsis is governed |
| 267 |
% by \DescribeMacro{\xelipnum}|\xelipnum|. |\xelipnum| is |
| 268 |
% a \emph{counter}, not a macro, so if you change it, do so |
| 269 |
% with a simple |=|: |
| 270 |
% |
| 271 |
% \bigskip \hbox to\linewidth{% \hfil% \hbox |
| 272 |
% to0.4\linewidth{% \hfil% \vbox{% \hbox{|\xelipnum=6|} |
| 273 |
% \hbox{|\xelip|} } \hfil% }\hbox to0.4\linewidth{% \hfil% |
| 274 |
% \vbox{% \xelipnum=6 \xelip } \hfil% } \hfil% } \bigskip |
| 275 |
% |
| 276 |
% Most likely this would be 3 or 4, but I'm not going to try |
| 277 |
% to limit you. |\xelipnum| defaults to 3. The package |
| 278 |
% option is \DescribeMacro{num}|num|. |
| 279 |
% |
| 280 |
% There are three lengths responsible for controlling the |
| 281 |
% spacing of the ellipses. The space \emph{before} the |
| 282 |
% first character of the ellipses is |
| 283 |
% \DescribeMacro{\xelipbef}|\xelipbef|; the space |
| 284 |
% \emph{after} the last character of the ellipses is |
| 285 |
% \DescribeMacro{\xelipaft}|\xelipaft|; and the space |
| 286 |
% \emph{between} the characters of the ellipses is |
| 287 |
% \DescribeMacro{\xelipgap}|\xelipgap|. Each of these |
| 288 |
% default to |3pt|. Their package options are |
| 289 |
% \DescribeMacro{before}|before|, |
| 290 |
% \DescribeMacro{after}|after|, and |
| 291 |
% \DescribeMacro{gap}|gap|. |
| 292 |
% |
| 293 |
% The benefit of having each of these independently |
| 294 |
% configurable is that you don't have to worry about |
| 295 |
% inserting special spacing before the ellipsis. |
| 296 |
% Furthermore, you don't have to worry about |\xelip| eating the space |
| 297 |
% after your command unless you prevent that with |{}| or |
| 298 |
% |\ |; it \emph{does} |
| 299 |
% eat the space, but that's okay, because the appropriate |
| 300 |
% spacing is built into it. So you can say |
| 301 |
% |I went\xelip to the store| and you'll get |
| 302 |
% ``I went\xelip to the store'', exactly as you undoubtedly |
| 303 |
% wanted. No need for |\xelip{}| or such expedients. |
| 304 |
% |
| 305 |
% Remember that these lengths are |dimen|s, so they are |
| 306 |
% reset using a simple |=|; you can also use the \LaTeX\ |
| 307 |
% |\setlength| incantation if you'd prefer: |
| 308 |
% |
| 309 |
% \bigskip |
| 310 |
% \hbox to\linewidth{% |
| 311 |
% \hfil% |
| 312 |
% \hbox to0.49\linewidth{% |
| 313 |
% \hfil% |
| 314 |
% \vbox{% |
| 315 |
% \hbox{|\xelipbef=1em|} |
| 316 |
% \hbox{|\xelipgap=2em|} |
| 317 |
% \hbox{|\setlength{\xelipaft}{2pt}|} |
| 318 |
% \hbox{|This is\xelip strange.|} |
| 319 |
% }% |
| 320 |
% \hfil% |
| 321 |
% }\hbox to0.49\linewidth{% |
| 322 |
% \hfil% |
| 323 |
% \vbox{% |
| 324 |
% \xelipbef=1em |
| 325 |
% \xelipgap=2em |
| 326 |
% \setlength{\xelipaft}{2pt} |
| 327 |
% This is\xelip strange. |
| 328 |
% } |
| 329 |
% \hfil% |
| 330 |
% }% |
| 331 |
% \hfil% |
| 332 |
% } |
| 333 |
% \bigskip |
| 334 |
% |
| 335 |
% Finally, some style guides (including the MLA, until |
| 336 |
% recently) require some surrounding punctuation for an |
| 337 |
% ellipsis. |xellipsis| provides for this, too. The |
| 338 |
% character that is to go \emph{before} the ellipsis is |
| 339 |
% \DescribeMacro{\xelipprechar}|\xelipprechar|, while the |
| 340 |
% character that is to go \emph{after} the ellipsis is |
| 341 |
% \DescribeMacro{\xelippostchar}|\xelippostchar|. Both of |
| 342 |
% these default to be empty. Their package options are |
| 343 |
% \DescribeMacro{prechar}|prechar| and |
| 344 |
% \DescribeMacro{postchar}|postchar|. |
| 345 |
% |
| 346 |
% \bigskip |
| 347 |
% \hbox to\linewidth{% |
| 348 |
% \hfil% |
| 349 |
% \hbox to0.49\linewidth{% |
| 350 |
% \hfil% |
| 351 |
% \vbox{% |
| 352 |
% \hbox{|\def\xelipprechar{[}|} |
| 353 |
% \hbox{|\def\xelippostchar{]}|} |
| 354 |
% \hbox{|This is\xelip strange.|} |
| 355 |
% }% |
| 356 |
% \hfil% |
| 357 |
% }\hbox to0.49\linewidth{% |
| 358 |
% \hfil% |
| 359 |
% \vbox{% |
| 360 |
% \def\xelipprechar{[} |
| 361 |
% \def\xelippostchar{]} |
| 362 |
% This is\xelip strange. |
| 363 |
% } |
| 364 |
% \hfil% |
| 365 |
% }% |
| 366 |
% \hfil% |
| 367 |
% } |
| 368 |
% \bigskip |
| 369 |
% |
| 370 |
% As with |\xelipchar|, you can use really anything for |
| 371 |
% this, even things that would be truly bizarre (daggers? |
| 372 |
% fleur-de-lis?); but this is a typical use case. |
| 373 |
% |
| 374 |
% The unsurprisingly-named |
| 375 |
% \DescribeMacro{\xelipprebef}|\xelipprebef|, |
| 376 |
% \DescribeMacro{\xelippreaft}|\xelippreaft|, |
| 377 |
% \DescribeMacro{\xelippostbef}|\xelippostbef|, and |
| 378 |
% \DescribeMacro{\xelippostaft}|\xelippostaft| control the |
| 379 |
% spacing around these two characters; by default, all four |
| 380 |
% are set to |0pt|. They are |dimen|s and can be set in |
| 381 |
% either the \TeX\ way or the \LaTeX\ |\setlength| way. |
| 382 |
% Their package options are |
| 383 |
% \DescribeMacro{prebefore}|prebefore|, |
| 384 |
% \DescribeMacro{preafter}|preafter|, |
| 385 |
% \DescribeMacro{postbefore}|postbefore|, and |
| 386 |
% \DescribeMacro{postafter}|postafter|, |
| 387 |
% |
| 388 |
% \bigskip |
| 389 |
% \hbox to\linewidth{% |
| 390 |
% \hfil% |
| 391 |
% \hbox to0.49\linewidth{% |
| 392 |
% \hfil% |
| 393 |
% \vbox{% |
| 394 |
% \hbox{|\def\xelipprechar{[}|} |
| 395 |
% \hbox{|\def\xelippostchar{]}|} |
| 396 |
% \hbox{|\xelipprebef=6pt|} |
| 397 |
% \hbox{|\xelippreaft=3pt|} |
| 398 |
% \hbox{|\setlength{\xelippostbef}{3pt}|} |
| 399 |
% \hbox{|\setlength{\xelippostaft}{6pt}|} |
| 400 |
% \hbox{|This is\xelip strange.|} |
| 401 |
% }% |
| 402 |
% \hfil% |
| 403 |
% }\hbox to0.49\linewidth{% |
| 404 |
% \hfil% |
| 405 |
% \vbox{% |
| 406 |
% \def\xelipprechar{[} |
| 407 |
% \def\xelippostchar{]} |
| 408 |
% \xelipprebef=6pt |
| 409 |
% \xelippreaft=3pt |
| 410 |
% \setlength{\xelippostbef}{3pt} |
| 411 |
% \setlength{\xelippostaft}{6pt} |
| 412 |
% This is\xelip strange. |
| 413 |
% } |
| 414 |
% \hfil% |
| 415 |
% }% |
| 416 |
% \hfil% |
| 417 |
% } |
| 418 |
% \bigskip |
| 419 |
% |
| 420 |
% Please be aware that |\xelippreaft| \emph{stacks} |
| 421 |
% with |\xelipbef|, and |\xelippostbef| stacks with |
| 422 |
% |\xelipaft|; so their sum should be the spacing you want. |
| 423 |
% Often this means simply leaving the two of them alone, as |
| 424 |
% you've already got the appropriate space in the |
| 425 |
% shorter-named |dimen|s. |
| 426 |
% |
| 427 |
% And that's it; if |xellipsis| can't meet your ellipsis |
| 428 |
% needs somehow, please contact me and let me know, and I'll |
| 429 |
% endeavor to add what you require. Happy \TeX{}ing! |
| 430 |
% |
| 431 |
% \section{Implementation} |
| 432 |
% |
| 433 |
% Our first task, as usual, is to define our options. We |
| 434 |
% have options for default \LaTeX\ ellipsis behavior, |
| 435 |
% Chicago Manual of Style behavior, old MLA behavior, and |
| 436 |
% current MLA behavior. These all default to \emph{off}, |
| 437 |
% and the default |xellipsis| behavior described above is |
| 438 |
% \emph{on}. We define the conditions for the options, then |
| 439 |
% process the options themselves. We use |xkeyval| to get |
| 440 |
% these options, so we can easily give them key-value |
| 441 |
% arguments. We also need to define our default characters. |
| 442 |
% \begin{macrocode} |
| 443 |
\RequirePackage{xkeyval} |
| 444 |
\def\xelipchar{.} |
| 445 |
\def\xelipprechar{} |
| 446 |
\def\xelippostchar{} |
| 447 |
% \end{macrocode} |
| 448 |
% Proceed to define the dimens that we will need. These are |
| 449 |
% mostly self-explanatory; the first is for the gap |
| 450 |
% between the characters of the ellipsis, the second is for |
| 451 |
% the space \emph{before} the ellipsis begins, and the third |
| 452 |
% is for the space \emph{after} the ellipsis ends. The |
| 453 |
% fourth and fifth are for the spaces around the |
| 454 |
% pre-ellipsis character, and the sixth and seventh are for |
| 455 |
% the spaces around the post-ellipsis character. |
| 456 |
% \begin{macrocode} |
| 457 |
\newdimen\xelipgap\xelipgap=3pt |
| 458 |
\newdimen\xelipbef\xelipbef=3pt |
| 459 |
\newdimen\xelipaft\xelipaft=3pt |
| 460 |
\newdimen\xelipprebef\xelipprebef=0pt |
| 461 |
\newdimen\xelippreaft\xelippreaft=0pt |
| 462 |
\newdimen\xelippostbef\xelippostbef=0pt |
| 463 |
\newdimen\xelippostaft\xelippostaft=0pt |
| 464 |
% \end{macrocode} |
| 465 |
% Now we define the counter which holds the number of |
| 466 |
% ellipsis characters we want. Defaults to 3. |
| 467 |
% \begin{macrocode} |
| 468 |
\newcount\xelipnum\xelipnum = 3% |
| 469 |
% \end{macrocode} |
| 470 |
% \begin{macrocode} |
| 471 |
\newif\ifxel@latex\xel@latexfalse |
| 472 |
\newif\ifxel@chicago\xel@chicagofalse |
| 473 |
\newif\ifxel@oldmla\xel@oldmlafalse |
| 474 |
\newif\ifxel@mla\xel@mlafalse |
| 475 |
\newif\ifxel@bluebook\xel@bluebookfalse |
| 476 |
\DeclareOptionX{latex}{\xel@latextrue} |
| 477 |
\DeclareOptionX{chicago}{\xel@chicagotrue} |
| 478 |
\DeclareOptionX{oldmla}{\xel@oldmlatrue} |
| 479 |
\DeclareOptionX{mla}{\xel@mlatrue} |
| 480 |
\DeclareOptionX{bluebook}{\xel@bluebooktrue} |
| 481 |
\DeclareOptionX{char}{\def\xelipchar{#1}} |
| 482 |
\DeclareOptionX{num}{\xelipnum=#1} |
| 483 |
\DeclareOptionX{before}{\xelipbef=#1} |
| 484 |
\DeclareOptionX{after}{\xelipaft=#1} |
| 485 |
\DeclareOptionX{gap}{\xelipgap=#1} |
| 486 |
\DeclareOptionX{prechar}{\def\xelipprechar{#1}} |
| 487 |
\DeclareOptionX{postchar}{\def\xelippostchar{#1}} |
| 488 |
\DeclareOptionX{prebefore}{\xelipprebef=#1} |
| 489 |
\DeclareOptionX{preafter}{\xelippreaft=#1} |
| 490 |
\DeclareOptionX{postbefore}{\xelippostbef=#1} |
| 491 |
\DeclareOptionX{postafter}{\xelippostaft=#1} |
| 492 |
\ProcessOptionsX |
| 493 |
% \end{macrocode} |
| 494 |
% Now we define the loop variable. |
| 495 |
% \begin{macrocode} |
| 496 |
\newcount\xel@loopi\xel@loopi = 0% |
| 497 |
% \end{macrocode} |
| 498 |
% Next, we define the box which will hold the ellipsis; this |
| 499 |
% way we can be sure that it won't break across lines. |
| 500 |
% \begin{macrocode} |
| 501 |
\def\xelip{% |
| 502 |
\nobreak\hskip0pt\hbox{% |
| 503 |
% \end{macrocode} |
| 504 |
% Put it the code for the |\xelipprechar| and its spacing: |
| 505 |
% \begin{macrocode} |
| 506 |
\hskip\xelipprebef\xelipprechar\hskip\xelippreaft% |
| 507 |
% \end{macrocode} |
| 508 |
% Now, we use |\xelipbef| to skip the pre-ellipsis distance. |
| 509 |
% \begin{macrocode} |
| 510 |
\hskip\xelipbef\xelipchar% |
| 511 |
% \end{macrocode} |
| 512 |
% Now we loop, printing |\xelipchar| and skipping |
| 513 |
% |\xelipgap| as many times as |\xelipnum| requires. We |
| 514 |
% start be resetting the |\xel@loopi| variable, just in |
| 515 |
% case. |
| 516 |
% \begin{macrocode} |
| 517 |
\xel@loopi = 1% |
| 518 |
\loop\ifnum\xelipnum>\xel@loopi% |
| 519 |
\advance\xel@loopi by1% |
| 520 |
\hskip\xelipgap% |
| 521 |
\xelipchar% |
| 522 |
\repeat |
| 523 |
% \end{macrocode} |
| 524 |
% Lastly, we skip |\xelipaft|, then skip for |
| 525 |
% |\xelippostchar| and its |dimen|s, close our box, and sit |
| 526 |
% back in the satisfaction of an ellipsis well-made. |
| 527 |
% \begin{macrocode} |
| 528 |
\hskip\xelipaft% |
| 529 |
\hskip\xelippostbef\xelippostchar\hskip\xelippostaft% |
| 530 |
}% |
| 531 |
}% |
| 532 |
% \end{macrocode} |
| 533 |
% Set up a special command, |\xelipend|, which omits the |
| 534 |
% spacing at the end and can be used immediately before |
| 535 |
% quotations or the like. |
| 536 |
% \begin{macrocode} |
| 537 |
\def\xelipend{% |
| 538 |
\begingroup% |
| 539 |
\xelipaft=0pt |
| 540 |
\xelip% |
| 541 |
\endgroup% |
| 542 |
}% |
| 543 |
% |
| 544 |
% Set up the |latex| option. |
| 545 |
% \begin{macrocode} |
| 546 |
\ifxel@latex |
| 547 |
\xelipbef=0pt% |
| 548 |
\xelipaft=\fontdimen3\font% |
| 549 |
\xelipgap=\fontdimen3\font% |
| 550 |
\fi |
| 551 |
% \end{macrocode} |
| 552 |
% \textit{The Chicago Manual of Style} option. |
| 553 |
% \begin{macrocode} |
| 554 |
\ifxel@chicago |
| 555 |
\xelipbef=0pt% |
| 556 |
\xelipaft=\fontdimen2\font% |
| 557 |
\xelipgap=\fontdimen2\font% |
| 558 |
\fi |
| 559 |
% \end{macrocode} |
| 560 |
% The \textsc{mla} option. |
| 561 |
% \begin{macrocode} |
| 562 |
\ifxel@mla |
| 563 |
\xelipbef=\fontdimen2\font% |
| 564 |
\xelipaft=\fontdimen2\font% |
| 565 |
\xelipgap=\fontdimen2\font% |
| 566 |
\fi |
| 567 |
% \end{macrocode} |
| 568 |
% \textit{The Bluebook} option. |
| 569 |
% \begin{macrocode} |
| 570 |
\ifxel@bluebook |
| 571 |
\xelipbef=\fontdimen2\font% |
| 572 |
\xelipaft=\fontdimen2\font% |
| 573 |
\xelipgap=\fontdimen2\font% |
| 574 |
\fi |
| 575 |
% \end{macrocode} |
| 576 |
% The old \textsc{mla} option. |
| 577 |
% \begin{macrocode} |
| 578 |
\ifxel@oldmla |
| 579 |
\xelipbef=\fontdimen2\font% |
| 580 |
\xelipaft=\fontdimen2\font% |
| 581 |
\xelipgap=\fontdimen2\font% |
| 582 |
\def\xelipprechar{[}% |
| 583 |
\def\xelippostchar{]}% |
| 584 |
\xelipprebef=\fontdimen2\font% |
| 585 |
\xelippostaft=\fontdimen2\font% |
| 586 |
\fi |
| 587 |
% } |
| 588 |
% \end{macrocode} |
| 589 |
% And there's the |xellipsis| package. I hope it proves |
| 590 |
% useful to someone besides myself. Happy \TeX{}ing! |
| 591 |
% |
| 592 |
% \PrintIndex |