summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/navydocs/navydocs.sty
blob: 459ba1f5ce1241168c3153eafa3e3cd00b3fddec (plain)
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
%%
%% This is file `navydocs.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% navydocs.dtx  (with options: `package')
%% 
%% Copyright (C) 2016 Peter Andrew Rochford.
%% 
%% This file is NOT the source for navydocs, because almost all comments
%% have been stripped from it.  It is NOT the preferred form of navydocs for
%% making modifications to it.
%% 
%% Therefore you can NOT redistribute and/or modify THIS file.  You can
%% however redistribute the complete source package (Makefile, navydocs.dtx
%% and navydocs.ins) and/or modify it under the terms of the LaTeX Project
%% Public License, either version 1.3c of this license or (at your option)
%% any later version. The latest version of this license can be found at:
%% https://latex-project.org/lppl/
%% 
%% The navydocs package is distributed in the hope that it will be useful,
%% but `as is', WITHOUT WARRANTY OF ANY KIND, either expressed or
%% implied, including, but not limited to, the implied warranties of
%% MERCHANTABILITY and FITNESS FOR A PARTICULAR PURPOSE.  See the LaTeX
%% Project Public License for more details.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{navydocs}[2016/06/22 Navy Documents]
\typeout{Package: navydocs 2016/07/01 v1.1)}
\providecommand{\eg}{{\it e.g.\/\ }}
\newcommand{\MONTH}{%
  \ifcase\the\month
  \or January% 1
  \or February% 2
  \or March% 3
  \or April% 4
  \or May% 5
  \or June% 6
  \or July% 7
  \or August% 8
  \or September% 9
  \or October% 10
  \or November% 11
  \or December% 12
  \fi}
\IfFileExists{eso-pic.sty}{%
  \usepackage{eso-pic, rotating}}
  {\PackageError {navydocs}{The eso-pic package was not found.}
  {Install the eso-pic package on your system.}}
\IfFileExists{mdframed.sty}{%
\usepackage[
linewidth=4pt,
middlelinecolor= black,
middlelinewidth=0.4pt,
roundcorner=1pt,
topline = false,
rightline = false,
bottomline = false,
rightmargin=0pt,
skipabove=0pt,
skipbelow=0pt,
leftmargin=0cm,
innerleftmargin=1cm,
innerrightmargin=0pt,
innertopmargin=0pt,
innerbottommargin=0pt,
]{mdframed}}
  {\PackageError {mdframed}{The mdframed package was not found.}
  {Install the mdframed package on your system.}}
\IfFileExists{fancyhdr.sty}{%
  \usepackage{fancyhdr}}
  {\PackageError {navydocs}{The fancyhdr package was not found.}
  {Install the fancyhdr package on your system.}}
\IfFileExists{relsize.sty}{%
  \usepackage{relsize}}
  {\PackageError {navydocs}{The relsize package was not found.}
  {Install the relsize package on your system.}}
\IfFileExists{setspace.sty}{%
  \usepackage{setspace}}
  {\PackageError {navydocs}{The setspace package was not found.}
  {Install the setspace package on your system.}}
\IfFileExists{xparse.sty}{%
  \usepackage{xparse}}
  {\PackageError {navydocs}{The xparse package was not found.}
  {Install the xparse package on your system.}}
\newcommand\NavyDivision[1]{\renewcommand\navy@Division{#1\hfill}}
\newcommand\navy@Division{\relax}
\newcommand\NavyDivisionLocation[1]{\renewcommand\navy@Location{#1\hfill}}
\newcommand\navy@Location{\relax}
\newcommand\NavyReportNumber[1]{
  \ifx&#1&%
     % Empty argument so use existing report number
     \navy@ReportNumber
  \else
     % Use argument for report number
     \renewcommand\navy@ReportNumber{#1}
  \fi
}
\newcommand\navy@ReportNumber{\relax}
\newcommand\NavyReportDate[1]{\renewcommand\navy@ReportDate{#1\hfill}}
\newcommand\navy@ReportDate{\number\day~\MONTH~\number\year}
\newcommand\NavyReportType[1]{\renewcommand\navy@ReportType{#1\hfill}}
\newcommand\navy@ReportType{\relax}
\newcommand\NavyReportTitle[1]{\renewcommand\navy@ReportTitle{#1\hfill}}
\newcommand\navy@ReportTitle{\relax}
\newcommand\NavyAuthor[1]{\renewcommand\navy@Author{#1\hfill}}
\newcommand\navy@Author{\relax}
\newcommand\NavyDistributionStatement[1]
{\renewcommand\navy@DistributionStatement{#1\hfill}}
\newcommand\navy@DistributionStatement{
Approved for public release; distribution is unlimited.\hfill
}
\newcommand\countlines[1]{
   {\setbox0\vbox{\noindent{#1}\par
   \count@\z@
   \loop
   \unskip\unpenalty\unskip\unpenalty\unskip
   \setbox0\lastbox
   \ifvoid0
       \xdef\numlines{\the\count@}
   \else
       \advance\count@\@ne
   \repeat}}
}
\newcommand\getmargintextheight[1]{
  \newdimen\margintextheight
  \setbox0=\vbox{#1}
  \margintextheight=\ht0 \advance\margintextheight by \dp0
  % count number of lines so height of each line can be found
  \countlines{#1}
  % now determine height of each line
  \margintextheight=\the\dimexpr \margintextheight / \numlines
}
\newif\ifmargin
\margintrue

\def\marginoffset{\the\dimexpr -\margintextheight*(\numlines - 1)  +
\margintextheight*(\numlines - 1)/2}

\def\navy@xmargin{
\LenToUnit{\leftmargin - \oddsidemargin + \marginparwidth/2
+ \marginoffset}}
\def\navy@ymargin{\LenToUnit{\paperheight - \textheight + \topmargin}}
\newcommand\xmargin{\navy@xmargin}
\newcommand\ymargin{\navy@ymargin}

\DeclareDocumentCommand{\NavyMarginTitle}
{
O{ \LenToUnit{\leftmargin - \oddsidemargin + \marginparwidth/2
+ \marginoffset} }
O{ \LenToUnit{\paperheight - \textheight + \topmargin} } m }{
  \renewcommand\xmargin{#1}
  \renewcommand\ymargin{#2}
  \ifx&#3&%
     % Empty argument so suppress margin title
     \marginfalse
  \else
     % Use mandatory argument for margin title

     % get height of each line for margin offset calculation
     \getmargintextheight{#3}

     \renewcommand\navy@MarginTitle{#3}
  \fi
}
\newcommand\navy@MarginTitle{\relax}
\newcommand\NavyFormID[1]{
\fancypagestyle{NavyFormIDStyle}
{\fancyhf{}\renewcommand{\headrulewidth}{0pt}
\fancyfoot[L]{\scriptsize #1}} }
\newif\ifnavy@undef
\navy@undeffalse
\newcommand{\navy@undefined}[1][\@empty]{%
  \ifx \@empty#1\relax
    \ifnavy@undef
       \typeout{^^J%
                navydocs Warning: There are required fields that are
                undefined.%
                ^^J}%
     \fi
  \else
    \navy@undeftrue
    \typeout{^^J%
             navydocs Warning: \expandafter\string\csname #1
             \endcsname\space is undefined.%
             ^^J}%
  \fi}
\newcommand{\navy@checkfield}[1]{%
  \setbox\@tempboxa\vbox{\csname navy@#1\endcsname}%
  \ifdim \wd\@tempboxa =0pt
    \navy@undefined[#1]
  \fi}
\AtEndDocument{\navy@undefined}
\newcommand{\NavyTitlePage}{%
   \global\let\thanks\@gobble
   \MakeNavyTitlePage
   \global\let\thanks\relax}
\newcommand\MakeNavyTitlePage{%
  \newpage
  \if@twoside\ifodd\c@page\else
    \null
    \thispagestyle{empty}%
    \newpage
  \fi\fi
  \navy@checkfield{Division}
  \navy@checkfield{Location}
  \navy@checkfield{ReportNumber}
  \navy@checkfield{ReportDate}
  \navy@checkfield{ReportType}
  \navy@checkfield{ReportTitle}
  \navy@checkfield{Author}
  \navy@checkfield{DistributionStatement}
\ifmargin
\AddToShipoutPicture*{\put(\xmargin,\ymargin)
 {\rotatebox{90}
 {\scalebox{1}{\parbox[t]{\textheight}
 {\textbf{\small \navy@MarginTitle}}
 }}}}
 \fi
 \begin{titlepage}

 \noindent
 \begin{minipage}[t]{\textwidth}
 \begin{mdframed}
 \parbox[t][0.98\textheight][t]{\textwidth}{
 \noindent\textbf{\large \navy@Division}
 \vskip3mm
 \noindent\textbf{\small \navy@Location}
 \vskip3mm
 \noindent\rule{\textwidth}{4pt} % thick line across page
 \vskip-8pt
 \noindent\rule{\textwidth}{2pt} % thinner line across page
\vspace{4mm}\\
\noindent
\navy@ReportNumber \ \navy@ReportDate \\ \navy@ReportType \\
\vspace{1.7cm}\\
{\Large \textbf{\navy@ReportTitle}
\vspace{1cm}\\
\normalsize
\noindent
by \\ \navy@Author
}\\
\vfill
\noindent
\includegraphics[width=21mm]{graphics/navy-logo-102.png}
\hspace{0.6in}
\begin{minipage}{0.75\textwidth}
\vspace{-0.8cm}
\hrule height 4pt
\vspace{4pt}
\noindent
\parbox[c]{\textwidth}{
\vspace{4pt}
\textbf{\small \navy@DistributionStatement}
\vspace{4pt}
}
\hrule height 4pt
\end{minipage}}
 \end{mdframed}
 \end{minipage}
 \end{titlepage}

  \global\let\NavyDivision\relax
  \global\let\navy@Division\relax
  \global\let\Location\relax
  \global\let\navy@Location\relax
  \global\let\ReportNumber\relax
  \global\let\navy@ReportNumber\relax
  \global\let\NavyReportDate\relax
  \global\let\navy@ReportDate\relax
  \global\let\NavyReportType\relax
  \global\let\navy@ReportType\relax
  \global\let\ReportTitle\relax
  \global\let\navy@ReportTitle\relax
  \global\let\NavyAuthor\relax
  \global\let\navy@Author\relax
  \global\let\NavyRelease\relax
  \global\let\navy@DistributionStatement\relax
  \global\let\MarginTitle\relax
  \global\let\navy@MarginTitle\relax

  \global\let\MakeNavyCoverPage\relax} % end of \MakeNavyCoverPage
\newcommand\MakeCarderockDivPage{%
  \thispagestyle{NavyFormIDStyle} % insert document code in footer
  \section*{ \sffamily\colorbox{black}{\bfseries\textcolor{white}
  {\large MAJOR CARDEROCK DIVISION TECHNICAL COMPONENTS}} }
  \vspace{8ex}

  \doublespace
  \begin{tabular}{lrl}
  CODE & 011 & Director of Technology \\
  & 10 & Machinery Systems/Programs and Logistics Directorate \\
  & 20 & Ship Systems \& Programs Directorate \\
  & 50 & Hydromechanics Directorate \\
  & 60 & Survivability, Structures and Materials Directorate \\
  & 70 & Signatures Directorate \\
  & 80 & Machinery Research \& Development Directorate \\
  & 90 & Machinery In-Service Engineering Directorate
  \end{tabular}
  \singlespace
  \vfill % push minipage to bottom of page

  \noindent
  \fbox{\begin{minipage}{\textwidth}
  \vspace{2ex}
  \begin{center}
  CARDEROCK DIVISION, NSWC, ISSUES THREE TYPES OF REPORTS:
  \end{center}

  \parbox{0.97\textwidth}{
  \begin{enumerate}
  \item \textbf{CARDEROCKDIV reports, a formal series,} contain information
  of permanent technical value. They carry a consecutive numerical
  identification regardless of their classification or the originating
  directorate.
  \item \textbf{Directorate reports, a semiformal series,} contain
  information of a preliminary, temporary, or proprietary nature or of
  limited interest or significance. They carry an alpha numeric
  identification issued by the originating directorate.
  \item \textbf{Technical memoranda, an informal series,} contain
  technical documentation of limited use and interest. They are primarily
  working papers intended for internal use. They carry an identifying
  number which indicates their type and the numerical code of the
  originating directorate. Any distribution outside CARDEROCKDIV must be
  approved by the head of the originating directorate on a case-by-case
  basis.
  \end{enumerate}
  }
  \vspace{1ex}

  \end{minipage}}
  \newpage
  \global\let\MakeCarderockDivPage\relax} % end of \MakeCarderockDivPage
\endinput
%%
%% End of file `navydocs.sty'.