summaryrefslogtreecommitdiff
path: root/macros/latex-dev/required/graphics/rotex.tex
blob: 9dabfd37f749c6ed1c479ea5224ca3c1084c44b1 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
\errorcontextlines32
\documentclass[twoside]{report}
\usepackage[chatter]{rotating}
\usepackage{fancyvrb}
\makeatletter
\newsavebox{\@display}
\newcommand\@@Display[1]{%
 \sbox\@display{%
  \begin{minipage}[b]{.45\textwidth}%
  #1\end{minipage}%
 }\raisebox{\depth}{\usebox{\@display}}%
}

\newcommand\@@VDisplay[1]{%
 \sbox\@display{%
   \begin{minipage}[b]{.45\textwidth}%
     \BVerbatimInput[fontsize=\small]{#1}%
   \end{minipage}}%
   \usebox{\@display}%
}
\newcommand\SideBySide[2]{%
\bgroup\def\baselinestretch{1}%
 \trivlist\item[]%
 \leavevmode
 \makebox[\textwidth][l]{\@@Display{#1}\hspace{1em}%
                             \@@VDisplay{#2}}%
 \endtrivlist
 \egroup
}
\newcommand\BeginExample{%
  \nobreak
  \VerbatimEnvironment
  \catcode`\<=12
  \begin{VerbatimOut}{\jobname.ex}%
}
\newcommand{\EndExample}{\end{VerbatimOut}}

\newenvironment{example}
 {\nobreak
  \VerbatimEnvironment
  \catcode`\<=12
  \begin{VerbatimOut}{\jobname.ex}%
 }
 {\end{VerbatimOut}
  \SideBySide {\input{\jobname.ex}}%
                {\jobname.ex}}
\makeatother
%-------------------------------------------------------
\def\degrees{{\small$^{\mathrm{o}}$}}
%-------------------------------------------------------

\begin{document}

\title{Test of `rotating' package}
\author{Sebastian Rahtz and Leonor Barroca\thanks{Now maintained as part of the \LaTeX\ graphics bundle.}}
\date{November 19th 1994\thanks{Updated for graphics bundle 2016/05/22}}
\maketitle

`Rotating' provides a generalised rotation environment, where the text
will be rotated (anti-clockwise) by the number of degrees specified as
a parameter to the environment, but no special arrangement is made to
find space for the result.

\begin{example}
Start here
\begin{rotate}{-56}
Save whales
\end{rotate}
End here
\end{example}

A complete example of rotating text without leaving space
would the `Save the whale' text
written at 10 degree intervals round the compass. We use
`rlap' to ensure that all the texts are printed at the same point.
Just to show that \TeX\ can handle PostScript muckings-about
properly\ldots
\begin{example} 
\newcount\wang
\newsavebox{\wangtext}
\newdimen\wangspace
\def\wheel#1{\savebox{\wangtext}{#1}%
\wangspace\wd\wangtext
\advance\wangspace by 1cm%
\centerline{%
\rule{0pt}{\wangspace}%
\rule[-\wangspace]{0pt}{\wangspace}%
\wang=-180\loop\ifnum\wang<180
\rlap{\begin{rotate}{\the\wang}%
\rule{1cm}{0pt}#1\end{rotate}}%
\advance\wang by 10\repeat}}
\wheel{Save the whale}
\end{example}

If the user
desires \LaTeX\ to leave space for the rotated box, then `turn' is used:
\begin{example}
 Start here \begin{turn}{56}%
   Save the whale
  \end{turn} end here
\end{example}
The environment `Sideways' is a  special case, setting the rotation to $-90$,
and leaving the correct space for the rotated box. 
\begin{example}
Start here
\begin{sideways}%
Save the whale
\end{sideways}
End here
\end{example}

If you deal with whole paragraphs of text, you realize that \TeX\
boxes are not as simple as they sometimes look: they have a height
{\em and} a depth. So when you rotate, you rotate about the point on
the left-hand edge of the box that meets the baseline. The results can
be unexpected, as shown in the full set of  paragraph rotations in
Figures \ref{angles1} and \ref{angles2}. If you really want to turn a
paragraph so that it appears to rotate about the {\em real} bottom of
the \TeX\ box,
you have to adjust the box in the normal \LaTeX\ way:
\begin{example}
\newsavebox{\foo}
\savebox{\foo}{\parbox{1in}{Save 
the whales Save the whale 
Save the whale 
Save the whale}}%
Start
\begin{turn}{45}\usebox{\foo}\end{turn}
End
\end{example}
\begin{example}
\savebox{\foo}{\parbox[b]{1in}{Save 
the whales Save the whale 
Save the whale 
Save the whale}}%
Start
\begin{turn}{45}\usebox{\foo}\end{turn}
End
\end{example}

\def\testrot#1{%
\savebox{\foo}{\parbox{1in}{Save 
the whales Save the whale Save the whale Save the whale}}%
\framebox{---\begin{turn}{#1}\framebox{\usebox{\foo}}\end{turn}---}}%

\begin{figure*}
\begin{tabular}{|c|c|c|}
\hline
\testrot{0} &\testrot{-40}&\testrot{-80}\\
0\degrees & -40\degrees & -80\degrees \\
\hline
\testrot{-120}&\testrot{-160}&\testrot{-200}\\
120\degrees & -160\degrees & -200\degrees \\
\hline
\testrot{-240}&\testrot{-280}&\testrot{-320}\\
-240\degrees & -280\degrees & -320\degrees \\
\hline
\end{tabular}
\caption{Rotation of paragraphs between 0 and -320 degrees \label{angles1}}
\end{figure*}

\begin{figure*}
\begin{tabular}{|c|c|c|}
\hline
\testrot{-180} &\testrot{40}&\testrot{80}\\
-180\degrees & 40\degrees & 80\degrees \\
\hline
\testrot{120}&\testrot{160}&\testrot{200}\\
120\degrees & 160\degrees & 200\degrees \\
\hline
\testrot{240}&\testrot{280}&\testrot{320}\\
240\degrees & 280\degrees & 320\degrees \\
\hline
\end{tabular}
\caption{Rotation of paragraphs between 0 and 320 degrees\label{angles2}}
\end{figure*}


We can set tabular material in this way; at the same time, we
demonstrate that the rotation can be nested:
\begin{example}
\begin{sideways}
\rule{1in}{0pt}
\begin{tabular}{|lr|}
\em Word & \begin{rotate}{90}%
Occurrences\end{rotate}
\\
\hline
hello & 33\\
goodbye & 34\\
\hline
\end{tabular}
\end{sideways}
\end{example}

\begin{example}
\begin{quote}
\rule{0pt}{1.5in}\begin{tabular}{rrr}
\begin{rotate}{45}Column 1\end{rotate}&
\begin{rotate}{45}Column 2\end{rotate}&
\begin{rotate}{45}Column 3\end{rotate}\\
\hline
1& 2& 3\\
4& 5& 6\\
7& 8& 9\\
\hline
\end{tabular}
\end{quote}
\end{example}

\begin{example}
\begin{quote}
\begin{tabular}{rrr}
\begin{turn}{45}Column 1\end{turn}&
\begin{turn}{45}Column 2\end{turn}&
\begin{turn}{45}Column 3\end{turn}\\
\hline
1& 2& 3\\
4& 5& 6\\
7& 8& 9\\
\hline
\end{tabular}
\end{quote}
\end{example}

\begin{example}
\begin{quote}
\rule{0pt}{1.5in}\begin{tabular}{rrr}
\begin{rotate}{45}Column 1\end{rotate}
\rule{.5cm}{0pt}&
\begin{rotate}{45}Column 2\end{rotate}
\rule{.5cm}{0pt}&
\begin{rotate}{45}Column 3\end{rotate}
\rule{.5cm}{0pt}\\
\hline
1& 2& 3\\
4& 5& 6\\
7& 8& 9\\
\hline
\end{tabular}
\end{quote}
\end{example}

\begin{example}
\begin{sideways}
\begin{tabular}{|l|c|c|c|c|c|p{1in}|}
\hline
&&\multicolumn{4}{c}{NUMBER OF SITES}\vline &ACCEPT or\\
\cline{3-6} &STUDY AREA&&\multicolumn{3}{c}{%
IN BOUNDARY ZONE}\vline&REJECT\\
\cline{4-6}&&&&\multicolumn{2}{c}{EXPECTED}
\vline&NULL\\
\cline{5-6}&&TOT&OBS&FROM&TO&HYPOTH\\
\cline{2-7}
&FULL SAMPLE&41&31&10.3&27.0&REJECT\\
&SAMPLE AREA 1&23&16&4.3&16.7&ACCEPT\\
&SAMPLE AREA 2&18&15&2.8&13.7&REJECT\\
&RUSHEN&13&9&1.2&10.4&ACCEPT\\
&ARBORY&10&7&0.6&8.8&ACCEPT\\
&MAROWN&10&8&0.4&8.6&ACCEPT\\
\rule{0.5cm}{0pt}
\begin{rotate}{90}PRIMARY UNITS%
\end{rotate}\rule{0.5cm}{0pt}
&SANTON&8&7&0.0&7.3&ACCEPT\\
\hline
\end{tabular}
\end{sideways}
\end{example}

If you are interested in setting rotated material in tables or
figures, this presents no problem. Figure \ref{fig1} shows how
PostScript files which are being incorporated using can be
rotated at will, while Figure \ref{fig2} shows, in contrast, how
`includegraphics' itself handles rotation. It is also possible to rotate the
whole of the figure environment, including caption, 
by using the `sidewaysfigure' ands `sidewaystable' environments
in place of `figure' and `table'. 

Sideways figures and tables always take up the whole page. They can be
rotated so that the bottom ot the figures is on the left or the right;
the default is to always turn to the right. If the `twoside' option
has been given to the main document class, this package then starts
rotating sideways figures according to the page number (this requires
two passes through \LaTeX{} at least). If you want the `twoside'
option, but want the figures always in one direction, use the
`figuresright' or `riguresleft' options to `rotating'.

The code used to produce figures
\ref{rotfloat1}--\ref{rotfloat4} is as follows:
\begin{description}

\item[Figure \ref{rotfloat1}]
{\small\begin{verbatim}
\begin{sidewaystable}
\centering
\caption{This is a narrow  table, which should be centred vertically
on the final page.\label{rotfloat1}}
  \begin{tabular}{|ll|}
\hline
    a & b \\
    c & d \\
    e & f \\
    g & h \\
    i & j \\
\hline
  \end{tabular}
\end{sidewaystable}
\end{verbatim}
}

\item[Figure \ref{rotfloat2}]
{\scriptsize\begin{verbatim}
\begin{sidewaystable}
\centering
\begin{tabular}{|llllllllp{1in}lp{1in}|}
\hline
Context   &Length   &Breadth/   &Depth   &Profile   &Pottery   &Flint   &Animal   &Stone   &Other    &C14 Dates \\
  &         &Diameter   &        &          &          &        & 
Bones&&&\\
\hline
&&&&&&&&&&\\
\multicolumn{10}{|l}{\bf Grooved Ware}&\\
784       &---        &0.9m       &0.18m   &Sloping U &P1       &$\times$46  &  $\times$8      &&       $\times$2 bone&  2150$\pm$ 100 BC\\
785       &---        &1.00m      &0.12    &Sloping U &P2--4    &$\times$23  &  $\times$21     & Hammerstone &---&---\\
962       &---        &1.37m      &0.20m   &Sloping U &P5--6    &$\times$48  &  $\times$57*    & ---&     ---&1990 $\pm$ 80 BC (Layer 4) 1870 $\pm$90 BC (Layer 1)\\
983       &0.83m      &0.73m      &0.25m   &Stepped U &---      &$\times$18  &  $\times$8      & ---& Fired clay&---\\
&&&&&&&&&&\\
\multicolumn{10}{|l}{\bf Beaker}&\\
552       &---        &0.68m      &0.12m   &Saucer    &P7--14   &---           & ---       & ---       &---        &---\\
790       &---        &0.60m      &0.25m   &U         &P15      &$\times$12    & ---       & Quartzite-lump&---    &---\\
794       &2.89m      &0.75m      &0.25m   &Irreg.    &P16      &$\times$3     & ---       & ---       &---        &---\\
\hline
\end{tabular}
 
\caption[Grooved Ware and Beaker Features, their Finds and
Radiocarbon Dates]{Grooved Ware and Beaker Features, their
Finds and Radiocarbon Dates; For a breakdown of the Pottery
Assemblages see Tables I and III; for
the Flints see Tables II and IV; for the
Animal Bones see Table V.}\label{rotfloat2}
\end{sidewaystable}
\end{verbatim}
}

\item[Figure \ref{rotfloat3}]
{\small\begin{verbatim}
\begin{table}
\centering
\rotcaption{Minimum number of individuals; effect of rotating table
and caption separately}\label{rotfloat3}%
\begin{sideways}
\begin{tabular}[b]{cccccccccp{1cm}}
\hline
Phase&Total&Cattle&Sheep&Pig&Red Deer&Horse&Dog&Goat&Other\\
\hline
&1121&54&12&32&1&1&1&1&1 polecat\\
3&8255&58&6&35&1&1&1&1&1 roe deer, 1 hare, 1 cat, 1 otter\\
4&543&45&6&45&4&1&1&---&---\\
\hline
&9919&157&24&112&6&3&3&2&5\\
\hline
\end{tabular}
\end{sideways}
\end{table}
\end{verbatim}
}

\item[Figure \ref{rotfloat4}]
{\small\begin{verbatim}
\begin{sidewaysfigure}
  \centering
  \includegraphics[width=.8\textheight,height=.4\textwidth]{cat}
\caption{A pathetically squashed rotated pussycat}\label{rotfloat4}
\end{sidewaysfigure}
\end{verbatim}
}
\end{description}

\begin{figure}
\begin{example}
---\begin{turn}{156}
\includegraphics[width=1in]{cat}
\end{turn}---
\end{example}

\begin{example}
---\begin{sideways}
\includegraphics[width=1in]{cat}
\end{sideways}---
\end{example}

\begin{example}
---\includegraphics[width=1in]{cat}---
\end{example}
\caption{A normal, and sideways, pictures within a figure\label{fig1}}
\end{figure}

\begin{figure}
\begin{example}
\includegraphics[width=1in,%
angle=-56]{cat}
\end{example}

\caption{Figures rotated with `includegraphics'\label{fig2}}
\end{figure}
\begin{sidewaystable}
\centering
\caption{This is a narrow  table, which should be centred vertically
on the final page.\label{rotfloat1}}
  \begin{tabular}{|ll|}
\hline
    a & b \\
    c & d \\
    e & f \\
    g & h \\
    i & j \\
\hline
  \end{tabular}
\end{sidewaystable}



\begin{sidewaystable}
\centering
\begin{tabular}{|llllllllp{1in}lp{1in}|}
\hline
Context   &Length   &Breadth/   &Depth   &Profile   &Pottery   &Flint   &Animal   &Stone   &Other    &C14 Dates \\
  &         &Diameter   &        &          &          &        & 
Bones&&&\\
\hline
&&&&&&&&&&\\
\multicolumn{10}{|l}{\bf Grooved Ware}&\\
784       &---        &0.9m       &0.18m   &Sloping U &P1       &$\times$46  &  $\times$8      &&       $\times$2 bone&  2150$\pm$ 100 BC\\
785       &---        &1.00m      &0.12    &Sloping U &P2--4    &$\times$23  &  $\times$21     & Hammerstone &---&---\\
962       &---        &1.37m      &0.20m   &Sloping U &P5--6    &$\times$48  &  $\times$57*    & ---&     ---&1990 $\pm$ 80 BC (Layer 4) 1870 $\pm$90 BC (Layer 1)\\
983       &0.83m      &0.73m      &0.25m   &Stepped U &---      &$\times$18  &  $\times$8      & ---& Fired clay&---\\
&&&&&&&&&&\\
\multicolumn{10}{|l}{\bf Beaker}&\\
552       &---        &0.68m      &0.12m   &Saucer    &P7--14   &---           & ---       & ---       &---        &---\\
790       &---        &0.60m      &0.25m   &U         &P15      &$\times$12    & ---       & Quartzite-lump&---    &---\\
794       &2.89m      &0.75m      &0.25m   &Irreg.    &P16      &$\times$3     & ---       & ---       &---        &---\\
\hline
\end{tabular}
 
\caption[Grooved Ware and Beaker Features, their Finds and
Radiocarbon Dates]{Grooved Ware and Beaker Features, their
Finds and Radiocarbon Dates; For a breakdown of the Pottery
Assemblages see Tables I and III; for
the Flints see Tables II and IV; for the
Animal Bones see Table V.}\label{rotfloat2}
\end{sidewaystable}

\begin{table}
\centering
\hbox{
\rotcaption{Minimum number of individuals; effect of rotating table
and caption separately}\label{rotfloat3}%
\begin{sideways}
\begin{tabular}[t]{cccccccccp{1cm}}
\hline
Phase&Total&Cattle&Sheep&Pig&Red Deer&Horse&Dog&Goat&Other\\
\hline
&1121&54&12&32&1&1&1&1&1 polecat\\
3&8255&58&6&35&1&1&1&1&1 roe deer, 1 hare, 1 cat, 1 otter\\
4&543&45&6&45&4&1&1&---&---\\
\hline
&9919&157&24&112&6&3&3&2&5\\
\hline
\end{tabular}
\end{sideways}
}
\end{table}


\begin{sidewaysfigure}
  \centerline{\includegraphics[width=.8\textheight,height=.4\textwidth]{cat}}
\caption{A pathetically squashed rotated pussycat (1)}
\end{sidewaysfigure}

\begin{sidewaysfigure}
  \centerline{\includegraphics[width=.8\textheight,height=.4\textwidth]{cat}}
\caption{A pathetically squashed rotated pussycat (2)}
\end{sidewaysfigure}

\begin{sidewaysfigure}
  \centerline{\includegraphics[width=.8\textheight,height=.4\textwidth]{cat}}
\caption{A pathetically squashed rotated pussycat (3)}
\end{sidewaysfigure}

\begin{sidewaysfigure}
  \centerline{\includegraphics[width=.8\textheight,height=.4\textwidth]{cat}}
\caption{A pathetically squashed rotated pussycat (4)}
\end{sidewaysfigure}

\begin{sidewaysfigure}
  \centerline{\includegraphics[width=.8\textheight,height=.4\textwidth]{cat}}
\caption{A pathetically squashed rotated pussycat}\label{rotfloat4}
\end{sidewaysfigure}

\end{document}