summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/umoline/umoline.dtx
blob: 9efadccf4c3231857b637662049234e0c027d1f4 (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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
% \iffalse
%% 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.
%% 
% \fi
%
% \CheckSum{485}
%% \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         \~}
%%
% \iffalse
%%
%<*dtx>
\ProvidesFile{umoline.dtx}
%</dtx>
%<package>\def\next{LaTeX2e}
%<package>\ifx\fmtname\next
%<package>\def\next{
%<package>\NeedsTeXFormat{LaTeX2e}[1994/12/01]
%<package>\ProvidesPackage{umoline}}
%<package>\else\def\next[#1]{}\fi
%<package>\next
%<driver>\ProvidesFile{umoline.drv}
% \fi
% \ProvidesFile{umoline.dtx}
[2000/07/11 v1.1 ]
% \iffalse
%<*driver>
\documentclass{ltxdoc}
\usepackage{umoline}
\DisableCrossrefs
\PageIndex
\CodelineNumbered
\RecordChanges
%</driver>
%<driver>\OnlyDescription
%<driver>\def\ONLYDESCRIPTION{}
%<*driver>
\advance\textwidth4em
\begin{document}
\DocInput{umoline.dtx}
\end{document}
%</driver>
% \fi
% \changes{v1.0}{1999/04/14}
%	{The style is born from jumoline.}
%
% \errorcontextlines10000
% \def\|{\verb|}
% \DeleteShortVerb\|
% \GetFileInfo{umoline.dtx}
% \setcounter{IndexColumns}{2}
% 
% \def\bottomfraction{.9}
% \def\cs#1{\hbox{\tt\char\escapechar#1}}
% \def\Item{\vskip-\itemsep\vskip-\parsep\vskip0pt\item}
%
% \makeatletter
% \def\eqnarray{\stepcounter{equation}\let\@currentlabel=\theequation
% \global\@eqnswtrue
% \global\@eqcnt\z@\tabskip\@centering\let\\=\@eqncr
% $$\halign to \displaywidth\bgroup\hskip\@centering
%   $\displaystyle\tabskip\z@{##}$\@eqnsel&\global\@eqcnt\@ne
%   \hfil$\;{##}\;$\hfil
%   &\global\@eqcnt\tw@ $\displaystyle\tabskip\z@{##}$\hfil
%    \tabskip\@centering&\llap{##}\tabskip\z@\cr}
%
% \def\Meta#1{\penalty\@highpenalty
%	\hbox{{\tt\char`\{}{\it\meta{#1}}{\tt\char`\}}}}
% \def\opt#1{{\tt[}{\it\meta{#1}}{\tt]}}
% \def\optn#1{{\tt[#1]}}
% \def\arg#1{{\tt\char`\{#1\char`\}}}
%
% \let\latex@addmarginpar\@addmarginpar
% \let\latex@latex@warning@no@line\@latex@warning@no@line
% \def\@addmarginpar{\let\@latex@warning@no@line\@gobble
%	\latex@addmarginpar
%	\let\@latex@warning@no@line\latex@latex@warning@no@line}
% \let\@font@warning\@gobble
%
% \long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist
%    \edef\saved@macroname{\string#2}
%   \def\makelabel##1{\llap{##1\hskip\@totalleftmargin}}
%   \if@inlabel
%     \let\@tempa\@empty \count@\macro@cnt
%     \loop \ifnum\count@>\z@
%       \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat
%     \edef\makelabel##1{\llap{\vtop to\baselineskip
%                                {\@tempa\hbox{##1}\vss}
%			       \hskip\@totalleftmargin}}
%     \advance \macro@cnt \@ne
%   \else  \macro@cnt\@ne  \fi
%   \edef\@tempa{\noexpand\item[
%      #1
%        \noexpand\PrintMacroName
%      \else
%        \noexpand\PrintEnvName
%      \fi
%      {\string#2}]}
%   \@tempa
%   \global\advance\c@CodelineNo\@ne
%    #1
%       \SpecialMainIndex{#2}\nobreak
%       \DoNotIndex{#2}
%    \else
%       \SpecialMainEnvIndex{#2}\nobreak
%    \fi
%   \global\advance\c@CodelineNo\m@ne
%   \ignorespaces}
% 
% \def\DescribeOpt{\leavevmode\@bsphack\begingroup\MakePrivateLetters
%   \Describe@Opt}
% \def\Describe@Opt#1{\endgroup \Describe@pt{#1}}
% \def\Describe@pt#1#2{
%               \marginpar{\raggedleft\PrintDescribeMacro{#1}}
% 		\SpecialOptUsageIndex{#1}{#2}}
% \def\SpecialOptUsageIndex#1#2{
% 	\index{#1\actualchar{\protect\ttfamily#1} (#2)\encapchar usage}
%	\index{#2s:\levelchar{\protect\ttfamily#1}\encapchar usage}
%	\@esphack\ignorespaces}
% \def\SpecialOptMainIndex#1#2{
% 	\index{#1\actualchar{\protect\ttfamily#1} (#2)\encapchar main}
%	\index{#2s:\levelchar{\protect\ttfamily#1}\encapchar main}
%	\@esphack\ignorespaces}
% \def\SpecialOptIndex#1#2{
% 	\index{#1\actualchar{\protect\ttfamily#1} (#2)}
%	\index{#2s:\levelchar{\protect\ttfamily#1}}
%	\@esphack\ignorespaces}
% \def\SpecialOptIndexS#1#2{
% 	\index{#1\actualchar{\protect\ttfamily#1} (#2)}
%	\index{#2es:\levelchar{\protect\ttfamily#1}}
%	\@esphack\ignorespaces}
%
% \def\SpecialMainIndex#1{\@bsphack
%	\RemoveAtFromCS{#1}
% 	\protected@edef\@tempa{\noexpand\special@index{\RAFCtempa
%		\actualchar \string\verb
% 		\quotechar*\verbatimchar\string#1\verbatimchar
%		\encapchar main}}\@tempa
%	\@esphack}
% \def\SpecialIndex#1{\@bsphack
%	\RemoveAtFromCS{#1}
% 	\protected@edef\@tempa{\noexpand\special@index{\RAFCtempa
%		\actualchar \string\verb
% 		\quotechar*\verbatimchar\string#1\verbatimchar}}\@tempa
%	\@esphack}
% 
% \let\RAFCempty\@empty
% \let\RAFCgobble\@gobble
% \makeatother
% \def\RemoveAtFromCS#1{\edef\RAFCtempa{\expandafter\RAFCgobble\string#1}
% 	\edef\RAFCtempa{\expandafter\string\csname\RAFCtempa\endcsname}
%	\expandafter\iRemoveAtFromCS\RAFCtempa@\NIL}
% \def\iRemoveAtFromCS#1#2@#3\NIL{\def\RAFCtempb{#3}
% 	\ifx\RAFCtempb\RAFCempty \def\RAFCtempa{#2}\let\next\relax
%	\else \def\RAFCtempa{#2@}\def\next{\iiRemoveAtFromCS#3\NIL}
% 	\def\RAFCtempb{#2}
%	\ifx\RAFCtempb\RAFCempty
%	\else\ifx\RAFCtempb\CommonCSPrefix
%	\else\ifx\RAFCtempb\CommonIfPrefix
%	\else \def\RAFCtempa{}\def\next{\xRemoveAtFromCS#2@#3\NIL}\fi\fi\fi\fi
%	\next}
% \def\iiRemoveAtFromCS#1{\ifx#1@\edef\RAFCtempa{\RAFCtempa@}
%	\let\next\iiRemoveAtFromCS
%	\else \def\next{\xRemoveAtFromCS#1}\fi
% 	\next}
% \def\xRemoveAtFromCS#1@\NIL{\edef\RAFCtempa{#1\RAFCtempa}}
% \makeatletter
% 
% \begingroup
% \gdef\@sverbcat{\catcode`\@\active\catcode`\#\active}
% \catcode`\@\active \gdef@{\char`\@\penalty\exhyphenpenalty}
% \catcode`\#\active \gdef#{\penalty\exhyphenpenalty}
% \endgroup
% \let\latex@sverb\@sverb
% \def\@sverb{\@sverbcat\latex@sverb}
%
% \def\theglossary{\onecolumn \glossary@prologue
%	\GlossaryParms \let\item\@idxitem \ignorespaces}
% \def\endtheglossary{\relax}
% 
% 
%
% \def\bracepair{`{\tt\char`\{\char`\}'}}
%
% \ifx\ONLYDESCRIPTION\undefined\else
% \let\SpecialUsageIndex\SpecialMainIndex
% \let\SpecialOptUsageIndex\SpecialOptMainIndex
% \fi
% 
% 
%
% \edef\CommonCSPrefix{\expandafter\RAFCgobble\string\UMO}
% \edef\CommonIfPrefix{\expandafter\RAFCgobble\string\ifUMO}
%
% \title{\textsf{umoline}\\
%	The Package for Under/Mid/Overline for Long Texts\thanks{
%	This file has version number \fileversion, last revised \filedate.}}
% \author{Hiroshi Nakashima\\(Toyohashi Univ. of Tech.)}
% \date{\filedate}
% \maketitle
% 
% \begin{abstract}
% This file provides macros to draw \|\Underline|, \|\Midline| and
% \|\Overline| with a long text allowing line breaking in the text.
% \end{abstract}
%
% \tableofcontents
% \newpage
%
% 
% \section{Introduction}
% \label{sec:intro}
%
% Users of \TeX{} and \LaTeX{} often complain that a text with \|\underline|
% and \|\overline| cannot have line-break points in it.  This makes it hard 
% to draw lines under a sentence in order to, for example, show that the
% sentence is modified by a revision.
%
% Although it is almost impossible to find the perfect solution for the
% problem, we could have a acceptable approximation by introducing certain
% reasonable restrictions. For example, macros provided by \textsf{umoline}
% only accept {\em ordinary} texts as their objective texts to draw
% underline, etc.  In fact, many \TeX{}ackers have written macros having this
% restriction, including author's \textsf{julem}\footnote{
%
% This style was named by someone who distributed author's macro set posted
% to a news group, and thus the author himself does not know the reason why
% it is called so.}
%
% which copes with texts in both Japanese and English (and other European
% languages).  The style, however, has a few drawbacks including that it
% consumes a huge amount of computational time and dvi-file space.
%
% The style \textsf{umoline} is designed to solve the problem minimizing
% the time/space consumption to some acceptable level although still they are
% not very small.  Note that \textsf{umoline} is only for English (and
% possibly some other European language) and another style \textsf{jumoline} 
% by the author is available for Japanese users.
%
% 
% \section{Usage}
% \label{sec:usage}
%
% \subsection{Basic Usage}
% \label{sec:usage-basic}
%
% The package is usable to both \LaTeXe{} and \LaTeX-2.09 users with their
% standard package loading declaration.  If you use \LaTeXe, simply do the
% following.
% \begin{quote}
% \|\usepackage{umoline}|\SpecialIndex{\usepackage}
% \end{quote}
% If you still love \LaTeX-2.09, the following is what you have to do.
% \begin{quote}
% \|\documentstyle[..,umoline,...]|\Meta{style}\SpecialIndex{\documentstyle}
% \end{quote}
%
% You have the following three basic commands to draw underlines and
% relatives.
%
% \begin{itemize}
% \item \|\Underline|\Meta{text}
%	\DescribeMacro{\Underline}\par
% Draw lines under the \meta{text}.  \Underline{For example, this sentence
% is generated by 
% {\tt\string\Underline\char`\{}\UMOspace{0pt}[0]{\tt For Example, }{\ldots}
% {\tt\char`\}}.}
%
% \item \|\Midline|\Meta{text}
%	\DescribeMacro{\Midline}\par
% Draw lines as if hyphens are overlaid on the \meta{text}.  \Midline{For
% example, this sentence is generated by
% {\tt\string\Midline\char`\{}\UMOspace{0pt}[0]{\tt For Example, }{\ldots}
% {\tt\char`\}}.}
%
% \item \|\Overline|\Meta{text}
%	\DescribeMacro{\Overline}\par
% Draw lines over the \meta{text}.  \Overline{For example, this sentence is
% generated by
% {\tt\string\Overline\char`\{}\UMOspace{0pt}[0]{\tt For Example, }{\ldots}
% {\tt\char`\}}.}
% \end{itemize}
%
% For each command shown above, its argument \meta{text} is the sequence of
% one of the following elements.
%
% \begin{itemize}
% \item
% Ordinary characters excluding those for command invocation and math
% staffs.  For example;
%
% \begin{quote}
%\begin{verbatim}
%\Underline{Since this sentence does not have macro invocation nor math
%staffs, you may path it directly to the commands.}
%\end{verbatim}
% \end{quote}
%
% will produce the following result.
%
% \begin{quote}
% \Underline{Since this sentence does not have macro invocation nor math
% staffs, you may path it directly to the commands.}
% \end{quote}
%
% \item
% Character string surrounded by `\|{|' and `\|}|'.  Any string that can be
% passed to \LaTeX's \|\mbox| is also able to be passed to \|\Underline| and 
% its relatives.  Since the string is processed as if it is packed into
% \|\mbox|, line break will never occur in the string.  For example;
%
% \begin{quote}
%\begin{verbatim}
%\Underline{The {\textbf{boldface}} part and the math part {$y=x^2$} are
%surrounded by brace pairs because they have special characters.}
%\end{verbatim}
% \end{quote}
%
% will produce the following result.
% \begin{quote}
% \Underline{The {\textbf{boldface}} part and the math part {$y=x^2$} are
% surrounded by brace pairs because they have special characters.}
% \end{quote}
%
% \item
% Commands \|\UMOspace|, \|\UMOnewline| and \|\\| for spacing and line
% breaking.  The usage of them will be shown later.
% \end{itemize}
% 
% 
%
% \subsection{Control Lines}
% \label{sec:usage-line}
%
% The default distance of the lines drawn by \|\Underline| and its relatives 
% from baselines are defined as follows, where $b$ is the value of
% \|\baselineskip| and $a$ is the height of `-'\footnote{
%
% The height of `-' is not the distance between a baseline and the visible
% short line of the image of `-'.  Rather, its invisible part is
% approximately twice as tall as the distance.}.
%
% Note that positive value
% means the lines are drawn above baselines, while below baselines if
% negative.
% \SpecialIndex{\baselineskip}
% \SpecialIndex{\strutbox}
%
% \begin{eqnarray*}
% \|\Underline|&:&	-0.3b\ \hbox{(depth of \|\strutbox|)}\\
% \|\Midline|&:&	+0.5a\\
% \|\Overline|&:&	+0.7b\ \hbox{(height of \|\strutbox|)}
% \end{eqnarray*}
%
% If you wish to draw lines at the position other than the defaults, you may 
% set the following {\em length commands} (or {\em dimen register} in TeX's
% jargon) to some appropriate positive values representing the distance from 
% baselines using \|\setlength|.
%
% \begin{itemize}
% \item
% \makebox[12em]{\cs{UnderlineDepth} \dotfill}
% The depth of \|\Underline|
% \DescribeMacro{\UnderlineDepth}
%
% \item
% \makebox[12em]{\cs{MidlineHeight} \dotfill}
% The height of \|\Midline|
% \DescribeMacro{\MidlineHeight}
%
% \item
% \makebox[12em]{\cs{OverlineHeight} \dotfill}
% The height of \|\Overline|
% \DescribeMacro{\OverlineHeight}
% \end{itemize}
%
% Setting these commands to any negative values makes corresponding lines
% drawn at the defaults.
%
% \leavevmode\DescribeMacro{\MidlineChar}
% Another position control for \|\Midline| is to change the {\em reference}
% character by \|\Midline|\allowbreak\|Char|\Meta{$c$}.  That is,
% \|\Midline| will be
% drawn $0.5a$ above baselines where $a$ is the height of $c$.
%
% \leavevmode\DescribeMacro{\UMOline}
% Yet another position control can be done by a generalized line drawing
% command;
%
% \begin{quote}
% \|\UMOline|\Meta{height}\Meta{text}
% \end{quote}
%
% This command draw lines \meta{height} above (or below if negative)
% baselines for the \meta{text}.
%
% \leavevmode\DescribeMacro{\UMOlineThickness}
% The thickness of lines is the value set to the length-command
% \|\UMOlineThickness|, whose default value is 0.4\,pt.
%
% 
%
% \subsection{Explicit Spacing and Line Breaking}
% \label{sec:usage-space}
%
% If the argument \meta{text} has a command invocation, it should be
% surrounded by `\|{|' and `\|}|' and its result will be packed in a
% \|\mbox|.  Therefore a space inserted by \|{\hspace|\Meta{len}\|}| will
% not disappear when a line is broken just before the space.  Commands for
% line breaking, such as \|\(no)linebreak|, \|\newline| and \|\\| will not
% have any effect in \|\mbox| (or cause error).
% \SpecialIndex{\hspace}
% \SpecialIndex{\linebreak}
% \SpecialIndex{\nolinebreak}
% \SpecialIndex{\newline}
% \SpecialIndex{\\}
%
% To solve these problems, the following commands for spacing and line
% breaking are available.
%
% \begin{itemize}
% \item
% \|\UMOspace|\Meta{len}\opt{num}
%	\DescribeMacro{\UMOspace}\par
% A space of \meta{len} wide is inserted and will disappear if a line is
% broken just before the space.  The optional argument \meta{num} discourage 
% or encourage the line break at the space.  If \meta{num} is non-negative,
% it discourages line breaking in the same way as the argument of
% \|\nolinebreak|.  If negative, it encourages breaking and its absolute
% value corresponds to the argument of \|\linebreak|.
%
% Note that if \opt{num} follows `\|*|', \meta{num} is interpreted as the 
% value to pass \TeX's \|\penalty|.
% \SpecialIndex{\penalty}
%
% \item
% \|\UMOspace*|\Meta{len}
%	\DescribeMacro{\UMOspace*}\par
% A space of \meta{len} wide is inserted and will not disappear even if a
% line is broken at the space.
%
% \item
% \|\UMOnewline|, \|\\|
%	\DescribeMacro{\UMOnewline}
%	\DescribeMacro{\\}\par
% Terminate a line simply leaving space.
%
% \item
% \|\UMOnewline*|, \|\\*|
%	\DescribeMacro{\UMOnewline*}
%	\DescribeMacro{\\*}\par
% Terminate a line leaving underlined (or mid/overlined) space.
% \end{itemize}
%
% 
%
% \subsection{Remarks}
% \label{sec:usage-note}
%
% \begin{enumerate}
% \item
% No hyphenation will be performed in \meta{text}.
%
% \item
% As other \LaTeX's commands, \|\verb| in \meta{text} may cause an error even
% if it surrounded by `\|{|' and `\|}|'.
%
% \item
% Also as other \LaTeX's commands, paragraph separator cannot be included in
% \meta{text} or you will have an error message.
%
% \item
% Processing time for underlined (or mid/overlined) text is approximately 10
% times as long as that for ordinary text.  The size of dvi file also
% enlarged by factor three or so.
% \end{enumerate}
%
% 
%
% \IndexPrologue{\newpage\section*{Index}
% Underlined number refers to the page where the specification of
% corresponding entry is described.}
% \StopEventually{\PrintIndex}
%
% 
%
% \newpage
% \section{Implementation}
% \label{sec:imp}
%
% \subsection{Problems and Solution}
% \label{sec:imp-solution}
%
% The fundamental difficulty to draw underlines and its relatives is removed 
% by restricting as \meta{text} may have {\em ordinary} characters and other 
% staffs surrounded by \bracepair{} (called {\em blocked text}), because we
% can pick each element in \meta{text} and draw a line for the element.
% Thus remaining problems is {\em glues} that may be stretched or shrunk
% when a paragraph is build.
%
% This problem has the following two subproblems.
%
% \begin{enumerate}
% \item
% How can we obtain the natural width, stretch and shrink of a glue
% automatically inserted by \TeX's spacing mechanism?
% 
% \item
% How can we draw the line having the same natural width, stretch and shrink
% as the glue?
% \end{enumerate}
%
% The second problem is relatively easy because we have \|\leaders| whose
% specification is as follows.
% \SpecialIndex{\leaders}
%
% \begin{quote}
% \|\leaders\hrule height|\meta{$h$}\|depth|\meta{$d$}\|\hskip|\meta{$s$}
% \end{quote}
%
% The important (and not well-known) feature of \|\leaders| is that $h$ and
% $d$ are not necessary to be non-negative, but $h$ simply specifies the
% distance between the upper edge of the line and the baseline, while $d$ is
% that for the lower edge\footnote{
%
% The lack of the knowledge of this fact caused one major drawback of
% \textsf{julem} in which a line for a space is terribly inefficiently drawn
% by \cs{leaders} with \cs{hbox} containing a very short line segment.}.
%
% Note that positive (negative) value of $h$ ($d$) means the edge is above
% the baseline, and negative (positive) means below it.  Thus for an
% underline whose upper edge is $u$ below the baseline and thickness is $w$,
% we can simply do the following to have a space-like object that will be
% stretched or shrunk and will be potentially discarded on line breaking in
% the exactly same way as the space produced by \|\hskip|\meta{$s$}.
%
% \begin{quote}
% \|\leaders\hrule height|\meta{$-u$}\|depth|\meta{$u{+}w$}\|\hskip|\meta{$s$}
% \end{quote}
%
% Mid-lines and overlines are also drawn in similar ways.
%
% As for the first problem, we can calculate the natural width, stretch and
% shrink by simulating \TeX's spacing machanism.  For each space in
% \meta{text} (but not in blocked text), let $f$ be the \|\spacefactor|
% defined by the word (or other object) preceeding the space, $d_i$ be the
% \|\fontdimen|\meta{$i$} of the selected font, $s$ and $x$ be \|\spaceskip| 
% and \|\xspaceskip|, $n(g)$, $p(g)$ and $m(g)$ be the natural width and
% stetch/shrink factor of the glue $g$.  The glue $\sigma$ inserted for
% the space is calculated as shown in Table~\ref{tab:space}.
% \SpecialIndex{\spacefactor}\SpecialIndex{\spaceskip}
% \SpecialIndex{\xspaceskip}
% 
% \begin{table}[b]
% \caption{Glue for Interword Space}
% \label{tab:space}
% $$\arraycolsep0pt
% \begin{array}{r@{\;\land\;}l@{\quad}c@{\quad}c@{\quad}c}
% \multicolumn2c{\hbox{condition}}&n(\sigma)&p(\sigma)&m(\sigma)\\\hline
% f<2000&n(s)=0&	d_2&	d_3\cdot(f/1000)&	d_4\cdot(1000/f)\\
% f<2000&n(s)\neq0&	n(s)&	p(s)\cdot(f/1000)&	m(s)\cdot(1000/f)\\
% f\geq2000&n(x)=0&	d_2+d_7&d_3\cdot(f/1000)&	d_4\cdot(1000/f)\\
% f\geq2000&n(x)\neq0&	n(x)&	p(x)&			m(x)
% \end{array}
% $$
% \end{table}
%
% 
%
% \subsection{Tricks for Compatibility}
% \label{sec:imp-compat}
%
% At the very beginning of \textsf{umoline.sty}, we checks whether it is
% loaded by \LaTeXe{} or \LaTeX-2.09, and then declares \|\NeedsTeXFormat|
% and \|\ProvidesPackage| if \LaTeXe{}.  This part is embedded at the
% beginning of \textsf{umoline.dtx} in a tricky manner to let
% \textsf{docstrip} produce the following code.
% \SpecialIndex{\NeedsTeXFormat}
% \SpecialIndex{\ProvidesPackage}
%
%\begin{quote}
%\begin{verbatim}
%\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 ]
%\end{verbatim}
%\end{quote}
%
% \begin{macro}{\PackageError}
% We have to define \|\PackageError|, which is only \LaTeX2e-specific
% macro in \textsf{umoline}, using \|\@latexerr| if the macro has not yet
% defined (i.e. \LaTeX-2.09).
% \SpecialIndex{\@latexerr}
% \end{macro}
%
% \iffalse
%<*package>
% \fi
%    \begin{macrocode}

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

%%^L

%    \end{macrocode}
%
% 
%
% \subsection{Register Declaration}
% \label{sec:imp-decl}
%
% In \textsf{umoline}, we use the following registers and relatives.
%
% \begin{itemize}
% \item
% \begin{macro}{\UnderlineDepth}
% \|\UnderlineDepth| (dimen)\\
% The distance from baseline to the upper edge of an underline.  It is
% initialized to a negative value (\|-\maxdimen|) to refer the default
% value, the depth of \|\strutbox|.
% \end{macro}
% 
% \item
% \begin{macro}{\MidlineHeight}
% \|\MidlineHeight| (dimen)\\
% The distance from baseline to the lower edge of a mid-line.  It is
% initialized to a negative value (\|-\maxdimen|) to refer the default
% value, the half height of \|\UMO@midlinechar| (see
% \S\ref{sec:imp-uifinit}).
% \end{macro}
% 
% \item
% \begin{macro}{\OverlineHeight}
% \|\OverlineHeight| (dimen)\\
% The distance from baseline to the lower edge of a overline.  It is
% initialized to a negative value (\|-\maxdimen|) to refer the default
% value, the height of \|\strutbox|.
% \end{macro}
%
% \item
% \begin{macro}{\UMOlineThickness}
% \|\UMOlineThickness| (dimen)\\
% The thickness of underlines and its relatives, and is initialized to the
% default 0.4\,pt.
% \end{macro}
%
% \item
% \begin{macro}{\UMO@height}
% \|\UMO@height| (dimen)\\
% The distance from baseline to the upper edge of lines, which is refered in 
% line drawing procedure.
% \end{macro}
% 
% \item
% \begin{macro}{\UMO@depth}
% \|\UMO@depth| (dimen)\\
% The distance from baseline to the lower edge of lines, which is refered in 
% line drawing procedure.
% \end{macro}
% 
% \item
% \begin{macro}{\UMO@spacefactor}
% \|\UMO@spacefactor| (count)\\
% The value of \|\spacefactor| at the time a word or blocked text is produced.
% \SpecialIndex{\spacefactor}
% \end{macro}
%
% \item
% \begin{macro}{\ifUMO@nospace}
% \|\ifUMO@nospace| (if)\\
% True if the word or blocked text currently processed is the first member of
% \meta{text} or is
% preceded by a blocked text (or its sequence) following a space.  For such
% an element, we don't insert interword space before it.
% \end{macro}
% \end{itemize}
%
%    \begin{macrocode}
%% 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

%    \end{macrocode}
%
% We also use the following registers defined by \LaTeX.
%
% \begin{itemize}\item[]
% \|\@tempboxa|\quad\|\@tempdima|\quad\|\@tempdimb|\quad
% \|\@tempskipa|\quad\|\@tempcnta|\\\|\if@tempswa|
% \SpecialIndex{\@tempboxa}
% \SpecialIndex{\@tempdima}
% \SpecialIndex{\@tempdimb}
% \SpecialIndex{\@tempskipa}
% \SpecialIndex{\@tempcnta}
% \SpecialIndex{\if@tempswa}
% \end{itemize}
%
% 
% 
%
% \subsection{User Interface and Initialization}
% \label{sec:imp-uifinit}
%
% \begin{macro}{\MidlineChar}
% \begin{macro}{\UMO@midlinechar}
% The macro \|\MidlineChar|\Meta{$c$} defines \meta{$c$} as the body of
% \|\UMO@midlinechar| that is refered by \|\Midline| to calculate its
% default height.  The default of \meta{$c$}, `-', is also defined by
% \|\MidlineChar|.
% \end{macro}\end{macro}
%
%    \begin{macrocode}
%% User Interface and Initialization

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

%    \end{macrocode}
%
% \begin{macro}{\Underline}
% \begin{macro}{\Midline}
% \begin{macro}{\Overline}
% \begin{macro}{\UMOline}
% The user interface macros, \|\Underline|\Meta{text},
% \|\Midline|\Meta{text}, \|\Overline|\Meta{text},
% \|\UMOline|\Meta{height}\Meta{text}, call the following common macro to
% draw lines at the position specific to them.
%
% \begin{quote}
% \|\UMO@line|\Meta{reg-or-def}\Meta{reg-height}\Meta{def-height}\Meta{text}
% \end{quote}
%
% The distance $\delta$ between baseline and the baseline-side edge of the
% line is defined by the following equation.
%
% \begin{equation}
% \delta=\cases{\meta{reg-height}&if $\meta{reg-or-def}\geq 0$\cr
%		  \meta{def-height}&if $\meta{reg-or-def}< 0$}
% \label{eq:delta}
% \end{equation}
%
% Therefore, the following argument passing properly controls the drawing
% position described in \S\ref{sec:usage-line}, where $c$ is the body of
% \|\UMO@midlinechar|.
%
% \begin{center}\begin{tabular}{l|lll}
% &\meta{reg-or-def}&\meta{reg-height}&\meta{def-height}\\\hline
% \|\Underline|&\|\UnderlineDepth|&\|-\UnderlineDepth|&\|\dp\strutbox|\\
% \|\Midline|&\|\MidlineHeight|&\|\MidlineHeight|&{\it height-of\/}(c)/2\\
% \|\Overline|&\|\OverlineHeight|&\|\OverlineHeight|&\|\ht\strutbox|\\
% \|\UMOline|&\|-\maxdimen|&---&\meta{height}\\
% \end{tabular}\end{center}
% \end{macro}\end{macro}\end{macro}\end{macro}
%
%    \begin{macrocode}
\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@}

%    \end{macrocode}
%
% \begin{macro}{\UMO@line}
% \begin{macro}{\\}
% Since the behavior of the control character \|\\| in \meta{text} has to be
% different from that of its original version, \|\UMO@line| firstly opens a
% group to \|\let| the \|\\| be our own newline command \|\UMOnewline|.
% 
% Next, we calculate $\delta$ of the equation (\ref{eq:delta}).  Since
% $\delta$ is the distance from baseline to the baseline-side edge of the
% drawn line, we then calculate \|\UMO@height| ($h$) and \|\UMO@depth|
% ($d$) using the following equations, where $w$ is the value of
% \|\UMOlineThickness|.
%
% \begin{eqnarray}
% h&=&\cases{\delta+w&if $\delta\geq0$\cr
%	     \delta&if $\delta<0$}\\[.3ex]
% e&=&\cases{-\delta&if $\delta\geq0$\cr
%	     -\delta+w&if $\delta<0$}
% \end{eqnarray}
%
% Then \|\ifUMO@nospace| is set to true for the first element of \meta{text},
% \TeX's mode is turned to horizontal by \|\leavevmode| if necessary, and
% \|\UMO@spacefactor| is set to the current value of \|\spacefactor| to cope 
% with the case that \meta{text} has a leading space.
%
% After those initializations, \|\UMO@wordloop| (see \S\ref{sec:imp-word}) 
% is invoked to process each space-separated word element in \meta{text}.
% The argument passed to \|\UMO@wordloop| has the form of;
%
% \begin{quote}
% $w_1$\verb*| |$w_2$\verb*| |\ldots\verb*| |$w_n$\verb*| \@nil |
% \end{quote}
%
% where $w_i$ is a word element.  The last element \|\@nil| and the space
% following it is added to \meta{text} by a trick expanding
% \|\noexpand\@nil\space| using \|\edef| and expanding the result once more
% by \|\expandafter|.
%
% After \|\UMO@worldloop| completes its procedure for \meta{text},
% \|\UMO@line| close the group and invokes \|\UMO@aftergroup| to make
% \|\spacefactor| have an appropriate value when the space following
% \meta{text} processed by \TeX.
% \end{macro}\end{macro}
%    \begin{macrocode}
\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

%    \end{macrocode}
%
% 
%
% \subsection{Processing Word Elements}
% \label{sec:imp-word}
%
% Since we have \|\UMOspace| and \|\UMOnewline| (and \|\\| as its alias) as
% {\em top-level} elements of \meta{text}, we have to scan each character in 
% \meta{text} to find them after picking space-separated word elements.
% 
% \begin{macro}{\UMO@wordloop}
% The macro \|\UMO@wordloop| checks if the first character of given word
% element is `\|{|' by \|\UMO@ifbgroup|.  If so, it invokes
% \|\UMO@wordblock| to process the blocked text following the character,
% while \|\UMO@iwordloop| is invoked to process characters in the word
% element otherwise.
% \end{macro}
%
% \begin{macro}{\UMO@ifbgroup}
% \begin{macro}{\UMO@ifnc}
% \SpecialIndex{\if@nextchar}
% The macro \|\UMO@ifbgroup|\meta{then}\meta{else} is similar to \LaTeX's
% \|\if@nextchar\bgroup|\meta{then}\allowbreak\meta{else}, but not
% equivalent because it does not skip spaces preceding `\|{|'.  This
% feature is introduced to cope with a \meta{text} having leading spaces as
% the following.
%
% \begin{quote}
% \verb*|\Underline{ |\Meta{blocked-text}\ldots\|}|
% \end{quote}
%
% Removing the space skip feature makes the implementation of
% \|\UMO@ifbgroup| simpler because it just uses \|\futurelet| to get the
% following character.
% \end{macro}\end{macro}
%
%    \begin{macrocode}
%% 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}
%    \end{macrocode}
%
% \begin{macro}{\UMO@wordblock}
% \begin{macro}{\UMO@theword}
% The macro \|\UMO@wordblock|\Meta{blocked-text} at first produces an
% underline (or others) for the space followed by \Meta{blocked-text}, if
% exists, by \|\UMO@spaceskip| (see \S\ref{sec:imp-wordspace}).  Next, it
% invokes \|\UMO@putword| (see \S\ref{sec:imp-drawline}) that produces
% underlined (or other type) word contained in the macro \|\UMO@theword|
% that is defined as \meta{blocked-text}.  Finally, it repeats the procedure
% for word elements invoking \|\UMO@wordloop| turning \|\ifUMO@nospace| to
% true to indicate that the element directly following \Meta{blocked-text}
% does not follows a space.
% 
% If \Meta{blocked-text} is followed by a space, it is detected by
% \|\UMO@iwordloop| to produce underlined (or other type) space before next
% word element is processed as shown later, and the \|\spacefactor| is set
% to the value determined by the last character (or a few trailing
% characters) of \meta{blocked-text}.  Thus, it is not correct to say
% \meta{blocked-text} is packed into \|\mbox| and put because the
% \|\spacefacor| for \|\mbox| is always 1000.  However, this feature will
% make the spacing of \meta{text} natural when it has blocked word.
% \end{macro}\end{macro}
%
%    \begin{macrocode}
\def\UMO@wordblock#1{\UMO@spaceskip
        \def\UMO@theword{#1}\UMO@putword \UMO@nospacetrue
        \UMO@wordloop}
%    \end{macrocode}
%
% \begin{macro}{\UMO@iwordloop}
% \begin{macro}{\UMO@theword}
% The macro \|\UMO@iwordloop|\meta{word}\verb*| | invokes \|\UMO@end| (see
% \S\ref{sec:imp-end}) for finalization if \meta{word} is \|\@nil|.  If the
% \meta{word} is empty mainly because the preceding word element is a
% blocked text that \|\UMO@wordblock| has processed and removed,
% \|\ifUMO@nospace| is turned to false in order to insert a interword space
% preceding the next word element.
% 
% Otherwise, \|\UMO@iwordloop| produces an
% underline (or others) for the space followed by \meta{word}, if
% exists, by \|\UMO@spaceskip| (see \S\ref{sec:imp-wordspace}).  Then it
% invokes \|\UMO@charloop|\meta{word}\allowbreak\hbox{\|\@nil|} to process
% the character string of \meta{word} after initializing \|\UMO@theword|
% empty.  Finally, \|\UMO@wordloop| is recursively invoked after turning
% \|\ifUMO@nospace| to false to indicate the \meta{word} is followed by a
% space.
% \end{macro}\end{macro}
%
%    \begin{macrocode}
\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}

%    \end{macrocode}
%
% \begin{macro}{\UMO@charloop}
% The macro \|\UMO@charloop| checks if the given character
% is `\|{|' by \|\UMO@ifbgroup| (see above), because a word element may have 
% a blocked text directly following a character string.  If so, it invokes
% \|\UMO@charblock| to process the blocked text following the character,
% while \|\UMO@icharloop| is invoked to process the given characters as the
% member of word element otherwise.
% \end{macro}
%
% \begin{macro}{\UMO@charblock}
% \begin{macro}{\UMO@theword}
% The macro \|\UMO@charblock|\Meta{blocked-text} at first produces an
% underlined (or other type) word that precedes \Meta{blocked-text} by
% \|\UMO@putword| (see \S\ref{sec:imp-drawline}).  Next, it
% invokes \|\UMO@putword| again but this time for \meta{blocked-text} that
% is \|\def|ined as the body of \|\UMO@theword|.
% Finally, it repeats the procedure
% for the remaining character string by invoking \|\UMO@charloop|.
% \end{macro}\end{macro}
%
%    \begin{macrocode}
\def\UMO@charloop{\UMO@ifbgroup\UMO@charblock\UMO@icharloop}
\def\UMO@charblock#1{\UMO@putword
        \def\UMO@theword{#1}\UMO@putword
        \UMO@charloop}
%    \end{macrocode}
%
% \begin{macro}{\UMO@icharloop}
% \begin{macro}{\UMO@theword}
% \|\UMO@icharloop|\meta{char} at first checks if the \meta{char} is
% \|\@nil|, \|\UMOspace| or \|\UMOnewline| (or its alias \|\\|).  If the
% \meta{char} is one of them, the character string preceding the \meta{char} 
% is underlined (or other-lined) by \|\UMO@putword| (see
% \S\ref{sec:imp-drawline}).  Then \|\UMO@icharloop| finishes the procedure
% for the character string if \meta{char} is \|\@nil|, inserts underlined
% (or other type) space by \|\UMO@space| (see \S\ref{sec:imp-spnl}) if
% \|\UMOspace|, or breaks line by \|\UMO@newline| (see \S\ref{sec:imp-spnl})
% if \|\UMOnewline|.
%
% Otherwise, the \meta{char} is appended to the tail of \|\UMO@theword| and
% \|\UMO@charloop| is recursively invoked for the following characters.
% \end{macro}\end{macro}
%
% \begin{macro}{\UMOspace}
% \begin{macro}{\UMOnewline}
% Note that the control sequences \|\UMOspace| and \|\UMOnewline| cannot be
% processed properly if they occur in a context other than the argument of
% \|\UMO@icharloop|, for example outside of \|\Underline|.  Thus they are
% defined to complain about their illegal occurrence by \|\PackageError|.
% \end{macro}\end{macro}
%
%    \begin{macrocode}
\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

%    \end{macrocode}
%
% 
%
% \subsection{Interword Spacing}
% \label{sec:imp-wordspace}
%
% \begin{macro}{\UMO@spaceskip}
% The macro \|\UMO@spaceskip| produces an underline (or others) for an
% interword space if \|\ifUMO@nospace| is false.  Since the glue for the
% space is calculated as shown in Table~\ref{tab:space}, it invokes
% \|\UMO@skip|\meta{$\sigma$} (see \S\ref{sec:imp-drawline}) after setting
% \|\@tempskipa| to $\sigma$ calculated referring \|\UMO@spacefactor| that is
% the value of \|\spacefactor| at the time the word preceding the space is
% processed.
% \end{macro}
%
% \begin{macro}{\UMO@setspaceskip}
% A non-trivial part of the calculation of $\sigma$ is to obtain the natural 
% width and stretch/shrink factor of \|\spaceskip| ($s$) individually.
% Since no convenient primitives to obtain $n(s)$, $p(s)$ and $m(s)$ are
% available, we have to define a macro \|\UMO@setspaceskip| that processes
% the character string representation of $s$, \meta{the-s}, which is
% obtained by \|\the\spaceskip|.  This \meta{the-s} is represented in one of 
% the following four forms.
% $$
% \def\PLUS{\hbox{\tt\char`\ plus\char`\ }}
% \def\MINUS{\hbox{\tt\char`\ minus\char`\ }}
% \def\LAND{{\;\land\;}}
% \meta{the-s}=\cases{n(s)&			if $p(s)=0\LAND m(s)=0$\cr
%		      n(s)\PLUS p(s)&		if $p(s)\neq0\LAND m(s)=0$\cr
%		      n(s)\MINUS m(s)&		if $p(s)=0\LAND m(s)\neq0$\cr
%		      n(s)\PLUS p(s)\MINUS m(s)&if $p(s)\neq0\LAND m(s)\neq0$}
% $$
% Thus \|\UMO@spaceskip| invokes \|\UMO@setspaceskip| by the following
% tricky sequence;
%
% \begin{quote}
% \|\UMO@setspaceskip|\meta{the-s}\verb*| @ @ @ @ \@nil|
% \end{quote}
%
% in order to pass at least six elements (sixth is a garbage) separated by
% five spaces.  The part from \meta{the-s} to the preceding space of
% \|\@nil| of the calling sequence shown above is generated by a trick
% expanding ``\|\the\spaceskip\space @ @ @ @ |'' using \|\edef| and
% expanding the result once more by \|\expandafter|.
%
% On the other hand, the argument syntax of \|\UMO@setspaceskip| is as
% follows.
%
% \begin{itemize}\item[]
% \|\UMO@setspaceskip|\meta{$n$}\verb*| |\meta{plus-or-minus}\verb*| |
%	\meta{p-or-m}\verb*| |\meta{minus}\verb*| |\meta{$m$}\verb*| |
%	\meta{trailer}\|\@nil|
% \end{itemize}
%
% Thus we will know how \meta{the-s} is represented by checking whether
% \meta{plus-or-minus} is ``\|plus|'', ``\|minus|'' or ``\|@|'', and whether
% \meta{minus} is ``\|\minus|'' or ``\|@|'', in order to set \|\@tempskipa|
% to an appropriate glue.
% \end{macro}
%
% \begin{macro}{\UMO@plus}
% \begin{macro}{\UMO@minus}
% \changes{v1.1-1}{2000/07/11}
%	{Fixed the misspell of the macro names for \texttt{plus} and
%	 \texttt{minus}.}
% Note that ``\|plus|'' and ``\|minus|'' shown above have to consist of
% characters whose \|\catcode| are not 11 but 12.  To obtain these unusual
% character strings easily, we \|\def|ine \|\UMO@plus| and \|\UMO@minus| as
% these strings beforehand by extracting them from \|\the\@tempskipa| that
% contains ``\|\1pt plus 2pt minus 3pt|''.
% \end{macro}\end{macro}
%
%    \begin{macrocode}
%% 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

%    \end{macrocode}
%
% 
%
% \subsection{Drawing Lines}
% \label{sec:imp-drawline}
%
% \begin{macro}{\UMO@putword}
% \|\UMO@putword| produces a \|\hbox| containing a \meta{word}
% defined as the body of \|\UMO@theword| and an underline (or others) for
% the \meta{word}.  The width of line is that of the \|\hbox|, and the height
% and depth is \|\UMO@height| and \|\UMO@depth| respectively.  The line is
% put by \|\rlap| so that it is laid over the \|\hbox|.  After the box and
% line is produced \|\UMO@theword| is reinitialized to empty.
% \end{macro}
%
% \begin{macro}{\UMO@skip}
% \|\UMO@skip|\Meta{glue} draws an underline (or others) for a
% stretchable\slash shrinkable space of \meta{glue} by \|\leaders| as shown
% in \S\ref{sec:imp-solution}.
% \end{macro}
%
%    \begin{macrocode}
%% 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

%    \end{macrocode}
%
% 
%
% \subsection{Explicit Spacing and Line Breaking}
% \label{sec:imp-spnl}
%
% \begin{macro}{\UMO@space}
% \begin{macro}{\UMO@sspace}
% \begin{macro}{\UMO@ispace}
% \begin{macro}{\UMO@iispace}
% \begin{macro}{\UMO@penalty}
% The procedure for the user interface control sequence
% \|\UMOspace|\Meta{glue}\opt{pen} is performed by \|\UMO@space| to check
% the existence of `\|*|' directly following \|\UMOspace|, \|\UMO@ispace| to 
% check that of `\|*|' directly preceding \opt{pen}, and \|\UMO@iispace| to
% check that of \opt{pen} and to invoke \|\UMO@skip| (see
% \S\ref{sec:imp-drawline}) to draw a line for the space.  The penalty is
% inserted by \|\UMO@penalty| following \LaTeX's convention if \|\@tempswa|
% is true or \TeX's otherwise.
%
% The sequence \|\UMOspace*|\Meta{glue} is processed by \|\UMO@sspace| that
% inserts \|\vrule| of zero wide and \|\nobreak| as \|\hspace*| does, and
% then draw a line by \|\UMO@skip| for a space of \meta{glue}.
% 
% In both cases, \|\UMO@charloop| is invoked after underlined (or other
% type) space is produced to process characters following \|\UMOspace|.
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
%
%    \begin{macrocode}
%% 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}

%    \end{macrocode}
%
% \begin{macro}{\UMO@newline}
% The user interface control sequence \|\UMOnewline|(\|*|) is processed by
% \|\UMO@newline|.  It produces a underlined (or other type) space having
% \|1fil| stretch factor by \|\UMO@skip| if `\|*|' is supplied, while a
% space of \|1fil| is simply inserted otherwise.  In both cases, \|\break|
% is inserted after the space to break a line and \|\UMO@charloop| is
% invoked for the characters following \|\UMOnewline|.
% \end{macro}
%
%    \begin{macrocode}
\def\UMO@newline{\@ifstar{\UMO@skip{0pt plus1fil}\break \UMO@charloop}%
                                          {\hfil \break \UMO@charloop}}

%%^L

%    \end{macrocode}
%
% 
%
% \subsection{Finalization}
% \label{sec:imp-end}
%
% \begin{macro}{\UMO@end}
% \begin{macro}{\UMO@aftergroup}
% When the \meta{text} is completely processed, \|\UMO@end| is invoked from
% \|\UMO@iwordloop| to set \|\spacefactor| to the value at the last word
% element is produced.  Since this assignment has to be performed outside the 
% group that \|\UMO@line| has opened (see \S\ref{sec:imp-uifinit}), setting
% \|\spacefactor| to \|\UMO@spacefactor| is \|\xdef|ined as the body of
% \|\UMO@aftergroup| that is called by \|\UMO@line| after the group is closed.
% \end{macro}\end{macro}
%
%    \begin{macrocode}
%% Finalization

\def\UMO@end{\xdef\UMO@aftergroup{\spacefactor\number\UMO@spacefactor}}
%    \end{macrocode}
% \iffalse
%</package>
% \fi
%
% 
%
% \IndexPrologue{\newpage\section*{Index}
% Italicized number refers to the page where the specification and usage of
% corresponding entry is described, while underlined is for the
% implementation of the entry.\endgraf
% 
% To find a control sequence, remove prefixes \cs{@}, \cs{adl@} or
% \cs{ifadl@} from its name if it has one of them.}
% \Finale
% \GlossaryPrologue{\newpage\section*{Revision History}}
% \PrintChanges
\endinput