summaryrefslogtreecommitdiff
path: root/macros/xetex/latex/armymemo/armymemo.dtx
blob: 159996839ff5416a113a54b90a0157ea6cfeab2a (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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
% \iffalse meta-comment
%
% Copyright (C) 2011 George L. Allen
% Copyright (C) 2019 Christian J. Sharpsten
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License along
% with this program; if not, write to the Free Software Foundation, Inc.,
% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{armymemo.dtx}
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}[2016/02/01]
%<package>\ProvidesPackage{armymemo}
%<*package>
    [2019/01/12 v1.0.0 U.S. Army Memorandum Class]
%</package>
%
%<*driver>
\documentclass{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{armymemo.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \changes{v1.0.0}{2019/01/12}{Initial version}
%
% \GetFileInfo{armymemo.dtx}
%
% \DoNotIndex{\\,\alph,\arabic,\armydate}
% \DoNotIndex{\baselineskip,\begin,\brokenpenalty}
% \DoNotIndex{\chead,\clubpenalty}
% \DoNotIndex{\defaultfontfeatures}
% \DoNotIndex{\end}
% \DoNotIndex{\fancyfoot,\fancyhf,\fancypagestyle,\footnotesize,\footrulewidth}
% \DoNotIndex{\gdef,\global}
% \DoNotIndex{\headheight,\headrulewidth,\hfill,\hspace}
% \DoNotIndex{\ifdefvoid,\includegraphics}
% \DoNotIndex{\let,\lhead,\LoadClass}
% \DoNotIndex{\makebox,\MakeUppercase,\monthname}
% \DoNotIndex{\newcommand,\newcounter,\newdateformat,\node}
% \DoNotIndex{\pagestyle,\parbox,\parindent,\parskip}
% \DoNotIndex{\RaggedRight,\refstepcounter,\relax,\renewcommand}
% \DoNotIndex{\RequirePackage}
% \DoNotIndex{\scriptsize,\setlength,\setmainfont}
% \DoNotIndex{\textwidth,\THEDAY,\THEMONTH,\thepage,\THEYEAR,\thispagestyle}
% \DoNotIndex{\vspace}
% \DoNotIndex{\widowpenalty}
%
% \DoNotIndex{\@amitem,\am@department,\am@enclosures,\am@memofor,\am@memothru}
% \DoNotIndex{\am@officesymbol,\am@subject,\am@unit,\am@unitaddress}
% \DoNotIndex{\am@unitcity}
%
% \title{The \textsf{armymemo} package\thanks{This document
%   corresponds to \textsf{armymemo}~\fileversion,
%   dated \filedate.}}
% \author{Christian J. Sharpsten}
%
% \maketitle
%
% \begin{abstract}
%   The \textsf{armymemo} package provides a class to create U.S. Army
%   memorandums in accordance with AR 25-50. It provides proper formatting
%   and macros for common blocks in a memo.
% \end{abstract}
%
% \section{Introduction}
%
% As with to the article class, you can use |armymemo| by
% declaring it as your |documentclass| and defining a few macros in the
% document header.
%
% \begin{quote}
% |\documentclass{armymemo}|\\
%
% |\unit{ORGANIZATIONAL NAME/TITLE}|\\
% |\unitaddress{STANDARDIZED STREET ADDRESS}|\\
% |\unitcity{CITY STATE 12345-1234}|\\
%
% |\officesymbol{OFFICE SYMBOL}|\\
% |\memofor{U.S. Army Command and General Staff College (ATZL),|\\
% |    100 Stimson Avenue, Ft Leavenworth, KS 66027-1352}|\\
% |\subject{Using and Preparing a Memorandum}|
% \end{quote}
%
% The above macros are required to properly create a memorandum
% header. Additionally, there are other optional macros that can be used
% to further customize the memorandum header. Once declared, the header and
% page style can be applied with the |\makeheader| macro.
%
% \begin{quote}
% |\begin{document}|\\
% |\makeheader|
% \end{quote}
%
% The |\makeheader| macro generates the letterhead as well as the header for
% additional pages. It also creates the THRU, FOR, and SUBJECT lines on the
% first page of the memorandum.
%
% To define the body of the memo, |armymemo| provides three macros: |\ami|,
% |\amii|, and |\amiii|. These correspond to 0, 1, and 2 levels of indentation
% respectively. Once the memo body is complete, you can generate a signature
% block with |\makesigblock|.
%
% \begin{quote}
% |\ami Short, clear purpose sentence|\\
%
% |\ami Second item|\\
%
% |\amii Subitem a|\\
%
% |\amii Subitem b|\\
%
% |\makesigblock{JOHN W. SMITH}{Colonel, GS}{Chief of Staff}|\\
%
% |\end{document}|
% \end{quote}
%
% If there are enclosures, they can optionally be listed with the |\enclosures|
% macro in the document header. |\makesigblock| will insert them appropriately.
%
% \section{Macros}
% \setlength{\parindent}{0pt}
%
% The following macros can be used in the document header to define the
% letterhead and memo header contents.\\
%
% \DescribeMacro{\department}
% Optional. Set the letterhead department. Defaults to\\
% ``DEPARTMENT OF THE ARMY''.
%
% \DescribeMacro{\unit}
% Unit name. Displayed in the letterhead.
%
% \DescribeMacro{\unitaddress}
% Unit street address. Displayed in the letterhead.
%
% \DescribeMacro{\unitcity}
% Unit city and nine-digit zip code. Displayed in the letterhead.
%
% \DescribeMacro{\officesymbol}
% Office symbol for the memorandum originator.
%
% \DescribeMacro{\date}
% Optional. Date for the memo. As described in AR 25-50, dates should be in
% the following format: ``1 January 2013'' or ``1 Jan 13''. |armymemo| defaults
% to |\today| in the long date format.
%
% \DescribeMacro{\memothru}
% Optional. Use a memorandum “THRU” to let other personnel know what is being
% done and give them the opportunity to comment, especially if their comment
% will affect the action. If there are multiple recipients on the THRU line,
% ensure the argument to this macro is prefixed with two blank lines.
%
% \DescribeMacro{\memofor}
% The office that is expected to complete the action.
%
% \DescribeMacro{\subject}
% Subject for the memorandum, 10 words or less if possible.
%
% \DescribeMacro{\enclosures}
% Optional. A list of enclosures.
%
% \vspace{\baselineskip}
% The following macros can be used in the document body to create memo
% elements.\\
%
% \DescribeMacro{\makeheader}
% Create the memorandum header, including the THRU, FOR, and SUBJECT lines.
% This macro will also apply any page styles needed to set the header and
% footer correctly.
%
% \DescribeMacro{\ami}
% Top-level paragraph. Items will be numbered.
%
% \DescribeMacro{\amii}
% Indented subparagraph. Items will be enumerated alphabetically.
%
% \DescribeMacro{\amiii}
% Twice-indented sub-paragraph. Items will be numbered and enclosed in
% parentheses.
%
% \DescribeMacro{\makesigblock}
% Create the signature block. This macro accepts three parameters. In order,
% the parameters are |{name}|, |{rank, branch}|, and |{title}|. This macro
% also includes the enclosure listing to the left of the signature block.
%
% \StopEventually{\PrintIndex}
%
% \section{Implementation}
%
% |armymemo| inherits from |article|. Before declaring any of the macros, we
% include a few packages we depend on.
%    \begin{macrocode}
\LoadClass[letterpaper,12pt,oneside]{article}
\RequirePackage{datetime}
\RequirePackage{fancyhdr}
\RequirePackage{graphicx}
\RequirePackage{hanging}
\RequirePackage{tikz}
%    \end{macrocode}
%
% AR 25-50 calls for 8.5in x 11in paper and 1in margins on all sides (2-3).
% Preferred font is Arial with a point size of 12 (1-17). The fontspec
% package limits this package to xelatex. In order to support \LaTeX ``''
% quotes, we define |Mapping=tex-text|.
%    \begin{macrocode}
\RequirePackage[letterpaper,margin=1in,includefoot]{geometry}
\RequirePackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Arial}
%    \end{macrocode}
%
% Set text wrapping behavior and penalties for widows, orphans, and hyphenation
% across pages. Army memorandums use raggedright text, one line between
% paragraphs, and no indentation. Set max penalties for undesirable page
% breaking behavior in order to satisfy AR 25-50 2-5.c(1) and 2.5.c(3).
%    \begin{macrocode}
\RequirePackage{ragged2e} \RaggedRight
\setlength{\parskip}{\baselineskip}
\setlength{\parindent}{0pt}
\widowpenalty=10000
\clubpenalty=10000
\brokenpenalty=10000
%    \end{macrocode}
%
% Army date format. Note this is the long month name. AR25-50 1-23.a
%    \begin{macrocode}
\newdateformat{armydate}{\THEDAY{} \monthname[\THEMONTH] \THEYEAR}
%    \end{macrocode}
%
% \begin{macro}{\department}
% \begin{macro}{\unit}
% \begin{macro}{\unitaddress}
% \begin{macro}{\unitcity}
% The |\deparment|, |\unit|, |\unitaddress|, and |\unitcity| macros define the
% values used to populate the memorandum letterhead.
%    \begin{macrocode}
\newcommand*{\department}[1]{\gdef\am@department{#1}}
\newcommand*{\unit}[1]{\gdef\am@unit{#1}}
\newcommand*{\unitaddress}[1]{\gdef\am@unitaddress{#1}}
\newcommand*{\unitcity}[1]{\gdef\am@unitcity{#1}}
\department{DEPARTMENT OF THE ARMY}
\newcommand*{\am@unit}{\ClassError{armymemo}{No \@backslashchar unit given}{}}
\newcommand*{\am@unitaddress}{\ClassError{armymemo}{No \@backslashchar unitaddress given}{}}
\newcommand*{\am@unitcity}{\ClassError{armymemo}{No \@backslashchar unitcity given}{}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\officesymbol}
% \begin{macro}{\memothru}
% \begin{macro}{\memofor}
% \begin{macro}{\subject}
% \begin{macro}{\enclosures}
% The |\officesymbol|, |\memothru|, |\memofor|, and |\subject| macros
% define the values used to populate the memorandum header. The
% |\enclosures| macro defines any enclosures included at the end of
% the memorandum.
%    \begin{macrocode}
\newcommand*{\officesymbol}[1]{\gdef\am@officesymbol{#1}}
\newcommand*{\memothru}[1]{\gdef\am@memothru{#1}}
\newcommand*{\memofor}[1]{\gdef\am@memofor{#1}}
\newcommand*{\subject}[1]{\gdef\am@subject{#1}}
\newcommand*{\enclosures}[1]{\gdef\am@enclosures{#1}}
\newcommand*{\am@officesymbol}{\ClassError{armymemo}{No \@backslashchar officesymbol given}{}}
\global\let\am@memothru\relax     % optional
\newcommand*{\am@memofor}{\ClassError{armymemo}{No \@backslashchar memofor given}{}}
\newcommand*{\am@subject}{\ClassError{armymemo}{No \@backslashchar subject given}{}}
\global\let\am@enclosures\relax   % optional
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ami}
% \begin{macro}{\amii}
% \begin{macro}{\amiii}
% The |\ami|, |\amii|, and |\amiii| macros create items, subitems, and
% subsubitems. Subitems are indented by 0.25in increments in accordance with
% AR 25-50 fig 2-1, paragraph 3.
%    \begin{macrocode}
\newcounter{ami}
\newcounter{amii}[ami]
\newcounter{amiii}[amii]
\newcommand*{\@amitem}[2]{\hspace{#1}\makebox[0.25in][l]{#2}}
\newcommand*{\ami}{\refstepcounter{ami}\@amitem{0in}{\arabic{ami}. }}
\newcommand*{\amii}{\refstepcounter{amii}\@amitem{0.25in}{\alph{amii}. }}
\newcommand*{\amiii}{\refstepcounter{amiii}\@amitem{0.5in}{(\arabic{amiii}) }}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\makeheader}
% If |\amthru| is specified, |\makeheader| will insert a THRU block prior to
% the FOR block. It will insert the appropriate header and set page styles for
% the rest of the document.
%    \begin{macrocode}
\newcommand{\makeheader}{
  \thispagestyle{plain}
  \pagestyle{body}
  \am@officesymbol\hfill\armydate\@date\\~\\~\\
  \ifdefvoid{\am@memothru}{
    MEMORANDUM FOR \am@memofor\\~\\
  }{
    MEMORANDUM THRU \am@memothru\\~\\
    FOR \am@memofor\\~\\
  }
  SUBJECT: \am@subject\\~\\~\\
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\makesigblock}
% The |\makesigblock| macro will insert a signature block along with any
% enclosures if specified.
%    \begin{macrocode}
\newcommand{\makesigblock}[3]{
  \setlength{\parskip}{0pt}
  \begin{minipage}[t]{\textwidth}
    \vspace{3\baselineskip}
    \ifdefvoid{\am@enclosures}{}{
      \parbox[t]{0.28\textwidth}{Encl:\\
        \begin{hangparas}{0.25in}{1}
          \am@enclosures
        \end{hangparas}
      }
    }
    \hfill\parbox[t]{0.5\textwidth}{%
      \MakeUppercase{#1}\\
      \MakeUppercase{#2}\\
      #3
    }
  \end{minipage}
}
%    \end{macrocode}
% \end{macro}
%
% Redefine the plain page style. This style should be applied automatically by
% the |\makeheader| command. This style creates the memo letterhead.
%    \begin{macrocode}
\fancypagestyle{plain}{
  \fancyhf{}
  \setlength{\headheight}{56pt}

  \lhead{
    {\begin{tikzpicture}[remember picture, overlay]
      \node[yshift=20pt] at (0,0) {\includegraphics[height=1in]{dodlogo.eps}};
    \end{tikzpicture}}
  }

  \chead{
    {\begin{sffamily}\begin{bfseries}
      {\footnotesize\MakeUppercase{\am@department}} \\
      {\scriptsize
        \MakeUppercase{\am@unit} \\
        \MakeUppercase{\am@unitaddress} \\
        \MakeUppercase{\am@unitcity} \\
      }
    \end{bfseries}\end{sffamily}}
  }

  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
}
%    \end{macrocode}
%
% Define the page style for the memo body. This style should be applied
% automatically by the |\makeheader| command. This style will apply to all
% pages except the first.
%    \begin{macrocode}
\fancypagestyle{body}{
  \setlength{\headheight}{30pt}

  \lhead[]{
    \am@officesymbol\\
    SUBJECT: \am@subject
  }
  \fancyfoot[C]{\thepage}

  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
}
%    \end{macrocode}
%
% \Finale
\endinput