summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/sttools/marginal.sty
blob: 4037895887653f5a76118a693b037aa837a9f07d (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
%%
%% This is file `marginal.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% marginal.dtx  (with options: `package')
%% 
%% Copyright (C) 1997-2012 by Sigitas Tolu\v{s}is <sigitas@vtex.lt>
%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
%% http://www.vtex.lt/tex/download/macros/
%% --------------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% 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.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% PURPOSE:   Enlarge free and show lost marginal inserts.
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{marginal}
    [2012/05/29 v1.1 Enlarge free and show lost marginal inserts]
\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
  }
\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
  }
\def\enlargefreelist{%
  \@for\curr@option:={S,T,U,W,X,Y,Z,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}%
    \do{\expandafter\newinsert\csname bx@\curr@option\endcsname}%
  \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
%%
%% End of file `marginal.sty'.