% TPIC rotation style (tpicrot.sty)
%  bear@hashi1.civil.tohoku.ac.jp (5/16/1993) "stolen" from loval.sty
%  put % at the ends of all the lines just in case
%  always need "eclarith.sty" by Mr. Isozaki
%
%  sample is after the line of \endinput
%
\newbox\@rotatetmpbox%
\newdimen\@tmpdimd \newdimen\@tmpdimh \newdimen\@tmpdimw%
\newdimen\@oldunitl%
\newcount\@textw \newcount\@texth \newcount\@textd%
\newif\if@horizontalrotspace \newif\if@verticalrotspace%
%
\def\rotatebox{\global\@horizontalrotspacetrue%
 \global\@verticalrotspacetrue\@ifnextchar [{\@rot@tebox}{\@rot@tebox[90]}}
%
\def\Rotatebox{\global\@horizontalrotspacefalse%
  \@ifstar{\global\@verticalrotspacefalse\@Rotatebox}%
          {\global\@verticalrotspacetrue\@Rotatebox}}
%
\def\@Rotatebox{\@ifnextchar [{\@rot@tebox}{\@rot@tebox[90]}}
%
\long\def\@rot@tebox[#1]#2{\relax\leavevmode%
 \DegRad{-#1}\@ngleofrot@tion%
 \@oldunitl=\unitlength%
 \unitlength.01pt%
%
 \setbox\@rotatetmpbox\hbox{#2}%
 \@tmpdimd=\dp\@rotatetmpbox%
 \@tmpdimh=\ht\@rotatetmpbox%
 \@tmpdimw=\wd\@rotatetmpbox%
 \@textw=\@tmpdimw\divide\@textw by\unitlength%
 \@texth=\@tmpdimh\divide\@texth by\unitlength%
 \@textd=\@tmpdimd\divide\@textd by\unitlength%
%
 \Sin{-\@ngleofrot@tion}\@Sinrot \Cos{-\@ngleofrot@tion}\@Cosrot%
 \ifdim\@Sinrot pt<0pt\def\@SinRot{-\@Sinrot}\else\def\@SinRot{\@Sinrot}\fi%
 \ifdim\@Cosrot pt<0pt\def\@CosRot{-\@Cosrot}\else\def\@CosRot{\@Cosrot}\fi%
%
 \Mul{\@CosRot}{\number\@textw}\@tempa%
 \Mul{\@SinRot}{\number\@texth}\@rotxoffset%
 \Add{\@rotxoffset}{\@tempa}\@tempb%
 \Mul{\@SinRot}{\number\@textd}\@tempa%
 \Add{\@tempa}{\@tempb}\@rotationboxwidth%
%
 \Mul{\@CosRot}{\number\@texth}\@tempa%
 \Mul{\@SinRot}{\number\@textw}\@rotationboxheight%
 \Add{\@tempa}{\@rotationboxheight}\@tempb%
 \Mul{\@CosRot}{\number\@textd}\@rotyoffset%
 \Add{\@tempb}{\@rotyoffset}\@rotationboxheight%
%
 \ifdim\@Sinrot pt>0.0pt%
    \Mul{\@Sinrot}{\number\@texth}\@tempa%
  \ifdim\@Cosrot pt>0.0pt%
    \Mul{\@Cosrot}{\number\@textd}\@rotyoffset%
    \Mul{1}{\@tempa}\@rotxoffset%
  \else \Mul{\@CosRot}{\number\@texth}\@rotyoffset%
    \Mul{\@CosRot}{\number\@textw}\@tempb%
    \Add{\@tempa}{\@tempb}\@rotxoffset%
  \fi%
 \else%
    \Mul{\@SinRot}{\number\@textd}\@tempa%
    \Mul{\@SinRot}{\number\@textw}\@tempb%
  \ifdim\@Cosrot pt>0.0pt%
   \Mul{1}{\@tempa}\@rotxoffset%
   \Mul{\@Cosrot}{\number\@textd}\@tempa%
   \Add{\@tempa}{\@tempb}\@rotyoffset%
  \else%
   \Mul{\@CosRot}{\number\@textw}\@rotyoffset%
   \Add{\@rotyoffset}{\@tempa}\@rotxoffset%
   \Mul{\@CosRot}{\number\@texth}\@tempa%
   \Add{\@tempa}{\@tempb}\@rotyoffset%
  \fi%
 \fi%
%
 \ifdim\@Sinrot pt>0.0pt%
  \ifdim\@Cosrot pt>0.0pt \@tmpdimh=\@Cosrot\@tmpdimd%
   \else \@tempdima=-\@Cosrot\@tmpdimh \@tmpdimh\@tempdima \fi%
 \else \@tempdima=-\@Sinrot\@tmpdimw%
  \ifdim\@Cosrot pt>0.0pt \@tmpdimw=\@Cosrot\@tmpdimd%
  \else \@tmpdimw=-\@Cosrot\@tmpdimh%
  \fi \advance\@tempdima\@tmpdimw \@tmpdimh\@tempdima%
 \fi%
%
 \hbox{\if@verticalrotspace\lower\@tmpdimh\fi%
  \hbox%
   {\relax%
    \if@horizontalrotspace\else%
      \def\@rotationboxwidth{0}\def\@rotxoffset{0}\fi%
    \if@verticalrotspace\else%
      \def\@rotationboxheight{0}\def\@rotyoffset{0}\fi%
    \begin{picture}(\@rotationboxwidth,\@rotationboxheight)%
     \put(\@rotxoffset,\@rotyoffset){\special{rt 0 0 \@ngleofrot@tion}%
      \makebox(0,0)[bl]{#2}\special{rt 0 0 0}}%
    \end{picture}\relax%
  }%
 }%
 \unitlength=\@oldunitl%
}
%
\endinput
%%%%%%%%%%%%%%%%%%%
%     sample      %
%%%%%%%%%%%%%%%%%%%
\documentstyle[eclarith,tpicrot]{article}
\title{for {\bf TPIC} rotation special}
\author{a user}
\date{July 15, 1993}
\begin{document}
\maketitle

A new feature is added into TPIC about rotating strings in
the device driver ``{\tt dviout/prt} v.2.39''.
To use \verb+\special{rt ...}+ within text lines.\vspace{2em}

\begin{minipage}{.2\textwidth}\ \end{minipage}~%
\fbox{\begin{minipage}{.5\textwidth}
\begin{center} CONCERT\\
{\sc Tpic Symphony Orchestra}\\
May 16, 1993, 7:00 pm \\
at TPIC Orchestra Hall \\
{\LARGE\bf\Rotatebox*[20]{Cancelled}}
All \LaTeX\  Programs
\end{center}
\end{minipage}}

\begin{minipage}{.2\textwidth}\ \end{minipage}~%
\fbox{\begin{minipage}{.5\textwidth}
\begin{center} FOR SALE\\
{\sc Tpic Fancy Boutique}\\
May 16, 1993 \\
Tpic-Brand for{\LARGE\bf\Rotatebox*[20]{Sold Out}} Ladies and Girls \\
All \LaTeX\  Imitation Jewelry
\end{center}
\end{minipage}}

To use:
\begin{center}
Need `eclarith.sty' as an option, so that the document must be\\
\verb+\documentstyle[eclarith,tpicrot]{article}+\\
Usage\\
\verb+\rotatebox[angle]{strings}+
\end{center}
where `angle' must be specified by {\bf degree} and its default
is 90 degrees.

\begin{itemize}
\item \verb+\rotatebox+ opens space vertically and horizontally
to embed a box of rotated strings.
\item \verb+\Rotatebox+ opens only vertical space.
\item \verb+\Rotatebox*+ opens no space.
\end{itemize}

\vspace{10em}%
\hspace*{4cm}\ %
{\Rotatebox*[40]{40 degrees}}%
{\Rotatebox*[80]{80 degrees}}%
{\Rotatebox*[120]{120 degrees}}%
{\Rotatebox*[160]{160 degrees}}%
{\Rotatebox*[200]{200 degrees}}%
{\Rotatebox*[240]{240 degrees}}%
{\Rotatebox*[280]{280 degrees}}%
{\Rotatebox*[320]{320 degrees}}%
{\Rotatebox*[360]{360 degrees}}%
\vspace{10em}

\section*{rotatebox}

\fbox{\begin{minipage}[t]{.45\textwidth}
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box.
This is{\Large\bf\rotatebox[20]{20 degrees}} a box.
This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
\end{minipage}}\hfill
\fbox{\begin{minipage}[t]{.45\textwidth}
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box.
This is{\Large\bf\rotatebox[140]{140 degrees}} a box.
This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
\end{minipage}}

\fbox{\begin{minipage}[t]{.45\textwidth}
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box.
This is{\Large\bf\rotatebox[230]{230 degrees}} a box.
This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
\end{minipage}}\hfill
\fbox{\begin{minipage}[t]{.45\textwidth}
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box.
This is{\Large\bf\rotatebox[310]{310 degrees}} a box.
This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
\end{minipage}}

\section*{Rotatebox}

\fbox{\begin{minipage}[t]{.45\textwidth}
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box.
This is{\Large\bf\Rotatebox[20]{20 degrees}} a box.
This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
\end{minipage}}\hfill
\fbox{\begin{minipage}[t]{.45\textwidth}
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box.
This is{\Large\bf\Rotatebox[140]{140 degrees}} a box.
This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
\end{minipage}}

\fbox{\begin{minipage}[t]{.45\textwidth}
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box.
This is{\Large\bf\Rotatebox[230]{230 degrees}} a box.
This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
\end{minipage}}\hfill
\fbox{\begin{minipage}[t]{.45\textwidth}
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box.
This is{\Large\bf\Rotatebox[310]{310 degrees}} a box.
This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
\end{minipage}}

\section*{Rotatebox*}

\fbox{\begin{minipage}[t]{.45\textwidth}
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box.
This is{\Large\bf\Rotatebox*[20]{20 degrees}} a box.
This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
\end{minipage}}\hfill
\fbox{\begin{minipage}[t]{.45\textwidth}
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box.
This is{\Large\bf\Rotatebox*[140]{140 degrees}} a box.
This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
\end{minipage}}

\fbox{\begin{minipage}[t]{.45\textwidth}
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box.
This is{\Large\bf\Rotatebox*[230]{230 degrees}} a box.
This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
\end{minipage}}\hfill
\fbox{\begin{minipage}[t]{.45\textwidth}
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box.
This is{\Large\bf\Rotatebox*[310]{310 degrees}} a box.
This is a box. This is a box.
This is a box. This is a box. This is a box.
This is a box. This is a box. This is a box.
\end{minipage}}

\end{document}
