File: examples.tex

package info (click to toggle)
tetex-src 2.0.2a-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 71,124 kB
  • ctags: 1,576
  • sloc: makefile: 1,764; sh: 1,181; perl: 925; lisp: 342; python: 251; sed: 138; ansic: 138; xml: 96; yacc: 52
file content (141 lines) | stat: -rw-r--r-- 3,757 bytes parent folder | download | duplicates (2)
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
%%
%% This is file `examples.tex',
%% Examples for the rotfloat package
%%
%% Copyright (c) 1995-2002 Axel Sommerfeldt (rotfloat@sommerfeldt.net)
%% 
%% This file is part of the rotfloat package.
%% ------------------------------------------
%% 
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.2 or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%% 
\documentclass{article}
\usepackage[figuresright]{rotfloat}[1995/03/30]
\usepackage{shortvrb}

\floatstyle{ruled}
\floatname{program}{Program}
\newfloat{program}{tbp}{lof}[section]
\floatstyle{plain}
\floatname{example}{Example}
\newfloat{example}{t}{lof}[section]
\floatstyle{boxed}
\restylefloat{table}

\begin{document}
%\errorcontextlines9
%\tracingmacros=1\tracingcommands=1

\noindent First of all, here comes the original examples from the \textsf{float} package
(just to see if they still work), the rotated versions of these will follow on the next pages:

\begin{program}[H]
\begin{verbatim}
#include <stdio.h>

int main(int argc, char **argv)
{
       int i;
       for (i = 0; i < argc; ++i)
               printf("argv[%d] = %s\n", i, argv[i]);
       return 0;
}
\end{verbatim}
\caption{The first program. This hasn't got anything to do with the style
   but is included as an example. Note the \texttt{ruled} float style.%
   \label{prog1.1}}
\end{program}

\begin{example}[H]
\begin{verse}
\MakeShortVerb{\|}
|\floatstyle{ruled}|\\
|\newfloat{Program}{tbp}{lop}[section]|\\
\dots\ loads o' stuff \dots\\
|\begin{Program}|\\
|\begin{verbatim}|\\
\dots\ program text \dots\\
|\end{verbatim}|\\
|\caption{|\dots\ caption \dots|}|\\
|\end{Program}|
\DeleteShortVerb{\|}
\end{verse}
\caption{This is another silly floating Example.}
\end{example}

\begin{table}[H] \def\B#1{$\displaystyle{n\choose#1}$}
\begin{center} \begin{tabular}{c|cccccccc}
$n$&\B0&\B1&\B2&\B3&\B4&\B5&\B6&\B7\\ \hline
 0 & 1\\
 1 & 1&1\\
 2 & 1&2&1\\
 3 & 1&3&3&1\\
 4 & 1&4&6&4&1\\
 5 & 1&5&10&10&5&1\\
 6 & 1&6&15&20&15&6&1\\
 7 & 1&7&21&35&35&21&7&1
\end{tabular} \end{center}
\caption{Pascal's triangle. This is a re-styled \LaTeX\ \texttt{table}.%
  \label{table1}}
\end{table}

\begin{sidewaysprogram}[H]
\begin{verbatim}
#include <stdio.h>

int main(int argc, char **argv)
{
       int i;
       for (i = 0; i < argc; ++i)
               printf("argv[%d] = %s\n", i, argv[i]);
       return 0;
}
\end{verbatim}
\caption{The first program. This hasn't got anything to do with the style
   but is included as an example. Note the \texttt{ruled} float style.%
   \label{prog1.2}}
\end{sidewaysprogram}

% Here we try the star-form just for fun.
% Note that this leads to an error is rotating < 2.10 is used!
%
\begin{sidewaysexample*}[H]
\begin{verse}
\MakeShortVerb{\|}
|\floatstyle{ruled}|\\
|\newfloat{Program}{tbp}{lop}[section]|\\
\dots\ loads o' stuff \dots\\
|\begin{Program}|\\
|\begin{verbatim}|\\
\dots\ program text \dots\\
|\end{verbatim}|\\
|\caption{|\dots\ caption \dots|}|\\
|\end{Program}|
\DeleteShortVerb{\|}
\end{verse}
\caption{This is another silly floating Example.}
\end{sidewaysexample*}

\begin{sidewaystable}[H] \def\B#1{$\displaystyle{n\choose#1}$}
\begin{center} \begin{tabular}{c|cccccccc}
$n$&\B0&\B1&\B2&\B3&\B4&\B5&\B6&\B7\\ \hline
 0 & 1\\
 1 & 1&1\\
 2 & 1&2&1\\
 3 & 1&3&3&1\\
 4 & 1&4&6&4&1\\
 5 & 1&5&10&10&5&1\\
 6 & 1&6&15&20&15&6&1\\
 7 & 1&7&21&35&35&21&7&1
\end{tabular} \end{center}
\caption{Pascal's triangle. This is a re-styled \LaTeX\ \texttt{table}.%
  \label{table2}}
\end{sidewaystable}

\end{document}