File: SANDreport.cls

package info (click to toggle)
trilinos 12.18.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 825,604 kB
  • sloc: cpp: 3,352,065; ansic: 432,926; fortran: 169,495; xml: 61,903; python: 40,836; sh: 32,697; makefile: 26,612; javascript: 8,535; perl: 7,136; f90: 6,372; csh: 4,183; objc: 2,620; lex: 1,469; lisp: 810; yacc: 497; awk: 364; ml: 281; php: 145
file content (1644 lines) | stat: -rw-r--r-- 55,143 bytes parent folder | download | duplicates (7)
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
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
% ---------------------------------------------------------------------------- %
% $Id$
%
% We start out with the standard LaTeX document class "article" or "report" and
% modify it so it conforms to the Sandia Technical report style.
% The modifications are based on "Guide to Preparing SAND Reports",
% SAND98-0730, edited by Tamara K. Locke, and the newer "Guide to
% Preparing SAND Reports and Other Communication Products", SAND2002-2068P.
%
% Get the latest version and more at
%    http://www.cs.sandia.gov/~rolf/SANDreport
%
% Rolf Riesen, September 19, 2006.
%
%
% 06/14/2002 v1.01
%     Make distribution list wider. Spaces between area codes and phone numbers
%
% 06/17/2002 v1.02
%     Use \raggedright for main title
%
% 06/19/2002 v1.03
%     Set tocdepth to 2 to only list sections and subsections in TOC
%
% 08/07/2002 v1.04
%     Added a Makefile based on one Mike Heroux provided
%     Allow for distribution lists that span more than one page and
%     typeset the distribution in two columns
%
% 11/25/2002 v1.05
%     Some changes from Daniel Segalman to conform to the new guide
%     (SAND2002-2068P):
%     - Adjust top margin of the title page to conform to the MS Word
%         template (this may or may not be correct depending on your
%         latex/dvips initial setup. Use texconfig to setup paper and
%         dvips).
%     - Added the word "Printed" before the date on front page
%     - Classification category is no longer needed on page 3; get
%         rid of \SANDdistcategory
%     - Added "National Nuclear Security Administration" on title page
%     - Changed NTIS URL on page 2
%
%     If "strict" is not used, we'll number sections to two decimal
%     places (1.2.3)
%
% 02/13/2003 v1.06
%     New DOEbwlogo.eps from Tim Draelos. This one is smaller and has some
%     incompatible junk removed.
%
% 10/16/2003 v1.7
%     Using \ifthenelse in the addcontentsline command interfered with
%     the subfigure class. James Gruetzner and Todd Pitts provided a fix.
%
%     Philippe Pebay reports that the color package needs to be imported
%     before the graphicx package. This class file uses the graphicx package,
%     so Philippe could not use the color package because graphicx was already
%     loaded when his \usepackage command got executed.
%
% 11/19/2003 v1.8
%     Make it work using the report class. Put "report" as an option into
%     \documentclass[report]{SANDreport} to activate it. There were some other
%     fixes and clean-up s as well. Mainly in the table of contents.
%     - Changed NTIS URL on page 2
%     - Added fleqn to \LoadClass
%     - Can't get the report title to repeat on the first chapter page.
%         Left it off for now.
%     - The table of contents formatting for report class is more or less like
%         report.cls. For article, we try to make it look like the guideline.
%
% 01/19/2004 v1.9
%     - The distribution list at the end of a SAND report was modifying the
%         description environment which interfered with its regular use. Created
%         a separate environment to fix that.
%     - If in "report", list chapters and sections in TOC
%     - With the jpg option, load the jpg versions of the DOE and Sandia
%         logos. This makes it possible to use pdftex which doesn't
%         understand Postscript.
%
% 02/25/2004 v1.10
%     - It is now SANDIA REPORT, no longer SAND REPORT. Central Technical Files
%         now wants three copies. See the distribution examples. (Info from
%         Philippe Pebay)
%     - Added new commands for markings used in OUO, export controlled, and
%         other reports not labeled "Unlimited Release". Thanks to Mark
%         Ackermann for providing an OUO example.
%     - In report style, the page numbers restarted after the title page. Fixed!
%     - Big clean-up.
%
% 05/14/2004 v1.11
%     - Had to comment out a line in fancyhdr.sty for pdflatex to work.
%         Don't know why.
%
% 05/21/2004 v1.12
%     - Added the options [FIGBOTCAP,normal,bf,tight] to the subfigure
%         package in the example files from a suggestion by Philippe P. Pebay.
%     - Added the CA and NM options to insert the respective standard distributions.
%
% 08/07/2004 v1.13
%     - Use pdf versions of logos. Makes the "jpg" option obsolete. Suggestion
%         and logos by Richard Lehoucq.
%     - Making SANDreport.cls compatible with the hyperref package
%     - Added SANDmath.tex from Philippe Pebay
%
% 08/18/2004 v1.14
%     - \begin{SANDdistribution} now takes an optional argument (CA or NM). The
%         respective \documentclass options are no longer valid. Several new
%         commands are available within the SANDdistribution environment to
%         automate distributions for special cases such as CRADA, LDRD,
%         Classified, Patent, etc.
%     - The distribution list is now better formatted.
%     - Fixed a bug with \SANDreleaseType discovered by Mark Ackermann
%     - Added the command \SANDmarkTop
%
% 05/20/2005 v1.15
%     - A small change in the distribution list (D. Chavez in the LDRD office
%         moved) Thanks to Brandon Rohrer.
%
% 12/05/2005 v1.16
%     - New org numbers reflect new corporate structure 9616->4536, etc. Thanks
%         to Philip Sackinger for doing this.
%     - Philip also found out what the newest distribution rules for NM are.
%     - In the example files, deleted a misleading comment about secnumdepth in
%         the appendix. Thanks to John Mitchell for spotting this.
%     - New SANDmath.tex from Philippe Pebay: (ver. 1.2)
%         + add support for discrete intervals
%         + fix some comments
%         + replace incorrect \RequirePackage's by \usepackage'
%     - Also from Philippe Pebay: CA distribution list changes.
%     - Abstract will start on title page, even with report style. Thanks to
%         Daniel Dolan for noticing it and making suggestions to fix it.
%     - Put the title just above the first chapter in the report style
%
% 12/09/2005 v1.17
%    - Fixed a bug introduced in the last version: The \cleardoublepage is
%        only supposed to happen for chapters in the main body of a report,
%        and it needs to happen before the page number is entered into the TOC.
%    - Fixed several new and old bugs that dealt with markings
%    - Fixed text on usage page about marking commands.
%
% 12/09/2005 v1.18
%    - Make it work with hyperref again....
%
% 12/19/2005 v1.19
%    - There were still problems with the hyperref package. Fixed it so that
%        the page markings on the back cover are now correct.
%
% 12/21/2005 v1.20
%    - Updated the distribution list according to version 2.0 of the Guide
%
% 03/22/2006 v1.21
%    - Introduced \SANDrePrintDate and \begin{SANDreDistribution}
%    - Put a page number (2) on the back cover
%    - No institution in \SANDauthor{} in example files
%    - Move the SNL logo on the cover towards the bottom of the page
%    - Add a back cover with the SNL logo at the bottom of the back
%    - Use \cleardouble page and add comment to example files to make
%        sure TOC always starts on an odd page.
%    - Don't put title on first page of body text (above introduction)
%        anymore. (Changed from Ver 1.0, Sep. 2002 to Ver 2.0, Dec. 2005 of the guide.)
%    - For article, start every section on a new page (report already does this)
%    - Fixed URLs for DOE report ordering
%    - \SANDmarkCover now takes only one argument! This makes it easier to draw a
%        box around the statement and configure it as needed. See MarkOUO.tex for
%        an example. Thanks to John Foster for the example.
%    - Print small class file version number at bottom of inside back cover
%    - Change by Daniel Dolan to make it work and look consistent with the mathptmx
%        package. This leaves the Helvetica fonts on the cover alone, but lets him
%        have the body of the report in Times.
%    - From Debbie Johnson (Creative Arts):
%        - In example files, use First Name, Middle Initial, Last Name on cover and title page
%        - In example files, on cover, put author names on one line
%        - Mail Stop for Central Technical Files is MS9018. (This was an error in the example
%            file, not the class itself.)
%        - Back cover was shifted right too far.
%        - Move chapter headings up a bit.
%        - Use the geometry package to get the margins right
%
% 06/10/2006 v1.22
%    - Remove "Unclassified" from "Unclassified Unlimited Release" (Thanks Brett Bader and Mike Heroux)
%    - Confirmed that M2497 is correct mail stop for classified reports to Central Technical
%          Files. (Thanks Debbie Johnson)
%    - Make the distribution list single column. This makes it easier to print labels.
%    - D. Chavez, LDRD Office mail-stop changed from 0188 to 0123. (Thanks Brett Bader)
%    - In examples, added \phantomsection and moved \addcontentsline{toc}{section}{References}
%        just before the \bibliography{...} command. This helps putting the right page number
%        into the TOC and also with hyperlinking. (Thanks Tammy Kolda)
%    - Clarified usage of \SANDnum{} on Web page. (Thanks Tammy Kolda)
%    - More usage and LaTeX tips on Web page. (Thanks Tammy Kolda)
%    - Newer distributions have a fancyhdr.sty that works. Removed it.
%
% 06/26/2006 v1.23
%    - Tammy Kolda found a bug when using amsmath. Seems to have been a problem with
%        white space in the redefinition of \section. LaTeX would stop when building the TOC.
%
% 08/17/2006 v1.24
%    - Changed tar file extenstion from .tgz to .tar.gz Some winzip versions under
%        Windows don't seem to like the former. (Rich Lehoucq)
%    - Org. Number for Central Technical Files changed from 8945-1 to 8944 (Tammy and Debbie)
%
% 09/19/2006 v1.25
%    - David Wilson discovered that markings in report style also activated chapter
%        name headings, which are unwanted and sometimes overlap with the markings.
%


