-
Notifications
You must be signed in to change notification settings - Fork 0
/
katdoc.sty
308 lines (250 loc) · 6.97 KB
/
katdoc.sty
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
% File: katdoc.sty
% Subject: Stylesheet for KAT document
% Author: A. Pinska; based on template by R.T. Lord and J.C. Guzman
\ProvidesPackage{katdoc}
\setcounter{errorcontextlines}{999}
\newcommand{\stylesheetVersion}{1.1.2}
\usepackage{graphicx}
\usepackage{lastpage}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{geometry}
\usepackage{array}
\usepackage{babel}
\usepackage{fancyhdr}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{ifthen}
\geometry{verbose,a4paper,tmargin=32mm,bmargin=27mm,lmargin=21mm,rmargin=19mm,headheight=10mm,headsep=12mm,footskip=12mm}
\pagestyle{empty}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\pagenumbering{arabic}
\setlength{\unitlength}{1mm}
% Template revision
\newcommand{\templateVersion}{???}
% Front Cover
\newcommand{\addcontributor}[5]{
#1 & #2 & #3 & #4 & #5 & \\
\hline
}
\newcommand{\addchange}[4]{
#1 & #2 & #3 & #4 \\
\hline
}
\newcommand{\addprogram}[3]{
#1 & #2 & #3 \\
\hline
}
\renewcommand{\maketitle}{
\begin{titlepage}
\begin{center}
% SKA logo
\begin{figure}
\begin{center}
\includegraphics{images/ska_logo}
\end{center}
\end{figure}
\vspace{2cm}
\renewcommand{\arraystretch}{1.5}
% Client Table
\Large
\begin{tabularx}{0.75\textwidth}{|Xr|}
\hline
\textbf{Client:} & \docClient \\
\hline
\textbf{Project:} & \docProject \\
\hline
\textbf{Type:} & \docType \\
\hline
\end{tabularx}
\vspace{1cm}
% Title
\huge
\textbf{\@title}
\vspace{1cm}
% Document Information Table
\Large
\begin{tabularx}{0.75\textwidth}{|Xr|}
\hline
\textbf{Document number:} & \docId \\
\hline
\textbf{Revision:} & \docRevision \\
\hline
\textbf{Classification:} & \docClassification \\
\hline
\textbf{Author:} & \@author \\
\hline
\textbf{Date:} & \docDate \\
\hline
\end{tabularx}
\newpage{}
% Approval Table
\begin{minipage}[c]{\textwidth}
\begin{center}
\LARGE
\textbf{Document Approval}
\vspace{0.5cm}
% lots of padding for signatures
\renewcommand{\arraystretch}{2.0}
\normalsize
\begin{tabularx}{\textwidth}{|l|l|l|l|X|X|}
\hline
Function & Name & Designation & Affiliation & Date & Signature \\
\hline
\docApproval
\end{tabularx}
\end{center}
\end{minipage}
\vspace{1cm}
% Document History
\begin{minipage}[c]{\textwidth}
\begin{center}
\LARGE
\textbf{Document History}
\vspace{0.5cm}
\renewcommand{\arraystretch}{1.2}
\normalsize
\begin{tabular}{|p{0.1\textwidth}|p{0.15\textwidth}|p{0.15\textwidth}|p{0.5\textwidth}|}
\hline
Revision & Date of Issue & ECN Number & Comments \\
\hline
\docHistory
\end{tabular}
\end{center}
\end{minipage}
\vspace{1cm}
% Document Software
\begin{minipage}[c]{\textwidth}
\begin{center}
\LARGE
\textbf{Document Software}
\vspace{0.5cm}
\normalsize
\begin{tabularx}{\textwidth}{|l|l|X|}
\hline
Task & Package & Version \\
\hline
Stylesheet & katdoc & \stylesheetVersion \\
\hline
\docSoftware
\end{tabularx}
\end{center}
\end{minipage}
\vspace{1cm}
% Company Details
\begin{minipage}[c]{\textwidth}
\begin{center}
\LARGE
\textbf{Company Details}
\vspace{0.5cm}
\normalsize
\begin{tabular}{|l|l|}
\hline
Name & SKA South Africa Office \\
\hline
\multirow{5}{*}{Physical/Postal Address} & Third Floor \\ & The Park \\ & Park Road \\ & Pinelands \\ & 7405 \\
\hline
Tel. & +27 21 506 7300 \\
\hline
Fax & +27 21 506 7375 \\
\hline
Website & http://www.ska.ac.za/ \\
\hline
\end{tabular}
\end{center}
\end{minipage}
\end{center}
\vspace{1cm}
% reset table cell padding
\renewcommand{\arraystretch}{1.0}
\end{titlepage}
}
% General Page Header and Footer
\clearpage
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\fancyhead[C]{\docClassification}
\fancyhead[R]{\docId \\ Revision: \docRevision}
\fancyfoot{} % clear all footer fields
\fancyfoot[L]{\docDate \\ \footnotesize \docCopyright}
\fancyfoot[C]{\docClassification}
\fancyfoot[R]{Page \thepage\ of \pageref{LastPage}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
% Abbreviations
\newcommand{\abbrev}[2]{
#1 & #2\\
\hline
}
\newcommand{\listofabbreviations}{
\section*{List of Abbreviations}
\begin{tabular}{|p{0.1\textwidth}|p{0.9\textwidth}|}
\hline
\abbreviations
\end{tabular}
}
% The entire beginning part of the document
\newcommand{\makekatdocbeginning}{
\maketitle
\newpage{}
\tableofcontents{}
\newpage{}
\listoffigures
\listoftables
\listofabbreviations
\newpage{}
}
% Bibliography
\renewenvironment{thebibliography}[1]
{\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\itemindent 1.5em
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}
\newcounter{countDocs}
\setcounter{countDocs}{0}
\newcommand{\adddocument}[4]{
\item \addtocounter{countDocs}{1} \arabic{countDocs} - #1, \emph{#2 (#3)}, #4.
}
\newcommand{\references}[1]{
\section{Applicable and Reference Documents}
\subsection{Applicable Documents}
The following documents are applicable to the extent stated herein. In the event of conflict between the contents of the applicable documents and this document, the applicable documents shall take precedence.
\ifdefined\applicableDocs
\begin{itemize}
\applicableDocs
\end{itemize}
\else
\begin{itemize}
\item \emph{No applicable documents}
\end{itemize}
\fi
\subsection{Related Documents}
The following documents are referenced in this document. In the event of conflict between the contents of the referenced documents and this document, this document shall take precedence.
% \ifdefined\referenceDocs
% \begin{itemize}
% \referenceDocs
% \end{itemize}
% \else
% \begin{itemize}
% \item \emph{No reference documents}
% \end{itemize}
% \fi
% \bibliographystyle{plain}
\bibliographystyle{unsrt}
\bibliography{#1}
}