summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xduthesis/xduthesis.dtx
blob: a8ae63c49df912f8c6234889ec0e318e49fb0b8b (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
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
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
% \iffalse meta-comment
% Local Variables:
% mode: doctex
% TeX-master: t
% End:
%<*internal>
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
  \expandafter\begingroup
\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble
---------:| ---------------------------------------------------------------
xduthesis:| XeLaTeX template for writing Xidian University Thesis
   Author:| Fei Qi
   E-mail:| fred.qi@ieee.org
  License:| Released under the LaTeX Project Public License v1.3c or later
      See:| http://www.latex-project.org/lppl.txt

\endpreamble
\postamble

Copyright (C) 2008-2016 by Fei Qi <fred.qi@ieee.org>

This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
version 1.3c of this license or (at your option) any later
version.  The latest version of this license is in the file:

http://www.latex-project.org/lppl.txt

This work is "maintained" (as per LPPL maintenance status) by
Fei Qi.

This work consists of the file xduthesis.dtx and a Makefile.
Running "make" generates the derived files xduthesis.pdf and xduthesis.cls.
Running "make inst" installs the files in the user's TeX tree.
Running "make install" installs the files in the local TeX tree.

\endpostamble

\usedir{tex/xelatex/xduthesis}
\generate{
  \file{\jobname.cls}{\from{\jobname.dtx}{class}}
  \file{\jobname.cfg}{\from{\jobname.dtx}{config}}
}
%</install>
%<install>\endbatchfile
%<*internal>
\usedir{source/xelatex/xduthesis}
\generate{
  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble
% \usedir{doc/xelatex/xduthesis}
% \generate{
%   \file{README.rst}{\from{\jobname.dtx}{readme}}
% }
\ifx\fmtname\nameofplainTeX
  \expandafter\endbatchfile
\else
  \expandafter\endgroup
\fi
%</internal>
% \fi
%
% \CheckSum{1988}
%
% \iffalse
%<*driver>
\ProvidesFile{xduthesis.dtx}[2015/09/11 1.0.0 Xidian University Thesis Template]
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{xduthesis}
%<config>\ProvidesFile{xduthesis.cfg}
%<class|config>    [2015/09/11 1.0.0 Xidian University Thesis Template]
%<*driver>
\documentclass{ltxdoc}
\usepackage{amssymb}
\usepackage{url}
\usepackage{metalogo}
\usepackage[normalem]{ulem}
\usepackage{xeCJK}
\setCJKmainfont[BoldFont={Adobe Heiti Std}]{Adobe Song Std}
\usepackage{indentfirst}
% \usepackage[a4paper,margin=25mm,left=50mm,nohead]{geometry}
\usepackage[numbered]{hypdoc}
\setlength{\parskip}{4pt plus1pt minus0pt}
\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}
\setlength{\parindent}{20pt}
\addtolength{\oddsidemargin}{-1cm}
\advance\textwidth 1.5cm
\addtolength{\topmargin}{-1cm}
\addtolength{\headsep}{0.3cm}
\addtolength{\textheight}{2.3cm}
\renewcommand{\baselinestretch}{1.3}

\makeatletter
\def\tableofcontents{\renewcommand{\baselinestretch}{1.0}\@starttoc{toc}}
\def\DescribeOption#1{\SpecialOptionIndex{#1}}
\def\DescribeMacro{\Describe@Macro}
\def\Describe@Macro#1{\PrintDescribeMacro{#1}\SpecialUsageIndex{#1}}
\def\PrintDescribeMacro#1{{\color{-red!75!green!50!blue!55}\MacroFont \string #1\hskip1em }}
\def\ps@headings{%
  \let\@oddfoot\@empty
  \def\@oddhead{\vbox{\hbox
    to\textwidth{\llap{\fbox{\rightmark\rule[-2pt]{0pt}{13pt}}}\hfil\thepage}\vskip-0.7pt
      \hbox to \textwidth{\hrulefill}}}%
  \let\@evenfoot\@oddfoot
  \let\@evenhead\@oddhead
  \let\@mkboth\markboth
  \def\sectionmark##1{%
    \markright{\ifnum \c@secnumdepth >\m@ne
      \thesection\quad
      \fi
      ##1}}
  \def\subsectionmark##1{%
    \markright{\ifnum \c@secnumdepth >\m@ne
      \thesubsection\quad
      \fi
      ##1}}
  \def\subsubsectionmark##1{%
    \markright{\ifnum \c@secnumdepth >\m@ne
      \thesubsubsection\quad
      \fi
      ##1}}}
\renewcommand\section{\@startsection {section}{1}{\z@}%
                              {-3.5ex \@plus -1ex \@minus -.2ex}%
                              {2.3ex \@plus.2ex}%
                              {\normalfont\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                  {-3.25ex\@plus -1ex \@minus -.2ex}%
                                  {1.5ex \@plus .2ex}%
                                  {\normalfont\large\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                           {-3.25ex\@plus -1ex \@minus -.2ex}%
                                           {1.5ex \@plus .2ex}%
                                           {\normalfont\normalsize\bfseries}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                           {3.25ex \@plus1ex \@minus.2ex}%
                                           {-1em}%
                                           {\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
                                                 {3.25ex \@plus1ex \@minus .2ex}%
                                                 {-1em}%
                                                 {\normalfont\normalsize\bfseries}}
\makeatother

\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{\jobname.dtx}
  \clearpage
\end{document}
%</driver>
% \fi
%
% \pagestyle{empty}
%
% \GetFileInfo{xduthesis.dtx}
% \MakeShortVerb{\|}
%
% \changes{v0.9.9}{2014/04/19}{Naming changed from xdthesis to xduthesis.}
% \changes{v0.9.4}{2012/01/10}{Made the full support for the master option.}
% \changes{v0.9.3a}{2011/12/13}{Fixed line space and chapter space in TOC.}
% \changes{v0.9.3}{2011/04/20}{Fixed the error on \texttt{$\backslash$nobreakspace}.}
% \changes{v0.9.2}{2009/06/17}{Using full Chinese punctuation.}
% \changes{v0.9.1}{2009/06/15}{Template for Bachelor's thesis release candidate.}
% \changes{v0.9}{2009/06/10}{Template realy works for Bachelor's thesis.}
% \changes{v0.2}{2009/06/06}{Defined styles of fonts, names, and titles and floats formats.}
% \changes{v0.1}{2008/06/24}{The \XeLaTeX\ template for writing thesis of Xidian starts.}
%
% \def\xduthesis{\texttt{XDU}-\texttt{Thesis}}
% \def\xduthesis{$\mathbb{XDU}$-$\mathcal{THESIS}$}
% \def\pkg#1{\texttt{#1}}
% \def\xdu{西安电子科技大学}
%
% \DoNotIndex{\begin,\end,\begingroup,\endgroup}
% \DoNotIndex{\ifx,\ifdim,\ifnum,\ifcase,\else,\or,\fi}
% \DoNotIndex{\let,\def,\xdef,\newcommand,\renewcommand}
% \DoNotIndex{\expandafter,\csname,\endcsname,\relax,\protect}
% \DoNotIndex{\Huge,\huge,\LARGE,\Large,\large,\normalsize}
% \DoNotIndex{\small,\footnotesize,\scriptsize,\tiny}
% \DoNotIndex{\normalfont,\bfseries,\slshape,\interlinepenalty}
% \DoNotIndex{\hfil,\par,\hskip,\vskip,\vspace,\quad}
% \DoNotIndex{\centering,\raggedright}
% \DoNotIndex{\c@secnumdepth,\@startsection,\@setfontsize}
% \DoNotIndex{\ ,\@plus,\@minus,\p@,\z@,\@m,\@M,\@ne,\m@ne}
% \DoNotIndex{\@@par,\DeclareOperation,\RequirePackage,\LoadClass}
% \DoNotIndex{\AtBeginDocument,\AtEndDocument}
%
% \IndexPrologue{\section*{索~~~~引}}
% \GlossaryPrologue{\section*{修改记录}}
%
% \renewcommand{\abstractname}{摘~~要}
% \renewcommand{\contentsname}{目~~录}
%
% \title{\xduthesis:\xdu{}学位论文模板\thanks{Xidian University \XeLaTeX{}
%     Thesis Template.}}
% \author{齐飞\\[5pt] \texttt{fred.qi@ieee.org}}
% \date{v\fileversion\ (\filedate)}
%
% \maketitle\thispagestyle{empty}
%
% \begin{abstract}
%   本宏包旨在建立一个简单易用的、符合西安电子科技大学各级学位撰写格式要求的论文
%   模板。目前已经完整支持从学士到硕士及博士学位论文的最新格式。目前研究生论文
%   (硕士、博士学位论文)符合研究生院2014年发布的学位论文版式要求。
% \end{abstract}
%
% \vskip2cm 
% \def\abstractname{免责声明}
% \begin{abstract}
% \noindent
% \begin{enumerate}
% \item 本模板的发布遵守~\LaTeX{} Project Public License (v1.3c)
% \footnote{\url{http://www.latex-project.org/lppl.txt}},使用前请认真阅读协议内容。
% \item 本模板为作者根据\xdu{}教务处颁布的《本科生毕业设计(论文)工作手册》、研
%   究生院颁布的《西安电子科技大学研究生学位论文撰写标准》编写而成,旨在
%   供\xdu{}毕业生撰写学位论文使用。
% \item 此模板仅为写作指南的参考实现,不保证格式审查老师不提任何意见。任何由于使
%   用本模板而引起的论文格式审查问题均与本模板作者无关。
% \item 任何个人或组织以本模板为基础进行修改、扩展而生成的新的专用模板,请严格遵
%   守~\LaTeX{} Project Public License 协议。由于违犯协议而引起的任何纠纷争端均与
%   本模板作者无关。
% \end{enumerate}
% \end{abstract}
% 
% \clearpage
% \begin{multicols}{2}[
% \section*{\contentsname}
% \setlength{\columnseprule}{.4pt}
% \setlength{\columnsep}{18pt}]
%  \tableofcontents
% \end{multicols}
%
% \clearpage
% \pagenumbering{arabic}
% \pagestyle{headings}
%
% \section{模板介绍}
%
% 本模板为作者根据\xdu{}教务处颁布的《本科生毕业设计(论文)工作手册》以及研究生
% 院颁布的《西安电子科技大学研究生学位论文撰写标准》编写而成,旨在供\xdu{}毕业生
% 撰写学位论文使用。目前模板支持从学士到硕士、博士等三级学位论文的排版。
% 
% 模板在~\texttt{examples} 目录下提供了学士学位论
% 文(\texttt{thesis-bachelor.tex})、硕士学位论文(\texttt{thesis-master.tex})、专
% 业硕士学位论文(\texttt{thesis-masterpro.tex})以及博士学位论
% 文(\texttt{thesis-doctor.tex})的使用示例。用户可以选择自己需要的样例,并在样例
% 的基础上修改使用。这此论文样例的实际内容为模板的使用说明,建议在使用模板前认真
% 阅读。为方便用户阅读,该说明按照博士学位论文版式进行了编译,并随模板一同发布(文
% 件\texttt{thesis-doctor.pdf})。
%
% 模板在~\texttt{texlive} (\url{https://www.tug.org/texlive/}) 下进行了详细的测试,
% 能够正常工作。对于其他~\XeLaTeX{}~的发布版本,由于没有进行完整测试,暂时无法确
% 定模板的是否能够正常工作。
%
% \xduthesis{} 的主页是:\url{https://github.com/fredqi/xduthesis}。用户可以到该
% 主页查看模板的开发进展、下载最新版本。如果在使用中遇到问题,请在页面
% \url{https://github.com/fredqi/xduthesis/issues} 报告您所遇到的问题。希望在报
% 告错误时能够提供测试代码,以便更快的定位和排查错误。
%
% \section*{致谢}
% \label{sec:thanks}
%
% \changes{v0.9.8}{2012/12/26}{补充致谢信息}
%
% 本模板经过多年不断积累完善,终于达到了可以正式发布的状态。在此对本模板开发、测
% 试做出贡献与帮助的人一并表示谢意。\pkg{xeCJK}宏包是本模板中文字体支持的基础,模
% 板中的很多格式在实现方式上参考了\pkg{thuthesis}宏包,在此对这两个宏包的开发人员
% 孙文昌、刘海洋\footnote{leoliu.pku@gmail.com}、李
% 清\footnote{sobenlee@gmail.com}与薛瑞尼\footnote{xueruini@gmail.com}等人表示深
% 挚的谢意。
%
% 本模板的本科学位论文封面部分参考了\textrm{bigeagle}等人开发维护
% 的\pkg{XDBA-thesis}论文模板,在此表示感谢。研究生论文封面由陆丹
% 峰\footnote{killucs@foxmail.com}参照\pkg{XDBA-thesis}实现了第一个可用版本,在此
% 亦表示感谢。
%
% 在本模板开发过程中,我所指导的硕士生陆丹峰、韩钧宇和谷跃胜、本科毕业生王蓬金、
% 赵亚龙、博士生吴金建等人先后试用了功能尚不完善、实现存在严重缺陷的开发版本,为
% 本模板的进一步开发完善提供了宝贵的意见,在此一并表示感谢。
%
%
% \StopEventually{\PrintChanges\PrintIndex}
% \clearpage
%
% \section{实现细节}
%
% \subsection{基本信息}
%
% \subsection{定义选项}
% \label{sec:defoption}
%
% \changes{v0.9.9}{2014/04/19}{Added option english.}
% \changes{v0.9.4a}{2012/02/07}{Added option print.}
% 定义论文类型以及是否涉密
%    \begin{macrocode}
%<*class>
\hyphenation{XDU-Thesis}
\def\xduthesis{$\mathbb{XDU}$-$\mathcal{THESIS}$}
\def\version{1.0.0}
\newif\ifxdu@bachelor\xdu@bachelorfalse
\newif\ifxdu@master\xdu@masterfalse
\newif\ifxdu@masterpro\xdu@masterprofalse
\newif\ifxdu@doctor\xdu@doctorfalse
\newif\ifxdu@secret\xdu@secretfalse
\newif\ifxdu@english\xdu@englishfalse
\newif\ifxdu@mkabstract\xdu@mkabstractfalse
\newif\ifxdu@print\xdu@printfalse
\newif\ifxdu@msfonts\xdu@msfontsfalse
\DeclareOption{bachelor}{\xdu@bachelortrue}
\DeclareOption{master}{\xdu@mastertrue}
\DeclareOption{masterpro}{\xdu@masterprotrue}
\DeclareOption{doctor}{\xdu@doctortrue}
\DeclareOption{secret}{\xdu@secrettrue}
\DeclareOption{english}{\xdu@englishtrue}
\DeclareOption{print}{\xdu@printtrue}
\DeclareOption{msfonts}{\xdu@msfontstrue}
\DeclareOption{adobefonts}{\xdu@msfontsfalse}
\AtEndOfClass{%
  \ifxdu@doctor\relax\else
    \ifxdu@bachelor\relax\else
      \ifxdu@master\relax\else
        \ifxdu@masterpro\relax\else
          \ClassError{xduthesis}%
          {Please specify a thesis option: bachelor, master, masterpro or doctor.}{}
        \fi
      \fi
    \fi
  \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\ExecuteOptions{}
\ProcessOptions
\ifxdu@print
\LoadClass[12pt, a4paper, openright]{book}
\else
\LoadClass[12pt, a4paper, openany]{book}
\fi
%</class>
%    \end{macrocode}
%
% \subsection{装载宏包}
% \label{sec:loadpackage}
%
% \changes{v0.9.4a}{2012/02/07}{Added package calc for paper layout setup.}
% 设置页边距等引用宏包
%    \begin{macrocode}
%<*class>
\RequirePackage{calc}
%    \end{macrocode}
% 参考文献引用宏包。
%    \begin{macrocode}
\RequirePackage[numbers,super,sort&compress]{natbib}
%    \end{macrocode}
%
%    \begin{macrocode}
\ifxdu@print
\RequirePackage[xetex,colorlinks=true,allcolors=black]{hyperref}
\else
\RequirePackage[xetex,colorlinks=true]{hyperref}
\fi
%    \end{macrocode}
% 引用的宏包和相应的定义。
% \pkg{hypernat} 让~\pkg{hyperref} 和~\pkg{natbib} 协调的工作。应该
% 在~\pkg{natbib} 和~\pkg{hyperref} 之后加载,参看其文档。
%    \begin{macrocode}
% \RequirePackage{hypernat}
%    \end{macrocode}
%
% 首行缩进。
%    \begin{macrocode}
\RequirePackage{indentfirst}
%    \end{macrocode}
%
% \changes{v0.9.1}{2009/06/15}{引用\pkg{paralist},缩小列表环境的行距}
% 更好的列表环境。
%    \begin{macrocode}
\RequirePackage[neverdecrease]{paralist}
%    \end{macrocode}
%
% 页眉页脚。
%    \begin{macrocode}
% \RequirePackage{fancyhdr}
%    \end{macrocode}
%
% AMS\LaTeX{} 宏包,用来排出更加漂亮的公式
%    \begin{macrocode}
\RequirePackage{amsmath, amssymb}
%    \end{macrocode}
%
% 图形支持宏包。
%    \begin{macrocode}
\RequirePackage{graphicx}
%    \end{macrocode}
%
% 并排图形。\pkg{subfigure} 已经不再推荐,用新的~\pkg{subfig}。加入~|config| 选项以便兼容
% ~\pkg{subfigure} 的命令。
% 浮动图形和表格标题样式。\pkg{caption2} 已经不推荐使用,采用新的~\pkg{caption}。它会自动被
% ~\pkg{subfig} 装载进来。所以可以在后面看到~\cs{captionsetup} 的命令。
%    \begin{macrocode}
\RequirePackage{subfig}
% 下划线(虚线)
% \dashuline{dashing} dashed underline like dashing
\RequirePackage[normalem]{ulem}
%    \end{macrocode}
%
% 载入标题格式宏包。
%    \begin{macrocode}
\RequirePackage{ifthen}
\RequirePackage{titlesec,titletoc}
%    \end{macrocode}
% 本模板是基于\XeLaTeX{}的。
%    \begin{macrocode}
\RequirePackage[BoldFont]{xeCJK}
%
% \changes{v0.9.8}{2013/03/14}{增加msfonts选项以使用微软字体}
% \changes{v0.9.1}{2009/06/17}{使用全角格式中文标点符号}
%
\punctstyle{quanjiao}
\def\CJK@null{\kern\CJKnullspace\Unicode{48}{7}\kern\CJKnullspace}
\defaultfontfeatures{Mapping=tex-text} % after fontspec
\ifxdu@msfonts
\setCJKmainfont{SimSun}
\setCJKsansfont{SimHei}
\setCJKmonofont{KaiTi_GB2312}
\setCJKfamilyfont{song}{SimSun}
\setCJKfamilyfont{hei}{SimHei}
\setCJKfamilyfont{fs}{FangSong_GB2312}
\setCJKfamilyfont{kai}{KaiTi_GB2312}
\setCJKfamilyfont{li}{Adobe Kaiti Std}
\setCJKfamilyfont{you}{LiSu}
\else
\setCJKmainfont{Adobe Song Std}
\setCJKsansfont{Adobe Heiti Std}
\setCJKfamilyfont{song}{Adobe Song Std}
\setCJKfamilyfont{hei}{Adobe Heiti Std}
% \setCJKmonofont{Adobe Kaiti Std}
% \setCJKfamilyfont{fs}{Adobe Fangsong Std}
% \setCJKfamilyfont{kai}{Adobe Kaiti Std}
\fi
\setmainfont{Times New Roman}
\setsansfont{Arial}
\setmonofont{Courier Std}
% \changes{v0.9.3}{2011/04/20}{引用宏包顺序调整,以避免\texttt{nobreakspace}的问题}
% \changes{v0.9.7}{2012/12/11}{\texttt{xeCJK}与\texttt{xltxtra}冲突导致标点出错}
\RequirePackage{xunicode,metalogo}
%</class>
%    \end{macrocode}
%
% \subsection{主文档格式}
% \label{sec:mainbody}
% \subsubsection{Three matters}
%
%    \begin{macrocode}
%<*class>
\renewcommand\frontmatter{%
  \xdu@clearpage%
  \@mainmatterfalse
  \ifxdu@bachelor\pagenumbering{roman}\else\pagenumbering{Roman}\fi
  \pagestyle{xdu@front}}
\renewcommand\mainmatter{%
  \xdu@clearpage
  \@mainmattertrue
  \pagenumbering{arabic}
  \pagestyle{xdu@headings}}
\renewcommand\backmatter{%
  \xdu@clearpage
  \@mainmattertrue}
%</class>
%    \end{macrocode}
%
% \subsubsection{字体}
% \label{sec:fonts}
% Ref 2:
% WORD 中的字号对应该关系如下:
% \begin{verbatim}
% 初号 = 42bp = 14.82mm = 42.1575pt
% 小初 = 36bp = 12.70mm = 36.135 pt
% 一号 = 26bp = 9.17mm = 26.0975pt
% 小一 = 24bp = 8.47mm = 24.09pt
% 二号 = 22bp = 7.76mm = 22.0825pt
% 小二 = 18bp = 6.35mm = 18.0675pt
% 三号 = 16bp = 5.64mm = 16.06pt
% 小三 = 15bp = 5.29mm = 15.05625pt
% 四号 = 14bp = 4.94mm = 14.0525pt
% 小四 = 12bp = 4.23mm = 12.045pt
% 五号 = 10.5bp = 3.70mm = 10.59375pt
% 小五 = 9bp = 3.18mm = 9.03375pt
% 六号 = 7.5bp = 2.56mm
% 小六 = 6.5bp = 2.29mm
% 七号 = 5.5bp = 1.94mm
% 八号 = 5bp = 1.76mm
%
% 1bp = 72.27/72 pt
% \end{verbatim}
%
% \begin{macro}{\song}
% \begin{macro}{\songti}
% \begin{macro}{\hei}
% \begin{macro}{\heiti}
%
%    \begin{macrocode}
%<*class>
\newcommand{\song}{\CJKfamily{song}} % 宋体
\def\songti{\song}
\newcommand{\hei}{\CJKfamily{hei}} % 黑体
\def\heiti{\hei}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% 
% \begin{macro}{\chuhao}
% \begin{macro}{\xiaochu}
% \begin{macro}{\yihao}
% \begin{macro}{\xiaoyi}
% \begin{macro}{\erhao}
% \begin{macro}{\xiaoer}
% \begin{macro}{\sanhao}
% \begin{macro}{\xiaosan}
% \begin{macro}{\sihao}
% \begin{macro}{\banxiaosi}
% \begin{macro}{\xiaosi}
% \begin{macro}{\dawu}
% \begin{macro}{\wuhao}
% \begin{macro}{\xiaowu}
% \begin{macro}{\liuhao}
% \begin{macro}{\xiaoliu}
% \begin{macro}{\qihao}
% \begin{macro}{\bahao}
%    \begin{macrocode}
\newlength\xdu@linespace
\newcommand{\xdu@choosefont}[2]{%
   \setlength{\xdu@linespace}{#2*\real{#1}}%
   \fontsize{#2}{\xdu@linespace}\selectfont}
\def\xdu@define@fontsize#1#2{%
  \expandafter\newcommand\csname #1\endcsname[1][\baselinestretch]{%
    \xdu@choosefont{##1}{#2}}}
\xdu@define@fontsize{chuhao}{42bp}
\xdu@define@fontsize{xiaochu}{36bp}
\xdu@define@fontsize{yihao}{26bp}
\xdu@define@fontsize{xiaoyi}{24bp}
\xdu@define@fontsize{erhao}{22bp}
\xdu@define@fontsize{xiaoer}{18bp}
\xdu@define@fontsize{sanhao}{16bp}
\xdu@define@fontsize{xiaosan}{15bp}
\xdu@define@fontsize{sihao}{14bp}
\xdu@define@fontsize{banxiaosi}{13bp}
\xdu@define@fontsize{xiaosi}{12bp}
\xdu@define@fontsize{dawu}{11bp}
\xdu@define@fontsize{wuhao}{10.5bp}
\xdu@define@fontsize{xiaowu}{9bp}
\xdu@define@fontsize{liuhao}{7.5bp}
\xdu@define@fontsize{xiaoliu}{6.5bp}
\xdu@define@fontsize{qihao}{5.5bp}
\xdu@define@fontsize{bahao}{5bp}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% 定义行距,正文小四号(12pt)字,行距为1.5倍行距
%    \begin{macrocode}
\renewcommand\normalsize{\@setfontsize\normalsize{12bp}{18bp}}
\renewcommand\baselinestretch{1.2}
%</class>
%    \end{macrocode}
%
% \subsubsection{页面设置}
% \label{sec:layout}
%
%    \begin{macrocode}
%<*class>
\setlength{\textwidth}{\paperwidth}
\addtolength{\textwidth}{-6cm}
\setlength{\textheight}{\paperheight}
\ifxdu@bachelor
\addtolength{\textheight}{-4.5cm}
\setlength{\topmargin}{1.45cm-1in}
\setlength{\headheight}{20pt}
\setlength{\headsep}{0.6cm}
\setlength{\footskip}{18pt}
\else
\addtolength{\textheight}{-5.5cm}
\setlength\voffset{3cm-1in}
\setlength{\topmargin}{-5ex}
\setlength{\headheight}{3ex}
\setlength{\headsep}{2ex}
\setlength{\footskip}{5ex}
\addtolength{\textheight}{-3ex}
\fi
\setlength\marginparwidth{0cm} 
\setlength\marginparsep{0cm}
\setlength{\oddsidemargin}{4cm-1in}
\setlength{\evensidemargin}{2cm-1in}
% \setlength{\topskip}{0pt}
% \setlength{\skip\footins}{15pt}
%</class>
%    \end{macrocode}
%
% \subsubsection{页眉页脚}
% \label{sec:headerfooter}
%
% \changes{v1.0.0}{2014/11/25}{2014版研究生学位论文页眉页脚格式}
% \changes{v0.9.7}{2012/12/12}{增加博士学位论文页眉与页脚格式支持}
% \changes{v0.9.8}{2012/12/18}{修正论文题目中换行破坏右侧页眉的问题}
%
% 新的一章最好从奇数页开始(openright),所以必须保证它前面那页如果没有内容也必
% 须没有页眉页脚。code stolen from fancyhdr
%
%    \begin{macrocode}
%<*class>
\def\xdu@clearpage{%
  \clearpage%
  \if@openright%
    \ifodd\c@page\relax\else%
      \null\thispagestyle{xdu@empty}\newpage%
    \fi%
  \fi}
%    \end{macrocode}
%
%
% 定义页眉和页脚。chapter 自动调用~thispagestyle{xdu@front},所以要重新定
% 义~xdu@front。
% \begin{macro}{\ps@xdu@empty}
% \begin{macro}{\ps@xdu@front}
% \begin{macro}{\ps@xdu@headings}
% 定义页眉页脚格式:
% \begin{itemize}
% \item \texttt{xdu@empty} :无页眉页脚
% \item \texttt{xdu@front} :页眉中无页码
% \item \texttt{xdu@headings}:页眉中显示页码
% \end{itemize}
%    \begin{macrocode}
\ifxdu@bachelor%
  \def\ps@xdu@header@rules{\vskip2pt\rule{\textwidth}{0.6pt}}
\else
  \def\ps@xdu@header@rules{
    \vskip4pt\rule{\textwidth}{0.6pt}%
    \vskip0.8pt\rule{\textwidth}{0.6pt}}
\fi
\def\ps@xdu@header@lefttext{%
  \hbox to\textwidth{%
    \hfil{\wuhao\noindent\leftmark}\hfil%
    {\ifxdu@bachelor\xiaowu\thepage\hskip1pt\fi}}}
\def\ps@xdu@header@righttext{%
  \hbox to\textwidth{%
    {\ifxdu@bachelor\xiaowu\thepage\hskip1pt\fi}%
    \hfil{\let\\=\relax\wuhao\rightmark}\hfil}}
\def\ps@xdu@footer@text{%
  \ifxdu@bachelor\relax\else%
  \hbox to\textwidth{\hfil{\xiaowu\thepage}\hfil}\fi}
% \def\ps@xdu@foot@doctor{\vbox{\vskip10pt\rule{\textwidth}{1mm}%
%     \vskip1pt\rule{\textwidth}{0.75pt}\vskip1pt%
%     \hbox to\textwidth{\hfil{\wuhao\ps@xdu@pagefoot}\hfil}}}
\def\ps@xdu@empty{%
  \let\@oddhead\@empty%
  \let\@evenhead\@empty%
  \let\@oddfoot\@empty%
  \let\@evenfoot\@empty}
\def\ps@xdu@front{%
  \def\@oddhead{\vbox{\ps@xdu@header@lefttext\ps@xdu@header@rules}}%
  \def\@evenhead{\vbox{\ps@xdu@header@righttext\ps@xdu@header@rules}}%
  \def\@oddfoot{\ps@xdu@footer@text}%
  \def\@evenfoot{\ps@xdu@footer@text}%
}
\def\ps@xdu@headings{% 
  \def\@oddhead{\vbox{\ps@xdu@header@lefttext\ps@xdu@header@rules}}%
  \def\@evenhead{\vbox{\ps@xdu@header@righttext\ps@xdu@header@rules}}%
  \def\@oddfoot{\ps@xdu@footer@text}%
  \def\@evenfoot{\ps@xdu@footer@text}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \changes{v0.9.8}{2013/03/14}{修正电子存储方式页眉}
%
% 其实可以直接写到~\cs{chapter} 的定义里面。
%    \begin{macrocode} 
\ifxdu@bachelor\ifxdu@english
\renewcommand{\chaptermark}[1]{%
  \ifodd\c@page%
    \markboth{#1}{\xdu@etitle}%
  \else%
    \markboth{\xdu@etitle}{#1}%
  \fi}
\else
\renewcommand{\chaptermark}[1]{%
  \ifodd\c@page%
    \markboth{#1}{\xdu@ctitle}%
  \else%
    \markboth{\xdu@ctitle}{#1}%
  \fi}
\fi\else
\renewcommand{\chaptermark}[1]{%
  \ifodd\c@page%
    \markboth{#1}{\xdu@xidian@str\xdu@thesis@str}%
  \else%
    \markboth{\xdu@xidian@str\xdu@thesis@str}{#1}%
  \fi}
\fi
\renewcommand{\sectionmark}[1]{}
%</class>
%    \end{macrocode}
%
% \changes{v0.9.1}{2009/06/15}{增加首行按照两个中文字符缩进}
% \subsubsection{段落}
% \label{sec:paragraph}
%
% 用于中文段落缩进和正文版式
%    \begin{macrocode}
%<*class>
\newlength\xdu@CJK@twochars
\newcommand{\xdu@unicode}[2]{\char\numexpr#1*256+#2\relax}
\def\xdu@CJK@space{\xdu@unicode{48}{7}}
\def\CJKindent{%
  \settowidth\xdu@CJK@twochars{\xdu@CJK@space\xdu@CJK@space}%
  \parindent\xdu@CJK@twochars}
%    \end{macrocode}
%
% 段落之间的竖直距离
%    \begin{macrocode}
\setlength{\parskip}{0pt \@plus0pt \@minus0pt}
%    \end{macrocode}
%
% 调整默认列表环境间的距离,以符合中文习惯。
% \begin{macro}{xdu@item@space}
%    \begin{macrocode}
\def\xdu@item@space{%
  \let\itemize\compactitem
  \let\enditemize\endcompactitem
  \let\enumerate\compactenum
  \let\endenumerate\endcompactenum
  \let\description\compactdesc
  \let\enddescription\endcompactdesc}
%</class>
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{中文标题定义}
% \label{sec:theor}
%
% \changes{v0.2.9.10}{2014/11/24}{根据2014研究生论文版式修正标题样式}
% \changes{v0.2}{2009/06/06}{加入中文标题的定义}
%
%    \begin{macrocode}
%<*config>
\ifxdu@english
\renewcommand{\bibname}{References}
\newcommand{\xdu@ackname}{Acknowledgments}
\renewcommand{\chaptername}{Chapter {\@arabic\c@chapter}}
\else
\renewcommand\contentsname{目录}
\renewcommand\listfigurename{插图索引}
\renewcommand\listtablename{表格索引}
\renewcommand\appendixname{附录}
\newcommand\listequationname{公式索引}
\newcommand\equationname{公式}
\renewcommand\bibname{参考文献}
\renewcommand\indexname{索引}
\renewcommand\figurename{图}
\renewcommand\tablename{表}
\def\xdu@CJKnumber#1{\ifcase#1{零}\or%
                    {一}\or{二}\or{三}\or{四}\or{五}\or%
                    {六}\or{七}\or{八}\or{九}\or{十}\or%
                    {十一}\or{十二}\or{十三}\or{十四}\or{十五}\or%
                    {十六}\or{十七}\or{十八}\or{十九}\or{二十}\fi}
\newcommand\CJKprepartname{第}
\newcommand\CJKpartname{部分}
\newcommand\CJKthepart{\CJKnumber{\@arabic\c@part}}
\newcommand\CJKprechaptername{第}
\newcommand\CJKchaptername{章}
\newcommand\CJKthechapter{\xdu@CJKnumber{\@arabic\c@chapter}}
\newcommand{\CJKthechaptername}[1]{%
            \CJKprechaptername\xdu@CJKnumber{\@arabic#1}\CJKchaptername}
\renewcommand{\chaptername}{\CJKprechaptername\CJKthechapter\CJKchaptername}
\newcommand{\xdu@ackname}{致谢}
\fi
\newcommand{\cabstractname}{摘要}
\newcommand{\eabstractname}{ABSTRACT}
\newcommand{\xdu@ckeywords@title}{关\hfill{}键\hfill{}词:}
\newcommand{\xdu@cthesistype@title}{论文类型:}
\newcommand{\xdu@ekeywords@title}{Keywords:}
\newcommand{\xdu@ethesistype@title}{Type of Dissertation:}
%</config>
%    \end{macrocode}

% \subsubsection{章节标题}
% \label{sec:titleandtoc}
%
% \changes{v0.9.8}{2013/03/13}{修正无编号章节的页眉}
% \changes{v0.9.8}{2013/03/13}{修正章标题之后的空白}
% \changes{v0.9.8}{2013/03/11}{修正无编号章标题段前段后空白}
% \changes{v0.9.8}{2013/03/11}{去掉了章标题段首空格}
% \changes{v0.9.8}{2013/01/19}{增加附录环境}
%
% 章标题与章名之间空一个半角空格,居中书写,单倍行距,段前空\texttt{4ex},段后空
% \texttt{3ex}。
%
%    \begin{macrocode}
%<*class>
\newlength{\xdu@chapter@before}
\newlength{\xdu@chapter@after}
\ifxdu@bachelor
  \setlength{\xdu@chapter@before}{15mm}
  \setlength{\xdu@chapter@after}{4ex}
\else
  \setlength{\xdu@chapter@before}{7ex}
  \setlength{\xdu@chapter@after}{5ex}
\fi
\renewcommand\chapter{%
  \xdu@clearpage%
  \if@mainmatter\thispagestyle{xdu@headings}%
  \else\thispagestyle{xdu@front}\fi%
  \phantomsection%
  \global\@topnum\z@%
  \secdef\@chapter\@schapter}
\def\@chapter[#1]#2{%
  \if@mainmatter\refstepcounter{chapter}\fi
  \ifxdu@english%
  \addcontentsline{toc}{chapter}{\xiaosi\bfseries\@chapapp~#1}%
  \chaptermark{\@chapapp~#1}%
  \else%
  \addcontentsline{toc}{chapter}{\xiaosi\song\bfseries\@chapapp\hskip1ex#1}%
  \chaptermark{\@chapapp\hskip2ex#1}%
  \fi%
  \@makechapterhead{#2}}
\def\@makechapterhead#1{\noindent%
  \parbox[b]{\textwidth}{\vskip\xdu@chapter@before}%
  {\centering \sanhao\song\bfseries%
    \ifnum \c@secnumdepth > \m@ne%
      \@chapapp\hskip1ex%
    \fi%
   \interlinepenalty\@M%
   #1\par\nobreak%
   \vskip\xdu@chapter@after%
   \nointerlineskip}}
\def\@schapter#1{%
  \addcontentsline{toc}{chapter}{\xiaosi\song\bfseries#1}%
  \chaptermark{#1}%
  \@makeschapterhead{#1}
  \@afterheading}
\def\@makeschapterhead#1{\noindent%
  \parbox[b]{\textwidth}{\vskip\xdu@chapter@before}%
  {\sanhao\song\bfseries\centering%
   \interlinepenalty\@M
   #1\par\nobreak%
   \vskip\xdu@chapter@after%
   \nointerlineskip}}
%    \end{macrocode}
% \begin{macro}{\section}
%
% 一级节标题,例如:2.1  实验装置与实验方法
% 节标题序号与标题名之间空一个汉字符(下同)。
% 采用宋体四号(14pt)字书写。
%
%    \begin{macrocode}
\ifxdu@bachelor
\renewcommand\section{\par%
  \ifdim\prevdepth=-1000pt\dimen0=1ex%
  \else\dimen0=3ex\fi%
  \@startsection {section}{1}{\z@}%
  {\dimen0}%
  {2ex}%
  {\sihao[1.429]\filcenter}}
\else
\titleformat{\section}[block]{\xiaosan}{\thesection}{1ex}{}
\titlespacing{\section}{0pt}{2ex}{2ex}
\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\subsection}
% 二级节标题,例如:2.1.1  实验方法
% 节标题序号与标题名之间空一个汉字符(下同)。
% 采用宋体小四号(12pt)字居左书写。
%    \begin{macrocode}
\ifxdu@bachelor
\titleformat{\subsection}[block]{\xiaosi}{\thesubsection}{1ex}{}
\titlespacing{\subsection}{0em}{2ex}{2ex}
\else
\titleformat{\subsection}[block]{\sihao}{\thesubsection}{1ex}{}
\titlespacing{\subsection}{\xdu@CJK@twochars}{2ex}{2ex}
\fi
%</class>
%    \end{macrocode}
% \end{macro}
%
%
%\subsubsection{目录格式}
%\label{sec:tableofcontents}
%
% \changes{v0.9.8}{2013/03/13}{修正小节目录点间距}
% \changes{v0.9.8}{2013/03/12}{修正目录点间距、PDF书签}
%
%    \begin{macrocode}
%<*class>
\renewcommand{\tableofcontents}{%
  % \xdu@clearpage%
  % \phantomsection%
  % \@makeschapterhead{\contentsname}%
  % \chaptermark{\contentsname}%
  \chapter*{\contentsname}%
  \@starttoc{toc}}
\newlength\xdu@dot@space
\setlength\xdu@dot@space{3bp}
\titlecontents{chapter}[0pt]{}%
              {\contentslabel{0pt}}%
              {\hspace*{0pt}}%
              {\titlerule*[\xdu@dot@space]{.}\bfseries\contentspage}
\dottedcontents{section}[4em]{}{2.1em}{\xdu@dot@space}
\dottedcontents{subsection}[6.8em]{}{2.7em}{\xdu@dot@space}
%</class>
%    \end{macrocode}
%
% \subsubsection{封面和封底}
% \label{sec:cover}
%
% 方便的定义封面的一些替换命令。
%
% \changes{v0.9.9}{2014/04/20}{Cleaned unused codes for master's thesis.}
% \changes{v0.9.5}{2012/06/23}{引入 \cs{xdu@define@term} 定义封面命令}
%
% \begin{macro}{\xdu@define@term}
%    \begin{macrocode}
%<*class>
\def\xdu@define@term#1{
  \expandafter\gdef\csname #1\endcsname##1{%
    \expandafter\gdef\csname xdu@#1\endcsname{##1}}
  \csname #1\endcsname{}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\subjectcode}
% \begin{macro}{\catalognumber}
% \begin{macro}{\classid}
% \begin{macro}{\studentid}
% \begin{macro}{\secretlevel}
% \begin{macro}{\ctitle}
% \begin{macro}{\cschool}
% \begin{macro}{\cmajor}
% \begin{macro}{\cfirstdiscipline}
% \begin{macro}{\efirstdiscipline}
% \begin{macro}{\cseconddiscipline}
% \begin{macro}{\eseconddiscipline}
% \begin{macro}{\cauthor}
% \begin{macro}{\csupervisor}
% \begin{macro}{\ccosupervisor}
% \begin{macro}{\ecosupervisor}
% \begin{macro}{\cdate}
% \begin{macro}{\edate}
% \begin{macro}{\etitle}
%    \begin{macrocode}
\xdu@define@term{universitycode}
\xdu@define@term{catelognumber}
\xdu@define@term{classid}
\xdu@define@term{studentid}
\xdu@define@term{secretlevel}
\xdu@define@term{ctitle}
\xdu@define@term{etitle}
\xdu@define@term{cschool}
\xdu@define@term{cmajor}
\xdu@define@term{cfirstdiscipline}
\xdu@define@term{efirstdiscipline}
\xdu@define@term{cseconddiscipline}
\xdu@define@term{eseconddiscipline}
\xdu@define@term{cauthor}
\xdu@define@term{eauthor}
\xdu@define@term{cdegree}
\xdu@define@term{edegree}
\xdu@define@term{csupervisor}
\xdu@define@term{esupervisor}
\xdu@define@term{ccosupervisor}
\xdu@define@term{ecosupervisor}
\xdu@define@term{cdate}
\xdu@define@term{edate}
\xdu@define@term{cthesistype}
\xdu@define@term{ethesistype}
%</class>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro} 
% \end{macro}
% \end{macro}
% \end{macro} 
% \end{macro}
% \end{macro}
% \end{macro} 
% \end{macro} 
% \end{macro} 
% \end{macro} 
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% 
%    \begin{macrocode}
%<*config>
\def\xdu@universitycode@prefix{学校代码}
\def\xdu@catelognumber@prefix{分类号}
\def\xdu@classid@prefix{班级}
\def\xdu@studentid@prefix{学号}
\def\xdu@secretlevel@prefix{密级}
\def\xdu@ctitle@prefix{\ifxdu@bachelor{题目}\else{题{\xiaowu(中、英文)}目}\fi}
\def\xdu@cschool@prefix{学院}
\def\xdu@cmajor@prefix{专业}
\def\xdu@cauthor@prefix{\ifxdu@bachelor{学生姓名}\else{作者姓名}\fi}
\def\xdu@csupervisor@prefix{\ifxdu@bachelor{导师姓名}%
  \else\ifxdu@masterpro{学校导师姓名、职称}\else{导师姓名、职称}\fi\fi}
\def\xdu@ccosupervisor@prefix{\ifxdu@masterpro{企业导师姓名、职称}\else\relax\fi}
\def\xdu@cfirstdiscipline@prefix{\ifxdu@masterpro{领\hskip2em{}域}\else{一级学科}\fi}
\def\xdu@cseconddiscipline@prefix{二级学科}
\def\xdu@cdegree@prefix{\ifxdu@masterpro{学位类别}\else{申请学位类别}\fi}
\def\xdu@cdate@titlepage@prefix{提交学位论文日期}
\def\xdu@cdate@prefix{提交日期}
\def\xdu@thesis@str{%
  \ifxdu@bachelor{本科毕业设计论文}\else%
    \ifxdu@master{硕士学位论文}\else%
      \ifxdu@doctor{博士学位论文}\else%
        \ifxdu@masterpro{硕士学位论文}\fi%
  \fi\fi\fi}
%</config>
%    \end{macrocode} 
%
% \changes{v1.0.0}{2014/11/26}{2014研究生论文封面}
% \changes{v0.9.8}{2013/03/14}{修正研究生论文封面行距}
% \changes{v0.9.6}{2012/06/27}{完成了本科毕业设计封面设计}
% \changes{v0.9.7}{2012/12/12}{完成了研究生论文封面的设计}
% \changes{v0.9.7}{2012/12/13}{改进了封面论文题目显示机制,允许题目中使用换行}
%
%    \begin{macrocode}
%<*class>
\def\xdu@urule#1#2{\hskip2pt\underline{\hb@xt@#1{\hss#2\hss}}\hskip3pt}
\def\xdu@put@prefix#1#2{\makebox[#1][s]{#2}}
\def\xdu@titlepage{%
  \ifxdu@bachelor%
    \xdu@titlepage@bachelor%
  \else%
    \xdu@titlepage@graduate%
  \fi}
\newcommand{\xdu@titlepage@bachelor}{
  \parbox[b]{0.9\linewidth}{%
    \xiaosi[1.5]\song\bf\ignorespaces\flushright%
    \xdu@put@prefix{3em}{\xdu@classid@prefix}\enskip%
    \xdu@urule{32mm}{\xdu@classid}\par%
    \xdu@put@prefix{3em}{\xdu@studentid@prefix}\enskip%
    \xdu@urule{32mm}{\xdu@studentid}}
  \begin{center}
    \ifxdu@print\vspace{132mm}\else\vspace{18mm}
    \includegraphics[width=77mm]{xdubadge}\par
    \vspace{15mm}
    \parbox[t]{\linewidth}{\chuhao\hei\centering\xdu@thesis@str}\par
    \vspace{15mm}
    \includegraphics[width=44mm]{xdlogo}\par
    \vspace{18mm}\fi
    \begin{minipage}{122mm}
      \flushleft\xiaosan[2.5]\song%
      \xdu@put@prefix{25mm}{\bf\xdu@ctitle@prefix}
      \xdu@urule{95mm}{}\par
      \xdu@put@prefix{25mm}{}\xdu@urule{95mm}{}\par
      \xdu@put@prefix{25mm}{\bf\xdu@cschool@prefix}
      \xdu@urule{95mm}{\xdu@cschool}\par
      \xdu@put@prefix{25mm}{\bf\xdu@cmajor@prefix}
      \xdu@urule{95mm}{\xdu@cmajor}\par
      \xdu@put@prefix{25mm}{\bf\xdu@cauthor@prefix}
      \xdu@urule{95mm}{\xdu@cauthor}\par
      \xdu@put@prefix{25mm}{\bf\xdu@csupervisor@prefix}
      \xdu@urule{95mm}{\xdu@csupervisor}
    \end{minipage}
    \vskip-87mm\hskip25mm
    \begin{minipage}{85mm}
      \xiaosan[2.5]\song\centering\ignorespaces\xdu@ctitle
    \end{minipage}
  \end{center}
}
\newcommand{\xdu@titlepage@graduate}{
  \ifxdu@print%
    \parbox{\textwidth}{\vskip143mm}
  \else%
    \parbox{\textwidth}{\vskip35mm}
    \begin{center}
      \includegraphics[width=77mm]{xdubadge-gr}\par
      \vskip15mm
      \parbox[t]{\linewidth}{\chuhao\hei\centering\xdu@thesis@str}\par
      \vskip15mm
      \includegraphics[width=44mm]{xdlogo}\par
    \end{center}
  \fi
  \vskip44mm\noindent
  \xdu@put@prefix{5em}{\heiti\sihao\bfseries\xdu@cauthor@prefix}
  \xdu@urule{12em}{\song\sihao\bfseries\xdu@cauthor}
  \ifxdu@masterpro
  \xdu@put@prefix{10.5em}{\heiti\sihao\bfseries\xdu@csupervisor@prefix}
  \xdu@urule{6.5em}{\song\sihao\bfseries\xdu@csupervisor}\par
  \else
  \xdu@put@prefix{8em}{\heiti\sihao\bfseries\xdu@csupervisor@prefix}
  \xdu@urule{9em}{\song\sihao\bfseries\xdu@csupervisor}\par
  \fi
  \vskip3ex\noindent
  \xdu@put@prefix{5em}{\heiti\sihao\bfseries\xdu@cfirstdiscipline@prefix}
  \xdu@urule{12em}{\song\sihao\bfseries\xdu@cfirstdiscipline}
  \ifxdu@masterpro
  \xdu@put@prefix{10.5em}{\heiti\sihao\bfseries\xdu@ccosupervisor@prefix}
  \xdu@urule{6.5em}{\song\sihao\bfseries\xdu@ccosupervisor}\par
  \else
  \xdu@put@prefix{5em}{\heiti\sihao\bfseries\xdu@cseconddiscipline@prefix}
  \xdu@urule{12em}{\song\sihao\bfseries\xdu@cseconddiscipline}\par
  \fi
  \vskip3ex\noindent
  \xdu@put@prefix{7em}{\heiti\sihao\bfseries\xdu@cdegree@prefix}
  \xdu@urule{10em}{\song\sihao\bfseries\xdu@cdegree}
  \xdu@put@prefix{9em}{\heiti\sihao\bfseries\xdu@cdate@titlepage@prefix}
  \xdu@urule{8em}{\song\sihao\bfseries\xdu@cdate}\par
  \vskip-79mm\noindent
  \begin{minipage}{\textwidth}
    \centering\song\erhao\bfseries\xdu@ctitle\par
  \end{minipage}
}
\newcommand{\xdu@cheadpage@bachelor}{}
\newcommand{\xdu@eheadpage@bachelor}{}
\newcommand{\xdu@cheadpage@graduate}{
  \noindent
  \parbox[b]{\textwidth}{
    \vskip4ex
    \song\wuhao\bfseries\ignorespaces\centering
    \xdu@put@prefix{4em}{\xdu@universitycode@prefix}%
    \xdu@urule{8em}{\xdu@universitycode}%
    \hfill{}%
    \xdu@put@prefix{4em}{\xdu@studentid@prefix}%
    \xdu@urule{8em}{\xdu@studentid}
    \par\vskip1ex
    \xdu@put@prefix{4em}{\xdu@catelognumber@prefix}%
    \xdu@urule{8em}{\xdu@catelognumber}%
    \hfill
    \xdu@put@prefix{4em}{\xdu@secretlevel@prefix}%
    \xdu@urule{8em}{\xdu@secretlevel}}
  \vskip17mm\noindent
  \begin{center}
    \begingroup\hei\bfseries\yihao\xdu@xidian@str\par\endgroup
    \vskip17mm
    \begingroup\song\erhao\bfseries\xdu@thesis@str\par\endgroup
  \end{center}
  \vskip65mm
  \begingroup\song\sihao[2]
  \newlength\xdu@headpage@hangpos
  \setlength\xdu@headpage@hangpos{0.5\textwidth-4em}
  \noindent\hangindent\xdu@headpage@hangpos\\
  \begingroup\bfseries\xdu@cauthor@prefix\endgroup{:}\xdu@cauthor\\
  \begingroup\bfseries\xdu@cfirstdiscipline@prefix\endgroup{:}
  \xdu@cfirstdiscipline\\
  \ifxdu@masterpro
  \begingroup\bfseries\xdu@cdegree@prefix\endgroup{:}\xdu@cdegree\\
  \begingroup\bfseries\xdu@csupervisor@prefix\endgroup{:}\xdu@csupervisor\\
  \begingroup\bfseries\xdu@ccosupervisor@prefix\endgroup{:}\xdu@ccosupervisor\\
  \else
  \begingroup\bfseries\xdu@cseconddiscipline@prefix\endgroup{:}
  \xdu@cseconddiscipline\\
  \begingroup\bfseries\xdu@cdegree@prefix\endgroup{:}\xdu@cdegree\\
  \begingroup\bfseries\xdu@csupervisor@prefix\endgroup{:}\xdu@csupervisor\\
  \fi
  \begingroup\bfseries\xdu@cdate@prefix\endgroup{:}\xdu@cdate\par
  \endgroup
  \vskip-110mm\noindent
  \begin{minipage}{\textwidth}
    \centering\song\erhao\bfseries\xdu@ctitle\par
  \end{minipage}
}
\newcommand{\xdu@eheadpage@graduate}{
  \noindent\parbox{\textwidth}{%
    \ifxdu@doctor\vskip155mm\else\vskip178mm\fi}
  \noindent
  \begin{minipage}{1.0\linewidth}
    \noindent\centering\sanhao[1.57]
    A \ifxdu@doctor dissertation \else thesis \fi submitted to\\
    XIDIAN UNIVERSITY\\
    in partial fulfillment of the requirements\\
    for the degree of \xdu@edegree%
    \ifxdu@doctor\relax\else\\in \xdu@efirstdiscipline\fi
  \end{minipage}
  \ifxdu@doctor\vskip27mm\else\vskip18mm\fi
  \begin{minipage}{1.0\linewidth}
    \noindent\centering\sanhao[1.57]
    By\\
    \xdu@eauthor\\
    \ifxdu@doctor(\xdu@efirstdiscipline)\\\fi
    Supervisor: \xdu@esupervisor%
    \ifxdu@masterpro\hskip1em\xdu@ecosupervisor\fi\\
    \xdu@edate
  \end{minipage}
  \vskip-225mm\noindent
  \begin{minipage}{\textwidth}
    \noindent\centering\erhao\bfseries\xdu@etitle\par
  \end{minipage}
}
\ifxdu@bachelor
  \let\xdu@cheadpage\xdu@cheadpage@bachelor
  \let\xdu@eheadpage\xdu@eheadpage@bachelor
\else
  \let\xdu@cheadpage\xdu@cheadpage@graduate
  \let\xdu@eheadpage\xdu@eheadpage@graduate
\fi
%</class>
%    \end{macrocode}
%
%
% \changes{v0.9.9}{2014/04/26}{纯英文论文中不出现作者简介}
% \changes{v0.9.7}{2012/12/14}{增加研究论文作者简介}
%
%    \begin{macrocode}
%<*config>
\ifxdu@english
\def\xdu@authorbio@title{Author Biography}
\else
\def\xdu@authorbio@title{作者简介}
\fi
%</config>
%    \end{macrocode}
%
% \begin{macro}{\xdu@make@authorbio}
%    \begin{macrocode}
%<*class>
\long\@xp\def\@xp\collect@@body\@xp#\@xp1\@xp\end\@xp#\@xp2\@xp{%
  \collect@@body{#1}\end{#2}}
\long\@xp\def\@xp\push@begins\@xp#\@xp1\@xp\begin\@xp#\@xp2\@xp{%
  \push@begins{#1}\begin{#2}}
\long\@xp\def\@xp\addto@envbody\@xp#\@xp1\@xp{%
  \addto@envbody{#1}}
\newcommand{\xdu@@cauthorbio}[1]{\long\gdef\xdu@cauthorbio{#1}}
\newenvironment{cauthorbio}[1]{\long\gdef\xdu@bio@photo{#1}%
  \collect@body\xdu@@cauthorbio}{}
\newcommand{\xdu@@eauthorbio}[1]{\long\gdef\xdu@eauthorbio{#1}}
\newenvironment{eauthorbio}{\collect@body\xdu@@eauthorbio}{}
% 照片区域大小 IEEEtran格式
\def\xdu@bio@photowidth{1.00in}   % width of the biography photo area
\def\xdu@bio@photodepth{1.25in}   % depth (height) of the biography photo area
% 为放置照片留出的空白区域大小
\def\xdu@bio@hangwidth{1.15in}    % width cleared for the biography photo area
\def\xdu@bio@hangdepth{1.25in}    % depth cleared for the biography photo area
\newdimen\@xdtmpdimenA
\newdimen\@xdtmpdimenB
\newcount\@xdtmpcountA
\def\xdu@make@authorbio{%
  \begin{center}
    \ifxdu@english%
      \sanhao[2]\bfseries{\xdu@authorbio@title}
    \else
      \sanhao[2]\hei{\xdu@authorbio@title}
    \fi
  \end{center}
  \vskip2ex%
  \def\xdu@temp@photobox{\mbox{%
      \begin{minipage}[b][\xdu@bio@photodepth][c]{\xdu@bio@photowidth}%
        \centering \xdu@bio@photo%
      \end{minipage}}}
  \settoheight{\@xdtmpdimenA}{\xdu@temp@photobox}
  \@xdtmpdimenB=\xdu@bio@hangdepth%
  % countA has the hang depth
  \@xdtmpcountA=\@xdtmpdimenB
  % calculates lines needed to produce the hang depth
  \divide\@xdtmpcountA by \baselineskip
  \advance\@xdtmpcountA by 1% ensure we overestimate
  % reference the top of the photo area to the top of a capital T
  \settoheight{\@xdtmpdimenB}{\mbox{T}}%
  \noindent\makebox[0pt][l]{\hspace{-\xdu@bio@hangwidth}%
    \raisebox{\@xdtmpdimenB}[0pt][0pt]{%
      \raisebox{-\xdu@bio@photodepth}[0pt][0pt]{\xdu@temp@photobox}}}%
  \hangindent\xdu@bio@hangwidth%
  \hangafter-\@xdtmpcountA%
  \ifxdu@english%
    \xdu@eauthorbio\par%
  \else
    \indent\xdu@cauthorbio\par%
  \fi
  \ifnum \prevgraf <\@xdtmpcountA\relax% detect when the biography text is shorter than the photo
  \advance\@xdtmpcountA by -\prevgraf% calculate how many lines we need to pad
  \advance\@xdtmpcountA by -1\relax% we compensate for the fact that we indented an extra line
  \@xdtmpdimenA=\baselineskip% calculate the length of the padding
  \multiply\@xdtmpdimenA by \@xdtmpcountA%
  \noindent\rule{0pt}{\@xdtmpdimenA}% insert an invisible support strut
  \fi%
  \ifxdu@english\relax\else\xdu@eauthorbio\par\fi%
}
%</class>
%    \end{macrocode}
% \end{macro}
% 
%
% 封面中论文诚信声明部分。
%
% \changes{v0.9.7}{2012/12/12}{增加各级学位论文诚信声明页}
%
%<*config>
\def\xdu@xidian@str{西安电子科技大学}
\def\xdu@declaration@title{%
  \ifxdu@bachelor{毕业设计(论文)诚信声明书}%
  \else{学位论文独创性(或创新性)声明}\fi}
\def\xdu@authorization@title{\ifxdu@bachelor{}%
  \else{关于论文使用授权的说明}\fi}
\def\xdu@declaration@str{
  \ifxdu@bachelor{本人声明:本人所提交的毕业论文《\xdu@ctitle》是本人在指导教师指
    导下独立研究、写作的成果,论文中所引用他人的无论以何种方式发布的文字、研究成
    果, 均在论文中加以说明;有关教师、同学和其他人员对本文的写作、修订提出过并为
    我在论文中加以采纳的意见、建议,均已在我的致谢辞中加以说明并深致谢意。\par{}
    本论文和资料若有不实之处,本人承担一切相关责任。}
  \else{秉承学校严谨的学风和优良的科学道德,本人声明所呈交的论文是我
    个人在导师指导下进行的研究工作及取得的研究成果。尽我所知,除了文中特别加以标
    注和致谢中所罗列的内容以外,论文中不包含其他人已经发表或撰写过的研究成果; 也
    不包含为获得西安电子科技大学或其它教育机构的学位或证书而使用过的材料。与我一
    同工作的同志对本研究所做的任何贡献均已在论文中做了明确的说明并表示了谢
    意。\par{}
    学位论文若有不实之处,本人承担一切法律责任。}
  \fi}
\def\xdu@authorization@str{
  \ifxdu@bachelor\relax
  \else{本人完全了解西安电子科技大学有关保留和使用学位论文的规定,即:
    研究生在校攻读学位期间论文工作的知识产权单位属于西安电子科技大学。学校有权保
    留送交论文的复印件,允许查阅、借阅论文;学校可以公布论文的全部或部分内容,允
    许采用影印、缩印或其它复制手段保存论文。同时本人保证,获得学位后结合学位论文
    研究成果撰写的文章,署名单位为西安电子科技大学。\par{}%
    保密的学位论文在\underline{\hskip2em}年解密后适用本授权书。}
  \fi}
\def\xdu@author@presig{\ifxdu@bachelor{论文作者:}\else{本人签名:}\fi}
\def\xdu@supervisor@presig{\ifxdu@bachelor{指导教师已阅:}%
  \else{导师签名:}\fi}
\def\xdu@date@presig{\ifxdu@bachelor{日期}\else{日  期:}\fi}
%</config>
%
% \begin{macro}{\xdu@make@declaration}
%    \begin{macrocode}
%<*class>
\def\xdu@make@declaration{%
  \song\xiaosi[1.5]
  {\centering\bfseries\ifxdu@bachelor\sanhao\else\sihao[1.6]\fi%
    \xdu@xidian@str\par\xdu@declaration@title\par}
  \vskip4ex\xdu@declaration@str\vskip3ex
  \xdu@put@prefix{5em}{\xdu@author@presig}\underline{\hskip30mm}\hskip25mm
  \ifxdu@bachelor
    \xdu@put@prefix{2em}{\xdu@date@presig}\underline{\hskip30mm}\par
  \else
    \xdu@put@prefix{5em}{\xdu@date@presig}\underline{\hskip30mm}\par
  \fi
  \vskip16ex
  \ifxdu@bachelor\relax\else
  {\centering\bfseries\ifxdu@bachelor\sanhao\else\sihao[1.6]\fi%
    \xdu@xidian@str\par\xdu@authorization@title\par}
  \vskip4ex\xdu@authorization@str\par\vskip3ex
  \xdu@put@prefix{5em}{\xdu@author@presig}\underline{\hskip30mm}\hskip25mm
  \xdu@put@prefix{5em}{\xdu@supervisor@presig}\underline{\hskip30mm}\par
  \vskip3ex
  \xdu@put@prefix{5em}{\xdu@date@presig}\underline{\hskip30mm}\hskip25mm
  \xdu@put@prefix{5em}{\xdu@date@presig}\underline{\hskip30mm}\par
  \fi
}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\makecover}
% \changes{v0.9.5}{2012/06/23}{分成几个小模块来搞,不然这个 macro 太大了,看不过来}
%
%    \begin{macrocode}
\newcommand{\makecover}{
  \begin{titlepage}
    \xdu@titlepage
  \end{titlepage}
  \xdu@clearpage
  \thispagestyle{xdu@empty}
  \xdu@cheadpage
  \xdu@clearpage
  \thispagestyle{xdu@empty}
  \xdu@eheadpage
  \xdu@clearpage
  \addtolength{\topmargin}{15pt}
  \thispagestyle{xdu@empty}
  \xdu@make@declaration
  \xdu@clearpage
  \addtolength{\topmargin}{-15pt}
  \setcounter{page}{1}
  \xdu@makeabstract
}
%</class>
%    \end{macrocode}
% \end{macro}
% 
% \subsubsection{数学相关}
%\label{sec:maths}
%
%    \begin{macrocode}
%<*class>
\renewcommand\theequation{\ifnum \c@chapter>\z@ \thechapter%
                          -\fi\@arabic\c@equation}
%</class>
%    \end{macrocode}
%
% \subsubsection{浮动对象以及表格}
% \label{sec:float}
%
% 设置浮动对象和文字之间的距离
%
% \changes{v0.9.8}{2013/03/14}{设置图表长标题居中对齐}
% \changes{v0.2}{2009/06/06}{增加\cs{subfloat}}
%
%    \begin{macrocode}
%<*class>
\let\old@tabular\@tabular
\def\xdu@tabular{\wuhao\old@tabular}
\ifxdu@english
\DeclareCaptionLabelFormat{xdu@cap}{{\wuhao#1~\rmfamily#2}}
\else
\DeclareCaptionLabelFormat{xdu@cap}{{\wuhao#1\rmfamily#2}}
\fi
\DeclareCaptionLabelSeparator{xdu@sep}{\hspace{1em}}
\DeclareCaptionFont{xdu@capfont}{\wuhao}
\captionsetup{labelformat=xdu@cap,
              labelsep=xdu@sep,
              font=xdu@capfont,
              justification=centering}
\captionsetup[table]{position=top, belowskip={1pc-\intextsep}, aboveskip=1pc} 
\captionsetup[figure]{position=bottom, belowskip={1pc-\intextsep}, aboveskip=1pc}
\captionsetup[subfloat]{font=xdu@capfont,captionskip=6bp,%
                        nearskip=6bp,farskip=0bp,topadjust=0bp}
\renewenvironment{table}{%
  \renewcommand* {\@floatboxreset}{%
    \reset@font\@setminipage}
  \dawu\@float{table}%
}{%
  \end@float\normalsize
}
%</class>
%    \end{macrocode}

% \subsubsection{摘要格式}
% \label{sec:abstractformat}
%
% \changes{v1.0.0}{2014/11/24}{按照2014研究生论文版式修改摘要模板}
% \changes{v0.9.9}{2014/04/20}{Fixed fragile {e,c}abstract environments.}
%
% \begin{macro}{\xdu@makeabstract}
% 中文摘要部分的标题为"摘要",用宋体三号字加精力。
%    \begin{macrocode}
%<*class>
\newcommand{\xdu@@cabstract}[1]{\long\gdef\xdu@cabstract{#1}}
\newenvironment{cabstract}{\collect@body\xdu@@cabstract}{}
\newcommand{\xdu@@eabstract}[1]{\long\gdef\xdu@eabstract{#1}}
\newenvironment{eabstract}{\collect@body\xdu@@eabstract}{}
\newcommand{\xdu@@ckeywords}[1]{\long\gdef\xdu@ckeywords{#1}}
\newenvironment{ckeywords}{\collect@body\xdu@@ckeywords}{}
\newcommand{\xdu@@ekeywords}[1]{\long\gdef\xdu@ekeywords{#1}}
\newenvironment{ekeywords}{\collect@body\xdu@@ekeywords}{}
\newcommand{\xdu@makeabstract}{%
  \xdu@mkabstracttrue%
% 摘要内容用小四号字书写,两端对齐,汉字用宋体,外文字用Times New Roman 体,标点
% 符号一律用中文输入状态下的标点符号
  \expandafter \ifx \csname xdu@cabstract\endcsname%
  \relax\else%
    \chapter*{\cabstractname}%
    \normalsize\par\xdu@cabstract\vskip12bp%
%本科关键词为悬挂缩进
    \ifxdu@bachelor%
      \setbox0=\hbox{\hei\xdu@ckeywords@title\hspace{1em}}%
      \noindent\hangindent\wd0\hangafter1
      \expandafter \ifx \csname xdu@ckeywords\endcsname%
        \relax\box0{\hei}%
      \else\box0{\hei\xdu@ckeywords}\fi%
    \else%% 硕士、博士论文格式相同
      \begingroup\song\wuhao
      \setbox0=\hbox{\bfseries\xdu@cthesistype@title}%
      \setbox1=\hbox to \wd0 {\bfseries\xdu@ckeywords@title}%
      \noindent\hangindent\wd0\hangafter1
      \expandafter \ifx \csname xdu@ckeywords\endcsname%
        \relax\box1{\bfseries}%
      \else\box1{\xdu@ckeywords}\fi%
      \par\noindent\box0{\bfseries}\xdu@cthesistype%
      \endgroup%
    \fi%
  \fi%
% 英文摘要部分的标题为“ABSTRACT”,用Times New Roman 体三号字。
  \expandafter \ifx \csname xdu@eabstract\endcsname \relax%
  \else%
    \chapter*{\bfseries\eabstractname}%
    \normalsize\par\xdu@eabstract\vskip12bp%
% 关键词为悬挂缩进(本科、硕士、博士论文格式相同)
    \begingroup\ifxdu@bachelor\normalsize\else\wuhao\fi
    \setbox0=\hbox{\bfseries\xdu@ekeywords@title\hskip1em}%
    \noindent\hangindent\wd0\hangafter1%
    \expandafter \ifx \csname xdu@ekeywords\endcsname%
      \relax\box0{\ifxdu@bachelor\bfseries\fi}%
    \else\box0{\ifxdu@bachelor\bfseries\fi\xdu@ekeywords}\fi%
    \ifxdu@bachelor\relax\else%
    \par\noindent {\bfseries\xdu@ethesistype@title}%
    \hskip1em\xdu@ethesistype
    \endgroup
    \fi%
  \fi
  \xdu@mkabstractfalse%
}
%</class>
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{插图索引/表格索引}
% \label{sec:floatlists}
%
% \changes{v1.0.0}{2014/11/24}{按照2014研究生论文版式增加插图与表格索引}
%
% \begin{macro}{listoffigures}
% \begin{macro}{listoftables}
%    \begin{macrocode}
%<*class>
\def\@tocrmarg{2em}
\def\@dotsep{1} % 目录点间的距离
\def\@dottedtocline#1#2#3#4#5{%
  \ifnum #1>\c@tocdepth \else
    \vskip \z@ \@plus.2\p@
    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
    \parindent #2\relax\@afterindenttrue
    \interlinepenalty\@M
    \leavevmode
    \@tempdima #3\relax
    \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
    {#4}\nobreak\hskip2pt
    \leaders\hbox{$\m@th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill
    \nobreak{\normalfont \normalcolor #5}%
    \par}%
  \fi}
\def\xdu@starttoc#1{% #1: float type, prepend type name in \listof*** entry.
  \let\oldnumberline\numberline
  \def\numberline##1{\oldnumberline{\csname #1name\endcsname%
      \ifxdu@english~\else\hskip.2em\fi ##1}}
  \@starttoc{\csname ext@#1\endcsname}
  \let\numberline\oldnumberline}
\def\xdu@listof#1{% #1: float type
  \@ifstar
    {\chapter*[]{\csname list#1name\endcsname}\xdu@starttoc{#1}}
    {\chapter*{\csname list#1name\endcsname}\xdu@starttoc{#1}}}
\renewcommand\listoffigures{\xdu@listof{figure}}
\ifxdu@english
\renewcommand*\l@figure{\@dottedtocline{1}{0em}{5em}}
\else
\renewcommand*\l@figure{\@dottedtocline{1}{0em}{3.2em}}
\fi
\renewcommand\listoftables{\xdu@listof{table}}
\let\l@table\l@figure
%<class>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% 
%
% \subsubsection{参考文献}
% \label{sec:ref}
%
% \begin{macro}{\onlinecite}
% 正文引用模式。依赖于\pkg{natbib}宏包,修改其中的命令。
%    \begin{macrocode}
%<*class>
\bibpunct{[}{]}{,}{s}{}{,}
\renewcommand\NAT@citesuper[3]{\ifNAT@swa
\unskip\kern\p@\textsuperscript{\NAT@@open #1\NAT@@close}%
   \if*#3*\else\ (#3)\fi\else #1\fi\endgroup}
\DeclareRobustCommand\onlinecite{\@onlinecite}
\def\@onlinecite#1{\begingroup\let\@cite\NAT@citenum\citep{#1}\endgroup}
%    \end{macrocode}
% \end{macro}
%
% 参考文献的正文部分用五号字。
% 行距采用固定值16磅,段前空3磅,段后空0磅。
%
% \begin{environment}{thebibliography}
% 修改默认的thebibliography环境,增加一些调整代码。
%    \begin{macrocode}
\renewenvironment{thebibliography}[1]{%    
  \chapter*{\bibname}%
  \wuhao[1.5]%
  \list{\@biblabel{\@arabic\c@enumiv}}%
  {\renewcommand{\makelabel}[1]{##1\hfill}
    \settowidth\labelwidth{1.1cm}
    \setlength{\labelsep}{0.6em}
    \setlength{\itemindent}{0pt}
    \setlength{\leftmargin}{\labelwidth+\labelsep}
    \addtolength{\itemsep}{-0.7em}
    \usecounter{enumiv}%
    \let\p@enumiv\@empty
    \renewcommand\theenumiv{\@arabic\c@enumiv}}%
  \sloppy
  \clubpenalty4000
  \@clubpenalty \clubpenalty
  \widowpenalty4000%
  \interlinepenalty4000%
  \sfcode`\.\@m}
{\def\@noitemerr
  {\@latex@warning{Empty `thebibliography' environment}}%
  \endlist}
%</class>
%    \end{macrocode}
% \end{environment}
%
% \subsubsection{致谢}
% \label{sec:ack}
%
%    \begin{macrocode}
%<*class>
\ifxdu@english
\newenvironment{acknowledgments}{\chapter*{\bfseries\xdu@ackname}}{}
\else
\newenvironment{acknowledgments}{\chapter*{\xdu@ackname}}{}
\fi
%</class>
%    \end{macrocode}
%
% \subsubsection{附录}
% \label{sec:appendix}
%
%    \begin{macrocode}
%<*class>
\let\xdu@appendix\appendix
\renewenvironment{appendix}{
  \xdu@appendix
  \gdef\@chapapp{\appendixname~\thechapter}
}{}
%</class>
%    \end{macrocode}
%
%    \begin{macrocode}
%<class>\AtEndOfClass{\input{xduthesis.cfg}}%
%    \end{macrocode}
%
% 把 CJK 环境放到合适的位置,以免导致其它宏包的命令位于 CJK 环境中而出现问题(比
% 如 natbib 的``Multiple-defined labels'',同时自动开启 CJK。
%    \begin{macrocode}
%<*class>
\AtBeginDocument{\CJKindent}
\AtEndOfClass{\sloppy\xdu@item@space}
%</class>
%    \end{macrocode}
%
% \Finale
\endinput