=1 i

The isorot Package User Manual

Peter Wilson

                      peter.r.wilson@boeing.com

15 February 2000

Abstract The facilities in the isorot package are described. The package was initially designed for use with the iso class but can be used with the ‘normal’ classes as well. The package enables the rotation of document elements, like text or tables of figures.

Contents

1 Introduction 1 2 Options 1 3 DVI drivers 1 4 Rotational directions 3 5 Rotation of text 3 6 Rotations of tables and figures 8 7 Rotation of float captions and bodies 9 8 Landscaping 14

List of Figures

1 Example rotation through multiple angles . . . . . . . . . . . . . . . . . . . 7 2 Example figure with a standard caption. . . . . . . . . . . . . . . . . . . . . 9 3 Figure 2 with a rotated caption. . . . . . . . . . . . . . . . . . . . . . . . . 10 4 Rotation of paragraphs between 0 and -320 degrees . . . . . . . . . . . . . . 11 5 Rotation of paragraphs between 0 and 320 degrees . . . . . . . . . . . . . . 12

List of Tables

1 The rotation facilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1 Introduction

The isorot package enables the rotation of document elements on a page. It uses the L^{A}TEX \special command to perform its effects, and thus can only be used with a limited number of TEX to print routes. The facilities available are summarized in Table 1.

isorot is a modification of the rotation.sty file created by Rahtz and Barroca [RB92]. Further examples of the usage of their style are given in Goosens et al [GMS94]. The package also uses David Carlisle’s graphicx and lscape packages.

Note: Several examples of the effects of the commands described herein are shown. In many cases the results are not pretty. This should act as a warning that using rotational elements requires more care than most other document elements.

2 Options

The isorot facility has one option, namely debugshow. Calling this option produces messages on the screen and in the log file regarding the actions being taken.

Note: This option is principally of interest to the maintainer of the facility.

The font used for the captions of rotated figures or tables is controlled by the rotcapfont command. Under normal circumstances this is a null command but when used with the iso class it is defined as:

\newcommand{\rotcapfont}{\captionsisize\bf}

where \captionsize is defined in the class. You can renew \rotcapfont to change the caption font to your liking.

3 DVI drivers

The isorot facility supports only a limited number of dvi to postscript translators. The default translator is dvips. The following command must be put in the preamble of the document if dvips is not being used: \rotdriver{<drivername>}, where <drivername> is one of the following:^{1}

1. dvipdf for the dvipdf translator;

2. dvips for Tom Rockicki’s dvips translator;

3. dvipsone for Y&Y’s dvipsone translator;

4. dvitops for James Clark’s dvitops translator; 3 DVI DRIVERS 2

1I have been able to try the dvips driver but not the others. If anyone has experience with the other drivers, or has extended the range of drivers, I would like to be given the results.

Table 1: The rotation facilities

Facility  Effect

Commands

\rotdriver{<driver>} declare the name of the dvi to Postscript translator (default dvips)
\clockwise  sets rotation direction clockwise for positive angles (the default)
\counterclockwise  sets rotation direction counterclockwise for positive angles
\figuresright  sets rotation direction for sideways floats counterclockwise (the default)
\figuresleft  sets rotation direction for sideways floats clockwise
\rotcaption  like the caption command, but rotates the caption through 90 degrees
\controtcaption  like the contcaption command, but rotates the caption through 90 degrees

Environments

sideways  rotates the contents through 90 degrees counterclockwise
turn  rotates the contents through the given angle
rotate  rotates the contents through the given angle, but no space allowed for the result
sidewaystable  like the table environment, but rotated 90 degrees

sidewaystable*  twocolumn version of sidewaystable

sidewaysfigure  like the figure environment, but rotated 90 degrees

sidewaysfigure*  twocolumn version of sidewaysfigure

landscape  prints all enclosed pages in landscape mode

5. dviwindo for Y&Y’s dviwindo translator;

6. pctex32 for Personal TeX’s PC TeX for 32 bit Windows (pctex32 ) translator;

7. pctexps for Personal TeX’s PC PTI Laser/PS (pctexps) translator;

8. pubps for the Arbortext’s pubps translator.

9. textures for Blue Sky’s Textures translator;

The isorot package can also be used in documents processed by pdfLaTeX.

4 Rotational directions

isorot enables the textual and other elements of a document to be rotated from their normal horizontal layout. In some cases elements can be rotated through arbitrary angles, whereas in others only 90 degree rotation is possible.

By default, a rotation through a positive number of degrees corresponds to a clockwise rotation. The command \counterclockwise sets the following rotations to be counterclockwise for positive angles. The command \clockwise sets the following rotations to be clockwise for positive angles. These commands can be used to toggle the rotational behavior.

