The midfloat package
Sigitas Tolušis
sigitas@[Link]
v1.1 from 2012/05/29
1 Introduction
It is denoted to place some material (from the left column) in full-width at any
place (but not at the top) on double-column page (\twocolumn mode). Existing
text remains as it was before insert. Placement is restricted to one page. (It is
some kind of dbfloat intext).
2 Usage
strip Provides new environment:
\begin{strip}[<top strip stretch skip>/<bottom strip skip>]
<wide onecolumn material>
\end{strip}
Puts \vbox{hwide onecolumn material i} in full-width on double-column page.
Adds \stripsep glue before and after (by default: 15pt).
It can be problems with floats and footnotes. In the case of problems with
footnotes it is possible to correct the situation using commands \footnotemark
and \footnotetext.
Parameters htop strip stretch skipi and hbottom strip skipi are optional. By
default htop strip stretch skipi=0pt and hbottom strip skipi=0pt. The material
on the right column under strip is stretched down by htop strip stretch skipi and
below strip is moved down by hbottom strip skipi.
3 Implementation
1 \NeedsTeXFormat{LaTeX2e}
2 \ProvidesPackage{midfloat}[1997/10/01]
3 \newif\if@vihproof \@vihprooftrue
1
4 \newtoks\juo@sar \juo@sar={}
5 \@ifundefined{stripsep}{\newskip\stripsep \stripsep 15\p@}{}
6 \newskip\m@addvipersep \m@addvipersep\z@
7 \newskip\c@addvipersep \c@addvipersep\z@
8 \newdimen\ht@strip
9 \newdimen\right@cor
10 \newdimen\cor@height \cor@height=\z@
11 \newdimen\juo@pr
12 \newdimen\juo@ht
13 \newdimen\c@colht
14 \newbox\@viper
15 \newbox\@rightcolumn
16 \newcount\juo@sk
17 \def\@ca#1#2#3#4{}
\add@strip
18 \def\add@strip#1#2#3#4{%
19 \begingroup
20 \xdef\ex@{\global\noexpand\juo@sar{\the\juo@sar\noexpand\@ca{#1}{#2}{#3}{#4}}}%
21 \ex@
22 \endgroup
23 }
\remove@strip
24 \def\remove@strip#1{\ifx#1\@empty\global\juo@sk=0\else
25 \global\advance\juo@sk by-1\expandafter\next@item\the #1\@@#1\fi}
\next@item
26 \def\next@item \@ca #1#2#3#4#5\@@#6{\global #6={#5}\global\juo@pr=#1\global\juo@ht=#2%
27 \global\cor@height=#3\global\m@addvipersep=#4}
\strip
28 \def\strip{\@ifnextsymb[{\@strip}{\@strip[0pt/0pt]}}
\@strip
29 \def\@strip[#1/#2]{\global\@tempdima=#1\global\@tempdimb=#2%
30 \global \setbox\@viper\vbox\bgroup%
31 \hsize\textwidth
32 \@parboxrestore
33 \col@number \@ne
34 \vrule height\topskip width0pt depth0pt
35 }
\endstrip
36 \def\endstrip{%
37 \egroup
38 \if@firstcolumn
39 \ifdim\pagetotal>\z@
40 \vskip\stripsep
2
41 \global\ht@strip\pagegoal
42 \global\advance\ht@strip by-\pagetotal
43 \global\advance\ht@strip by-\stripsep
44 \global\advance\ht@strip by-\ht\@viper
45 \global\advance\ht@strip by-\stripsep
46 \global\juo@ht=\ht\@viper
47 \else
48 \global\ht@strip\z@
49 \fi
50 \ifdim\ht@strip>\z@
51 \unvbox\@viper
52 \vskip\stripsep
53 \add@strip{\the\pagetotal}{\the\juo@ht}{\the\@tempdima}{\the\@tempdimb}%
54 \global\advance\juo@sk by1
55 \else
56 \@latex@error{Strip needs more place!}\@ehc
57 \if@vihproof
58 \framebox[\columnwidth]{??? Strip ???}%
59 \fi
60 \fi
61 \else
62 \@latex@error{Strip is used only on left column!}\@ehc
63 \if@vihproof
64 \framebox[\columnwidth]{??? Strip ???}%
65 \fi
66 \fi
67 }
\@outputdblcol
68 \def\@outputdblcol{%
69 \if@firstcolumn
70 \global \@firstcolumnfalse
71 \global \setbox\@leftcolumn \box\@outputbox
72 \global\c@colht\@colht\global\c@addvipersep\z@
73 \ifnum\juo@sk>0
74 \remove@strip\juo@sar
75 \global\@colht\the\juo@pr
76 \ifdim\right@cor>\z@
77 \global\advance\@colht by\right@cor
78 \fi
79 \global\advance\@colht by\cor@height
80 \global\cor@height=0pt
81 \fi
82 \global \setbox\@rightcolumn \vbox{}%
83 \else
84 \ifdim\c@colht>\@colht
85 \@tempdima\@colht
86 \ifdim\@colht>\z@
87 \global\setbox\@rightcolumn \vbox{%
88 \unvbox\@rightcolumn
3
89 \vbox to\@tempdima{%
90 \vskip\c@addvipersep\unvbox\@outputbox}%
91 \vskip\stripsep
92 \vrule height\the\juo@ht width 0pt depth 0pt
93 \vskip\stripsep
94 }%
95 \global\c@addvipersep\m@addvipersep
96 \else
97 \global\setbox\@rightcolumn \vbox{%
98 \unvbox\@rightcolumn
99 \vrule height\the\juo@ht width 0pt depth 0pt
100 \vskip\stripsep
101 }%
102 \fi
103 \ifnum\juo@sk>0
104 \remove@strip\juo@sar
105 \global\@colht\the\juo@pr
106 \global\advance\@colht by -\ht\@rightcolumn
107 \global\advance\@colht by\cor@height
108 \global\cor@height=0pt
109 \else
110 \global\advance\c@colht by-\ht\@rightcolumn
111 \global\@colht\c@colht
112 \fi
113 \else
114 \global \@firstcolumntrue
115 \global\setbox\@outputbox\vbox to\ht\@leftcolumn{%
116 \unvbox\@rightcolumn
117 \vskip\c@addvipersep
118 \unvbox\@outputbox
119 }%
120 \setbox\@outputbox \vbox {%
121 \hb@xt@\textwidth {%
122 \hb@xt@\columnwidth {%
123 \box\@leftcolumn \hss}%
124 \hfil
125 \vrule \@width\columnseprule
126 \hfil
127 \hb@xt@\columnwidth {%
128 \box\@outputbox \hss}%
129 }%
130 }%
131 \@combinedblfloats
132 \@outputpage
133 \begingroup
134 \@dblfloatplacement
135 \@startdblcolumn
136 \@whilesw\if@fcolmade \fi
137 {\@outputpage
138 \@startdblcolumn}%
4
139 \endgroup
140 \global\juo@sk=0\global\juo@sar={}%
141 \global\cor@height\z@\global\c@addvipersep\z@
142 \fi
143 \fi
144 }
\@cflt
145 \def \@cflt{%
146 \let \@elt \@comflelt
147 \setbox\@tempboxa \vbox{}%
148 \@toplist
149 \global\right@cor\ht\@tempboxa
150 \ifdim\right@cor>\z@
151 \global\advance\right@cor by-\floatsep
152 \global\advance\right@cor by\textfloatsep
153 \fi
154 \setbox\@outputbox \vbox{%
155 \boxmaxdepth \maxdepth
156 \unvbox\@tempboxa
157 \vskip -\floatsep
158 \topfigrule
159 \vskip \textfloatsep
160 \unvbox\@outputbox
161 }%
162 \let\@elt\relax
163 \xdef\@freelist{\@freelist\@toplist}%
164 \global\let\@toplist\@empty
165 }
\@ifnextsymb
166 \def\@ifnextsymb#1#2#3{%
167 \let\reserved@d=#1%
168 \def\reserved@a{#2}\def\reserved@b{#3}%
169 \futurelet\@let@token\@ifnsymb}
\@ifnsymb
170 \def\@ifnsymb{%
171 \ifx\@let@token\@sptoken
172 \let\reserved@c\reserved@b
173 \else
174 \ifx\@let@token\reserved@d
175 \let\reserved@c\reserved@a
176 \else
177 \let\reserved@c\reserved@b
178 \fi
179 \fi
180 \reserved@c}
181 %\endinput
5
Index
Numbers written in italic refer to the page where the corresponding entry is de-
scribed; numbers underlined refer to the code line of the definition; numbers in
roman refer to the code lines where the entry is used.
strip= \subitem strip+, \main{18}, 110, 111,
53 114, noexpand= \subitem *+\noexpand+, 20
advance= \subitem *+\advance+, 115,
25, 140, 141, 54, 77, 79, 106, 107, 110,151,
42--45,
152 149, 151, 152, 164 = \subitem +, 5
pagegoal= \subitem *+\pagegoal+, 41
begingroup= hfil= \subitem
\subitem *+\begingroup+, 19,*+\hfil+,
133 124, 126
pagetotal= \subitem *+\pagetotal+, 39, 4
bgroup= hsize= 30 \subitem *+\hsize+,
\subitem *+\bgroup+, 31
ProvidesPackage= \subitem *+\ProvidesPac
box= \subitem *+\box+, hss=71, 123,\subitem
128 *+\hss+, 123, 128
boxmaxdepth= \subitem strip= \subitem155
*+\boxmaxdepth+, strip+, relax=
8, 41--45, 48, 50 *+\relax+, 162
\subitem
ht= \subitem *+\ht+, 44, 46,
strip= 106,\subitem115,
110, 149 \main{24}, 74, 1
strip+,
addvipersep= \subitem addvipersep+, 7, 72, 90, 95, a=117, \subitem
141 a+, 168, 175
colht= \subitem colht+,fcolmade=
13, 72, 84, 110,\subitem
111 fcolmade+,
b= 136
\subitem b+, 168, 172, 177
number= firstcolumn=
\subitem number+, 33 \subitem firstcolumn+,
c= \subitem 38,c+,69 172, 175, 177, 180
columnseprule= \subitemvihproof=
*+\columnseprule+,
\subitem125 vihproof+,
d= 3, 57, 63
\subitem d+, 167, 174
columnwidth= ifdim= \subitem
\subitem *+\columnwidth+, 58,*+\ifdim+, 39, 50, 76, 84, 86, 150
64, 122, 127
cor= \subitem cor+, 9, 76, 77, 149--152
height= \subitem height+, ifnum=
10, 27, \subitem *+\ifnum+,
79, 80, 107, 108, 14173, 103
ifx= \subitem *+\ifx+, 24, 171, 174\subitem *+\setbox+, 30, 71, 82,
setbox=
def= \subitem *+\def+, 17, 18, 24, 26, 28, 29, 36, 68, 145, 166, 168,170
strip= \subitem *+\strip+, \usage{1}, \m
ht= \subitem ht+, 12, 26, 46, 53, 92, 99
egroup= \subitem *+\egroup+, 37 stripsep= \subitem *+\stripsep+, 5, 40, 4
pr= \subitem pr+, 11, 26, 75, 105
else= \subitem *+\else+,sar= 24, 47,\subitem
55, 61, sar+,
83, 96,
4, 109,
20, 74,113,104,
173,140 176
endgroup= \subitem *+\endgroup+, 22, 139 textfloatsep= \subitem *+\textfloatsep+,
sk= \subitem sk+, 16, 24, 25, 54, 73, 103, 140
endinput= \subitem *+\endinput+, 181 textwidth= \subitem *+\textwidth+, 31, 1
endstrip= let=
\subitem *+\endstrip+, \subitem
\main{36} the= 162,\subitem
*+\let+, 146, 164, 167, *+\the+, 20, 177
172, 175, 25, 53, 75, 9
= \subitem +, 20, 21 topfigrule= \subitem *+\topfigrule+, 158
expandafter= addvipersep=
\subitem *+\expandafter+, \subitem
25 topskip=
addvipersep+, \subitem
6, 27, 95 *+\topskip+, 34
maxdepth= \subitem *+\maxdepth+, 155
fi= \subitem *+\fi+, 25, 49, 59, 60, 65, 66, 78, unvbox= 81, 102, 112, \subitem
136,142,*+\unvbox+, 51, 88, 90
143, 153, 178, 179 NeedsTeXFormat= \subitem *+\NeedsTeXFormat+, 1
floatsep= newbox= 151,
\subitem *+\floatsep+, \subitem
157 vbox= 14,\subitem
*+\newbox+, 15 *+\vbox+, 30, 82, 87, 89
framebox= newcount= 58,\subitem
\subitem *+\framebox+, 64 vrule=
*+\newcount+, 16
\subitem *+\vrule+, 34, 92, 99, 1
futurelet= newdimen= 169\subitem *+\newdimen+,
\subitem *+\futurelet+, vskip= 8--13 *+\vskip+, 40, 52, 90, 9
\subitem
newif= \subitem *+\newif+, 3
global= newskip=
\subitem *+\global+, \subitem
20, 24--27, 30, xdef=
29, *+\newskip+,
41--46, 48,5--7 54, 70--72,
\subitem 75,77,
*+\xdef+, 20, 163
79, 80, 82, 87, newtoks= \subitem *+\newtoks+, 4
95, 97, 105–108, item= \subitem item+, 25, = \main{26}
\subitem +, 6, 7, 10, 39, 48, 50, 72,