% ******************************************************************************
% Package definitions
%
    % The version and date of this file
    \newcommand\SANDreportVersionOnly{ v1.25 }		% leave the spaces before and after version
    \newcommand\SANDreportVersionDate{2006/09/19}	% Date has to bis this format!

    \typeout{Using Sandia Technical Report class: \SANDreportVersionDate, \SANDreportVersionOnly Rolf Riesen}
    \newcommand\SANDreportVersion{\SANDreportVersionDate \SANDreportVersionOnly}

    % We need LaTeX 2e or better
    \NeedsTeXFormat{LaTeX2e}

    % We need ifthenelse. \newboolean are false by default
    \RequirePackage{ifthen}
    \RequirePackage{color}
    \RequirePackage{graphicx}

    % Variables
    \newboolean{relaxedSAND}
    \newboolean{strictSAND}
    \newboolean{reportSAND}
    \newboolean{SANDmainProvided}
    \newboolean{SANDnumProvided}
    \newboolean{SANDprintDateProvided}
    \newboolean{SANDrePrintDateProvided}
    \newboolean{SANDauthorProvided}
    \newboolean{SANDsupersedProvided}
    \newboolean{SANDdistributionProvided}
    \newboolean{inAppendix}
    \newboolean{SANDmarkingsRequired}
    \newboolean{MarkCover}
    \newboolean{MarkBack}
    \newboolean{MarkTitle}
    \newboolean{MarkBody}
    \newboolean{MarkBottom}
    \newboolean{distCA}
    \newboolean{distNM}

    % Counters
    \newcounter{SANDprintingCnt}
    \setcounter{SANDprintingCnt}{1}
    \newcounter{SANDreDistCnt}
    \setcounter{SANDreDistCnt}{1}


    % We need calc to divide by 3 in setlength and other calculations
    \RequirePackage{calc}

    % We need the fancy headers for the report markings
    \RequirePackage{fancyhdr}


    % Specify what this file provides
    \ProvidesPackage{SANDreport}[\SANDreportVersion]
    \ProvidesFile{SANDreport.cls}[\SANDreportVersion]


    % We understand three options: "relax", "strict", and "report"
    % Using "relax" make the document look more LaTeXy
    % If no option are given, then we follow the format of SAND2002-2068P
    % Using "strict" tries to follow the guideline even more closely
    % Specifying "report" uses the report class instead of the article class
    %
    \DeclareOption{relax}{
	\typeout{Option "relax": Relaxing some of the SAND98-0730 requirements}
	\setboolean{relaxedSAND}{true}
    }
    \DeclareOption{strict}{
	\typeout{Option "strict": Follow the SAND98-0730 requirements more strictly}
	\setboolean{strictSAND}{true}
    }
    \ifthenelse{\boolean{relaxedSAND} \and \boolean{strictSAND}}   {
	\ClassWarning{SANDreport.cls}{Both, "strict" and "relax" options given}
    }{
    }
    \DeclareOption{report}{
	\typeout{Option "report": Using the report class as a base.}
	\setboolean{reportSAND}{true}
    }
    \DeclareOption{CA}{
	\ClassError{SANDreport.cls}{"CA" option is obsolete}{Use
	\@backslashchar begin{SANDdistribution}[CA] instead.}
    }
    \DeclareOption{NM}{
	\ClassError{SANDreport.cls}{"NM" option is obsolete}{Use
	\@backslashchar begin{SANDdistribution}[NM] instead.}
    }


    % We're based on the standard article or report class and assume certain
    % options. Set those, and pass all others to the article class
    \ProcessOptions % We need to do it here so we get "reportSAND", and then again
    \ifthenelse{\boolean{reportSAND}}   {
	\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
	\ProcessOptions % Repeat it here, otherwise LaTeX gets confused
	\LoadClass[letterpaper,twoside,final,fleqn]{report}
    }{
	\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
	\ProcessOptions % Repeat it here, otherwise LaTeX gets confused
	\LoadClass[letterpaper,twoside,final,fleqn]{article}
    }


    %
    % Setup for letter paper (This IS a SAND report!)
    %
    \RequirePackage{geometry}
    % \geometry{pdftex, showframe, inner=1.5in, textwidth=6in, textheight=9in}
    \geometry{pdftex, inner=1.5in, textwidth=6in, textheight=9in}



% ******************************************************************************
% Check some of the user directives and setup a few things
%

    \AtBeginDocument{

	% Do some usage checking
	\ifthenelse{\boolean{SANDnumProvided}}   {
	}{
	    \ClassError{SANDreport.cls}{\@backslashchar SANDnum
		not provided}{Insert \@backslashchar SANDnum in the preamble
		of your document}
	}
	\ifthenelse{\boolean{SANDauthorProvided}}   {
	}{
	    \ClassError{SANDreport.cls}{\@backslashchar SANDauthor
		not provided}{Insert \@backslashchar SANDauthor in the preamble
		of your document}
	}
	\ifthenelse{\boolean{SANDprintDateProvided}}   {
	}{
	    \ClassError{SANDreport.cls}{\@backslashchar SANDprintDate
		not provided}{Insert \@backslashchar SANDprintDate in the
		preamble of your document}
	}

	% Save the title, it will be cleared by \maketitle, but we need it later
	\newsavebox{\SANDtitletempbox}
	\sbox{\SANDtitletempbox}{\parbox{\textwidth - 1.5in}{
	    \centering \LARGE \bf \@title \par}
	}

	%
	% Some measurements to format the title page properly
	%
	\newlength{\textwidththird}
	\newlength{\topheight}
	\newlength{\topleftwidth}
	\newlength{\topmiddlewidth}
	\newlength{\toprightwidth}

	\setlength{\textwidththird}{(\textwidth / 3) - (\fboxsep * 2)}
	\setlength{\topleftwidth}{\the\textwidththird}
	\setlength{\topmiddlewidth}{\the\textwidththird}
	\setlength{\toprightwidth}{\the\textwidththird}
	\addtolength{\topleftwidth}{-3em}
	\addtolength{\topmiddlewidth}{+4em}
	\addtolength{\toprightwidth}{-3em}

	\ifthenelse{\boolean{SANDsupersedProvided}}   {
	    \setlength{\topheight}{1.5in}
	}{
	    \setlength{\topheight}{1.0in}
	}

	%
	% We want a blank line between paragraphs
	%
	\setlength\parskip{2ex}


	% We don't want a head rule
	\renewcommand{\headrulewidth}{0pt}
    } % End of AtBeginDocument{}



