Tidying up techical notes
[barrelfish] / doc / style / bftn.sty
1 % csmtr.sty     K. J. Turner    21/10/08
2
3 % This LaTeX style file sets up the environment for producing Departmental
4 % Technical Reports. It can be used with article or report style and LaTeX 2e.
5
6 \NeedsTeXFormat{LaTeX2e}
7
8 \ProvidesPackage{bftn}
9
10 \usepackage{palatino}
11 \usepackage{fancyhdr}
12 \usepackage{vhistory}
13 \usepackage{url}
14 \usepackage{boxedminipage}
15 \usepackage{fancybox}
16 \usepackage{alltt}
17 \usepackage{parskip}
18
19 \topmargin -0.5 in                      % Top margin 1 inch
20 \oddsidemargin 0.0 in                   % Left margin 1" on odd-numbered pages
21 \evensidemargin 0.0 in                  % Left margin 1" on even-numbered pages
22 \marginparwidth 0.75 in                 % Width of marginal notes
23
24 \textwidth 6.264 in                     % Width of text area
25 \textheight 9.26 in                     % Height of text area
26
27 % Table of contents
28
29 \@ifundefined{chapter}{                 % "article" style
30   \def\intro#1{
31     \clearpage
32     \global\@topnum\z@ \@afterindentfalse
33     \addcontentsline{toc}{section}{#1}
34     \section*{#1}
35   }
36 }{                                      % "report" style
37   \def\intro#1{
38     \cleardoublepage \thispagestyle{plain}
39     \global\@topnum\z@ \@afterindentfalse
40     \typeout{#1.}
41     \addcontentsline{toc}{chapter}{#1}
42     \markboth{#1}{#1}
43     \vspace*{30pt}
44     {
45       \parindent 0pt \raggedright
46       \huge \bf #1 \par
47       \nobreak \vskip 30pt
48     }
49     \@afterheading
50   }
51 }
52
53 % Automatic date
54
55 \def\@date{
56   \ifcase \month
57     \or January
58     \or February
59     \or March
60     \or April
61     \or May
62     \or June
63     \or July
64     \or August
65     \or September
66     \or October
67     \or November
68     \or December
69   \fi
70  \space\number\year
71 }
72
73 % Graphics
74 \RequirePackage{ifpdf}
75 \ifpdf
76   \usepackage[pdftex]{graphicx}
77   \DeclareGraphicsExtensions{.pdf}
78 \else
79   \usepackage{graphicx}
80   \DeclareGraphicsExtensions{.eps,.emf,.wmf}
81   \DeclareGraphicsRule{.emf}{bmp}{}{}
82   \DeclareGraphicsRule{.wmf}{bmp}{}{}
83 \fi
84
85 \def\graphic{\@ifnextchar[{\@graphic}{\@graphic[]}}
86
87 \def\@graphic[#1]#2{\hspace*{\fill}\includegraphics[#1]{#2}\hspace*{\fill}}
88
89 % Title page contents
90
91 \def\tnnumber#1{\gdef\@tnnumber{#1}}    % Report number
92 \def\email#1{\gdef\@email{#1}}          % Email address
93 \def\tnkey#1{\gdef\@tnkey{#1 - }}          % Key (for footers)
94
95 \def\bibname{References}
96
97 \renewcommand{\ttdefault}{cmtt}
98
99 % Environments for syntax and example formatting
100 \newenvironment{syntax}%
101 {\begin{Sbox}\begin{minipage}{\textwidth}\begin{alltt}}%
102 {\end{alltt}\end{minipage}\end{Sbox}
103   \begin{center}\doublebox{\TheSbox}\end{center}}
104 \newcommand{\synit}[1]{\textrm{\it #1}}
105 \newenvironment{example}%
106 {\begin{Sbox}\begin{minipage}{\textwidth}\begin{alltt}}%
107 {\end{alltt}\end{minipage}\end{Sbox}
108   \begin{center}\fbox{\TheSbox}\end{center}}
109
110
111 \def\maketitle{
112   \begin{titlepage}
113     \let\footnotesize\small
114     \let\footnoterule\relax
115     \setcounter{page}{1}
116     \null
117     \begin{center}
118     {
119       \LARGE \it
120       Barrelfish Project\\
121       ETH Zurich
122     }
123     \vskip 5ex
124     {
125       \includegraphics[scale=0.37]{bfish-logo}~\\[9ex]
126       \LARGE \bf
127       \@title \par
128       \vskip 2ex
129       \Large \it
130       Barrelfish Technical Note \@tnnumber\\[1.5em]
131     }
132     \vskip 5ex
133     {
134       \Large \lineskip .75em
135       \begin{tabular}[t]{c}
136       \@author
137       \end{tabular}\par
138       \vspace{3ex}
139       \vhCurrentDate \\ %% @date \\
140       \vspace{3ex}
141       \large \rm
142       Systems Group\\
143       Department of Computer Science \\
144       \large
145       ETH Zurich\\
146       CAB F.79, Universit\"atstrasse 6, Zurich 8092, Switzerland \\[1ex]
147       \large
148       \url{http://www.barrelfish.org/} \mbox{}
149       \par
150     }
151     \vskip 1.5em
152     \@thanks
153     \end{center}
154   \end{titlepage}
155
156   \setcounter{footnote}{0}
157   \let\thanks\relax
158   \gdef\@title{}
159   \gdef\@author{}
160   %% \gdef\@tnnumber{}
161   \gdef\@email{}
162   \gdef\@thanks{}
163   \let\maketitle\relax
164
165 }
166
167   \fancypagestyle{plain}{%
168     \fancyfoot{}
169     \fancyfoot[RO,LE]{\@tnkey\thepage}
170     \fancyfoot[RE,LO]{Barrelfish TN-\@tnnumber}
171     \fancyhead{}
172     \renewcommand{\footrulewidth}{0.4pt}
173   }
174   \pagestyle{plain}
175   
176
177