summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/umoline/umoline.sty
blob: f8f577b6e8e7023d2277192cc756f9e2efdd19a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
%%
%% This is file `umoline.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% umoline.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from umoline.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file umoline.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% Style file `umoline'.
%% Copyright (C) 1999,2000  Hiroshi Nakashima <nakasima@tutics.tut.ac.jp>
%%        (Toyohashi Univ. of Tech.)
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt; either
%% version 1 of the License, or any later version.
%%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
%%
\def\next{LaTeX2e}
\ifx\fmtname\next
\def\next{
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{umoline}}
\else\def\next[#1]{}\fi
\next
[2000/07/11 v1.1 ]

\ifx\PackageError\undefined
\def\PackageError#1#2#3{\@latexerr{#1:#2}{#3^^J\@ehc}}
\fi

%%^L

%% Register Declaration

\newdimen\UnderlineDepth \UnderlineDepth-\maxdimen
\newdimen\MidlineHeight \MidlineHeight-\maxdimen
\newdimen\OverlineHeight \OverlineHeight-\maxdimen
\newdimen\UMOlineThickness \UMOlineThickness.4pt

\newdimen\UMO@height \newdimen\UMO@depth

\newcount\UMO@spacefactor

\newif\ifUMO@nospace

%%^L

%% User Interface and Initialization

\def\MidlineChar{\def\UMO@midlinechar}
\MidlineChar{-}

\def\Underline{\UMO@line\UnderlineDepth{-\UnderlineDepth}{-\dp\strutbox}}
\def\Midline{\setbox\@tempboxa\hbox{\UMO@midlinechar}%
        \UMO@line\MidlineHeight\MidlineHeight{.5\ht\@tempboxa}}
\def\Overline{\UMO@line\OverlineHeight\OverlineHeight{\ht\strutbox}}
\def\UMOline{\UMO@line{-\maxdimen}\z@}

\def\UMO@line#1#2#3#4{\begingroup \let\\\UMOnewline
        \ifdim#1<\z@ \UMO@height#3\relax
        \else \UMO@height#2\relax \fi
        \UMO@depth-\UMO@height
        \ifdim\UMO@height<\z@ \advance\UMO@depth\UMOlineThickness
        \else                 \advance\UMO@height\UMOlineThickness \fi
        \UMO@nospacetrue
        \ifvmode\leavevmode\fi \UMO@spacefactor\spacefactor
        \def\@tempa{#4 }\edef\@tempb{\noexpand\@nil\space}%
        \expandafter\expandafter\expandafter\UMO@wordloop
                \expandafter\@tempa\@tempb
        \endgroup \UMO@aftergroup}

%%^L

%% Processing Word Elements

\def\UMO@wordloop{\UMO@ifbgroup\UMO@wordblock\UMO@iwordloop}
\def\UMO@ifbgroup#1#2{\let\@tempa#1\let\@tempb#2\futurelet\@tempc\UMO@ifnc}
\def\UMO@ifnc{\ifx\@tempc\bgroup \let\next\@tempa \else\let\next\@tempb \fi
        \next}
\def\UMO@wordblock#1{\UMO@spaceskip
        \def\UMO@theword{#1}\UMO@putword \UMO@nospacetrue
        \UMO@wordloop}
\def\UMO@iwordloop#1 {\def\@tempa{#1}\ifx\@tempa\@nnil \let\next\UMO@end
        \else\ifx\@tempa\empty \else
                \UMO@spaceskip
                \def\UMO@theword{}\UMO@charloop#1\@nil\fi
        \UMO@nospacefalse \let\next\UMO@wordloop \fi
        \next}

\def\UMO@charloop{\UMO@ifbgroup\UMO@charblock\UMO@icharloop}
\def\UMO@charblock#1{\UMO@putword
        \def\UMO@theword{#1}\UMO@putword
        \UMO@charloop}
\def\UMO@icharloop#1{\def\@tempa{#1}%
        \ifx\@tempa\@nnil \UMO@putword \let\next\relax
        \else\ifx\UMOspace#1\relax \UMO@putword \let\next\UMO@space
        \else\ifx\UMOnewline#1\relax \UMO@putword \let\next\UMO@newline
        \else\edef\UMO@theword{\UMO@theword#1}%
                \let\next\UMO@charloop \fi\fi\fi \next}
