% This is for report only.
% Note: in order to have properly centered captions, set
% rcaption takes two arguments, the first is the caption,
% the second is the width (height) of the caption.

\input rotate.sty

\def\rcaption{\refstepcounter\@captype \@dblarg{\@rcaption\@captype}}

\long\def\@rcaption#1[#2]#3#4{\par\addcontentsline{\csname
  ext@#1\endcsname}{#1}{\protect\numberline{\csname
  the#1\endcsname}{\ignorespaces #2}}\begingroup
    \@parboxrestore
    \normalsize
    \@makercaption{\csname fnum@#1\endcsname}{\ignorespaces #3}{ #4}
  \endgroup}

\long\def\@makercaption#1#2#3{
   \setbox\@tempboxa\hbox{#1: #2}
   \ifdim \wd\@tempboxa > #3   % IF longer than one line:
       \vskip -#3
       \hfill \rotate{\parbox{#3}{ \center #1: #2 \endcenter}}
            \else                        %   ELSE  center.
   \vskip -#3
       \hfill\rotate{\hbox to #3{\hfil\box\@tempboxa\hfil}}
   \fi}
