summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ptptex/wrapft.sty
blob: 9bfd271bda289bfd0cd32c76e5f29a5a095a4629 (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
\ProvidesPackage{wrapft}[2004/05/24 ver.0.95]
\RequirePackage{wrapfig}[1999/10/12 \space  v 3.3]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newdimen\WFcolsep %horizontal separation between fig and text
\newdimen\WFtextsep %vspace on the top and the bottom of the figure
\WFcolsep=1.6\columnsep 
\WFtextsep=\intextsep
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\WF@rapt[#1]#2{% final two args: #1 = overhang,  #2 = width,
 \ifnum `c=\WF@place % fig in the center
    \@tempdima\hsize \advance\@tempdima-#2 \divide\@tempdima\tw@
    \vskip\WFtextsep
    \noindent \hspace*{\@tempdima}\begin{minipage}[t]{#2}%
 \else
  \gdef\WF@ovh{#1}% hold overhang for later, when \width is known
  \global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
  \ifdim\hsize>\z@ \@parboxrestore \else 
  \setbox\z@\hbox\bgroup \let\wf@@caption\caption \let\caption\wf@caption 
  \ignorespaces \fi
 \fi}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\let\WF@@putfigmaybe\WF@putfigmaybe
\def\WF@putfigmaybe{%
 \columnsep \WFcolsep  \intextsep \WFtextsep
 \WF@@putfigmaybe}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\let\@endwr@pfigure\endwrapfigure
\def\endwrapfigure{%
 \ifnum `c=\WF@place % fig in the center
    \end{minipage} \vskip\WFtextsep
 \else
    \@endwr@pfigure
 \fi}
\let\endwraptable\endwrapfigure
%----- end of wrapft.sty ---------