Rotated floating environments are normally rotated so that they are printed with a counterclockwise rotation (i.e. the original bottom of the float is placed at the right hand side of the paper), which is what is normally required. This behavior can be altered by the command \figuresleft, which will give the reverse effect. The command \figuresright will set the behavior to the default. These commands can be used to toggle the rotational behavior of floats.

5 Rotation of text

The sideways environment rotates the contents of the environment by 90 degrees counterclockwise, and leaves space for the result.

The \begin{turn}{<angle>} environment rotates the contents by the given number of degrees in the direction specified by the most recent of the \clockwise or \counterclockwise commands, leaving space for the result.

The \begin{rotate}{<angle>} environment rotates the contents by the given number of degrees in the direction specified by the most recent of the \clockwise or \counterclockwise commands, but no arrangements are made for leaving space for the result.

Example: Some simple rotations: This code

5 ROTATION OF TEXT 4

Default rotation direction: \\
A
\begin{sideways}%
B C
\end{sideways}
D E F G H I J K L M
\begin{turn}{-90}%
Minus 90 turn
\end{turn}
N O P
\begin{rotate}{90}%
Plus 90 rotate
\end{rotate}
Q \\
and continue on with another line after rotations.

produces the following (note how space is allowed for the turned text, whereas the rotated text runs into the text below).

Default rotation direction:

A B C D E F G H I J K L M Minus 90 turn N O P Plus 90 rotate Q and continue on with another line after rotations.

Example: This example shows the effect of using the \counterclockwise command.

This code

Flip rotation direction: \\
\counterclockwise
A
\begin{sideways}%
B C
\end{sideways}
D E F G H I J K L M
\begin{turn}{-90}%
Minus 90 turn
\end{turn}
N O P
\begin{rotate}{90}%
Plus 90 rotate
\end{rotate}
Q \\
Set rotation direction back to default value.
\clockwise

produces the following, which should be compared with example 5.

Flip rotation direction:

A B C D E F G H I J K L M Minus 90 turn N O P Plus 90 rotate Q

Set rotation direction back to default value.

Although the examples so far have only shown the rotation of text, boxes can also be rotated.

Example: Rotating a box.

This code

\newsavebox{\foo}
\newlength{\fool}
\settowidth{\fool}{Hurrah for ISO.}
\savebox{\foo}{\parbox{\fool}{Hurrah for ISO. Hurrah for ISO.
                              Hurrah for ISO. Hurrah for ISO.}}
Start
\usebox{\foo}
\&
\begin{turn}{-45}\usebox{\foo}\end{turn}
\&
\begin{turn}{45}\usebox{\foo}\end{turn}
End

produces:

Start Hurrah for ISO. Hurrah for ISO. Hurrah for ISO. Hurrah for ISO. &  Hurrah for ISO. Hurrah for ISO. Hurrah for ISO. Hurrah for ISO.&  Hurrah for ISO. Hurrah for ISO. Hurrah for ISO. Hurrah for ISO.End

Elements can be rotated through arbitrary angles, and also rotated elements can be nested inside other rotated elements.

Example: Repeated rotation:

The following example code shows that text can be rotated through any angle. The result is shown in Figure 1.

\newcount\prwc
\newsavebox{\prwtext}
\newdimen\prwspace
\def\wheel#1#2{%
  \savebox{\prwtext}{#1\begin{sideways}#2\end{sideways}}%
  \prwspace\wd\prwtext%
  \advance\prwspace by 1cm%
  \centerline{%
  \rule{0pt}{\prwspace}%
  \rule[-\prwspace]{0pt}{\prwspace}%
  \prwc=-180\loop\ifnum\prwc<180
  \rlap{\begin{rotate}{\the\prwc}%
  \rule{1cm}{0pt}\usebox{\prwtext}\end{rotate}}%
  \advance\prwc by 20\repeat}}
\begin{figure}
\wheel{Express yourself ---}{Hooray for STEP!}
\caption{Example rotation through multiple angles}
\label{fig:wheel}
\end{figure}

Later in the manual, Figures 4 and 5 also show rotations through a range of angles, both positive and negative.

Example: Nested rotations.

This code

    Here is some text before a \verb|sideways| environment.
And some more, and more and more garble gobble cluck
click clack clock cluck and so on and on and on.
\begin{center}
\begin{sideways}
\rule{1in}{0pt}
\begin{tabular}{|lr|}
\begin{rotate}{-45}\emph{Word}\end{rotate} & \begin{rotate}{-90}%
Occurrences\end{rotate}
\\
\hline
hello & 33 \\
goodbye & 34 \\
\hline
\end{tabular}
\end{sideways}
\end{center}
    Here is some text after a \verb|sideways| environment.
 And some more, and more and more garble gobble cluck
