Path: kusu!shiwasu!wnoc-fukuoka-news!astemgw!kuis!kuee!kimura2.kuee.kyoto-u.ac.jp
From: tsato@kimura2.kuee.kyoto-u.ac.jp (Toru Sato)
Newsgroups: fj.comp.texhax
Subject: {left|right}{figure|table} macro
Message-ID: <3412@kuee.kuee.kyoto-u.ac.jp>
Date: 4 Oct 91 04:51:11 GMT
Sender: KUEE News Administrator <news@kuee.kuee.kyoto-u.ac.jp>
Distribution: fj
Organization: Dept. of Electr. Eng., Kyoto Univ., Japan
Lines: 145
Reply-To: fj-comp-texhax@ces.kyutech.ac.jp
 

$@:4F#!w5W!9$KF(Hr9TF0$7$F$7$^$C$?!%5~Bg(J $@$G$9!#(J

$@!!!!!!!!!!!!!!!!!!!!K\J8$N1&$d:8$K>.$5$J?^$dI=$rF~$l$k$?$a$N%^%/%m$G$9!#(J
 ---------------    $@$3$l$^$G$b5DO@$5$l$F$$$k$h$&$K!"(JLaTeX$@$K$O$3$N$?$a$N(J
 |  a  |   b   |    $@$^$H$b$J%^%/%m$O$"$j$^$;$s!#$3$3$K%]%9%H$9$k$b$N$b!"(J
 |-----|-------|    $@$$$m$$$mLdBj$,$"$j$^$9$,!"$&$^$/;H$($P$3$N$h$&$J=PNO(J
 | xxx |  ooo  |    $@$r:n$k$3$H$,$G$-$^$9!#<+J,$G$O!"(JLaTeX$@%H!<%?%k%,%$%I$H(J
 ---------------    $@$+$K$N$C$F$$$k(Jminipage$@$r;H$&J}K!$h$j$O$^$H$b$G!"3d$H(J
                    $@$^$7$J7k2L$,F@$i$l$k$H;W$C$F$$$^$9!##1!"#2%Z!<%8$N3X(J
  $@I=(J 1. xxx$@$H(Jooo    $@2q$NM=9F$H$+$K$O;H$($k!J<B$O$=$N$?$a$K:n$C$?$b$N$G$9!K(J
                    $@$H;W$&$N$G;H$C$F$d$C$F2<$5$$!#1Q8l$N@bL@$r=q$$$?$iHh$l(J
$@$F$7$^$C$?$N$G!"F|K\8l$N;H$$J}$O!v$J$7!v$G$9!#(J _o_
$@!!4pK\E*$K$O(JTeXbook$@$NBh(J14$@>O$K=q$$$F$"$k(J\parshape$@%3%^%s%I$r;H$C$F6uGr$r:n$j!"(J
LaTeX$@$N(Jfigure$@$H(Jtable$@$NDj5A$K$J$i$C$FBg$-$5$N$J$$%\%C%/%9$K?^$dI=$rF~$l$k!"(J
$@$H$$$&J}K!$G$9!#0J2<$N@bL@$HNc$r8+$F2<$5$$!J<jH4$-$G?=$7Lu$"$j$^$;$s!K!#(J

$@!!!!!!!!!!!!!!!!!!!!!!!!:4F#!!5|!wEE5$9)3XBhFs65<<!%5~ETBg3X(J
$@!!!!!!!!!!!!!!!!!!!!!!!!(Jtsato@kuee.kyoto-u.ac.jp
%=============================================================================
% cut.sty
%=============================================================================
% leftfigure, rightfigure, lefttable, righttable : produces a 'cut' at the
% right or left of the text.
%   by tsato@kuee.kyoto-u.ac.jp (Toru Sato)
%      Department of Electrical Engineering II, Kyoto University
%      Kyoto 606-01, Japan
%
%   Usage:  \begin{leftfigure}{width}{lines}
%             <figure body>
%           \end{leftfigure}
%           <a paragraph>
%   Example:
%         ...preceding text...
%
%         \begin{leftfigure}{60mm}{12}
%         \vspace{35mm}
%         \caption{This figure has width of 60mm and height of 12 lines.}
%         \end{leftfigure}  % note that here should not be a blank line
%         This text comes at the right of the figure.
%         If the text in this paragraph is not long enough to cover the height
%         of the figure, use
%         \Par
%         Command to connect the next paragraph.
%
%   Limitations:
%      1) It must be placed at the top of a paragraph, and the effect is
%         limited inside the paragraph (so you should not put a blank line
%         after \end{left|rightfigure}). Connect following paragraph(s) by
%         \Par command in place of a blank line, if it is necessary.
%         Naturally, one paragraph can contain only one left|rightfigure.
%      2) It cannnot handle end-of-page problem. You have to place it at the
%         right place so that entire lines are put on one page.
%      3) You have to specify the vertical size by the number of lines.
%         Although the paragraph may contain equations, each displayed
%         equation should be counted as 3 lines.
%      4) Ordinary \caption command can be used for a caption, and numbering
%         is made properly. It is possible to put it among ordinary figures,
%         but there is no guarantee that the order of the figures is kept
%         right.
%      5) The paragraph should not be the last paragraph of the document.
%=============================================================================
\newdimen\lfsep
\lfsep=3ex       % separation between the figure/table and text/margin
%=============================================================================
\def\leftfigure#1#2{\makeblank{#1}{#2}{#1}
\begin{nullfloat}{figure}{#1}{-#1}}
% next \def puts the following paragraph BEFORE the closing procedure
\def\endleftfigure#1 #2\par{\end{nullfloat}#2\par#1}

\def\rightfigure#1#2{\makeblank{#1}{#2}{0pt}
\@parwd=\textwidth \advance \@parwd by -#1
\begin{nullfloat}{figure}{#1}{\@parwd}}
\def\endrightfigure#1 #2\par{\end{nullfloat}#2\par#1}

\def\lefttable#1#2{\makeblank{#1}{#2}{#1}
\begin{nullfloat}{table}{#1}{-#1}}
\def\endlefttable#1 #2\par{\end{nullfloat}#2\par#1}

\def\righttable#1#2{\makeblank{#1}{#2}{0pt}
\@parwd=\textwidth \advance \@parwd by -#1
\begin{nullfloat}{table}{#1}{\@parwd}}
\def\endrighttable#1 #2\par{\end{nullfloat}#2\par#1}
%=============================================================================
% nullfloat : produces a table or figure whose size is 0pt x 0pt
\def\nullfloat#1#2#3{\def\@captype{#1} % #1=figure|table #2=width #3=lines
\noindent\leavevmode\hbox to 0pt \bgroup \hskip\lfsep\hskip #3
\vbox to 0pt \bgroup \hsize #2 \advance \hsize -2\lfsep
\textwidth\hsize\columnwidth\hsize \@parboxrestore}
\def\endnullfloat{\vss\egroup\hss\egroup\vskip-\baselineskip}

% makeblank : make a blank space at the right or left of text
\newdimen\@parwd \newcount\@nlp \newcount\@nlpi
\def\rightblank#1#2{\makeblank{#1}{#2}{0pt}}
\def\leftblank#1#2{\makeblank{#1}{#2}{#1}}
\def\makeblank#1#2#3{ % #1=width #2=lines #3=indent
\@parwd=\textwidth \advance \@parwd by -#1
\@nlp=1 \@nlpi=#2 \advance \@nlpi by 1
\edef\@PS{\parshape=\@nlpi}
\loop\ifnum\@nlp<\@nlpi \advance \@nlp by 1 \edef\@PS{\@PS #3\@parwd}\repeat
\edef\@PS{\@PS 0pt\textwidth} \@PS}
\def\Par{\\[\parskip]\hspace*{\parindent}}
%=============================================================================

% $@0J2<$O;HMQNc$G$9!#(J
%=============================================================================
\documentstyle[cut,a4j,12pt]{article}
\begin{document}
This is test. This is test. This is test. This is test. This is test.
This is test. This is test. This is test. This is test. This is test.
This is test. This is test. This is test. This is test. This is test.
This is test. This is test. This is test. This is test. This is test.

\begin{righttable}{60mm}{12}
\begin{center}
\begin{tabular}{|l|l|} \hline
test & test \\ \hline
test & This is test \\
test & This is test \\
test & This is test \\
test & This is test \\ \hline
\end{tabular}
\end{center}
\caption{This is caption. This is caption. This is caption.}
\end{righttable}
This is test. This is test. This is test. This is test. This is test.
This is test. This is test. This is test. This is test. This is test.
This is test. This is test. This is test. This is test. This is test.
\begin{equation}
a=b
\end{equation}
This is test. This is test. This is test. This is test. This is test.
This is test. This is test.
\Par
This is test. This is test. This is test.
This is test. This is test. This is test. This is test. This is test.
This is test. This is test. This is test. This is test. This is test.
This is test. This is test. This is test. This is test. This is test.
This is test. This is test. This is test. This is test. This is test.
This is test. This is test. This is test. This is test. This is test.

This is test. This is test. This is test. This is test. This is test.
This is test. This is test. This is test. This is test. This is test.
This is test. This is test. This is test. This is test. This is test.
\end{document}
%=============================================================================
