summaryrefslogtreecommitdiff
path: root/support/tiny_c2l/position.sty
blob: ab2bee96216d7bd2fedcf3325248434d3281b99b (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
%%
%% This is file `position.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% position.dtx  (with options: `package')
%% 
%%
%% File `position.dtx'.
%%
%% Copyright (C) 1997 - 2000 Michael Plugge <m.plugge@fh-mannheim.de>
%% All rights reserved.
%%
%% Please send error reports and suggestions for improvements to:
%%
%%                          Michael Plugge
%%                          Neustadter Str. 132
%%                          D-67360 Lingenfeld
%%                          Germany
%%               Internet:  <m.plugge@fh-mannheim.de>
%%

%% \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         \~}
\ifx\documentclass\undefined %this package may be used also with LaTeX 2.09 ;-)))
 \message{position.sty  1.4.0\space <2000/02/25>}
\else
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{position}[2000/02/25\space 1.4.0]
 \typeout{Package: position 1.4.0\space <2000/02/25>}
\fi
\ifx\getformat\undefined\newcount\getformat\getformat0\fi
\newif\ifmfiles\mfilesfalse
\newif\ifoldlatex\oldlatextrue
\gdef\pstd{\gdef\mm{\kern0.05em{--}\kern0.05em{}}\gdef\brl{\{}\gdef\brr{\}}}
\gdef\ptt{\gdef\mm{-}\gdef\brl{\symbol{`\{}}\gdef\brr{\symbol{`\}}}}
\ifoldlatex
 \gdef\basefont{\rm\pstd}
 \gdef\blockfont{\rm\pstd}
 \gdef\keywordfont{\bf\pstd}
 \gdef\stringfont{\tt\ptt}
 \gdef\commentfont{\it\pstd}
 \gdef\headfont{\sl\pstd}
 \gdef\footfont{\sl\pstd}
\else
 \gdef\basefont{\normalfont\pstd}
 \gdef\blockfont{\normalfont\pstd}
 \gdef\keywordfont{\bfseries\pstd}
 \gdef\stringfont{\ttfamily\ptt}
 \gdef\commentfont{\itshape\pstd}
 \gdef\headfont{\slshape\pstd}
 \gdef\footfont{\slshape\pstd}
\fi
\basefont
\gdef\spy{{\tt \symbol{'040}}}
\gdef\sq{{\tt\symbol{13}}}
\gdef\qql{``}
\gdef\qqr{''}
\gdef\ul{{\_\kern.1em}}

\gdef\bs#1{$\count255=1\loop\ifnum\count255<#1\advance\count255 by 1
 \backslash\hspace*{-.2em}\repeat\backslash$}
\gdef\mlt#1{$\count255=1 \loop\ifnum\count255<#1\advance\count255 by 1
  <\hspace*{-.4em}\repeat<$}
\gdef\mgt#1{$\count255=1 \loop\ifnum\count255<#1\advance\count255 by 1
  >\hspace*{-.4em}\repeat>$}
\gdef\mast#1{$\count255=0 \loop\ifnum\count255<#1\advance\count255 by 1
  \ast\repeat$}
\gdef\mblank#1{\count255=0 \loop\ifnum\count255<#1\advance\count255 by 1
  ~\repeat}
\gdef\n{\mbox{}\\}
\newbox\poutbox
\newbox\pstartbox
\newbox\pendbox
\newif\ifpend
\newif\ifpbrk
\newlength\pcur
\newlength\pcurbr
\newlength\pcmtstart
\newlength\plena
\newlength\plinenowidth
\newlength\ind
\newcount\pdecr
\newcount\pstarta
\newcount\pstart
\gdef\pst{$\ast$}
\pbrktrue
\ind.5em
\setbox\pstartbox=\hbox{}
\setbox\pendbox=\hbox{}
\gdef\init#1#2{%
 \par\noindent\hbox to \plinenowidth{\hss {\rm\scriptsize #2}\hspace{1em}}%
 \plena\textwidth \advance\plena -\plinenowidth
 \pdecr0
 \pcurbr0pt
 \setbox\pstartbox=\hbox{}%
 \pstart#1\advance\pstart 1 \pstarta\pstart
 \skip0\ind\multiply\skip0 by #1 \pcur\skip0
 \ifnum #1>0 \hspace*{\skip0}\fi%
 \ifpend\advance\plena -\wd\pendbox\fi%
}
\gdef\initc#1#2#3#4{%
 \par\noindent\pdecr0%
 \hbox to \plinenowidth{\hss {\rm\scriptsize #4}\hspace{1em}}%
 \ifcase#2
   \pcurbr\ind\multiply\pcurbr #1 \pcur\pcurbr \gdef\pst{}% 0
 \or%
   \pcurbr\ind\multiply\pcurbr #1 \gdef\pst{$\ast$}% 1
 \or%
   \pcurbr\ind\multiply\pcurbr #1
   \advance\pcurbr\pcmtstart \gdef\pst{}% 2
 \or%
   \pcurbr\ind\multiply\pcurbr #1
   \advance\pcurbr\pcmtstart \gdef\pst{$\ast$}% 3
 \or%
   \pcurbr\pcmtstart \setbox\poutbox=\hbox{/}%
   \advance\pcurbr\wd\poutbox \gdef\pst{}% 4
 \or%
   \pcurbr\pcmtstart \setbox\poutbox=\hbox{/}%
   \advance\pcurbr\wd\poutbox \gdef\pst{$\ast$}% 5
 \or%
   \pcurbr\pcmtstart \setbox\poutbox=\hbox{/$\ast$}%
   \advance\pcurbr\wd\poutbox \gdef\pst{}% 6
 \or%
   \pcurbr\pcmtstart \setbox\poutbox=\hbox{/$\ast$}%
   \advance\pcurbr\wd\poutbox \gdef\pst{$\ast$}% 7
 \or%
   \pcurbr\ind\multiply\pcurbr #1 \gdef\pst{}% 8
 \else%
   \pcurbr0pt \gdef\pst{}%
 \fi%
 \setbox\pstartbox=\hbox{\pst\mblank{#3}}%
 \hspace*{\pcurbr}\copy\pstartbox%
 \pcur\pcurbr \advance\pcur\wd\pstartbox
 \ifpend\advance\plena -\wd\pendbox \fi%
 \ifnum#2=8 \pcurbr0pt\fi%
}
\gdef\plcntmargin#1{%
 \setbox\poutbox=\hbox{#1\hspace{1em}}\global\plinenowidth\wd\poutbox
}
\gdef\pee{\advance\plena -\wd\pendbox\pendtrue}
\gdef\ped{\advance\plena \wd\pendbox\pendfalse}
\gdef\pes#1#2{%
 \setbox\pendbox=\hbox{#1}%
 \advance\plena -\wd\pendbox
 \ifnum#2 > -1 \pstart#2\fi%
 \pendtrue%
}
\gdef\psinit#1#2{%
 \ifnum#1>-1 \pstart#1\fi%
 \ifnum#1=-2 \pstart\pstarta\fi%
 \setbox\pstartbox=\hbox{#2}%
}
\gdef\cmtinit{\pcurbr\pcur \pcmtstart\pcur}
\gdef\eol{\ifpend\copy\pendbox\else\mbox{}\fi\\\hspace*{\plinenowidth}}
\gdef\calcindent{%
 \ifdim\pcurbr>0pt\skip0\pcurbr
\else%
 \skip0\ind \multiply\skip0\pstart
\fi
}
\gdef\brkln{%
 \ifpbrk%
   \eol %insert line break
   \calcindent% calculate the indentation for the new line
   \pdecr\count255 \advance\pdecr-\pstart
   \pcur\wd\poutbox \advance\pcur\skip0
   \hspace*{\skip0}\copy\pstartbox%
   \advance\pcur\wd\pstartbox
 \else%
   \hspace*{\skip0}%
 \fi%
}
\gdef\jmpo#1#2{%
 \ifnum#1>0
   \count255 #1\advance\count255 -\pdecr
   \skip0\ind \multiply\skip0\count255 %calculate the output position
   \advance\skip0-\pcur %calculate the width of the needed space
   \count255 #1 %current start position (needed for line break)
 \fi%
 \ifdim\skip0<0.25em %(current position > target position)
   \skip0 0.25em% insert a small space
 \fi%
 \ifnum #1<1 \skip0 0pt \count255 -#1\fi%
   %copy #2 to \poutbox and add the width of the box to \pcur
 \setbox\poutbox=\hbox{#2}%
%%%% probieren: \advance\pcur\wd\poutbox \advance\pcur\skip0
%%%% dann ohne \relax
 \advance\pcur\skip0 \advance\pcur\wd\poutbox %calculate the new position
 \relax% TeX seems to be tired at this point; give it some rest ;-)))
 \ifdim\pcur>\plena %requested position > right margin; break line
   \brkln%
 \else%
   \hspace*{\skip0}%
 \fi%
 \box\poutbox%
}
\gdef\xnjo#1#2#3{%
 \count255 #2 \advance\count255 -\pdecr
 \skip0\ind \multiply\skip0\count255
 \advance\skip0-\pcur \divide\skip0 #1
 \count255 #2 %current start position (for line break)
 \ifdim\skip0<0.3em \skip0 0.3em \multiply\skip0 #1\fi%
 \ifdim\skip0>0.45em \skip0 0.45em \multiply\skip0 #1\fi%
   %copy #3 to \poutbox and add the width of the box to \pcur
 \setbox\poutbox=\hbox{#3}%
 \advance\pcur\wd\poutbox \advance\pcur\skip0
 \ifdim\pcur>\plena %requested position > right margin
   \brkln% insert a line break
 \else%
   \hspace*{\skip0}%
 \fi%
 \box\poutbox%
}
\gdef\njo#1#2{%
 \ifnum#1<0 \count255 -#1 \skip0 0pt\fi%
 \ifnum#1=0 \count255 0 \skip0 0pt\fi%
 \ifnum#1>0%
   \count255 #1 \advance\count255 -\pdecr
   \skip0\ind \multiply\skip0\count255
   \advance\skip0-\pcur
   \count255 #1 %current start position (for line break)
 \fi%
 \ifdim\skip0<0.25em \skip0 0.25em\fi%
 \ifdim\skip0>0.55em \skip0 0.55em\fi%
 \ifnum#1<1 \skip0 0pt\fi%
   %copy #2 to \poutbox and add the width of the box to \pcur
 \setbox\poutbox=\hbox{#2}%
 \advance\pcur\wd\poutbox \advance\pcur\skip0
 \ifdim\pcur>\plena %requested position > right margin
   \brkln% insert a line break
 \else%
   \hspace*{\skip0}%
 \fi%
 \box\poutbox%
}
\gdef\mpout#1#2#3#4{%
 \ifnum#1>0 \skip0\ind\multiply\skip0 by #1\advance\skip0-\pcur \fi%
 \ifdim\skip0<0pt \skip0 0pt\fi% don't move back!
 \ifnum#1>0 \hspace*{\skip0}\advance\pcur\skip0\fi%
 \setbox\poutbox=\hbox{#3}\skip0\wd\poutbox %width of one output character (#3)
 \skip1\ind\multiply\skip1 by #2 \skip2\skip1 \advance\skip1-\pcur
 \pcur\skip2 \advance\pcur\skip0 \skip2\skip1 %total width of line
 \advance\skip0 #4 %add kern
 \divide\skip1\skip0 \count255\skip1 \advance\count255 by 1% number of characters
 \skip1\wd\poutbox \multiply\skip1 by \count255 \advance\skip2 -\skip1
 \ifdim\skip2<0pt \advance\count255 -1 \advance\skip2 \wd\poutbox \fi%
 \divide\skip2\count255
 \copy\poutbox%
 \loop%
   \ifnum\count255>0\advance\count255 by -1 \hspace*{\skip2}\copy\poutbox%
 \repeat%
}

\endinput
%%
%% End of file `position.sty'.