click clack clock cluck and so on and on and on.

produces:

5 ROTATION OF TEXT 7 Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Express yourself — Hooray for STEP!

Figure 1: Example rotation through multiple angles

Here is some text before a sideways environment. And some more, and more and more garble gobble cluck click clack clock cluck and so on and on and on.

Word  Occurrences
hello  33
goodbye 34

Here is some text after a sideways environment. And some more, and more and more garble gobble cluck click clack clock cluck and so on and on and on.

6 Rotations of tables and figures

The previous examples have demonstrated the rotation of textual elements. For instance, the last one showed that tabular material can be rotated using the sideways environment. (Actually, any of the previously mentioned environments could have been used instead.) Two further environments are provided which rotate a L^{A}TEX float through 90 degrees. These are:

• sidewaystable, which corresponds to the standard L^{A}TEX table environment; and

• sidewaysfigure, which corresponds to the standard L^{A}TEX figure environment.

There are also starred versions of these, namely sidewaystable* and sidewaysfigure*, for use in twocolumn mode. However, the correspondence with the standard environments is not strictly complete as a sideways float is alway placed on a page by itself.

The direction of rotation may be controlled by the \figuresright and \figuresleft commands.

Example: Table 1 was produced by the code below:

     \begin{sidewaystable}
     \centering
     \caption{The rotation facilities} \label{tab4}
     \begin{tabular}{|l|l|} \hline
     \textbf{Facility} & \textbf{Effect} \\ \hline
     \multicolumn{2}{|c|}{\textbf{Commands}} \\ \hline
     \verb|\rotdriver{<driver>}| &
     declare the name of the dvi to Postscript translator (default {\tt dvips}) \\
     ......
     \verb|sidewaysfigure| &
     like the \verb|figure| environment, but rotated 90 degrees \\ \hline
     \end{tabular}
     \end{sidewaystable}

7 ROTATION OF FLOAT CAPTIONS AND BODIES 9

Figure 2: Example figure with a standard caption.

[figure: 2,5 (1); date; A[1:3]; INTEGER]

7 Rotation of float captions and bodies

Sometimes it may be useful to rotate a caption independently of the rotation of a figure or table. The command \rotcaption is analogous to the normal \caption command, and inserts the caption rotated by 90 degrees. There is also the companion command \controtcaption, analagous to the \contcaption command, for continuation captions.

Example: Float with a regular caption. Figure 2 is produced by the code below:

\begin{figure}
\centering
\caption{Example figure with a standard caption.} \label{fig:nocrot}
\setlength{\unitlength}{0.2in}
\footnotesize
\begin{picture}(17,2)
\thicklines
\put(0,0){\begin{picture}(4,1)
  \put(1.5,0.5){\oval(3,1)}
  \put(1.5,0.5){\makebox(0,0){2,5 (1)}}
  \put(3,0.5){\line(1,0){1.0}}
  \put(4.25,0.5){\circle{0.5}}
  \end{picture}}
\put(4.5,0){\begin{picture}(8,1)
  \put(0,0){\dashbox{0.25}(4,1){date}}
  \put(4,0.5){\line(1,0){3.5}}
  \put(7.75,0.5){\circle{0.5}}
  \put(6,1){\makebox(0,0){A[1:3]}}
  \end{picture}}
\put(12.5,0){\begin{picture}(4,1)
  \put(0,0){\framebox(4,1){INTEGER}}
  \put(3.75,0){\line(0,1){1}}
  \end{picture}}
\end{picture}
\normalsize
\setlength{\unitlength}{1pt}
\end{figure}

Example: Float with a rotated caption. Figure 3 is produced by the code below:

\begin{figure}
\centering

Figure 3 – Figure 2 with a rotated caption. [figure: 2,5 (1); date; A[1:3]; INTEGER]

\rotcaption{Figure~\protect\ref{fig:nocrot} with a rotated caption.}
 \label{fig:crot}
\setlength{\unitlength}{0.2in}
\footnotesize
\begin{picture}(17,2)
...
\end{picture}
\normalsize
\setlength{\unitlength}{1pt}
\end{figure}

As can be seen from Figure 3 the advisability of rotating a caption depends on the size of the body of the float. It may be better in certain cases to leave the caption in its regular position and rotate the body of the float instead.

Example: Regular caption and float.

Figure 4 is a regular figure and caption. It is produced by the following code:

