summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ellipsis/ellipsis.sty
blob: 8eba8ffa631f69250dd37ba6df4af8dd301d9533 (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
%%
%% This is file `ellipsis.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ellipsis.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2003 by Peter Heslin <p.j.heslin@dur.ac.uk>
%% 
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.2 of this license
%% or (at your option) any later version.  The latest version of this
%% license is in:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% and version 1.2 or later is part of all distributions of LaTeX version
%% 1999/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ellipsis}
   [2020/5/22 v1.7 ellipsis: fixes spacing around \dots]
\newcommand{\ellipsisgap}{\fontdimen3\font}
\DeclareOption{chicago}{\renewcommand{\ellipsisgap}{\fontdimen2\font}}
\newcommand{\ellipsis@before}{}
\newcommand{\ellipsis@after}{}
\newif\ifellipsis@alwayscenter
\ellipsis@alwayscenterfalse
\DeclareOption{mla}{%
  \renewcommand{\ellipsis@before}{[\kern\ellipsisgap}%
  \renewcommand{\ellipsis@after}{\kern\ellipsisgap ]}
  \ellipsis@alwayscentertrue}
\newcommand\ellipsis@xspace{}
\DeclareOption{xspace}{%
  \renewcommand{\ellipsis@xspace}{\xspace}}
\ProcessOptions\relax
\RequirePackage{xspace}
\newcommand{\ellipsis@default}{%
  \ellipsis@before
  .\kern\ellipsisgap
  .\kern\ellipsisgap
  .\@\kern\ellipsisgap
  \ellipsis@after\relax}
\newcommand{\ellipsis@centered}{%
  \ellipsis@before
  .\kern\ellipsisgap
  .\kern\ellipsisgap
  .\@\ellipsis@after\relax}
\newcommand\ellipsispunctuation{,.:;!?}
\def\ellipsis@scan{\expandafter\ellipsis@scan@aux\ellipsispunctuation\ellipsis@delim}
\def\ellipsis@scan@aux #1#2\ellipsis@delim{%
  \let\ellipsis@one=#1%   the first char
  \def\ellipsis@two{#2}%   the remainder of the string
  \ifx\ellipsis@token\ellipsis@one
    \ellipsis@default
  \else
    \ifx\ellipsis@two\empty
      \ellipsis@centered
    \else
      \ellipsis@scan@aux #2\ellipsis@delim
    \fi
  \fi}
\renewcommand{\textellipsis}{\futurelet\ellipsis@token\@textellipsis}
\def\@textellipsis{%
  \ifellipsis@alwayscenter\ellipsis@centered\else
    \ellipsis@scan%
  \fi\ellipsis@xspace}%
\DeclareRobustCommand\textellipsis {\futurelet\ellipsis@token\@textellipsis}
\ifx\bbl@frenchdots\@undefined\else\def\ellipsis@frenchloaded{\relax}\fi
\AtBeginDocument{%
    \ifx\ellipsis@frenchloaded\@undefined
      \ifx\bbl@frenchdots\@undefined\else
        \PackageError{ellipsis}{Babel French loaded after ellipsis.sty}%
          {If you load Babel with the French option, do it before ellipsis.sty}%
      \fi
    \fi
  \@ifpackageloaded{amsmath}%
    {%
      \DeclareRobustCommand\dots{%
        \ifmmode \@xp \mdots@ \else \@xp \textellipsis \fi}%
    }%
    {%
      \DeclareRobustCommand\dots{%
        \ifmmode \mathellipsis \else \expandafter \textellipsis\fi}%
    }%
}
\DeclareRobustCommand{\midwordellipsis}{%
    \kern\ellipsisgap
   .\kern\ellipsisgap
   .\kern\ellipsisgap
   .\@\kern\ellipsisgap\relax}
\endinput
%%
%% End of file `ellipsis.sty'.