Debian Codegraph @

texmf-dist/doc/latex/graphics/rotex.tex

raw
1 \errorcontextlines32
2 \documentclass[twoside]{report}
3 \usepackage[chatter]{rotating}
4 \usepackage{fancyvrb}
5 \makeatletter
6 \newsavebox{\@display}
7 \newcommand\@@Display[1]{%
8 \sbox\@display{%
9 \begin{minipage}[b]{.45\textwidth}%
10 #1\end{minipage}%
11 }\raisebox{\depth}{\usebox{\@display}}%
12 }
13
14 \newcommand\@@VDisplay[1]{%
15 \sbox\@display{%
16 \begin{minipage}[b]{.45\textwidth}%
17 \BVerbatimInput[fontsize=\small]{#1}%
18 \end{minipage}}%
19 \usebox{\@display}%
20 }
21 \newcommand\SideBySide[2]{%
22 \bgroup\def\baselinestretch{1}%
23 \trivlist\item[]%
24 \leavevmode
25 \makebox[\textwidth][l]{\@@Display{#1}\hspace{1em}%
26 \@@VDisplay{#2}}%
27 \endtrivlist
28 \egroup
29 }
30 \newcommand\BeginExample{%
31 \nobreak
32 \VerbatimEnvironment
33 \catcode`\<=12
34 \begin{VerbatimOut}{\jobname.ex}%
35 }
36 \newcommand{\EndExample}{\end{VerbatimOut}}
37
38 \newenvironment{example}
39 {\nobreak
40 \VerbatimEnvironment
41 \catcode`\<=12
42 \begin{VerbatimOut}{\jobname.ex}%
43 }
44 {\end{VerbatimOut}
45 \SideBySide {\input{\jobname.ex}}%
46 {\jobname.ex}}
47 \makeatother
48 %-------------------------------------------------------
49 \def\degrees{{\small$^{\mathrm{o}}$}}
50 %-------------------------------------------------------
51
52 \begin{document}
53
54 \title{Test of `rotating' package}
55 \author{Sebastian Rahtz and Leonor Barroca\thanks{Now maintained as part of the \LaTeX\ graphics bundle.}}
56 \date{November 19th 1994\thanks{Updated for graphics bundle 2016/05/22}}
57 \maketitle
58
59 `Rotating' provides a generalised rotation environment, where the text
60 will be rotated (anti-clockwise) by the number of degrees specified as
61 a parameter to the environment, but no special arrangement is made to
62 find space for the result.
63
64 \begin{example}
65 Start here
66 \begin{rotate}{-56}
67 Save whales
68 \end{rotate}
69 End here
70 \end{example}
71
72 A complete example of rotating text without leaving space
73 would the `Save the whale' text
74 written at 10 degree intervals round the compass. We use
75 `rlap' to ensure that all the texts are printed at the same point.
76 Just to show that \TeX\ can handle PostScript muckings-about
77 properly\ldots
78 \begin{example}
79 \newcount\wang
80 \newsavebox{\wangtext}
81 \newdimen\wangspace
82 \def\wheel#1{\savebox{\wangtext}{#1}%
83 \wangspace\wd\wangtext
84 \advance\wangspace by 1cm%
85 \centerline{%
86 \rule{0pt}{\wangspace}%
87 \rule[-\wangspace]{0pt}{\wangspace}%
88 \wang=-180\loop\ifnum\wang<180
89 \rlap{\begin{rotate}{\the\wang}%
90 \rule{1cm}{0pt}#1\end{rotate}}%
91 \advance\wang by 10\repeat}}
92 \wheel{Save the whale}
93 \end{example}
94
95 If the user
96 desires \LaTeX\ to leave space for the rotated box, then `turn' is used:
97 \begin{example}
98 Start here \begin{turn}{56}%
99 Save the whale
100 \end{turn} end here
101 \end{example}
102 The environment `Sideways' is a special case, setting the rotation to $-90$,
103 and leaving the correct space for the rotated box.
104 \begin{example}
105 Start here
106 \begin{sideways}%
107 Save the whale
108 \end{sideways}
109 End here
110 \end{example}
111
112 If you deal with whole paragraphs of text, you realize that \TeX\
113 boxes are not as simple as they sometimes look: they have a height
114 {\em and} a depth. So when you rotate, you rotate about the point on
115 the left-hand edge of the box that meets the baseline. The results can
116 be unexpected, as shown in the full set of paragraph rotations in
117 Figures \ref{angles1} and \ref{angles2}. If you really want to turn a
118 paragraph so that it appears to rotate about the {\em real} bottom of
119 the \TeX\ box,
120 you have to adjust the box in the normal \LaTeX\ way:
121 \begin{example}
122 \newsavebox{\foo}
123 \savebox{\foo}{\parbox{1in}{Save
124 the whales Save the whale
125 Save the whale
126 Save the whale}}%
127 Start
128 \begin{turn}{45}\usebox{\foo}\end{turn}
129 End
130 \end{example}
131 \begin{example}
132 \savebox{\foo}{\parbox[b]{1in}{Save
133 the whales Save the whale
134 Save the whale
135 Save the whale}}%
136 Start
137 \begin{turn}{45}\usebox{\foo}\end{turn}
138 End
139 \end{example}
140
141 \def\testrot#1{%
142 \savebox{\foo}{\parbox{1in}{Save
143 the whales Save the whale Save the whale Save the whale}}%
144 \framebox{---\begin{turn}{#1}\framebox{\usebox{\foo}}\end{turn}---}}%
145
146 \begin{figure*}
147 \begin{tabular}{|c|c|c|}
148 \hline
149 \testrot{0} &\testrot{-40}&\testrot{-80}\\
150 0\degrees & -40\degrees & -80\degrees \\
151 \hline
152 \testrot{-120}&\testrot{-160}&\testrot{-200}\\
153 120\degrees & -160\degrees & -200\degrees \\
154 \hline
155 \testrot{-240}&\testrot{-280}&\testrot{-320}\\
156 -240\degrees & -280\degrees & -320\degrees \\
157 \hline
158 \end{tabular}
159 \caption{Rotation of paragraphs between 0 and -320 degrees \label{angles1}}
160 \end{figure*}
161
162 \begin{figure*}
163 \begin{tabular}{|c|c|c|}
164 \hline
165 \testrot{-180} &\testrot{40}&\testrot{80}\\
166 -180\degrees & 40\degrees & 80\degrees \\
167 \hline
168 \testrot{120}&\testrot{160}&\testrot{200}\\
169 120\degrees & 160\degrees & 200\degrees \\
170 \hline
171 \testrot{240}&\testrot{280}&\testrot{320}\\
172 240\degrees & 280\degrees & 320\degrees \\
173 \hline
174 \end{tabular}
175 \caption{Rotation of paragraphs between 0 and 320 degrees\label{angles2}}
176 \end{figure*}
177
178
179 We can set tabular material in this way; at the same time, we
180 demonstrate that the rotation can be nested:
181 \begin{example}
182 \begin{sideways}
183 \rule{1in}{0pt}
184 \begin{tabular}{|lr|}
185 \em Word & \begin{rotate}{90}%
186 Occurrences\end{rotate}
187 \\
188 \hline
189 hello & 33\\
190 goodbye & 34\\
191 \hline
192 \end{tabular}
193 \end{sideways}
194 \end{example}
195
196 \begin{example}
197 \begin{quote}
198 \rule{0pt}{1.5in}\begin{tabular}{rrr}
199 \begin{rotate}{45}Column 1\end{rotate}&
200 \begin{rotate}{45}Column 2\end{rotate}&
201 \begin{rotate}{45}Column 3\end{rotate}\\
202 \hline
203 1& 2& 3\\
204 4& 5& 6\\
205 7& 8& 9\\
206 \hline
207 \end{tabular}
208 \end{quote}
209 \end{example}
210
211 \begin{example}
212 \begin{quote}
213 \begin{tabular}{rrr}
214 \begin{turn}{45}Column 1\end{turn}&
215 \begin{turn}{45}Column 2\end{turn}&
216 \begin{turn}{45}Column 3\end{turn}\\
217 \hline
218 1& 2& 3\\
219 4& 5& 6\\
220 7& 8& 9\\
221 \hline
222 \end{tabular}
223 \end{quote}
224 \end{example}
225
226 \begin{example}
227 \begin{quote}
228 \rule{0pt}{1.5in}\begin{tabular}{rrr}
229 \begin{rotate}{45}Column 1\end{rotate}
230 \rule{.5cm}{0pt}&
231 \begin{rotate}{45}Column 2\end{rotate}
232 \rule{.5cm}{0pt}&
233 \begin{rotate}{45}Column 3\end{rotate}
234 \rule{.5cm}{0pt}\\
235 \hline
236 1& 2& 3\\
237 4& 5& 6\\
238 7& 8& 9\\
239 \hline
240 \end{tabular}
241 \end{quote}
242 \end{example}
243
244 \begin{example}
245 \begin{sideways}
246 \begin{tabular}{|l|c|c|c|c|c|p{1in}|}
247 \hline
248 &&\multicolumn{4}{c}{NUMBER OF SITES}\vline &ACCEPT or\\
249 \cline{3-6} &STUDY AREA&&\multicolumn{3}{c}{%
250 IN BOUNDARY ZONE}\vline&REJECT\\
251 \cline{4-6}&&&&\multicolumn{2}{c}{EXPECTED}
252 \vline&NULL\\
253 \cline{5-6}&&TOT&OBS&FROM&TO&HYPOTH\\
254 \cline{2-7}
255 &FULL SAMPLE&41&31&10.3&27.0&REJECT\\
256 &SAMPLE AREA 1&23&16&4.3&16.7&ACCEPT\\
257 &SAMPLE AREA 2&18&15&2.8&13.7&REJECT\\
258 &RUSHEN&13&9&1.2&10.4&ACCEPT\\
259 &ARBORY&10&7&0.6&8.8&ACCEPT\\
260 &MAROWN&10&8&0.4&8.6&ACCEPT\\
261 \rule{0.5cm}{0pt}
262 \begin{rotate}{90}PRIMARY UNITS%
263 \end{rotate}\rule{0.5cm}{0pt}
264 &SANTON&8&7&0.0&7.3&ACCEPT\\
265 \hline
266 \end{tabular}
267 \end{sideways}
268 \end{example}
269
270 If you are interested in setting rotated material in tables or
271 figures, this presents no problem. Figure \ref{fig1} shows how
272 PostScript files which are being incorporated using can be
273 rotated at will, while Figure \ref{fig2} shows, in contrast, how
274 `includegraphics' itself handles rotation. It is also possible to rotate the
275 whole of the figure environment, including caption,
276 by using the `sidewaysfigure' ands `sidewaystable' environments
277 in place of `figure' and `table'.
278
279 Sideways figures and tables always take up the whole page. They can be
280 rotated so that the bottom ot the figures is on the left or the right;
281 the default is to always turn to the right. If the `twoside' option
282 has been given to the main document class, this package then starts
283 rotating sideways figures according to the page number (this requires
284 two passes through \LaTeX{} at least). If you want the `twoside'
285 option, but want the figures always in one direction, use the
286 `figuresright' or `riguresleft' options to `rotating'.
287
288 The code used to produce figures
289 \ref{rotfloat1}--\ref{rotfloat4} is as follows:
290 \begin{description}
291
292 \item[Figure \ref{rotfloat1}]
293 {\small\begin{verbatim}
294 \begin{sidewaystable}
295 \centering
296 \caption{This is a narrow table, which should be centred vertically
297 on the final page.\label{rotfloat1}}
298 \begin{tabular}{|ll|}
299 \hline
300 a & b \\
301 c & d \\
302 e & f \\
303 g & h \\
304 i & j \\
305 \hline
306 \end{tabular}
307 \end{sidewaystable}
308 \end{verbatim}
309 }
310
311 \item[Figure \ref{rotfloat2}]
312 {\scriptsize\begin{verbatim}
313 \begin{sidewaystable}
314 \centering
315 \begin{tabular}{|llllllllp{1in}lp{1in}|}
316 \hline
317 Context &Length &Breadth/ &Depth &Profile &Pottery &Flint &Animal &Stone &Other &C14 Dates \\
318 & &Diameter & & & & &
319 Bones&&&\\
320 \hline
321 &&&&&&&&&&\\
322 \multicolumn{10}{|l}{\bf Grooved Ware}&\\
323 784 &--- &0.9m &0.18m &Sloping U &P1 &$\times$46 & $\times$8 && $\times$2 bone& 2150$\pm$ 100 BC\\
324 785 &--- &1.00m &0.12 &Sloping U &P2--4 &$\times$23 & $\times$21 & Hammerstone &---&---\\
325 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)\\
326 983 &0.83m &0.73m &0.25m &Stepped U &--- &$\times$18 & $\times$8 & ---& Fired clay&---\\
327 &&&&&&&&&&\\
328 \multicolumn{10}{|l}{\bf Beaker}&\\
329 552 &--- &0.68m &0.12m &Saucer &P7--14 &--- & --- & --- &--- &---\\
330 790 &--- &0.60m &0.25m &U &P15 &$\times$12 & --- & Quartzite-lump&--- &---\\
331 794 &2.89m &0.75m &0.25m &Irreg. &P16 &$\times$3 & --- & --- &--- &---\\
332 \hline
333 \end{tabular}
334
335 \caption[Grooved Ware and Beaker Features, their Finds and
336 Radiocarbon Dates]{Grooved Ware and Beaker Features, their
337 Finds and Radiocarbon Dates; For a breakdown of the Pottery
338 Assemblages see Tables I and III; for
339 the Flints see Tables II and IV; for the
340 Animal Bones see Table V.}\label{rotfloat2}
341 \end{sidewaystable}
342 \end{verbatim}
343 }
344
345 \item[Figure \ref{rotfloat3}]
346 {\small\begin{verbatim}
347 \begin{table}
348 \centering
349 \rotcaption{Minimum number of individuals; effect of rotating table
350 and caption separately}\label{rotfloat3}%
351 \begin{sideways}
352 \begin{tabular}[b]{cccccccccp{1cm}}
353 \hline
354 Phase&Total&Cattle&Sheep&Pig&Red Deer&Horse&Dog&Goat&Other\\
355 \hline
356 &1121&54&12&32&1&1&1&1&1 polecat\\
357 3&8255&58&6&35&1&1&1&1&1 roe deer, 1 hare, 1 cat, 1 otter\\
358 4&543&45&6&45&4&1&1&---&---\\
359 \hline
360 &9919&157&24&112&6&3&3&2&5\\
361 \hline
362 \end{tabular}
363 \end{sideways}
364 \end{table}
365 \end{verbatim}
366 }
367
368 \item[Figure \ref{rotfloat4}]
369 {\small\begin{verbatim}
370 \begin{sidewaysfigure}
371 \centering
372 \includegraphics[width=.8\textheight,height=.4\textwidth]{cat}
373 \caption{A pathetically squashed rotated pussycat}\label{rotfloat4}
374 \end{sidewaysfigure}
375 \end{verbatim}
376 }
377 \end{description}
378
379 \begin{figure}
380 \begin{example}
381 ---\begin{turn}{156}
382 \includegraphics[width=1in]{cat}
383 \end{turn}---
384 \end{example}
385
386 \begin{example}
387 ---\begin{sideways}
388 \includegraphics[width=1in]{cat}
389 \end{sideways}---
390 \end{example}
391
392 \begin{example}
393 ---\includegraphics[width=1in]{cat}---
394 \end{example}
395 \caption{A normal, and sideways, pictures within a figure\label{fig1}}
396 \end{figure}
397
398 \begin{figure}
399 \begin{example}
400 \includegraphics[width=1in,%
401 angle=-56]{cat}
402 \end{example}
403
404 \caption{Figures rotated with `includegraphics'\label{fig2}}
405 \end{figure}
406 \begin{sidewaystable}
407 \centering
408 \caption{This is a narrow table, which should be centred vertically
409 on the final page.\label{rotfloat1}}
410 \begin{tabular}{|ll|}
411 \hline
412 a & b \\
413 c & d \\
414 e & f \\
415 g & h \\
416 i & j \\
417 \hline
418 \end{tabular}
419 \end{sidewaystable}
420
421
422
423 \begin{sidewaystable}
424 \centering
425 \begin{tabular}{|llllllllp{1in}lp{1in}|}
426 \hline
427 Context &Length &Breadth/ &Depth &Profile &Pottery &Flint &Animal &Stone &Other &C14 Dates \\
428 & &Diameter & & & & &
429 Bones&&&\\
430 \hline
431 &&&&&&&&&&\\
432 \multicolumn{10}{|l}{\bf Grooved Ware}&\\
433 784 &--- &0.9m &0.18m &Sloping U &P1 &$\times$46 & $\times$8 && $\times$2 bone& 2150$\pm$ 100 BC\\
434 785 &--- &1.00m &0.12 &Sloping U &P2--4 &$\times$23 & $\times$21 & Hammerstone &---&---\\
435 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)\\
436 983 &0.83m &0.73m &0.25m &Stepped U &--- &$\times$18 & $\times$8 & ---& Fired clay&---\\
437 &&&&&&&&&&\\
438 \multicolumn{10}{|l}{\bf Beaker}&\\
439 552 &--- &0.68m &0.12m &Saucer &P7--14 &--- & --- & --- &--- &---\\
440 790 &--- &0.60m &0.25m &U &P15 &$\times$12 & --- & Quartzite-lump&--- &---\\
441 794 &2.89m &0.75m &0.25m &Irreg. &P16 &$\times$3 & --- & --- &--- &---\\
442 \hline
443 \end{tabular}
444
445 \caption[Grooved Ware and Beaker Features, their Finds and
446 Radiocarbon Dates]{Grooved Ware and Beaker Features, their
447 Finds and Radiocarbon Dates; For a breakdown of the Pottery
448 Assemblages see Tables I and III; for
449 the Flints see Tables II and IV; for the
450 Animal Bones see Table V.}\label{rotfloat2}
451 \end{sidewaystable}
452
453 \begin{table}
454 \centering
455 \hbox{
456 \rotcaption{Minimum number of individuals; effect of rotating table
457 and caption separately}\label{rotfloat3}%
458 \begin{sideways}
459 \begin{tabular}[t]{cccccccccp{1cm}}
460 \hline
461 Phase&Total&Cattle&Sheep&Pig&Red Deer&Horse&Dog&Goat&Other\\
462 \hline
463 &1121&54&12&32&1&1&1&1&1 polecat\\
464 3&8255&58&6&35&1&1&1&1&1 roe deer, 1 hare, 1 cat, 1 otter\\
465 4&543&45&6&45&4&1&1&---&---\\
466 \hline
467 &9919&157&24&112&6&3&3&2&5\\
468 \hline
469 \end{tabular}
470 \end{sideways}
471 }
472 \end{table}
473
474
475 \begin{sidewaysfigure}
476 \centerline{\includegraphics[width=.8\textheight,height=.4\textwidth]{cat}}
477 \caption{A pathetically squashed rotated pussycat (1)}
478 \end{sidewaysfigure}
479
480 \begin{sidewaysfigure}
481 \centerline{\includegraphics[width=.8\textheight,height=.4\textwidth]{cat}}
482 \caption{A pathetically squashed rotated pussycat (2)}
483 \end{sidewaysfigure}
484
485 \begin{sidewaysfigure}
486 \centerline{\includegraphics[width=.8\textheight,height=.4\textwidth]{cat}}
487 \caption{A pathetically squashed rotated pussycat (3)}
488 \end{sidewaysfigure}
489
490 \begin{sidewaysfigure}
491 \centerline{\includegraphics[width=.8\textheight,height=.4\textwidth]{cat}}
492 \caption{A pathetically squashed rotated pussycat (4)}
493 \end{sidewaysfigure}
494
495 \begin{sidewaysfigure}
496 \centerline{\includegraphics[width=.8\textheight,height=.4\textwidth]{cat}}
497 \caption{A pathetically squashed rotated pussycat}\label{rotfloat4}
498 \end{sidewaysfigure}
499
500 \end{document}