\def\UMOspace{\PackageError{jumoline}%
        {\string\UMOspace\space cannot be used here.}%
        {\string\UMOspace\space can be used only in the argument of
                \string\Underline\space and its relatives.}}
\def\UMOnewline{\PackageError{jumoline}%
        {\string\UMOnewline\space cannot be used here.}%
        {\string\UMOnewline\space can be used only in the argument of
                \string\Underline\space and its relatives.}}

%%^L

%% Interword Spacing

\def\UMO@spaceskip{\ifUMO@nospace\else
        \ifdim\spaceskip=\z@
            \@tempdima\fontdimen3\font\relax
                \multiply\@tempdima\UMO@spacefactor \divide\@tempdima\@m
            \@tempdimb\fontdimen4\font\relax \multiply\@tempdimb\@m
                \divide\@tempdimb\UMO@spacefactor
            \@tempskipa\fontdimen2\font plus\@tempdima minus\@tempdimb\relax
        \else
            \edef\@tempa{\the\spaceskip\space @ @ @ @ }%
            \expandafter\UMO@setspaceskip\@tempa\@nil
        \fi
        \ifnum\UMO@spacefactor<2000\else
                \ifdim\xspaceskip=\z@ \advance\@tempskipa\fontdimen7\font
                \else \@tempskipa\xspaceskip
        \fi\fi
        \UMO@skip\@tempskipa \fi}
\def\UMO@setspaceskip#1 #2 #3 #4 #5 #6\@nil{\@tempdima\z@ \@tempdimb\z@
        \def\@tempa{#2}\def\@tempb{#3}%
        \ifx\@tempa\UMO@plus \@tempdima#3\def\@tempa{#4}\def\@tempb{#5}\fi
        \ifx\@tempa\UMO@minus \@tempdimb\@tempb\relax\fi
        \multiply\@tempdima\UMO@specefactor \divide\@tempdima\@m
        \multiply\@tempdimb\@m \divide\UMO@spacefactor
        \@tempskipa#1 plus\@tempdima minus\@tempdimb\relax}
\def\@tempa#1 #2 #3 #4 #5\@nil{\def\UMO@plus{#2}\def\UMO@minus{#4}}
\@tempskipa1pt plus 2pt minus 3pt
\expandafter\@tempa\the\@tempskipa\@nil

%%^L

%% Draw Under/Mid/Overline

\def\UMO@putword{\setbox\@tempboxa\hbox{\UMO@theword
                \global\UMO@spacefactor\spacefactor}%
        \@tempdima\wd\@tempboxa
        \rlap{\vrule\@height\UMO@height\@depth\UMO@depth\@width\@tempdima}%
        \box\@tempboxa\def\UMO@theword{}}
\def\UMO@skip#1{%
        \leaders\hrule\@height\UMO@height\@depth\UMO@depth\hskip#1\relax}

%%^L

%% Explicit Spacing and Line Breaking

\def\UMO@space{\@ifstar\UMO@sspace\UMO@ispace}
\def\UMO@sspace#1{\vrule width\z@\nobreak\UMO@skip{#1}\UMO@charloop}
\def\UMO@ispace#1{\@tempskipa#1\relax
        \@ifstar{\@tempswafalse\UMO@iispace}{\@tempswatrue\UMO@iispace}}
\def\UMO@iispace{\@ifnextchar[%]
                              {\UMO@penalty}%
                              {\UMO@skip\@tempskipa \UMO@charloop}}
\def\UMO@penalty[#1]{\@tempcnta#1\relax
        \if@tempswa
                \ifnum\@tempcnta<\z@ \@tempcnta-\@tempcnta \fi
                \ifcase\@tempcnta \or
                        \@tempcnta\@lowpenalty \or
                        \@tempcnta\@medpenalty \or
                        \@tempcnta\@highpenalty \else
                        \@tempcnta\@M \fi
                \ifnum#1<\z@ \@tempcnta-\@tempcnta \fi \fi
        \penalty\@tempcnta \UMO@skip\@tempskipa \UMO@charloop}

\def\UMO@newline{\@ifstar{\UMO@skip{0pt plus1fil}\break \UMO@charloop}%
                                          {\hfil \break \UMO@charloop}}

%%^L

%% Finalization

\def\UMO@end{\xdef\UMO@aftergroup{\spacefactor\number\UMO@spacefactor}}
\endinput
%%
%% End of file `umoline.sty'.