\def\prwrot#1{%
\settowidth{\fool}{ISOROT}
\savebox{\foo}{\parbox{\fool}{ISOROT ISOROT ISOROT ISOROT}}%
\framebox{---\begin{turn}{#1}\framebox{\usebox{\foo}}\end{turn}---}}%
\def\degrees{{\small$^{o}$}}
\begin{figure}
\centering
\begin{tabular}{|c|c|c|} \hline
\prwrot{0} &\prwrot{-40}&\prwrot{-80}\\
0\degrees & -40\degrees & -80\degrees \\ \hline

— ISOROT ISOROT ISOROT ISOROT —  —  ISOROT ISOROT ISOROT ISOROT —  —  ISOROT ISOROT ISOROT ISOROT —

0^{o}  -40^{o}  -80^{o}

—  ISOROT ISOROT ISOROT ISOROT —  —  ISOROT ISOROT ISOROT ISOROT —  —  ISOROT ISOROT ISOROT ISOROT —

-120^{o}  -160^{o}  -200^{o}
—  ISOROT ISOROT ISOROT ISOROT —  —  ISOROT ISOROT ISOROT ISOROT —  —  ISOROT ISOROT ISOROT ISOROT —

-240^{o}  -280^{o}  -320^{o}

Figure 4: Rotation of paragraphs between 0 and -320 degrees

— ISOROT ISOROT ISOROT ISOROT —  —  ISOROT ISOROT ISOROT ISOROT —  —  ISOROT ISOROT ISOROT ISOROT —

0^{o}  40^{o}  80^{o}

—  ISOROT ISOROT ISOROT ISOROT —  —  ISOROT ISOROT ISOROT ISOROT —  —  ISOROT ISOROT ISOROT ISOROT —

120^{o}  160^{o}  200^{o}

—  ISOROT ISOROT ISOROT ISOROT —  —  ISOROT ISOROT ISOROT ISOROT —  —  ISOROT ISOROT ISOROT ISOROT —

240^{o}  280^{o}  320^{o}

Figure 5: Rotation of paragraphs between 0 and 320 degrees (with figure body turned sideways)

\prwrot{-120}&\prwrot{-160}&\prwrot{-200}\\
-120\degrees & -160\degrees & -200\degrees \\ \hline
\prwrot{-240}&\prwrot{-280}&\prwrot{-320}\\
-240\degrees & -280\degrees & -320\degrees \\ \hline
\end{tabular}
\caption{Rotation of paragraphs between 0 and -320 degrees} \label{fig:angles1}
\end{figure}

Example: Regular caption and rotated float body.

Figure 5 is a regular figure and caption where the figure contents have been rotated. It was produced by the following code.

\begin{figure}

\centering
\begin{sideways}
\begin{tabular}{|c|c|c|} \hline
\prwrot{0} &\prwrot{40}&\prwrot{80}\\
0\degrees & 40\degrees & 80\degrees \\ \hline
\prwrot{120}&\prwrot{160}&\prwrot{200}\\
120\degrees & 160\degrees & 200\degrees \\ \hline
\prwrot{240}&\prwrot{280}&\prwrot{320}\\
240\degrees & 280\degrees & 320\degrees \\ \hline
\end{tabular}
\end{sideways}
\caption[Rotation of paragraphs between 0 and 320 degrees]%
        {Rotation of paragraphs between 0 and 320 degrees (with figure
         body turned sideways)}\label{fig:angles2}
\end{figure}

8 Landscaping

L^{A}TEX normally prints in portrait mode. The landscape environment prints all the enclosed stuff in landscape mode, except for headers and footers which are not rotated.

Example: Landscaping

The source for this part of the document is:

     \begin{landscape}
     \section{Landscaping}
         \latex{} normally prints in portrait mode. The ...
     ...
     ... long, wide tables.
     \end{landscape}

The environment starts by clearing the current page and then switches to portrait mode. At the end of the environment the current page is cleared and the next page is back to normal portrait mode.

All the other rotation commands and environments produce boxes and L^{A}TEX will not break a box across a page. The landscape environemt does not produce a box and so many pages can be printed in landscape mode with L^{A}TEX taking care of the page breaking for you.

Landscape mode is not particularly useful for normal text as the lines are far too long for comfortable reading. Where it can be useful is where you have a table that is too wide to fit on a portrait page, so needs to be rotated, yet is also too long to fit on the page when it is rotated. The supertabular, the longtable, and the xtab packages provide facilities for automatically breaking long tables across pages. Any of these can be used in conjunction with landscaping to both rotate and automatically page break long, wide tables.

References

[GMS94] Michel Goossens, Frank Mittelbach and Alexander Samarin. The LaTeX Companion. Addison-Wesley Publishing Co. 1994.

[RB92] Sebastian Rahtz and Leonor Barroca. A style option for rotated objects in LaTeX. TUGBoat, volume 13, number 2, pp 156–180, July 1992.