summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/sttools/marginal.sty
blob: 58b2fb373ce22b9077cf9f29441dad6dbc3cced6 (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
%% marginal.sty
%% Copyright 1997 Sigitas Tolu\v sis
%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
%% e-mail sigitas@vtex.lt
%% http://www.vtex.lt/tex/download/macros/
%%
% This program can 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 (at your option) any later version.
%
% PURPOSE:   Enlarge free and show lost marginal inserts
%
% SHORT DESCRIPTION:
%
% \showlostmarginals
% ------------------
%   Outputs lost marginal notes at the left of page
%
% \enlargefreelist 
% ----------------
%   Adds more(34) free inserts to freelist
%
% \onesidemarginals 
% -----------------
%   Outputs marginal notes only on one side. It saves one half 
%   of the available free inserts.
%
\ProvidesPackage{marginal}[1997/04/01]
%
\newif\if@mparlost      \@mparlostfalse
%
\newbox\@mparlostbox
\setbox\@mparlostbox\vbox{}
%
\gdef\@fltovfpar{\global\@mparlosttrue%
  \@latex@warning{Too many unprocessed (marginal)floats}\relax}
\gdef\@fltovfmess{%
  \@latex@error{Too many unprocessed floats}\@ehb}
%
\def\marginpar{\ifhmode \@bsphack\@floatpenalty -\@Mii\else
   \@floatpenalty-\@Miii\fi\ifinner
      \@parmoderr\@floatpenalty\z@
    \else\@next\@currbox\@freelist{}{}\@next\@marbox\@freelist{\global
      \count\@marbox\m@ne}{\@floatpenalty\z@ \@fltovfmess
         \def\@currbox{\@tempboxa}\def\@marbox{\@tempboxa}}\fi
     \@ifnextchar [\@xmpar\@ympar}
%
\long\def \@savemarbox #1#2{%
  \global\setbox #1%
    \color@vbox
      \vtop{%
        \hsize\marginparwidth
        \@parboxrestore
        \@marginparreset
        #2%
        \global\@minipagefalse
        \outer@nobreak
        }%
    \color@endbox%
    \if@mparlost\global\setbox\@mparlostbox\vbox{\unvbox\@mparlostbox\copy#1}%
    \global\@mparlostfalse\fi
}
%
%   \showlostmarginals - outputs lost marginal notes at the left of the page
%
\def\showlostmarginals{%
  \global\let\old@textbottom\@textbottom
  \gdef\@textbottom{\vtop to\z@{\hbox to\z@{\kern-\wd\@mparlostbox\vbox 
  to\z@{\kern-\ht\@mparlostbox\box\@mparlostbox\vfill}}}\old@textbottom}%
  \global\let\@fltovfmess\@fltovfpar}
%
%   \enlargefreelist - Adds more(34) free inserts to freelist
%
\def\enlargefreelist{%
\newinsert\bx@S
\newinsert\bx@T
\newinsert\bx@U
\newinsert\bx@V
\newinsert\bx@W
\newinsert\bx@X
\newinsert\bx@Y
\newinsert\bx@Z
\newinsert\bx@a
\newinsert\bx@b
\newinsert\bx@c
\newinsert\bx@d
\newinsert\bx@e
\newinsert\bx@f
\newinsert\bx@g
\newinsert\bx@h
\newinsert\bx@i
\newinsert\bx@j
\newinsert\bx@k
\newinsert\bx@l
\newinsert\bx@m
\newinsert\bx@n
\newinsert\bx@o
\newinsert\bx@p
\newinsert\bx@q
\newinsert\bx@r
\newinsert\bx@s
\newinsert\bx@t
\newinsert\bx@u
\newinsert\bx@v
\newinsert\bx@w
\newinsert\bx@x
\newinsert\bx@y
\newinsert\bx@z
\gdef\@freelist{\@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E
                \@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt\bx@I\@elt\bx@J
                \@elt\bx@K\@elt\bx@L\@elt\bx@M\@elt\bx@N
                \@elt\bx@O\@elt\bx@P\@elt\bx@Q\@elt\bx@R
                \@elt\bx@S\@elt\bx@T\@elt\bx@U\@elt\bx@V
                \@elt\bx@W\@elt\bx@X\@elt\bx@Y\@elt\bx@Z
                \@elt\bx@a\@elt\bx@b\@elt\bx@c\@elt\bx@d\@elt\bx@e
                \@elt\bx@f\@elt\bx@g\@elt\bx@h\@elt\bx@i\@elt\bx@j
                \@elt\bx@k\@elt\bx@l\@elt\bx@m\@elt\bx@n
                \@elt\bx@o\@elt\bx@p\@elt\bx@q\@elt\bx@r
                \@elt\bx@s\@elt\bx@t\@elt\bx@u\@elt\bx@v
                \@elt\bx@w\@elt\bx@x\@elt\bx@y\@elt\bx@z}%
}
%
%   \onesidemarginals - outputs marginals only on one side
%
\def\onesidemarginals{%
\newbox\@marbox
\gdef\@addmarginpar{\@cons\@freelist\@currbox
    \@tempdima\@mparbottom
    \advance\@tempdima -\@pageht
    \advance\@tempdima\ht\@currbox
    \ifdim\@tempdima >\z@
      \@latex@warning@no@line {Marginpar on page \thepage\space moved}%
    \else
      \@tempdima\z@
    \fi
    \global\@mparbottom\@pageht
    \global\advance\@mparbottom\@tempdima
    \global\advance\@mparbottom\dp\@currbox
    \global\advance\@mparbottom\marginparpush
    \advance\@tempdima -\ht\@currbox
    \global\setbox \@currbox
                   \vbox {\vskip \@tempdima
                          \box \@currbox}%
    \global \ht\@currbox \z@
    \global \dp\@currbox \z@
    \kern -\@pagedp
    \nointerlineskip
    \hb@xt@\columnwidth
      {\hskip\columnwidth \hskip\marginparsep \box\@currbox \hss}%
    \nointerlineskip
    \hbox{\vrule \@height\z@ \@width\z@ \@depth\@pagedp}}%
%
\gdef\marginpar{\ifhmode \@bsphack\@floatpenalty -\@Mii\else
   \@floatpenalty-\@Miii\fi\ifinner\@parmoderr\@floatpenalty\z@
    \else\@next\@currbox\@freelist{\global
      \count\@currbox\m@ne}{\@floatpenalty\z@ \@fltovfmess
         \def\@currbox{\@tempboxa}}\fi
     \@ifnextchar [\@xmpar\@ympar}%
%
\long\gdef\@xmpar[##1]##2{\@savemarbox\@currbox{##2}\@xympar}%
\long\gdef\@ympar##1{\@savemarbox\@currbox{##1}\@xympar}%
\def \@xympar{%
%  \ifnum\@floatpenalty <\z@\@cons\@currlist\@marbox\fi
  \setbox\@tempboxa
    \color@vbox
      \vbox \bgroup
  \end@float
  \global \@ignorefalse \@esphack}%
}
\endinput