Newer
Older
% Inspired by:
%
% https://support.astron.nl/confluence/display/~kruger/Confluence+to+latex+to+pdf
% https://lsst-texmf.lsst.io
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{astron}[ASTRON document class]
\newlength{\topMargin}
\newlength{\bottomMargin}
\newlength{\sideMargin}
\setlength{\topMargin}{3.5cm}
\setlength{\bottomMargin}{3.5cm}
\setlength{\sideMargin}{2cm}
\RequirePackage{graphicx}
\RequirePackage{geometry}
\RequirePackage{fancyhdr}
\RequirePackage{lastpage}
\RequirePackage{longtable}
\RequirePackage[absolute]{textpos}
\RequirePackage{tabularx}
\geometry{tmargin=\topMargin,
bmargin=\bottomMargin,
lmargin=\sideMargin,
rmargin=\sideMargin,
headheight=52.05211pt}
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
\setlength{\parindent}{0cm} % No indent at start of paragraphs
\setlength{\parskip}{\baselineskip} % Blank line between paragraph
\newcommand{\docTitle}{Set the document title with \texttt{\textbackslash{}setDocTitle}}
\newcommand{\setDocTitle}[1]{
\renewcommand{\docTitle}{#1}
}
\newcommand{\docNumber}{Set the document number with \texttt{\textbackslash{}setDocNumber}}
\newcommand{\setDocNumber}[1]{
\renewcommand{\docNumber}{#1}
}
\newcommand{\docRevision}{Set the document revision with \texttt{\textbackslash{}setDocRevision}}
\newcommand{\setDocRevision}[1]{
\renewcommand{\docRevision}{#1}
}
\newcommand{\docDate}{Set the document date with \texttt{\textbackslash{}setDocDate}}
\newcommand{\setDocDate}[1]{
\renewcommand{\docDate}{#1}
}
\newcommand{\docClass}{Set the document class with \texttt{\textbackslash{}setDocClass}}
\newcommand{\setDocClass}[1]{
\renewcommand{\docClass}{#1}
}
\newcommand{\docProgram}{Set the document program with \texttt{\textbackslash{}setDocProgram}}
\newcommand{\setDocProgram}[1]{
\renewcommand{\docProgram}{#1}
}
%
% Document history
%
\newenvironment{docHistory}[0]{
\newpage
\section*{Document History}
\begin{small}
% flush table to the left
\setlength\LTleft{0pt}
\setlength\LTright{\fill}
\addtocounter{table}{-1}
\begin{longtable}{|l|p{.13\textwidth}|p{.68\textwidth}|}
\hline
\textbf{Revision} & \textbf{Date} & \textbf{Description} \\ \hline\hline
\endfirsthead
\hline
\textbf{Revision} & \textbf{Date} & \textbf{Description} \\ \hline\hline
\endhead
\multicolumn{3}{r}{\emph{Continued on next page}}
\endfoot
\endlastfoot
}{
\end{longtable}
\end{small}
\clearpage
}
\providecommand{\addtohist}[3]{ #1 & #2 & #3 \\\hline}
\newcommand{\docChangeRecord}{}
\newcommand{\setDocChangeRecord}[1]{\renewcommand{\docChangeRecord}
{
\clearpage
\begin{docHistory}
#1
\end{docHistory}
}}
%
% Define authors, approvers, etc for the front page
%
\providecommand{\addPerson}[3]{ #1 & #2 & #3 \tabularnewline}
\newcommand{\docAuthors}{
... & ... & ... \tabularnewline
}
\newcommand{\setDocAuthors}[1]{\renewcommand{\docAuthors}
{
#1
}}
\newcommand{\docCheckers}{
... & ... & ... \tabularnewline
}
\newcommand{\setDocCheckers}[1]{\renewcommand{\docCheckers}
{
#1
}}
\newcommand{\docApprovers}{
... & ... & ... \tabularnewline
}
\newcommand{\setDocApprovers}[1]{\renewcommand{\docApprovers}
{
#1
}}
\newcommand{\docAuthorizers}{
... & ... & ... \tabularnewline
}
\newcommand{\setDocAuthorizers}[1]{\renewcommand{\docAuthorizers}
{
#1
}}
%
% Define headers and footers
%
\pagestyle{fancy}
\fancyhf{}
\lfoot{\thepage \hspace{1pt} / \pageref{LastPage}}
\rfoot{
\begin{tabular}{>{\raggedright}ll}
Doc. Nr.: & \docNumber{}\tabularnewline
Rev.: & \docRevision{}\tabularnewline
Date: & \docDate{}\tabularnewline
Class & \docClass{}\tabularnewline
\end{tabular}
}
\rhead{\includegraphics[width=8cm]{astron-logo}}
\cfoot{\textbf{\large{}\docProgram{}}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{1pt}
\footskip2cm
%
% Construct the title page, history, etc.
%
\renewcommand{\maketitle}{
\begin{center}
\LARGE\textbf{\docTitle{}}
\end{center}
% This position was determined by trial and error; a bit unsatisfying.
\newlength{\copyrightBoxPosition}
\setlength{\copyrightBoxPosition}{25.2cm}
% Add the copyright notice towards the bottom of the page.
\begin{textblock*}{1\textwidth}(\sideMargin, \copyrightBoxPosition)
\fbox{%
\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
\begin{center}
\begin{small}
\textcopyright{} ASTRON 2020.\\
All rights are reserved. Reproduction in whole or in part is\\
prohibited without written consent of the copyright owner.
\end{small}
\end{center}
\end{minipage}%
}
\newcommand{\authorTable}{%
\begin{tabularx}{\textwidth}{|p{0.35\textwidth}|p{0.35\textwidth}|X|}
\cline{2-3} \cline{3-3}
\multicolumn{1}{c|}{} &
\textbf{\footnotesize{}Organisatie / Organization} &
\textbf{\footnotesize{}Datum / Date} \tabularnewline
\hline
\textbf{\footnotesize{}Auteur(s) / Author(s):\vspace{0.2cm}} & & \tabularnewline
\docAuthors
\hline
\textbf{\footnotesize{}Controle / Checked:\vspace{0.2cm}} & & \tabularnewline
\docCheckers
\hline
\textbf{\footnotesize{}Goedkeuring / Approval:\vspace{0.2cm}} & & \tabularnewline
\docApprovers
\hline
\textbf{\footnotesize{}Autorisatie / Authorization:} & & \tabularnewline
\docAuthorizers
\textbf{\footnotesize{}Handtekening / Signature:\vspace{1cm}} & & \tabularnewline
\hline
\end{tabularx}
}
% We generate the author table once (but don't print it) to measure its height,
% then use that to position the textblock* which ultimately contains the table.
% Note the measured height is (approximately) half the full height.
\newlength{\authorTableHalfHeight}
\settoheight{\authorTableHalfHeight}{\authorTable}
\begin{textblock*}{1\textwidth}(\sideMargin,
\dimexpr\copyrightBoxPosition-2\authorTableHalfHeight+\fboxsep)
\authorTable