% ******************************************************************************
% Cover pages
%

    % ------------------------------------------------------------------------ %
    % Font selections for the cover page \Coverfont{series}{size}{skip}
    %
    \newcommand{\CoverFont}[3]{
	\fontencoding{OT1}
	\fontfamily{phv}
	\fontseries{#1}
	\fontshape{n}
	\fontsize{#2}{#3}
	\selectfont
    }

    \newcommand{\doCover}{
	%
	% Print the cover pages
	%
	\SANDmarks{cover}
	\newlength{\coverindent}
	\setlength{\coverindent}{1em}
	\setlength{\parindent}{0em}


	%
	% Front Cover
	%
	%\hspace*{-0.375in}
	\begin{minipage}[t]{6.0in}
	    \CoverFont{b}{18}{20pt}
	    SANDIA REPORT
	    \vspace{0.125in}\\
	    \CoverFont{m}{12}{14pt}
	    \SANDnumVar\\
	    \SANDreleaseTypeVar\\
	    \ifthenelse{\boolean{SANDrePrintDateProvided}}   {
		Printed \SANDrePrintDateVar
	    }{
		Printed \SANDprintDateVar
	    }
	    \ifthenelse{\boolean{SANDsupersedProvided}}   {
		\vspace{0.125in}\\
		\SANDsupersedVar
	    }{
		\\
	    }

	    \vspace{0.25in}
	    \CoverFont{b}{24}{28pt}
	    \parbox[t]{\textwidth}{
		\raggedright
		\@title            
	    }


	    \vspace{0.75in}
	    \CoverFont{m}{12}{14pt}
	    \SANDauthorVar

	    \vspace{0.25in}
	    \CoverFont{m}{8}{10pt}
	    \selectfont
	    Prepared by\\
	    Sandia National Laboratories\\
	    Albuquerque, New Mexico 87185 and Livermore, California 94550\\
	    \\
	    Sandia is a multiprogram laboratory operated by Sandia Corporation,\\
	    a Lockheed Martin Company, for the United States Department of Energy's\\
	    National Nuclear Security Administration under Contract DE-AC04-94-AL85000.\\
	    \\
	    \MarkCoverVar
	\end{minipage}

	\vspace*{\fill} % Move the logo to the bottom of the cover page

	%\hspace*{-0.5in}
	\begin{minipage}[b]{6.0in}
	    \includegraphics{snllineblk}
	\end{minipage}



	%
	% Back cover
	%
	\newpage
	\begin{minipage}[t]{6.0in}
	    \fontencoding{OT1}
	    \fontfamily{pnc}
	    \fontseries{m}
	    \fontshape{n}
	    \fontsize{9}{11pt}
	    \selectfont

	    Issued by Sandia National Laboratories, operated for the
	    United States Department of Energy by Sandia Corporation.
	    \vspace{\baselineskip}

	    {\fontsize{11}{13pt}\fontseries{b}\selectfont NOTICE:}
	    This report was prepared
	    as an account of work sponsored by an agency of
	    the United States Government. Neither the United
	    States Government, nor any agency thereof, nor any
	    of their employees, nor any of their contractors,
	    subcontractors, or their employees, make any warranty,
	    express or implied, or assume any legal liability or
	    responsibility for the accuracy, completeness, or
	    usefulness of any information, apparatus, product,
	    or process disclosed, or represent that its use
	    would not infringe privately owned rights. Reference
	    herein to any specific commercial product, process,
	    or service by trade name, trademark, manufacturer, or
	    otherwise, does not necessarily constitute or imply
	    its endorsement, recommendation, or favoring by the
	    United States Government, any agency thereof, or any
	    of their contractors or subcontractors. The views and
	    opinions expressed herein do not necessarily state
	    or reflect those of the United States Government,
	    any agency thereof, or any of their contractors.
	    \vspace{\baselineskip}

	    Printed in the United States of America. This report has
	    been reproduced directly from the best available copy.
	    \vspace{\baselineskip}

	    Available to DOE and DOE contractors from\\
	    \begin{tabular}{ll}
		\hspace*{\coverindent} & U.S. Department of Energy \\
		& Office of Scientific and Technical Information \\
		& P.O. Box 62 \\
		& Oak Ridge, TN 37831 \\
		&  \\
	    \end{tabular}
	    \\
	    \begin{tabular}{lll}
		\hspace*{\coverindent} & Telephone: & (865) 576-8401\\
		& Facsimile: & (865) 576-5728\\
		& E-Mail: & 	reports@adonis.osti.gov\\
		& Online ordering: & http://www.osti.gov/bridge\\
	    \end{tabular}
	    \vspace{\baselineskip}
	    \vspace{0.25in}

	    Available to the public from\\
	    \begin{tabular}{ll}
		\hspace*{\coverindent} & U.S. Department of Commerce \\
		& National Technical Information Service \\
		& 5285 Port Royal Rd \\
		& Springfield, VA 22161 \\
		&  \\
	    \end{tabular}
	    \\
	    \begin{tabular}{lll}
		\hspace*{\coverindent} & Telephone: & (800) 553-6847 \\
		& Facsimile: & (703) 605-6900 \\
		& E-Mail: & orders@ntis.fedworld.gov \\
		%& Online ordering: & http://www.ntis.gov/ordering.htm \\
		& Online ordering: & http://www.ntis.gov/help/ordermethods.asp?loc=7-4-0\#online \\
	    \end{tabular}
	    \vspace{\baselineskip}
	    \vspace{0.125in}

	    \includegraphics[width=0.75in]{DOEbwlogo}
	\end{minipage}
	\SANDmarks{back}
    }


% ******************************************************************************
% The user commands
%

    % ------------------------------------------------------------------------ %
    % Here we define the mandatory declarations
    %
    \newcommand{\SANDnum}[1]{
	\newcommand{\SANDnumVar}{#1}
	\setboolean{SANDnumProvided}{true}
    }

    \newcommand{\SANDauthor}[1]{
	\newcommand{\SANDauthorVar}{#1}
	\setboolean{SANDauthorProvided}{true}
    }

    \newcommand{\SANDprintDate}[1]{
	\newcommand{\SANDprintDateVar}{#1}
	\setboolean{SANDprintDateProvided}{true}
    }


    % This one is optional
    \newsavebox{\SANDrePrintDistBox}
    \newsavebox{\SANDrePrintDistBoxSecond}
    \newsavebox{\SANDrePrintDistBoxThird}
    \newsavebox{\SANDrePrintDistBoxFourth}
    \newsavebox{\SANDrePrintDistBoxFifth}
    \newcommand{\SANDrePrintDateVar}{}

    \newcommand{\SANDrePrintDate}[1]{
	\renewcommand{\SANDrePrintDateVar}{#1}
	\setboolean{SANDrePrintDateProvided}{true}
	\stepcounter{SANDprintingCnt}
	\ifthenelse{\value{SANDprintingCnt} = 2}   {
	    \sbox{\SANDrePrintDistBoxSecond}{Second Printing, (#1):}
	}{
	    \ifthenelse{\value{SANDprintingCnt} = 3}   {
		\sbox{\SANDrePrintDistBoxThird}{Third Printing, (#1):}
	    }{
		\ifthenelse{\value{SANDprintingCnt} = 4}   {
		    \sbox{\SANDrePrintDistBoxFourth}{Fourth Printing, (#1):}
		}{
		    \ifthenelse{\value{SANDprintingCnt} = 5}   {
			\sbox{\SANDrePrintDistBoxFifth}{Fifth Printing, (#1):}
		    }{
			\ClassError{SANDreport.cls}{\@backslashchar SANDreDistribution
			    used more than four times!}{Do you really have more than
			    five printings? If so, you need to amend SANDreport.cls}
		    }
		}
	    }
	}
    }


    % Used to need the title at the top of the first section/chapter, but that is
    % not required anymore.  Make sure we start on an odd page.
    \newcommand{\SANDmain}{
	\cleardoublepage
	\setboolean{SANDmainProvided}{true}
    }


    \ifthenelse{\boolean{reportSAND}}   {
	%
	% new 1
	% Once we have left the preamble and are in the body of the text,
	% we want each chapter to begin on an odd numbered page
	%
	% new 2
	% After we're done with the title page, we switch to markings for body pages.
	%
	\renewcommand\chapter{%						% \chapter from report.cls
	    %\if@openright\cleardoublepage\else\clearpage\fi		% deleted
	    \ifSANDmainProvided\cleardoublepage\else\clearpage\fi	% new 1
	    \SANDmarks{body}						% new 2
	    % \thispagestyle{plain}%					% deleted
	    \global\@topnum\z@						% \chapter from report.cls
	    \@afterindentfalse						% \chapter from report.cls
	    \secdef\@chapter\@schapter					% \chapter from report.cls
	}								% \chapter from report.cls

	%
	% We redefine \@makechapterhead and \@schapter so we can move
	% the chapter title a little bit higher up.
	%

	%
	% This is for chapters in the body
	\def\@makechapterhead#1{%					% \@makechapterhead from report.cls
	    \vspace*{-10\p@}%						% Changed
	    {\parindent \z@ \raggedright \normalfont			% \@makechapterhead from report.cls
	    \ifnum \c@secnumdepth >\m@ne				% \@makechapterhead from report.cls
		\huge\bfseries \@chapapp\space \thechapter		% \@makechapterhead from report.cls
		\par\nobreak						% \@makechapterhead from report.cls
		\vskip 20\p@						% \@makechapterhead from report.cls
	    \fi								% \@makechapterhead from report.cls
	    \interlinepenalty\@M					% \@makechapterhead from report.cls
	    \Huge \bfseries #1\par\nobreak				% \@makechapterhead from report.cls
	    \vskip 40\p@						% \@makechapterhead from report.cls
	}}								% \@makechapterhead from report.cls

	%
	% This is for chapters in the preamble
	\def\@schapter#1{\if@twocolumn					% \@schapter from report.cls
		\@topnewpage[\@makeschapterhead{#1}]%			% \@schapter from report.cls
	    \else							% \@schapter from report.cls
		\@makeschapterhead{#1}%					% \@schapter from report.cls
		\@afterheading						% \@schapter from report.cls
	    \fi}							% \@schapter from report.cls
	    \def\@makeschapterhead#1{%					% \@schapter from report.cls
	    \vspace*{-10\p@}%						% Changed
	    {\parindent \z@ \raggedright				% \@schapter from report.cls
	    \normalfont							% \@schapter from report.cls
	    \interlinepenalty\@M					% \@schapter from report.cls
	    \Huge \bfseries  #1\par\nobreak				% \@schapter from report.cls
	    \vskip 40\p@						% \@schapter from report.cls
	}}

    }{
	% new 3
	% We want each section starting on a new page The report class already does this
	%
	% new 4
	% Center the section headings
	%
	\renewcommand\section{\clearpage%				% new 3
	    \@startsection {section}{1}{\z@}%				% \section from article.cls
	    {-3.5ex \@plus -1ex \@minus -.2ex}%			% \section from article.cls
	    {2.3ex \@plus.2ex}%					% \section from article.cls
	    %{\normalfont\Large\bfseries}%				% deleted
	    {\normalfont\Large\bfseries\centering}%			% new 4
	}								% \section from article.cls
    }



    % ------------------------------------------------------------------------ %
    % Distribution page at the end
    % We have to create our own description environment, so we don't
    % disturb the original one.
    \newcommand{\SANDdescriptionlabel}[1]{
	    \makebox[3em][r]{#1}
    }
    \newenvironment{SANDdescription}{
	\list{}
	{\labelwidth\z@ \itemindent-\leftmargin \let\makelabel\SANDdescriptionlabel}
    }{
	\endlist
    }

    \newenvironment{SANDdistribution}[1][nothing]{
	\setboolean{SANDdistributionProvided}{true}

	\newboolean{distCRADA}
	\newboolean{distPatent}
	\newboolean{distLDRD}
	\newboolean{distClassified}
	\newcommand{\SANDdistCRADA}{
	    \setboolean{distCRADA}{true}
	}

	\newcommand{\SANDdistPatent}{
	    \setboolean{distPatent}{true}
	}

	\newcommand{\SANDdistLDRD}{
	    \setboolean{distLDRD}{true}
	}

	\newcommand{\SANDdistClassified}{
	    \setboolean{distClassified}{true}
	    \SANDdistInternalM{2}{M2497}{Central Technical Files}{8944}
	}



	% Option NM given
	\ifthenelse{\equal{#1}{NM}}   {
	    \typeout{Option "NM": Using the SNL NM default distribution list.}
	    \setboolean{distNM}{true}
	}{
	}

	% Option CA given
	\ifthenelse{\equal{#1}{CA}}   {
	    \typeout{Option "CA": Using the SNL CA default distribution list.}
	    \setboolean{distCA}{true}
	}{
	}

	\clearpage
	{\Large DISTRIBUTION:}
	\normalsize
	\raggedbottom
	\begin{SANDdescription}
    }{
	\ifthenelse{\boolean{distCA}}   {
	    % Insert the standard CA distribution
	    \ifthenelse{\boolean{distClassified}}   {
		\SANDdistInternal{2}{9018}{Central Technical Files}{8944}
		\SANDdistInternalM{2}{0501}{Technical Library}{4536}
	    }{
		\SANDdistInternal{2}{9018}{Central Technical Files}{8944}
		\SANDdistInternal{2}{0899}{Technical Library}{4536}
	    }

	    % If this report has a Patent Caution or Patent Interest
	    \ifthenelse{\boolean{distPatent}}   {
		\SANDdistInternal{1}{0161}{Legal Intellectual Property}{11500}
	    }{}

	    % If this report is for CRADA work
	    \ifthenelse{\boolean{distCRADA}}   {
		\SANDdistInternal{1}{0115}{OFA/NFE Agreements}{10112}
	    }{}

	    % If this report is for LDRD work
	    \ifthenelse{\boolean{distLDRD}}   {
		\SANDdistInternal{1}{0123}{D. Chavez, LDRD Office}{1011}
	    }{}

	}{}

	\ifthenelse{\boolean{distNM}}   {
	    % Insert the standard NM distribution
	    \ifthenelse{\boolean{distClassified}}   {
		\SANDdistInternalM{2}{2497}{Central Technical Files}{8944}
		\SANDdistInternal{2}{0899}{Technical Library}{4536}
	    }{
		\SANDdistInternal{2}{9018}{Central Technical Files}{8944}
		\SANDdistInternal{2}{0899}{Technical Library}{4536}
	    }

	    % If this report has a Patent Caution or Patent Interest
	    \ifthenelse{\boolean{distPatent}}   {
		\SANDdistInternal{1}{0161}{Legal Intellectual Property}{11500}
	    }{}

	    % If this report is for CRADA work
	    \ifthenelse{\boolean{distCRADA}}   {
		\SANDdistInternal{1}{0115}{OFA/NFE Agreements}{10112}
	    }{}

	    % If this report is for LDRD work
	    \ifthenelse{\boolean{distLDRD}}   {
		\SANDdistInternal{1}{0123}{D. Chavez, LDRD Office}{1011}
	    }{}

	}{}

	\end{SANDdescription}
    }



    %
    % The distribution list for a reprint
    % No housekeeping copies are needed.
    \newenvironment{SANDreDistribution}{
	\ifthenelse{\boolean{SANDrePrintDateProvided}}   {
	    \setboolean{SANDdistributionProvided}{true}

	    \stepcounter{SANDreDistCnt}
	    \ifthenelse{\value{SANDreDistCnt} = 2}   {
		\sbox{\SANDrePrintDistBox}{\usebox{\SANDrePrintDistBoxSecond}}
	    }{
		\ifthenelse{\value{SANDreDistCnt} = 3}   {
		    \sbox{\SANDrePrintDistBox}{\usebox{\SANDrePrintDistBoxThird}}
		}{
		    \ifthenelse{\value{SANDreDistCnt} = 4}   {
			\sbox{\SANDrePrintDistBox}{\usebox{\SANDrePrintDistBoxFourth}}
		    }{
			\ifthenelse{\value{SANDreDistCnt} = 5}   {
			    \sbox{\SANDrePrintDistBox}{\usebox{\SANDrePrintDistBoxFifth}}
			}{
			    \ClassError{SANDreport.cls}{\@backslashchar SANDreDistribution
				used more than four times!}{Do you really have more than
				five printings? If so, you need to amend SANDreport.cls}
			}
		    }
		}
	    }

	    \usebox{\SANDrePrintDistBox}
	    \normalsize
	    \raggedbottom
	    \begin{SANDdescription}
	}{
	}
    }{
	\ifthenelse{\boolean{SANDrePrintDateProvided}}   {
	    \end{SANDdescription}
	}{
	}
    }


    \newcommand{\SANDdistInternal}[4]{
	\ifthenelse{\boolean{SANDdistributionProvided}}   {
	}{
	    \ClassError{SANDreport.cls}{\@backslashchar SANDdistribution
		not (yet) provided}{\@backslashchar SANDdistribution must
		be used before any \@backslashchar SANDdistInternal}
	}
	\item[#1] \parbox[t]{2.3in}{MS \makebox[5ex][r]{#2}\newline
		  \raggedright #3, #4}
    }


    % Use a mail channel
    \newcommand{\SANDdistInternalM}[4]{
	\ifthenelse{\boolean{SANDdistributionProvided}}   {
	}{
	    \ClassError{SANDreport.cls}{\@backslashchar SANDdistribution
		not (yet) provided}{\@backslashchar SANDdistribution must
		be used before any \@backslashchar SANDdistInternal}
	}
	\item[#1] \parbox[t]{2.3in}{#2\newline \raggedright #3, #4}
    }


    \newcommand{\SANDdistExternal}[2]{
	\ifthenelse{\boolean{SANDdistributionProvided}}   {
	}{
	    \ClassError{SANDreport.cls}{\@backslashchar SANDdistribution
		not (yet) provided}{\@backslashchar SANDdistribution must
		be used before any \@backslashchar SANDdistExternal}
	}
	\item[#1] \parbox[t]{2.3in}{#2}
    }



    % ------------------------------------------------------------------------ %
    % And now some optional declarations
    %
    \newcommand{\SANDsupersed}[2]{
	\newsavebox{\SANDsupersedtempbox}
	\newcommand{\SANDsupersedVar}{
	    Supersedes #1 \\
	    Dated #2
	}
	\sbox{\SANDsupersedtempbox}{
	    \begin{tabular}{c}
		Supersedes #1 \\
		dated #2
	    \end{tabular}
	}
	\setboolean{SANDsupersedProvided}{true}
    }


    % Distribution category is no longer needed
    \newcommand{\SANDdistcategory}[1]{
	\ClassWarning{SANDreport.cls}{Distribution category is no longer needed!}
    }


% ******************************************************************************
% The commands to specify the report markings.
%

    % Printed on the cover and title page below the SANDIA REPORT number
    \newcommand{\SANDreleaseTypeVar}{Unlimited Release} % default

    % Printed on the cover page
    \newcommand{\MarkCoverVar}{Approved for public release; further dissemination unlimited.} % default

    % Printed on the title page
    \newsavebox{\MarkTitletempbox}
    \sbox{\MarkTitletempbox}{} % default

    % ----------------------------

    % Printed on top of cover page
    \newcommand{\MarkTopCoverVar}{} % default

    % Printed on bottom of cover page
    \newcommand{\MarkBotCoverVar}{} % default

    % Printed on top of back cover page
    \newcommand{\MarkTopBackVar}{} % default

    % Printed on bottom of back cover page
    \newcommand{\MarkBotBackVar}{} % default

    % Printed on top of title page
    \newcommand{\MarkTopTitleVar}{} % default

    % Printed on bottom of title page
    \newcommand{\MarkBotTitleVar}{} % default

    % Printed on bottom of all body pages
    \newcommand{\MarkBotBodyVar}{} % default

    % Printed on top of all body pages
    \newcommand{\MarkTopBodyVar}{} % default


    %
    % The user marking commands
    %
    \newcommand{\SANDreleaseType}[1]{
	\renewcommand{\SANDreleaseTypeVar}{#1}
    }

    \newcommand{\SANDmarkBottomCover}[1]{
	\renewcommand{\MarkBotCoverVar}{#1}
	\setboolean{MarkCover}{true}
	\setboolean{SANDmarkingsRequired}{true}
    }

    \newcommand{\SANDmarkTopBottom}[1]{
	\renewcommand{\MarkBotBodyVar}{#1}
	\renewcommand{\MarkTopBodyVar}{#1}
	\renewcommand{\MarkBotBackVar}{#1}
	\renewcommand{\MarkTopBackVar}{#1}
	\renewcommand{\MarkBotTitleVar}{#1}
	\renewcommand{\MarkTopTitleVar}{#1}
	\renewcommand{\MarkBotCoverVar}{#1}
	\renewcommand{\MarkTopCoverVar}{#1}
	\setboolean{MarkTitle}{true}
	\setboolean{MarkBack}{true}
	\setboolean{MarkBody}{true}
	\setboolean{MarkCover}{true}
	\setboolean{SANDmarkingsRequired}{true}
	\setboolean{MarkBottom}{true}
    }

    \newcommand{\SANDmarkTop}[1]{
	\renewcommand{\MarkTopBodyVar}{#1}
	\renewcommand{\MarkTopBackVar}{#1}
	\renewcommand{\MarkTopTitleVar}{#1}
	\renewcommand{\MarkTopCoverVar}{#1}
	\setboolean{MarkTitle}{true}
	\setboolean{MarkBack}{true}
	\setboolean{MarkBody}{true}
	\setboolean{MarkCover}{true}
	\setboolean{SANDmarkingsRequired}{true}
    }

    \newcommand{\SANDmarkBottom}[1]{
	\renewcommand{\MarkBotBodyVar}{#1}
	\renewcommand{\MarkBotBackVar}{#1}
	\renewcommand{\MarkBotTitleVar}{#1}
	\renewcommand{\MarkBotCoverVar}{#1}
	\setboolean{MarkTitle}{true}
	\setboolean{MarkBack}{true}
	\setboolean{MarkBody}{true}
	\setboolean{MarkCover}{true}
	\setboolean{SANDmarkingsRequired}{true}
	\setboolean{MarkBottom}{true}
    }

    \newcommand{\SANDmarkTopBottomCoverBackTitle}[1]{
	\renewcommand{\MarkTopCoverVar}{#1}
	\renewcommand{\MarkBotCoverVar}{#1}
	\renewcommand{\MarkTopBackVar}{#1}
	\renewcommand{\MarkBotBackVar}{#1}
	\renewcommand{\MarkTopTitleVar}{#1}
	\renewcommand{\MarkBotTitleVar}{#1}
	\setboolean{MarkTitle}{true}
	\setboolean{MarkBack}{true}
	\setboolean{MarkCover}{true}
	\setboolean{SANDmarkingsRequired}{true}
	\setboolean{MarkBottom}{true}
    }

    \newcommand{\SANDmarkTopBottomCoverTitle}[1]{
	\renewcommand{\MarkBotTitleVar}{#1}
	\renewcommand{\MarkTopTitleVar}{#1}
	\renewcommand{\MarkBotCoverVar}{#1}
	\renewcommand{\MarkTopCoverVar}{#1}
	\setboolean{MarkTitle}{true}
	\setboolean{MarkCover}{true}
	\setboolean{SANDmarkingsRequired}{true}
	\setboolean{MarkBottom}{true}
    }


    %
    % Internal command used to activate markings depending on what part of
    % the document we are currently processing; e.g. \SANDmarks{body}
    %
    \newcommand{\SANDmarks}[1]{
	\ifthenelse{\boolean{SANDmarkingsRequired}}   {
	    \fancyfoot{} % Clear all foot markings
	    \fancyhead{} % Clear all head markings

	    % Fancyhdr needs a little room
	    \setlength{\headheight}{\baselineskip}

	    \pagestyle{fancy}
	    \thispagestyle{fancy}

	    \ifthenelse{\equal{#1}{cover}}   {
		% We're on the cover page
		\ifthenelse{\boolean{MarkCover}}   {
		    \chead{\MarkTopCoverVar}
		    \cfoot{\MarkBotCoverVar}
		}{
		    \chead{}
		    \cfoot{}
		}
	    }{
	    }

	    \ifthenelse{\equal{#1}{back}}   {
		% We're on the back cover page
		\ifthenelse{\boolean{MarkBack}}   {
		    \chead{\MarkTopBackVar}
		    \cfoot{\MarkBotBackVar}
		}{
		    \chead{}
		    \cfoot{}
		}

		% We do want a page number on the back cover
		\ifthenelse{\boolean{MarkBottom}}   {
		    \fancyfoot[LE,RO]{\thepage}
		}{% else
		    \fancyfoot[CE,CO]{\thepage}
		}
	    }{
	    }

	    \ifthenelse{\equal{#1}{title}}   {
		% We're on the title page
		\ifthenelse{\boolean{MarkTitle}}   {
		    \chead{\MarkTopTitleVar}
		    \cfoot{\MarkBotTitleVar}
		}{% else
		    \chead{}
		    \cfoot{}
		}

		\ifthenelse{\boolean{MarkBottom}}   {
		    \fancyfoot[LE,RO]{\thepage}
		}{% else
		    \fancyfoot[CE,CO]{\thepage}
		}
	    }{
	    }

	    \ifthenelse{\equal{#1}{body}}   {
		\ifthenelse{\boolean{MarkBody}}   {
		    \chead{\MarkTopBodyVar}
		    \cfoot{\MarkBotBodyVar}
		}{% else
		    \chead{}
		    \cfoot{}
		}

		% We're on a body page. If we're not going to mark the bottom,
		% or body pages at all, then we might as well put the page number
		% at the center
		\ifthenelse{\boolean{MarkBottom} \and \boolean{MarkBody}}   {
		    \fancyfoot[LE,RO]{\thepage}
		}{% else
		    \fancyfoot[CE,CO]{\thepage}
		}
	    }{
	    }
	}{
	    %
	    % If not SANDmarkingsRequired
	    %
	    \pagestyle{plain}% The default when we have no markings

	    \ifthenelse{\equal{#1}{cover}}   {
		% We're on the cover page

		% No page number on cover
		\thispagestyle{empty}
	    }{
	    }

	    \ifthenelse{\equal{#1}{back}}   {
		% We're on the back cover page

		% We do want a page number on the back cover
		\thispagestyle{plain}
	    }{
	    }

	}
    }  % end of \SANDmarks{}


    \newcommand{\SANDmarkCoverTitle}[2]{
	\ClassError{SANDreport.cls}{\@backslashchar SANDmarkCoverTitle doesn't work yet; sorry.}{Don't
	know where to put the text on the title page.}
	\sbox{\MarkTitletempbox}{{\bf #1\\}{#2}}
	\renewcommand{\MarkCoverVar}{{{\CoverFont{b}{12}{12pt}#1}\\ {\CoverFont{m}{8}{10pt}}{#2}}}
    }

    \newcommand{\SANDmarkCover}[1]{
	\renewcommand{\MarkCoverVar}{{\CoverFont{m}{8}{10pt}}{#1}}
    }


% ******************************************************************************
% Table of Contents
% The names we use to label the table of contents, and lists of figures,
% and tables.
%

    \ifthenelse{\boolean{reportSAND}}   {
	\renewcommand\bibname{References}
	\setcounter{tocdepth}{3}
    }{
	\renewcommand{\contentsname}{\raggedright \normalfont\Large\bfseries Contents}
	\renewcommand{\listfigurename}{\raggedright \bf Figures}
	\renewcommand\listtablename{\raggedright \bf Tables}
	\renewcommand\refname{\raggedright \bf \centering References}
	\setcounter{tocdepth}{2}
    }

    %
    % Don't enter figures, tables, and subsections of an appendix in
    % the main table of contents, if "strict" is used.
    % Code from James Gruetzner and Todd Pitts. Avoids the ifthen package in
    % \addcontentsline which interferes with the subfigure package.
    \renewcommand{\addcontentsline}[3]{
	\ifinAppendix%
	    % We are in the Appendix
	    \ifthenelse{\equal{#1}{toc}}   {
		% And we are attempting to add something to the TOC
		\ifreportSAND
		    \ifthenelse{\equal{#2}{chapter}}   {
			% It is a chapter, so we're OK
			\addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}}
		    }{% else
			% It's a section; we'll accept that too
			\ifthenelse{\equal{#2}{section}}   {
			    % It is a section, so we're OK
			    \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}}
			}{% else
			    % It is not a section; skip it
			    \relax
			}
		    }
		\else
		    \ifthenelse{\equal{#2}{section}}   {
			% It is a section, so we're OK
			\addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}}
		    }{% else
			% It is not a section; skip it
			\relax
		    }
		\fi
	    }{
		% We're not in TOC. Probably a figure or table; skip it
		\relax
	    }

	\else%
	    \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}}
	\fi
    }



    % ------------------------------------------------------------------------ %
    % Modify the look of the table of contents if we are using the article style
    % ------------------------------------------------------------------------ %

    % We want the dots closer together, and the same as in \dotfill
    %
    \renewcommand{\@dotsep}{2.27}

    \ifthenelse{\boolean{reportSAND}}   {
    }{
	% For article.sty
	% We don't want blank lines between entries and no boldface.
	% This is the l@section definition from article.sty. We get rid of 
	% \addvspace{1.0em... and \bfseries (if relax is not set in the main doc)
	\renewcommand*\l@section[2]{
	    \setlength\parskip{0ex}
	    \ifnum \c@tocdepth >\z@
	    \addpenalty\@secpenalty
	    \ifthenelse{\boolean{relaxedSAND}}   {
		\addvspace{1.0em \@plus\p@}
	    }{
	    }
	    \setlength\@tempdima{1.5em}
	    \begingroup
		\parindent \z@ \rightskip \@pnumwidth
		\parfillskip -\@pnumwidth
		\leavevmode
		\ifthenelse{\boolean{relaxedSAND}}   {
		    \bfseries
		}{
		}
		\advance\leftskip\@tempdima
		\hskip -\leftskip
		#1\nobreak\dotfill \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
	    \endgroup
	\fi}

	\renewcommand*\l@figure{\setlength\parskip{0ex}
	    \@dottedtocline{1}{1.5em}{2.3em}
	}

	\let\l@table\l@figure
    }

    % ------------------------------------------------------------------------ %
    % If there is an appendix, set it apart in the table of contents
    %
    \renewcommand\appendix{
	\setboolean{inAppendix}{true}
	\par
	\setcounter{section}{0}
	\setcounter{subsection}{0}
	\setcounter{subsubsection}{0}
	\setcounter{figure}{0}
	\setcounter{table}{0}

	\ifthenelse{\boolean{reportSAND}}   {
	    \setcounter{chapter}{0}
	    \gdef\@chapapp{\appendixname}
	    \gdef\thechapter{\@Alph\c@chapter}
	    % Insert the Appendix name in the TOC
	    \addtocontents{toc}{\protect\subsection*{\appendixname}}
	}{
	    \renewcommand{\thefigure}{\thesection.\arabic{figure}}
	    \renewcommand{\thetable}{\thesection.\arabic{table}}
	    \gdef\thesection{\@Alph\c@section}
	    % Insert the Appendix name in the TOC
	    \addtocontents{toc}{\protect\subsection*{\appendixname}}
	}

	\ifthenelse{\boolean{strictSAND}}   {
	    \setcounter{secnumdepth}{2}
	}{
	    \setcounter{secnumdepth}{3}
	}
    }



% ******************************************************************************
% Sections & Chapters
% We want unnumbered section/chapter headings
%

    \ifthenelse{\boolean{reportSAND}}   {
	\ifthenelse{\boolean{strictSAND}}   {
	    % The samples in SAND98-0730 don't number sections.
	    \setcounter{secnumdepth}{0}
	}{
	    % The report SAND98-0730 itself does, though ;-)
	    \setcounter{secnumdepth}{3}
	}
    }{% else
	\ifthenelse{\boolean{strictSAND}}   {
	    % The samples in SAND98-0730 don't number sections.
	    \setcounter{secnumdepth}{0}
	}{
	    % The report SAND98-0730 itself does, though ;-)
	    \setcounter{secnumdepth}{3}
	}
    }


% ******************************************************************************
% Captions
% We want the label bold face, and the whole captionwidth about 4",
% and the text small
%

    \newlength{\SANDcaptionwidth}
    \setlength{\SANDcaptionwidth}{4in}
    \newsavebox{\SANDtempbox}
    \renewcommand{\@makecaption}[2]{
	\par\vspace{\abovecaptionskip}
	\sbox{\SANDtempbox}{{\bf #1. }\ #2}
	\ifthenelse{\lengthtest{\wd\SANDtempbox < \SANDcaptionwidth}}   {
	    \begin{center}
		{\bf #1. }\small #2
	    \end{center}
	}{
	    \begin{center}
		\parbox[t]{\SANDcaptionwidth}{{\bf #1. }\small #2}
	    \end{center}
	}
    }



% ******************************************************************************
% We have to import a lot of code from report.cls and article.cls so we can
% change a few things. We do report.cls first.
%

    \ifthenelse{\boolean{reportSAND}}   {
	% We need to redo \maketitle for the report class.
	% Omit the date and add the SAND number and so on.
	% We also need to redo the titlepage environment to not
	% issue a newpage command, so the abstract can go there
	% if it is short enough. (SAND reports are supposed to have
	% an abstract!)

	%
	% Renew the report.cls \maketitle macro
	%
	\if@titlepage							% \maketitle from report.cls
	    \renewcommand\maketitle{%					% \maketitle from report.cls
		\doCover{}
		\begin{titlepage}%					% \maketitle from report.cls
		    \SANDmarks{title}
		    {
			% use framebox instead of makebox for debugging
			\makebox[\topleftwidth][t]{
			    \begin{minipage}[c][\topheight][t]{\topleftwidth}
				% There is nothing at top left
			    \end{minipage}
			}
			\makebox[\topmiddlewidth][c]{
			    \begin{minipage}[c][\topheight][t]{\topmiddlewidth}
			    \begin{center}
				\SANDnumVar\\
				\SANDreleaseTypeVar\\
				Printed \SANDprintDateVar\\
				\ifthenelse{\boolean{SANDrePrintDateProvided}}   {
				    Reprinted \SANDrePrintDateVar\\
				}{
				}
				\ifthenelse{\boolean{SANDsupersedProvided}}   {
				    \bigskip
				    \usebox{\SANDsupersedtempbox}\\
				}{
				}
			    \end{center}
			    \end{minipage}
			}
		    }
		    \let\footnotesize\small				% \maketitle from report.cls
		    \let\footnoterule\relax				% \maketitle from report.cls
		    \let \footnote \thanks				% \maketitle from report.cls
		    % \null\vfil					% deleted
		    % \vskip 60\p@					% deleted
		    \begin{center}%					% \maketitle from report.cls
			{\LARGE \@title \par}%				% \maketitle from report.cls
			\vskip 3em%					% \maketitle from report.cls
			{\large						% \maketitle from report.cls
			\lineskip .75em%				% \maketitle from report.cls
			\begin{tabular}[t]{c}%				% \maketitle from report.cls
			    \@author					% \maketitle from report.cls
			\end{tabular}\par}%				% \maketitle from report.cls
			\vskip 1.5em%					% \maketitle from report.cls
			% {\large \@date \par}%				% deleted
		    \end{center}\par					% \maketitle from report.cls
		    \@thanks						% \maketitle from report.cls
		    \vfil\null						% \maketitle from report.cls

		\end{titlepage}%					% \maketitle from report.cls
		\setcounter{footnote}{0}%				% \maketitle from report.cls
		\global\let\thanks\relax				% \maketitle from report.cls
		\global\let\maketitle\relax				% \maketitle from report.cls
		\global\let\@thanks\@empty				% \maketitle from report.cls
		\global\let\@author\@empty				% \maketitle from report.cls
		\global\let\@date\@empty				% \maketitle from report.cls
		\global\let\@title\@empty				% \maketitle from report.cls
		\global\let\title\relax					% \maketitle from report.cls
		\global\let\author\relax				% \maketitle from report.cls
		\global\let\date\relax					% \maketitle from report.cls
		\global\let\and\relax					% \maketitle from report.cls
	    }
	\else
	    % {---------------------- I doubt we ever get here ------------------------}
	    \ClassError{SANDreport.cls}{\@backslashchar maketitle definition outside
		a title page.}{The SANDreport class cannot handle this case.}
	\fi

	%
	% \titlepage in the report class resets the page
	% number, which is not correct for SANDIA Reports.
	% It also sets the page style to empty.
	\if@compatibility						% titlepage from report.cls
	\renewenvironment{titlepage}					% titlepage from report.cls
	    {%								% titlepage from report.cls
	      \if@twocolumn						% titlepage from report.cls
		\@restonecoltrue\onecolumn				% titlepage from report.cls
	      \else							% titlepage from report.cls
		\@restonecolfalse\newpage				% titlepage from report.cls
	      \fi							% titlepage from report.cls
	      %\thispagestyle{empty}%					% deleted
	      %\setcounter{page}\z@					% deleted
	    }%								% titlepage from report.cls
	    %{\if@restonecol\twocolumn \else \newpage \fi		% deleted, we want abstract on this page
	    {\if@restonecol\twocolumn \fi				% new version
	    }								% titlepage from report.cls
	\else								% titlepage from report.cls
	\renewenvironment{titlepage}					% titlepage from report.cls
	    {%								% titlepage from report.cls
	      \if@twocolumn						% titlepage from report.cls
		\@restonecoltrue\onecolumn				% titlepage from report.cls
	      \else							% titlepage from report.cls
		\@restonecolfalse\newpage				% titlepage from report.cls
	      \fi							% titlepage from report.cls
	      %\thispagestyle{empty}%					% deleted
	      %\setcounter{page}\@ne					% deleted
	    }%								% titlepage from report.cls
	    %{\if@restonecol\twocolumn \else \newpage \fi		% deleted, we want abstract on this page
	    {\if@restonecol\twocolumn \fi				% new version
	     \if@twoside\else						% titlepage from report.cls
		%\setcounter{page}\@ne					% deleted
	     \fi							% titlepage from report.cls
	    }								% titlepage from report.cls
	\fi								% titlepage from report.cls

	\if@titlepage							% abstract from report.cls
	    \renewenvironment{abstract}{%				% abstract from report.cls
		% \titlepage						% deleted
		\null\vfil						% abstract from report.cls
		\@beginparpenalty\@lowpenalty				% abstract from report.cls
		\begin{center}%						% abstract from report.cls
		    \bfseries \abstractname				% abstract from report.cls
		    \@endparpenalty\@M					% abstract from report.cls
		\end{center}}%						% abstract from report.cls
		% {\par\vfil\null\endtitlepage}				% deleted
		{\par\vfil\null}					% new version
	\else								% abstract from report.cls
	    % {---------------------- We should never get here ------------------------}
	    \ClassError{SANDreport.cls}{Abstract definition outside
		a title page.}{The SANDreport class cannot handle this case.}
	\fi								% abstract from report.cls

    }{
	%
	% Now for the changes to article.cls functions
	%


	%
	% In \@maketitle, we omit the \@date and insert the SAND number and so on
	%
	\renewcommand{\@maketitle}{
	    \doCover{}
	    \newpage							% \@maketitle from article.cls
	    {								% new
		% use framebox instead of makebox for debugging		% new
		\makebox[\topleftwidth][t]{				% new
		    \begin{minipage}[c][\topheight][t]{\topleftwidth}	% new
			% There is nothing at top left			% new
		    \end{minipage}					% new
		}							% new
		\makebox[\topmiddlewidth][c]{				% new
		    \begin{minipage}[c][\topheight][t]{\topmiddlewidth}	% new
		    \begin{center}					% new
			\SANDnumVar\\					% new
			\SANDreleaseTypeVar\\				% new
			Printed \SANDprintDateVar\\			% new
			\ifthenelse{\boolean{SANDrePrintDateProvided}}   {	% new
			    Reprinted \SANDrePrintDateVar\\		% new
			}{						% new
			}						% new
			\ifthenelse{\boolean{SANDsupersedProvided}}   {	% new
			    \bigskip					% new
			    \usebox{\SANDsupersedtempbox}\\		% new
			}{						% new
			}						% new
		    \end{center}					% new
		    \end{minipage}					% new
		}							% new
	    }								% new

	    \begin{center}						% \@maketitle from article.cls
		\let \footnote \thanks					% \@maketitle from article.cls
		{\LARGE \bf \@title\par}				% \@maketitle from article.cls
		\vskip 1.5em						% \@maketitle from article.cls
		{\large							% \@maketitle from article.cls
		    \lineskip .5em%					% \@maketitle from article.cls
		    \begin{tabular}[t]{c}				% \@maketitle from article.cls
		    \@author						% \@maketitle from article.cls
		    \end{tabular}\par					% \@maketitle from article.cls
		}							% \@maketitle from article.cls
	    \end{center}						% \@maketitle from article.cls
	    \par							% \@maketitle from article.cls
	    \vskip 1.5em						% \@maketitle from article.cls
	}


	%
	% For fancy headers, we have to redefine \maketitle. All we are doing,
	% is to activate the headers again, and then redefine \newpage so it
	% happens for every body page.
	%
	\renewcommand{\maketitle}{\par
	    \begingroup							% \maketitle from article.cls
	    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%		% \maketitle from article.cls
	    \def\@makefnmark{						% \maketitle from article.cls
		\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%	% \maketitle from article.cls
	    \long\def\@makefntext##1{\parindent 1em\noindent		% \maketitle from article.cls
		\hb@xt@1.8em{%						% \maketitle from article.cls
		\hss\@textsuperscript{\normalfont\@thefnmark}}##1}%	% \maketitle from article.cls
	    \if@twocolumn						% \maketitle from article.cls
		\ifnum \col@number=\@ne					% \maketitle from article.cls
		    \@maketitle						% \maketitle from article.cls
		\else							% \maketitle from article.cls
		    \twocolumn[\@maketitle]%				% \maketitle from article.cls
		\fi							% \maketitle from article.cls
	    \else							% \maketitle from article.cls
		\newpage						% \maketitle from article.cls
		% Prevents figures from going at top of page.		% \maketitle from article.cls
		\global\@topnum\z@					% \maketitle from article.cls
		\@maketitle						% \maketitle from article.cls
	    \fi								% \maketitle from article.cls
	    \SANDmarks{title}						% new
	    \@thanks							% \maketitle from article.cls
	    \endgroup							% \maketitle from article.cls
	    \setcounter{footnote}{0}%					% \maketitle from article.cls
	    \global\let\thanks\relax					% \maketitle from article.cls
	    \global\let\maketitle\relax					% \maketitle from article.cls
	    \global\let\@maketitle\relax				% \maketitle from article.cls
	    \global\let\@thanks\@empty					% \maketitle from article.cls
	    \global\let\@author\@empty					% \maketitle from article.cls
	    \global\let\@date\@empty					% \maketitle from article.cls
	    \global\let\@title\@empty					% \maketitle from article.cls
	    \global\let\title\relax					% \maketitle from article.cls
	    \global\let\author\relax					% \maketitle from article.cls
	    \global\let\date\relax					% \maketitle from article.cls
	    \global\let\and\relax					% \maketitle from article.cls


	    %
	    % Now we renew \newpage so that from here on the markings
	    % of the body are used.
	    %
	    \renewcommand{\newpage}{%				% \newpage from latex.ltx
		\if@noskipsec					% \newpage from latex.ltx
		    \ifx \@nodocument\relax			% \newpage from latex.ltx
			\leavevmode				% \newpage from latex.ltx
			\global \@noskipsecfalse		% \newpage from latex.ltx
		    \fi						% \newpage from latex.ltx
		\fi						% \newpage from latex.ltx
		\if@inlabel					% \newpage from latex.ltx
		    \leavevmode					% \newpage from latex.ltx
		    \global \@inlabelfalse			% \newpage from latex.ltx
		\fi						% \newpage from latex.ltx
		\if@nobreak \@nobreakfalse \everypar{}\fi	% \newpage from latex.ltx
		\par						% \newpage from latex.ltx
		\vfil						% \newpage from latex.ltx
		\penalty -\@M					% \newpage from latex.ltx
		\SANDmarks{body}				% new
	    }							% \newpage from latex.ltx
	}								% \maketitle from article.sty
    }



% ******************************************************************************
% Do some checking at the end of the document
%

    \AtEndDocument{
	% Do some more usage checking
	\ifthenelse{\boolean{SANDmainProvided}}   {
	}{
	    \ClassError{SANDreport.cls}{\@backslashchar SANDmain
		not provided}{Add \@backslashchar SANDmain before your
		introduction (first) section of your document}
	}


	%
	% Put the Sandia Logo on the back page
	%
	\cleardoublepage	% We're on the inside end page now
	\mbox{}			% Some invisible text
	\vfill
	\hfill {\CoverFont{m}{6}{6pt} \SANDreportVersionOnly}
	\setboolean{SANDmarkingsRequired}{false}
	\thispagestyle{empty}
	\pagestyle{empty}
	\newpage		% Now we're on the outside of the end page

	\vspace*{\fill}		% Move the logo to the bottom of the page
	\thispagestyle{empty}
	\begin{center}
	    \includegraphics{snllineblk}
	\end{center}

    } % End of AtEndDocument{}