summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-08-06 03:00:56 +0000
committerNorbert Preining <norbert@preining.info>2021-08-06 03:00:56 +0000
commite40ca5f6d9078173240b437a77d0fcc762e69bd4 (patch)
tree5bacc392092e10aed224f425a285b0e951376b72 /macros
parentb7e54219e4294fa527035f0bd2819ca11c3c6964 (diff)
CTAN sync 202108060300
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/tuda-ci/README.md4
-rw-r--r--macros/latex/contrib/tuda-ci/doc/DEMO-TUDaAnnouncement.pdfbin574086 -> 574086 bytes
-rw-r--r--macros/latex/contrib/tuda-ci/doc/DEMO-TUDaBeamer.pdfbin622116 -> 622116 bytes
-rw-r--r--macros/latex/contrib/tuda-ci/doc/DEMO-TUDaExercise.pdfbin594904 -> 594859 bytes
-rw-r--r--macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLeaflet.pdfbin583234 -> 583234 bytes
-rw-r--r--macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLetter.pdfbin590030 -> 589937 bytes
-rw-r--r--macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPhD.pdfbin655534 -> 655456 bytes
-rw-r--r--macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPoster.pdfbin558963 -> 558963 bytes
-rw-r--r--macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPub.pdfbin682663 -> 682571 bytes
-rw-r--r--macros/latex/contrib/tuda-ci/doc/DEMO-TUDaReport.pdfbin550456 -> 550790 bytes
-rw-r--r--macros/latex/contrib/tuda-ci/doc/DEMO-TUDaSciPoster.pdfbin586895 -> 586895 bytes
-rw-r--r--macros/latex/contrib/tuda-ci/doc/DEMO-TUDaThesis.pdfbin647328 -> 647245 bytes
-rw-r--r--macros/latex/contrib/tuda-ci/example/DEMO-TUDaAnnouncement.tex2
-rw-r--r--macros/latex/contrib/tuda-ci/example/DEMO-TUDaBeamer.tex2
-rw-r--r--macros/latex/contrib/tuda-ci/example/DEMO-TUDaBibliography.bib2
-rw-r--r--macros/latex/contrib/tuda-ci/example/DEMO-TUDaExercise.tex2
-rw-r--r--macros/latex/contrib/tuda-ci/example/DEMO-TUDaFromaddress.lco2
-rw-r--r--macros/latex/contrib/tuda-ci/example/DEMO-TUDaLeaflet.tex2
-rw-r--r--macros/latex/contrib/tuda-ci/example/DEMO-TUDaLetter.tex2
-rw-r--r--macros/latex/contrib/tuda-ci/example/DEMO-TUDaPhD.tex2
-rw-r--r--macros/latex/contrib/tuda-ci/example/DEMO-TUDaPoster.tex2
-rw-r--r--macros/latex/contrib/tuda-ci/example/DEMO-TUDaPub.tex2
-rw-r--r--macros/latex/contrib/tuda-ci/example/DEMO-TUDaReport.tex2
-rw-r--r--macros/latex/contrib/tuda-ci/example/DEMO-TUDaSciPoster.tex2
-rw-r--r--macros/latex/contrib/tuda-ci/example/DEMO-TUDaThesis.tex2
-rw-r--r--macros/latex/contrib/tuda-ci/tex/beamercolorthemeTUDa.sty6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/beamerfontthemeTUDa.sty6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/beamerinnerthemeTUDa.sty22
-rw-r--r--macros/latex/contrib/tuda-ci/tex/beamerouterthemeTUDa.sty6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa-mecheng.sty6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa.sty6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tuda-a0paper.clo6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tuda-a1paper.clo6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tuda-a2paper.clo6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tuda-a3paper.clo6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tuda-a4paper.clo6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tuda-a5paper.clo6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tuda-pgfplots.sty6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudabeamer.cls6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudacolors.def6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudacolors.sty6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudaexercise.cls6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudafonts.sty6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudaleaflet.cls6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudaletter.cls6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudalettersize10pt.clo2
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudamecheng.cfg6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudaposter.cls6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudapub.cls6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudarules.sty6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudasciposter.cls6
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudasize9pt.clo2
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudathesis.cfg6
-rw-r--r--macros/latex/contrib/zref-check/CHANGELOG.md8
-rw-r--r--macros/latex/contrib/zref-check/DEPENDS.txt3
-rw-r--r--macros/latex/contrib/zref-check/README.md17
-rw-r--r--macros/latex/contrib/zref-check/zref-check-code.pdfbin0 -> 702150 bytes
-rw-r--r--macros/latex/contrib/zref-check/zref-check-code.tex87
-rw-r--r--macros/latex/contrib/zref-check/zref-check.dtx2218
-rw-r--r--macros/latex/contrib/zref-check/zref-check.ins98
-rw-r--r--macros/latex/contrib/zref-check/zref-check.pdfbin0 -> 454988 bytes
-rw-r--r--macros/latex/contrib/zref-check/zref-check.tex89
-rw-r--r--macros/unicodetex/latex/nwafuthesis/README.md33
-rwxr-xr-xmacros/unicodetex/latex/nwafuthesis/build-win.bat7
-rwxr-xr-xmacros/unicodetex/latex/nwafuthesis/build.sh9
-rw-r--r--macros/unicodetex/latex/nwafuthesis/logo/building.jpgbin0 -> 218987 bytes
-rw-r--r--macros/unicodetex/latex/nwafuthesis/logo/motto.pngbin0 -> 23297 bytes
-rw-r--r--macros/unicodetex/latex/nwafuthesis/logo/nwafu-bar.pdfbin0 -> 694569 bytes
-rw-r--r--macros/unicodetex/latex/nwafuthesis/logo/nwafu-circle.pdfbin0 -> 656165 bytes
-rw-r--r--macros/unicodetex/latex/nwafuthesis/nwafuthesis-doc.dtx2115
-rw-r--r--macros/unicodetex/latex/nwafuthesis/nwafuthesis.dtx7911
-rw-r--r--macros/unicodetex/latex/nwafuthesis/nwafuthesis.pdfbin0 -> 1748925 bytes
72 files changed, 12699 insertions, 102 deletions
diff --git a/macros/latex/contrib/tuda-ci/README.md b/macros/latex/contrib/tuda-ci/README.md
index 631c7491b8..10140fd4a4 100644
--- a/macros/latex/contrib/tuda-ci/README.md
+++ b/macros/latex/contrib/tuda-ci/README.md
@@ -2,7 +2,7 @@
Copyright (C) Marei Peischl <marei@peitex.de>, 2018–2021
- tuda-ci 2021/07/27 v3.17
+ tuda-ci 2021/08/05 v3.18
***************************************************************************
@@ -290,3 +290,5 @@ leaflets | DEMO-TUDaLeaflet.tex | tudaleaflet.cls
* v3.17 (2021-07-27)
- add a temporary workaround to avoid incompatibilities with pdfa=true
- fix footer positions
+ * 3.18 (2021-08-05)
+ - fix bug in tudabeamer block spacing
diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaAnnouncement.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaAnnouncement.pdf
index 5aada3df12..5d0deadc62 100644
--- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaAnnouncement.pdf
+++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaAnnouncement.pdf
Binary files differ
diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaBeamer.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaBeamer.pdf
index 2efb1e9f1a..00b7d43e1d 100644
--- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaBeamer.pdf
+++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaBeamer.pdf
Binary files differ
diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaExercise.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaExercise.pdf
index e5ce3ba59b..e85a62bca9 100644
--- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaExercise.pdf
+++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaExercise.pdf
Binary files differ
diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLeaflet.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLeaflet.pdf
index e2c1d6a80e..19f85fc9f5 100644
--- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLeaflet.pdf
+++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLeaflet.pdf
Binary files differ
diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLetter.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLetter.pdf
index 85107673fc..021063b57e 100644
--- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLetter.pdf
+++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaLetter.pdf
Binary files differ
diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPhD.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPhD.pdf
index eb3d355584..fd48e295c1 100644
--- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPhD.pdf
+++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPhD.pdf
Binary files differ
diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPoster.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPoster.pdf
index 9cd8db8400..68f9634a36 100644
--- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPoster.pdf
+++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPoster.pdf
Binary files differ
diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPub.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPub.pdf
index 6a8c5d7888..204a115c0a 100644
--- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPub.pdf
+++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaPub.pdf
Binary files differ
diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaReport.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaReport.pdf
index 31ee12f74a..6c24baec8f 100644
--- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaReport.pdf
+++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaReport.pdf
Binary files differ
diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaSciPoster.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaSciPoster.pdf
index 88985c9e93..62c57c3495 100644
--- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaSciPoster.pdf
+++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaSciPoster.pdf
Binary files differ
diff --git a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaThesis.pdf b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaThesis.pdf
index 647ccf29a8..2f528ee4d3 100644
--- a/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaThesis.pdf
+++ b/macros/latex/contrib/tuda-ci/doc/DEMO-TUDaThesis.pdf
Binary files differ
diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaAnnouncement.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaAnnouncement.tex
index 66e5621b86..2046654d13 100644
--- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaAnnouncement.tex
+++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaAnnouncement.tex
@@ -1,4 +1,4 @@
-%% This is file `DEMO-TUDaAnnouncement.tex' version 3.17 (2021/07/27),
+%% This is file `DEMO-TUDaAnnouncement.tex' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBeamer.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBeamer.tex
index fab5602804..8e5848548d 100644
--- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBeamer.tex
+++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBeamer.tex
@@ -1,4 +1,4 @@
-%% This is file `DEMO-TUDaBeamer.tex' version 3.17 (2021/07/27),
+%% This is file `DEMO-TUDaBeamer.tex' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBibliography.bib b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBibliography.bib
index a51aafb903..f6ad2d26dd 100644
--- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBibliography.bib
+++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaBibliography.bib
@@ -1,4 +1,4 @@
-%% This is file `DEMO-TUDaBibliography.bib' version 3.17 (2021/07/27),
+%% This is file `DEMO-TUDaBibliography.bib' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaExercise.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaExercise.tex
index 691a39439b..dafab39fcb 100644
--- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaExercise.tex
+++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaExercise.tex
@@ -1,4 +1,4 @@
-%% This is file `DEMO-TUDaExercise.tex' version 3.17 (2021/07/27),
+%% This is file `DEMO-TUDaExercise.tex' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaFromaddress.lco b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaFromaddress.lco
index 0782b80cdb..9cdcae8d03 100644
--- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaFromaddress.lco
+++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaFromaddress.lco
@@ -1,4 +1,4 @@
-%% This is file `DEMO-TUDaFromaddress.lco' version 3.17 (2021/07/27),
+%% This is file `DEMO-TUDaFromaddress.lco' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLeaflet.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLeaflet.tex
index 9e8431b8dc..4e521f545e 100644
--- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLeaflet.tex
+++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLeaflet.tex
@@ -1,4 +1,4 @@
-%% This is file `DEMO-TUDaLeaflet.tex' version 3.17 (2021/07/27),
+%% This is file `DEMO-TUDaLeaflet.tex' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLetter.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLetter.tex
index be0f909e10..937060188e 100644
--- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLetter.tex
+++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaLetter.tex
@@ -1,4 +1,4 @@
-%% This is file `DEMO-TUDaLetter.tex' version 3.17 (2021/07/27),
+%% This is file `DEMO-TUDaLetter.tex' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPhD.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPhD.tex
index 3b183e6648..d01bf5a53c 100644
--- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPhD.tex
+++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPhD.tex
@@ -1,4 +1,4 @@
-%% This is file `DEMO-TUDaPhD.tex' version 3.17 (2021/07/27),
+%% This is file `DEMO-TUDaPhD.tex' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPoster.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPoster.tex
index 15548379d0..daaf4a7321 100644
--- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPoster.tex
+++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPoster.tex
@@ -1,4 +1,4 @@
-%% This is file `DEMO-TUDaPoster.tex' version 3.17 (2021/07/27),
+%% This is file `DEMO-TUDaPoster.tex' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPub.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPub.tex
index f033f1a299..80e7573569 100644
--- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPub.tex
+++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaPub.tex
@@ -1,4 +1,4 @@
-%% This is file `DEMO-TUDaPub.tex' version 3.17 (2021/07/27),
+%% This is file `DEMO-TUDaPub.tex' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaReport.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaReport.tex
index 6bedcd2d91..c3bc98b3f7 100644
--- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaReport.tex
+++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaReport.tex
@@ -1,4 +1,4 @@
-%% This is file `DEMO-TUDaReport.tex' version 3.17 (2021/07/27),
+%% This is file `DEMO-TUDaReport.tex' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaSciPoster.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaSciPoster.tex
index 31e943bdce..30714b6230 100644
--- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaSciPoster.tex
+++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaSciPoster.tex
@@ -1,4 +1,4 @@
-%% This is file `DEMO-TUDaSciPoster.tex' version 3.17 (2021/07/27),
+%% This is file `DEMO-TUDaSciPoster.tex' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaThesis.tex b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaThesis.tex
index 4ff6c0f488..037fd3cb94 100644
--- a/macros/latex/contrib/tuda-ci/example/DEMO-TUDaThesis.tex
+++ b/macros/latex/contrib/tuda-ci/example/DEMO-TUDaThesis.tex
@@ -1,4 +1,4 @@
-%% This is file `DEMO-TUDaThesis.tex' version 3.17 (2021/07/27),
+%% This is file `DEMO-TUDaThesis.tex' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/tex/beamercolorthemeTUDa.sty b/macros/latex/contrib/tuda-ci/tex/beamercolorthemeTUDa.sty
index 183432028c..ec66be1a0d 100644
--- a/macros/latex/contrib/tuda-ci/tex/beamercolorthemeTUDa.sty
+++ b/macros/latex/contrib/tuda-ci/tex/beamercolorthemeTUDa.sty
@@ -1,4 +1,4 @@
-%% This is file `beamercolorthemeTUDa.sty' version 3.17 (2021/07/27),
+%% This is file `beamercolorthemeTUDa.sty' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamercolorthemeTUDa}
[\filedate\space\fileversion]
diff --git a/macros/latex/contrib/tuda-ci/tex/beamerfontthemeTUDa.sty b/macros/latex/contrib/tuda-ci/tex/beamerfontthemeTUDa.sty
index 1a878be781..4bdee840f5 100644
--- a/macros/latex/contrib/tuda-ci/tex/beamerfontthemeTUDa.sty
+++ b/macros/latex/contrib/tuda-ci/tex/beamerfontthemeTUDa.sty
@@ -1,4 +1,4 @@
-%% This is file `beamerfontthemeTUDa.sty' version 3.17 (2021/07/27),
+%% This is file `beamerfontthemeTUDa.sty' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerfontthemeTUDa}
[\filedate\space\fileversion]
diff --git a/macros/latex/contrib/tuda-ci/tex/beamerinnerthemeTUDa.sty b/macros/latex/contrib/tuda-ci/tex/beamerinnerthemeTUDa.sty
index 33fdafeb10..df1fdf51a0 100644
--- a/macros/latex/contrib/tuda-ci/tex/beamerinnerthemeTUDa.sty
+++ b/macros/latex/contrib/tuda-ci/tex/beamerinnerthemeTUDa.sty
@@ -1,4 +1,4 @@
-%% This is file `beamerinnerthemeTUDa.sty' version 3.17 (2021/07/27),
+%% This is file `beamerinnerthemeTUDa.sty' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\ProvidesExplPackage{beamerinnerthemeTUDa}{\filedate}{\fileversion}{Inner~beamer~theme~of~tuda-ci}
@@ -155,12 +155,12 @@
\defbeamertemplate*{block~begin}{TUDa}
{
\par\vskip\medskipamount%
- \begin{beamercolorbox}[ wd=\dimexpr\linewidth+2\l__ptxcd_beamer_extraindent_dim,sep=.5pt,
+ \begin{beamercolorbox}[wd=\dimexpr\linewidth+2\l__ptxcd_beamer_extraindent_dim,sep=.5pt,
leftskip=\dimexpr\ifdim\l__ptxcd_beamer_extraindent_dim>\z@\l__ptxcd_beamer_extraindent_dim-\beamer@colbox@sep\else\z@\fi]{block~title}
\ifx\insertblocktitle\@empty
\else
- \begin{beamercolorbox}[colsep=.75ex,
- wd=\dimexpr\linewidth-1pt\relax]{block~title}
+ \begin{beamercolorbox}[colsep*=.75ex,
+ wd=\dimexpr\linewidth-1pt-1.5ex\relax]{block~title}
\usebeamerfont*{block title}\insertblocktitle%
\end{beamercolorbox}%
\ifbeamercolorempty[bg]{block~title}
@@ -168,7 +168,7 @@
{\ifbeamercolorempty[bg]{block~body}{}{\par\nointerlineskip\vskip-0.5pt}}%
\leavevmode
\fi
- \begin{beamercolorbox}[colsep=.75ex,vmode, wd=\dimexpr\linewidth-1pt\relax]{block~body}%
+ \begin{beamercolorbox}[colsep*=.75ex,vmode, wd=\dimexpr\linewidth-1.5ex-1pt\relax]{block~body}%
\usebeamerfont{block~body}%
\ifbeamercolorempty[bg]{block~body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
@@ -186,14 +186,14 @@
]{block~frame~alerted}
\ifx\insertblocktitle\@empty
\else
- \begin{beamercolorbox}[wd={\dimexpr\linewidth-3pt},colsep=.75ex]{block~title~alerted}
+ \begin{beamercolorbox}[wd=\dim_eval:n {\linewidth-1.5ex-3pt},colsep*=.75ex]{block~title~alerted}
\usebeamerfont*{block~title~alerted}\insertblocktitle%
\end{beamercolorbox}%
\vskip1.5pt\par\nointerlineskip
\fi
\leavevmode
\usebeamerfont{block~body~alerted}%
- \begin{beamercolorbox}[wd={\dimexpr\linewidth-3pt},colsep=.75ex]{block~body~alerted}%
+ \begin{beamercolorbox}[wd=\dim_eval:n {\linewidth-1.5ex-3pt},colsep*=.75ex]{block~body~alerted}%
}
\defbeamertemplate*{block~alerted~end}{TUDa}
@@ -210,14 +210,14 @@
]{block~frame~example}
\ifx\insertblocktitle\@empty
\else
- \begin{beamercolorbox}[wd={\dimexpr\linewidth-3pt},colsep=.75ex]{block~title~example}
+ \begin{beamercolorbox}[wd=\dim_eval:n {\linewidth-1.5ex-3pt},colsep*=.75ex]{block~title~example}
\usebeamerfont*{block~title~example}\insertblocktitle%
\end{beamercolorbox}%
\vskip1.5pt\par\nointerlineskip
\fi
\leavevmode
\usebeamerfont{block~body~example}%
- \begin{beamercolorbox}[wd={\dimexpr\linewidth-3pt},colsep=.75ex]{block~body~example}%
+ \begin{beamercolorbox}[wd=\dim_eval:n {\linewidth-1.5ex-3pt},colsep*=.75ex]{block~body~example}%
}
\defbeamertemplate*{block~example~end}{TUDa}
{\end{beamercolorbox}\end{beamercolorbox}\vskip\smallskipamount}
diff --git a/macros/latex/contrib/tuda-ci/tex/beamerouterthemeTUDa.sty b/macros/latex/contrib/tuda-ci/tex/beamerouterthemeTUDa.sty
index 8a47784218..d3dd8f7dfa 100644
--- a/macros/latex/contrib/tuda-ci/tex/beamerouterthemeTUDa.sty
+++ b/macros/latex/contrib/tuda-ci/tex/beamerouterthemeTUDa.sty
@@ -1,4 +1,4 @@
-%% This is file `beamerouterthemeTUDa.sty' version 3.17 (2021/07/27),
+%% This is file `beamerouterthemeTUDa.sty' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\ProvidesExplPackage{beamerouterthemeTUDa}{\filedate}{\fileversion}{Outer~beamer~theme~of~tuda-ci}
diff --git a/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa-mecheng.sty b/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa-mecheng.sty
index df1213c129..f81d7b635e 100644
--- a/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa-mecheng.sty
+++ b/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa-mecheng.sty
@@ -1,4 +1,4 @@
-%% This is file `beamerthemeTUDa-mecheng.sty' version 3.17 (2021/07/27),
+%% This is file `beamerthemeTUDa-mecheng.sty' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\RequirePackage{expl3}
\ProvidesExplPackage{beamerthemeTUDa-mecheng}{\filedate}{\fileversion}{specific tudabeamer configuration for the department of mechanical engineering}
diff --git a/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa.sty b/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa.sty
index 05f9224247..ee94494ab9 100644
--- a/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa.sty
+++ b/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa.sty
@@ -1,4 +1,4 @@
-%% This is file `beamerthemeTUDa.sty' version 3.17 (2021/07/27),
+%% This is file `beamerthemeTUDa.sty' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerthemeTUDa}
[\filedate\space\fileversion\space beamer theme using the Corporate Design of TU Darmstadt]
diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-a0paper.clo b/macros/latex/contrib/tuda-ci/tex/tuda-a0paper.clo
index ae48251500..9777fe8ece 100644
--- a/macros/latex/contrib/tuda-ci/tex/tuda-a0paper.clo
+++ b/macros/latex/contrib/tuda-ci/tex/tuda-a0paper.clo
@@ -1,4 +1,4 @@
-%% This is file `tuda-a0paper.clo' version 3.17 (2021/07/27),
+%% This is file `tuda-a0paper.clo' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\ProvidesExplFile{tuda-a0paper.clo}{\filedate}{\fileversion}{tuda-ci~size~adjustments~for~a0paper}
\cs_set:Nn \ptxcd_setup_title_sizes: {
\cs_set:Nn \ptxcd_title_fontsize: {{125pt}{165pt}}
diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-a1paper.clo b/macros/latex/contrib/tuda-ci/tex/tuda-a1paper.clo
index 49b00b162d..1219a20dee 100644
--- a/macros/latex/contrib/tuda-ci/tex/tuda-a1paper.clo
+++ b/macros/latex/contrib/tuda-ci/tex/tuda-a1paper.clo
@@ -1,4 +1,4 @@
-%% This is file `tuda-a1paper.clo' version 3.17 (2021/07/27),
+%% This is file `tuda-a1paper.clo' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\ProvidesExplFile{tuda-a1paper.clo}{\filedate}{\fileversion}{tuda-ci~size~adjustments~for~a0paper}
\cs_set:Nn \ptxcd_setup_title_sizes: {
\cs_set:Nn \ptxcd_title_fontsize: {{86pt}{120pt}}
diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-a2paper.clo b/macros/latex/contrib/tuda-ci/tex/tuda-a2paper.clo
index 2b06d23e7c..01b2e4313a 100644
--- a/macros/latex/contrib/tuda-ci/tex/tuda-a2paper.clo
+++ b/macros/latex/contrib/tuda-ci/tex/tuda-a2paper.clo
@@ -1,4 +1,4 @@
-%% This is file `tuda-a2paper.clo' version 3.17 (2021/07/27),
+%% This is file `tuda-a2paper.clo' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\ProvidesExplFile{tuda-a2paper.clo}{\filedate}{\fileversion}{tuda-ci~size~adjustments~for~a0paper}
\cs_set:Nn \ptxcd_setup_title_sizes: {
\cs_set:Nn \ptxcd_title_fontsize: {{65pt}{82pt}}
diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-a3paper.clo b/macros/latex/contrib/tuda-ci/tex/tuda-a3paper.clo
index f86015b357..bbf9343411 100644
--- a/macros/latex/contrib/tuda-ci/tex/tuda-a3paper.clo
+++ b/macros/latex/contrib/tuda-ci/tex/tuda-a3paper.clo
@@ -1,4 +1,4 @@
-%% This is file `tuda-a3paper.clo' version 3.17 (2021/07/27),
+%% This is file `tuda-a3paper.clo' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\ProvidesExplFile{tuda-a3paper.clo}{\filedate}{\fileversion}{tuda-ci~size~adjustments~for~a3paper}
\cs_set:Nn \ptxcd_setup_title_sizes: {
\cs_set:Nn \ptxcd_title_fontsize: {{47pt}{61pt}}
diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-a4paper.clo b/macros/latex/contrib/tuda-ci/tex/tuda-a4paper.clo
index ab8a1a0ba2..4144fe1248 100644
--- a/macros/latex/contrib/tuda-ci/tex/tuda-a4paper.clo
+++ b/macros/latex/contrib/tuda-ci/tex/tuda-a4paper.clo
@@ -1,4 +1,4 @@
-%% This is file `tuda-a4paper.clo' version 3.17 (2021/07/27),
+%% This is file `tuda-a4paper.clo' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\ProvidesExplFile{tuda-a4paper.clo}{\filedate}{\fileversion}{tuda-ci~size~adjustments~for~a4paper}
\cs_set:Nn \ptxcd_setup_title_sizes: {
\cs_set:Nn \ptxcd_title_fontsize: {{36pt}{47pt}}
diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-a5paper.clo b/macros/latex/contrib/tuda-ci/tex/tuda-a5paper.clo
index 158f2d5f12..fb6aff01b1 100644
--- a/macros/latex/contrib/tuda-ci/tex/tuda-a5paper.clo
+++ b/macros/latex/contrib/tuda-ci/tex/tuda-a5paper.clo
@@ -1,4 +1,4 @@
-%% This is file `tuda-a5paper.clo' version 3.17 (2021/07/27),
+%% This is file `tuda-a5paper.clo' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\ProvidesExplFile{tuda-a5paper.clo}{\filedate}{\fileversion}{tuda-ci~size~adjustments~for~a5paper}
\cs_set:Nn \ptxcd_setup_title_sizes: {
\cs_set:Nn \ptxcd_title_fontsize: {{22pt}{28pt}}
diff --git a/macros/latex/contrib/tuda-ci/tex/tuda-pgfplots.sty b/macros/latex/contrib/tuda-ci/tex/tuda-pgfplots.sty
index a6e355f82a..36e8eae372 100644
--- a/macros/latex/contrib/tuda-ci/tex/tuda-pgfplots.sty
+++ b/macros/latex/contrib/tuda-ci/tex/tuda-pgfplots.sty
@@ -1,4 +1,4 @@
-%% This is file `tuda-pgfplots.sty' version 3.17 (2021/07/27),
+%% This is file `tuda-pgfplots.sty' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
% Special thanks to: Sebastian Schöps Institut Theorie Elektromagnetischer Felder (TEMF), TU Darmstadt
% The original version of this file has been inspired by the colorscheme in the Metropolis beamer theme by Matthias Vogelgesang https://github.com/matze/mtheme
\ProvidesPackage{tuda-pgfplots}[\filedate\space\fileversion\space tuda-ci pgfplots color schemes]
diff --git a/macros/latex/contrib/tuda-ci/tex/tudabeamer.cls b/macros/latex/contrib/tuda-ci/tex/tudabeamer.cls
index a6e20362da..16c26fe74c 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudabeamer.cls
+++ b/macros/latex/contrib/tuda-ci/tex/tudabeamer.cls
@@ -1,4 +1,4 @@
-%% This is file `tudabeamer.cls' version 3.17 (2021/07/27),
+%% This is file `tudabeamer.cls' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{tudabeamer}
[\filedate\space\fileversion\space]
diff --git a/macros/latex/contrib/tuda-ci/tex/tudacolors.def b/macros/latex/contrib/tuda-ci/tex/tudacolors.def
index 19524dc019..2eeec39494 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudacolors.def
+++ b/macros/latex/contrib/tuda-ci/tex/tudacolors.def
@@ -1,4 +1,4 @@
-%% This is file `tudacolors.def' version 3.17 (2021/07/27),
+%% This is file `tudacolors.def' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\ProvidesFile{tudacolors.def}
[\filedate\space\fileversion\space Color definitions for tuda-ci]
diff --git a/macros/latex/contrib/tuda-ci/tex/tudacolors.sty b/macros/latex/contrib/tuda-ci/tex/tudacolors.sty
index 5731daec2a..8aadb1ab3a 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudacolors.sty
+++ b/macros/latex/contrib/tuda-ci/tex/tudacolors.sty
@@ -1,4 +1,4 @@
-%% This is file `tudacolors.sty' version 3.17 (2021/07/27),
+%% This is file `tudacolors.sty' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplPackage{tudacolors}{\filedate}{\fileversion}{Color definition for TU Darmstadt's tuda-ci bundle}
diff --git a/macros/latex/contrib/tuda-ci/tex/tudaexercise.cls b/macros/latex/contrib/tuda-ci/tex/tudaexercise.cls
index 55a7a333c1..e887152c06 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudaexercise.cls
+++ b/macros/latex/contrib/tuda-ci/tex/tudaexercise.cls
@@ -1,4 +1,4 @@
-%% This is file `tudaexercise.cls' version 3.17 (2021/07/27),
+%% This is file `tudaexercise.cls' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplClass{tudaexercise}
diff --git a/macros/latex/contrib/tuda-ci/tex/tudafonts.sty b/macros/latex/contrib/tuda-ci/tex/tudafonts.sty
index ebe208c13a..a055ca3370 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudafonts.sty
+++ b/macros/latex/contrib/tuda-ci/tex/tudafonts.sty
@@ -1,4 +1,4 @@
-%% This is file `tudafonts.sty' version 3.17 (2021/07/27),
+%% This is file `tudafonts.sty' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tudafonts}
[\filedate\space\fileversion\space
diff --git a/macros/latex/contrib/tuda-ci/tex/tudaleaflet.cls b/macros/latex/contrib/tuda-ci/tex/tudaleaflet.cls
index b08262a492..217a088964 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudaleaflet.cls
+++ b/macros/latex/contrib/tuda-ci/tex/tudaleaflet.cls
@@ -1,4 +1,4 @@
-%% This is file `tudaleaflet.cls' version 3.17 (2021/07/27),
+%% This is file `tudaleaflet.cls' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplPackage{tudaleaflet}{\filedate}{\fileversion}{Leaflets using the Corporate Design of TU Darmstadt}
diff --git a/macros/latex/contrib/tuda-ci/tex/tudaletter.cls b/macros/latex/contrib/tuda-ci/tex/tudaletter.cls
index 00678b431d..3d7ea1bd5f 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudaletter.cls
+++ b/macros/latex/contrib/tuda-ci/tex/tudaletter.cls
@@ -1,4 +1,4 @@
-%% This is file `tudaletter.cls' version 3.17 (2021/07/27),
+%% This is file `tudaletter.cls' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplClass{tudaletter}
diff --git a/macros/latex/contrib/tuda-ci/tex/tudalettersize10pt.clo b/macros/latex/contrib/tuda-ci/tex/tudalettersize10pt.clo
index 185982a4e4..fe267121d8 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudalettersize10pt.clo
+++ b/macros/latex/contrib/tuda-ci/tex/tudalettersize10pt.clo
@@ -1,4 +1,4 @@
-%% This is file `tudalettersize10pt.clo' version 3.17 (2021/07/27),
+%% This is file `tudalettersize10pt.clo' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/tex/tudamecheng.cfg b/macros/latex/contrib/tuda-ci/tex/tudamecheng.cfg
index dc9ebde2b6..32428131d4 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudamecheng.cfg
+++ b/macros/latex/contrib/tuda-ci/tex/tudamecheng.cfg
@@ -1,4 +1,4 @@
-%% This is file `tudamecheng.cfg' version 3.17 (2021/07/27),
+%% This is file `tudamecheng.cfg' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\RequirePackage{expl3}
\ProvidesExplFile{tudamecheng.cfg}
{\filedate}{\fileversion}{Special Features the department of mechanical engineering of Darmstadt's Corporate Design (tuda-ci)}
diff --git a/macros/latex/contrib/tuda-ci/tex/tudaposter.cls b/macros/latex/contrib/tuda-ci/tex/tudaposter.cls
index bba27ec195..467d272de4 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudaposter.cls
+++ b/macros/latex/contrib/tuda-ci/tex/tudaposter.cls
@@ -1,4 +1,4 @@
-%% This is file `tudaposter.cls' version 3.17 (2021/07/27),
+%% This is file `tudaposter.cls' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplPackage{tudaposter}{\filedate}{\fileversion}{Poster Layouts for the Corporate Design of TU Darmstadt}
diff --git a/macros/latex/contrib/tuda-ci/tex/tudapub.cls b/macros/latex/contrib/tuda-ci/tex/tudapub.cls
index f936cc0ba6..407dc03f30 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudapub.cls
+++ b/macros/latex/contrib/tuda-ci/tex/tudapub.cls
@@ -1,4 +1,4 @@
-%% This is file `tudapub.cls' version 3.17 (2021/07/27),
+%% This is file `tudapub.cls' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplClass{tudapub}
diff --git a/macros/latex/contrib/tuda-ci/tex/tudarules.sty b/macros/latex/contrib/tuda-ci/tex/tudarules.sty
index 4b55bd7afd..baa07563ac 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudarules.sty
+++ b/macros/latex/contrib/tuda-ci/tex/tudarules.sty
@@ -1,4 +1,4 @@
-%% This is file `tudarules.sty' version 3.17 (2021/07/27),
+%% This is file `tudarules.sty' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplPackage{tudarules}{\filedate}{\fileversion}{Creation of colored bars for tuda-ci bundle}
diff --git a/macros/latex/contrib/tuda-ci/tex/tudasciposter.cls b/macros/latex/contrib/tuda-ci/tex/tudasciposter.cls
index 589f3ead4a..aaa275001e 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudasciposter.cls
+++ b/macros/latex/contrib/tuda-ci/tex/tudasciposter.cls
@@ -1,4 +1,4 @@
-%% This is file `tudasciposter.cls' version 3.17 (2021/07/27),
+%% This is file `tudasciposter.cls' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplPackage{tudasciposter}{\filedate}{\fileversion}{Scientific Poster Layout for TU Darmstadt}
diff --git a/macros/latex/contrib/tuda-ci/tex/tudasize9pt.clo b/macros/latex/contrib/tuda-ci/tex/tudasize9pt.clo
index 61e6c1bb61..ef55e0f993 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudasize9pt.clo
+++ b/macros/latex/contrib/tuda-ci/tex/tudasize9pt.clo
@@ -1,4 +1,4 @@
-%% This is file `tudasize9pt.clo' version 3.17 (2021/07/27),
+%% This is file `tudasize9pt.clo' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
diff --git a/macros/latex/contrib/tuda-ci/tex/tudathesis.cfg b/macros/latex/contrib/tuda-ci/tex/tudathesis.cfg
index b0e7d344f4..779d33308e 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudathesis.cfg
+++ b/macros/latex/contrib/tuda-ci/tex/tudathesis.cfg
@@ -1,4 +1,4 @@
-%% This is file `tudathesis.cfg' version 3.17 (2021/07/27),
+%% This is file `tudathesis.cfg' version 3.18 (2021/08/05),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,8 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{3.17}
-\def\filedate{2021/07/27}
+\def\fileversion{3.18}
+\def\filedate{2021/08/05}
\RequirePackage{expl3}
\ProvidesExplFile{tudathesis.cfg}
{\filedate}{\fileversion}{Special Features for publication type 'thesis' using TU Darmstadt's Corporate Design (tuda-ci)}
diff --git a/macros/latex/contrib/zref-check/CHANGELOG.md b/macros/latex/contrib/zref-check/CHANGELOG.md
new file mode 100644
index 0000000000..debf07cafc
--- /dev/null
+++ b/macros/latex/contrib/zref-check/CHANGELOG.md
@@ -0,0 +1,8 @@
+# Changelog
+
+## [Unreleased](https://github.com/gusbrs/zref-check/compare/v0.1.0...HEAD)
+
+## [v0.1.0](https://github.com/gusbrs/zref-check/releases/tag/v0.1.0) (2021-08-04)
+
+### Added
+- Initial release.
diff --git a/macros/latex/contrib/zref-check/DEPENDS.txt b/macros/latex/contrib/zref-check/DEPENDS.txt
new file mode 100644
index 0000000000..bd9b1e21c4
--- /dev/null
+++ b/macros/latex/contrib/zref-check/DEPENDS.txt
@@ -0,0 +1,3 @@
+hard zref
+hard oberdiek
+soft hyperref
diff --git a/macros/latex/contrib/zref-check/README.md b/macros/latex/contrib/zref-check/README.md
new file mode 100644
index 0000000000..c5726af278
--- /dev/null
+++ b/macros/latex/contrib/zref-check/README.md
@@ -0,0 +1,17 @@
+# zref-check
+
+**Flexible LaTeX cross-references with contextual checks based on zref**
+
+`zref-check` provides an user interface for making LaTeX cross-references
+flexibly, while allowing to have them checked for consistency with the
+document structure as typeset. Statements such as “above”, “on the next
+page”, “previously”, “as will be discussed”, “on the previous chapter” and so
+on can be given to `\zcheck` in free-form, and a set of “checks” can be
+specified to be run against a given `label`, which will result in a warning at
+compilation time if any of these checks fail. `\zctarget` and the `zcregion`
+environment are also defined as a means to easily set label targets to
+arbitrary places in the text which can be referred to by `\zcheck`.
+
+The released version of this package is available from CTAN.
+
+For more details, check the Documentation.
diff --git a/macros/latex/contrib/zref-check/zref-check-code.pdf b/macros/latex/contrib/zref-check/zref-check-code.pdf
new file mode 100644
index 0000000000..52682fbc5e
--- /dev/null
+++ b/macros/latex/contrib/zref-check/zref-check-code.pdf
Binary files differ
diff --git a/macros/latex/contrib/zref-check/zref-check-code.tex b/macros/latex/contrib/zref-check/zref-check-code.tex
new file mode 100644
index 0000000000..d9ee1c58d0
--- /dev/null
+++ b/macros/latex/contrib/zref-check/zref-check-code.tex
@@ -0,0 +1,87 @@
+% \iffalse meta-comment
+%
+% File: zref-check-code.tex
+%
+% This file is part of the LaTeX package "zref-check".
+%
+% Copyright (C) 2021 Gustavo Barros
+%
+% It 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:
+%
+% https://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+%
+% This work is "maintained" (as per LPPL maintenance status) by
+% Gustavo Barros.
+%
+% This work consists of the files zref-check.dtx,
+% zref-check.ins,
+% zref-check.tex,
+% zref-check-code.tex,
+% and the derived files zref-check.sty and
+% zref-check.pdf,
+% zref-check-code.pdf.
+%
+% The released version of this package is available from CTAN.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the package can be found at
+%
+% https://github.com/gusbrs/zref-check
+%
+% for those people who are interested.
+%
+% -----------------------------------------------------------------------
+%
+% \fi
+
+\documentclass{l3doc}
+
+% Have \GetFileInfo pick up date and version data
+\usepackage{zref-check}
+
+\NewDocumentCommand\opt{m}{\texttt{#1}}
+
+% Have the Index at 'section' level rather than 'part'. Otherwise it is just
+% the same definition from 'l3doc.cls'.
+\IndexPrologue{%
+ \section*{Index}
+ \markboth{Index}{Index}
+ \addcontentsline{toc}{section}{Index}
+ The italic numbers denote the pages where the corresponding entry is
+ described, numbers underlined point to the definition, all others indicate
+ the places where it is used.%
+}
+
+\begin{document}
+
+\GetFileInfo{zref-check.sty}
+
+\title{%
+ The \pkg{zref-check} package implementation%
+ \thanks{This file describes \fileversion, last revised \filedate.}%
+}
+
+\author{%
+ Gustavo Barros%
+ \thanks{\url{https://github.com/gusbrs/zref-check}}%
+}
+
+\date{\filedate}
+
+\maketitle
+
+\tableofcontents
+
+\DisableDocumentation
+
+\DocInput{zref-check.dtx}
+
+\end{document}
diff --git a/macros/latex/contrib/zref-check/zref-check.dtx b/macros/latex/contrib/zref-check/zref-check.dtx
new file mode 100644
index 0000000000..3ef8af66d8
--- /dev/null
+++ b/macros/latex/contrib/zref-check/zref-check.dtx
@@ -0,0 +1,2218 @@
+% \iffalse meta-comment
+%
+% File: zref-check.dtx
+%
+% This file is part of the LaTeX package "zref-check".
+%
+% Copyright (C) 2021 Gustavo Barros
+%
+% It 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:
+%
+% https://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+%
+% This work is "maintained" (as per LPPL maintenance status) by
+% Gustavo Barros.
+%
+% This work consists of the files zref-check.dtx,
+% zref-check.ins,
+% zref-check.tex,
+% zref-check-code.tex,
+% and the derived files zref-check.sty and
+% zref-check.pdf,
+% zref-check-code.pdf.
+%
+% The released version of this package is available from CTAN.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the package can be found at
+%
+% https://github.com/gusbrs/zref-check
+%
+% for those people who are interested.
+%
+% -----------------------------------------------------------------------
+%
+% \fi
+%
+% \iffalse
+%<*driver>
+\documentclass{l3doc}
+% Have \GetFileInfo pick up date and version data
+\usepackage{zref-check}
+\NewDocumentCommand\opt{m}{\texttt{#1}}
+\MakeShortVerb{\|}
+\begin{document}
+ \DocInput{zref-check.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+%
+% \begin{documentation}
+%
+% \section{Introduction}
+%
+% The \pkg{zref-check} package provides an user interface for making \LaTeX{}
+% cross-references exploiting document contextual information to enrich the
+% way the reference can be rendered, but at the same time ensuring the means
+% that these cross-references can be done consistently with the document
+% structure.
+%
+% The usual \LaTeX{} cross-reference is done by referring to a \texttt{label},
+% associated with one or another document structural element, and this
+% reference will typeset for you some content based on the information which
+% is stored in that label. \cs{zcheck}, the main user command of
+% \pkg{zref-check}, has a somewhat different concept. Instead of trying to
+% provide the text to be typeset based on the contextual information,
+% \cs{zcheck} lets the user supply an arbitrary text and specify one or more
+% checks to be done on the label(s) being referred to. If any of the checks
+% fail, a warning is issued upon compilation, so that the user can go back to
+% that cross-reference and correct it as needed, without having to rely on
+% burdensome and error prone manual proof-reading.
+%
+% This grants a much increased flexibility for the cross-reference text, which
+% means in practice that the writing style, the variety of expressions you may
+% use for similar situations, does not need to be sacrificed for the
+% convenience. \cs{zcheck}'s cross-references do not need to ``feel''
+% automated to be consistently checked. Localization is also not an issue,
+% since the cross-reference text is provided directly by the user. Separating
+% ``typesetting'' from ``checking'' also means there is a lot of document
+% context we can leverage for this purpose (see Section~\ref{sec:checks}).
+%
+% A standard \LaTeX{} cross-reference is made to refer to specific numbered
+% document elements -- chapters, sections, figures, tables, equations, etc.
+% The cross-reference will normally produce that number (which is the
+% element's ``id'') and, eventually, its ``type'' (the counter). We may also
+% refer to the page that element occurs and even its ``title'' (in which case,
+% atypically, we may even get to refer to an unnumbered section, provided we
+% also implicitly supply by some means the ``id'').
+%
+% For references to these usual specific document elements, \pkg{zref-check}
+% caters for a particular kind of cross-reference which is common:
+% \emph{relational} statements based on them. \cs{zcheck} can typeset and
+% meaningfully check cross-references such as ``above'', ``on the next page'',
+% ``on the facing page'', ``on the previous section'', ``later on this
+% chapter'' and so on. After all, if your reference is being made on page 2
+% and refers to something on the same page, ``on this page'' reads much better
+% than ``on page~2''. If you are writing chapter~4, ``on the previous
+% chapter'' sounds nicer than ``on chapter~3''.
+%
+% However, there is yet another kind of ``looser'' cross-reference we
+% routinely do in our documents. Expressions such as ``previously'', ``as
+% mentioned before'', ``as will be discussed'', and so on, are a powerful
+% discursive instrument, which enriches the text, by offering hints to the
+% arguments' threads, without necessarily pressing them too hard onto the
+% reader. So, we might not want to say ``on footnote 57, pag.~34'', but
+% prefer ``previously'', not ``on Section 3.4'', but rather ``below'', or
+% ``later on''. Besides, we also may refer to certain passages in the text in
+% this way, rather than to numbered document elements. And this kind of
+% reference is not only hard to check and find, but also to fix. After all,
+% if you are making one such reference, you are taking that statement as a
+% premisse at the current point in the text. So, if that reference is
+% missing, or relocated, you may need to bring in the support to the premisse
+% for your argument to close, rather than just ``adjust the reference text''.
+% \pkg{zref-check} also provides support for this kind of cross-reference,
+% allowing for them to be consistently verified.
+%
+%
+%
+% \section{Loading the package}
+% \label{sec:loading-package}
+%
+% As usual:
+%
+% \begin{syntax}
+% \cs{usepackage}\oarg{options}|{zref-check}|
+% \end{syntax}
+%
+%
+%
+% \section{Dependencies}
+%
+% \pkg{zref} is required, of course, but in particular, its modules
+% \pkg{zref-user} and \pkg{zref-abspage} are loaded by default. \pkg{ifdraft}
+% (from the \pkg{oberdiek} bundle) is also loaded by default. A \LaTeX{}
+% kernel later than 2021-06-01 is required, since we rely on the new hook
+% system from \pkg{ltcmdhooks} for the sectioning checks. If \pkg{hyperref}
+% is loaded and option \pkg{hyperref} is given, \pkg{zref-check} makes use of
+% it, but it does not load the package for you.
+%
+%
+% \section{User interface}
+% \label{sec:user-interface}
+%
+% \begin{function}{\zcheck}
+% \begin{syntax}
+% \cs{zcheck}\oarg{options}\marg{labels}\oarg{checks}\marg{text}
+% \end{syntax}
+% Typesets \marg{text}, as given, while performing the comma separated list
+% of \oarg{checks} on each of the comma separated list of \marg{labels}.
+% When \pkg{hyperref} support is enabled, \marg{text} will be made a
+% hyperlink to \emph{the first} label in \marg{labels}. The starred version
+% of the command does the same as the plain one, just does not form a link.
+% The \oarg{options} are (mostly) the same as those of the package, and can
+% be given to local effect.
+% \end{function}
+%
+% \begin{function}{\zctarget}
+% \begin{syntax}
+% \cs{zctarget}\marg{label}\marg{text}
+% \end{syntax}
+% Typesets \marg{text}, as given, and places a pair of \texttt{zlabel}s, one
+% at the start of \marg{text}, using \marg{label} as label name, another one
+% (internal) at the end of \marg{text}.
+% \end{function}
+%
+%
+% \begin{function}{zcregion}
+% \begin{syntax}
+% |\begin{zcregion}|\marg{label}
+% | ...|
+% |\end{zcregion}|
+% \end{syntax}
+% An environment that does the same as \cs{zctarget}, for cases of longer
+% stretches of text.
+% \end{function}
+%
+%
+% \begin{function}{\zrefchecksetup}
+% \begin{syntax}
+% \cs{zrefchecksetup}\marg{options}
+% \end{syntax}
+% Sets \pkg{zref-check}'s options (see Section~\ref{sec:options}).
+% \end{function}
+%
+%
+% \section{Checks}
+% \label{sec:checks}
+%
+% \pkg{zref-check} provides several ``checks'' to be used with \cs{zcheck}.
+% The checks may be combined in a \cs{zcheck} call, e.g.\ \opt{[close,
+% after]}, or \opt{[thischap, before]}. In this case, each check in
+% \oarg{checks} is performed against each of the \marg{labels}. This is done
+% independently for each check, which means, in practice, that the checks bear
+% a logical \texttt{AND} relation to the others. Whether the combination is
+% meaningful, is up to the user. As is the correspondence between the
+% \oarg{checks} and the \marg{text>} in \cs{zcheck}.
+%
+% The use of checks which perform ``within the page'' comparisons -- namely
+% \opt{above} and \opt{below} and, through them, \opt{before} and \opt{after}
+% -- comes with some caveats you should be acquainted with.
+% Section~\ref{sec:within-page-checks} discusses their limitations and expands
+% on the expected workflow for their use to ensure reliable results.
+%
+% Note that the naming convention of the checks adopts the perspective of
+% \cs{zcheck}. That is, the name of the check describes the position of the
+% label being referred to, relative to the \cs{zcheck} call being made. For
+% example, the \opt{before} check should issue no message if
+% \cs{ztarget}|{mylabel}{...}| occurs before
+% \cs{zcheck}|{mylabel}[before]{...}|.
+%
+% The available checks are the following:
+%
+% \begin{description}[leftmargin=0pt, itemindent=0pt, align=right,
+% labelsep=1em, font=\MacroFont]
+%
+% \item[thispage] \meta{label} occurs on the same page as \cs{zcheck}.
+%
+% \item[prevpage] \meta{label} occurs on the previous page relative to
+% \cs{zcheck}.
+%
+% \item[nextpage] \meta{label} occurs on the next page relative to
+% \cs{zcheck}.
+%
+% \item[facing] On a \texttt{twoside} document, both \meta{label} and
+% \cs{zcheck} fall onto a double spread, each on one of the two facing
+% pages.
+%
+% \item[above] \meta{label} and \cs{zcheck} are both on the same page, and
+% \meta{label} occurs ``above'' \cs{zcheck}.
+%
+% \item[below] \meta{label} and \cs{zcheck} are both on the same page, and
+% \meta{label} occurs ``below'' \cs{zcheck}.
+%
+% \item[pagesbefore] \meta{label} occurs on any page before the one of
+% \cs{zcheck}.
+%
+% \item[ppbefore] Convenience alias for \opt{pagesbefore}.
+%
+% \item[pagesafter] \meta{label} occurs on any page after the one of
+% \cs{zcheck}.
+%
+% \item[ppafter] Convenience alias for \opt{pagesafter}.
+%
+% \item[before] Either \opt{above} or \opt{pagesbefore}.
+%
+% \item[after] Either \opt{below} or \opt{pagesafter}.
+%
+% \item[thischap] \meta{label} occurs on the same chapter as \cs{zcheck}.
+%
+% \item[prevchap] \meta{label} occurs on the previous chapter relative to the
+% one of \cs{zcheck}.
+%
+% \item[nextchap] \meta{label} occurs on the next chapter relative to the one
+% of \cs{zcheck}.
+%
+% \item[chapsbefore] \meta{label} occurs on any chapter before the one of
+% \cs{zcheck}.
+%
+% \item[chapsafter] \meta{label} occurs on any chapter after the one of
+% \cs{zcheck}.
+%
+% \item[thissec] \meta{label} occurs on the same section as \cs{zcheck}.
+%
+% \item[prevsec] \meta{label} occurs on the previous section (of the same
+% chapter) relative to the one of \cs{zcheck}.
+%
+% \item[nextsec] \meta{label} occurs on the next section (of the same chapter)
+% relative to the one of \cs{zcheck}.
+%
+% \item[secsbefore] \meta{label} occurs on any section (of the same chapter)
+% before the one of \cs{zcheck}.
+%
+% \item[secsafter] \meta{label} occurs on any section (of the same chapter)
+% after the one of \cs{zcheck}.
+%
+% \item[close] \meta{label} occurs within a page range from \opt{closerange}
+% pages before the one of \cs{zcheck} to \opt{closerange} pages after it
+% (about the \opt{closerange} option, see Section~\ref{sec:options}).
+%
+% \item[far] Not \opt{close}.
+%
+% \end{description}
+%
+%
+%
+% \section{Options}
+% \label{sec:options}
+%
+% Options are a standard \texttt{key=value} comma separated list, and can be
+% set globally either as \cs{usepackage}\oarg{options} at load-time (see
+% Section~\ref{sec:loading-package}), or by means of \cs{zrefchecksetup} (see
+% Section~\ref{sec:user-interface}) in the preamble. Most options can also be
+% used with local effects, through the optional argument \oarg{options} of
+% \cs{zcheck}.
+%
+% \DescribeOption{hyperref}
+% Controls the use of \pkg{hyperref} by \pkg{zref-check} and takes values
+% \opt{auto}, \opt{true}, \opt{false}. The default value, \opt{auto}, makes
+% \pkg{zref-check} use \pkg{hyperref} if it is loaded, meaning \cs{zcheck} can
+% be hyperlinked to the \emph{first label} in \marg{labels}. \opt{true} does
+% the same thing, but warns if \pkg{hyperref} is not loaded (\pkg{hyperref} is
+% never loaded for you). In either of these cases, if \pkg{hyperref} is
+% loaded, module \pkg{zref-hyperref} is also loaded by \pkg{zref-check}.
+% \opt{false} means not to use \pkg{hyperref} regardless of its availability.
+% This is a preamble only option, but \cs{zcheck} provides granular control of
+% hyperlinking by means of its starred version.
+%
+%
+% \DescribeOption{msglevel}
+% Sets the level of messages issued by \cs{zcheck} failed checks and takes
+% values \opt{warn}, \opt{info}, \opt{none}, \opt{obeydraft}, \opt{obeyfinal}.
+% The default value, \opt{warn}, issues messages both to the terminal and to
+% the log file, \opt{info} issues messages to the log file only, \opt{none}
+% suppresses all messages. \opt{obeydraft} corresponds to \opt{info} if
+% option \opt{draft} is passed to \cs{documentclass}, and to \opt{warn}
+% otherwise. \opt{obeyfinal} corresponds to \opt{warn} if option \opt{final}
+% is (explicitly) passed to \cs{documentclass} and \opt{info} otherwise.
+% \opt{ignore} is provided as convenience alias for \opt{msglevel=none} for
+% local use only. This option only affects the messages issued by the checks
+% in \cs{zcheck}, not other messages or warnings of the package. In
+% particular, it does not affect warnings issued for undefined labels, which
+% just use \cs{zref@refused} and thus are the same as standard \LaTeX{} ones
+% for this purpose.
+%
+%
+% \DescribeOption{onpage}
+% Allows to control the messaging style for ``within page checks'', and takes
+% values \opt{labelseq}, \opt{msg}, \opt{obeydraft}, \opt{obeyfinal}. The
+% default, \opt{labelseq}, uses the labels' shipout sequence, as retrieved
+% from the \file{.aux} file, to infer relative position within the page.
+% \opt{msg} also uses the same method for checking relative position, but
+% issues a (different) message \emph{even if the check passes}, to provide a
+% simple workflow for robust checking of ``false negatives'', considering the
+% label sequence is not fool proof (for details and workflow recommendations,
+% see Section~\ref{sec:within-page-checks}). \opt{msg} also issues its
+% messages at the same level defined in \opt{msglevel}. \opt{obeydraft}
+% corresponds to \opt{labelseq} if option \opt{draft} is passed to
+% \cs{documentclass} and to \opt{msg} otherwise. \opt{obeyfinal} corresponds
+% to \opt{msg} if option \opt{final} is (explicitly) passed to
+% \cs{documentclass}, and to \opt{labelseq} otherwise.
+%
+%
+% \DescribeOption{closerange}
+% Defines the width of the range of pages, relative to the reference, that are
+% considered ``close'' by the \opt{close} check. Takes a positive integer as
+% value, with default 5.
+%
+%
+% \DescribeOption{labelcmd}
+% Defines the command used to set the user labels in \cs{zctarget} and
+% \texttt{zcregion}. Takes a control sequence \emph{name} as value, and the
+% default sets labels with the minimal required properties, those of the
+% \texttt{zrefcheck} property list. This is a preamble only option. The
+% specified control sequence must receive one mandatory argument (the
+% \marg{label}) and must generate a \texttt{zref label} with at least the
+% properties in the \texttt{zrefcheck} property list. The intended use case
+% is that of the user creating a convenience macro which calls both \cs{label}
+% and \cs{zlabel}, as suggested in Section~\ref{sec:labels}, so that the same
+% labels are accessible either from the standard reference system or from
+% \pkg{zref}. For example:
+%
+% \begin{verbatim}
+% \NewDocumentCommand\mybothlabels{m}{\label{#1}\zlabel{#1}}
+% \zrefchecksetup{labelcmd=mybothlabels}
+% \end{verbatim}
+%
+% Note that the value of the underlying counter used for labels in
+% \cs{zctarget} and \texttt{zcregion} -- what you'd get with a plain \cs{ref}
+% here -- is not really meaningful. But you get to use
+% \cs{pageref}\marg{label}, or \pkg{hyperref}'s
+% \cs{hyperref}\oarg{label}\marg{text} on the labels used in \cs{zctarget} and
+% \texttt{zcregion} with this procedure.
+%
+%
+% \section{Labels}
+% \label{sec:labels}
+%
+% \pkg{zref-check} depends on \pkg{zref}, as the name entails, which means it
+% is able to work with \pkg{zref} labels, in general created by \cs{zlabel},
+% but also with \cs{zctarget} and the \texttt{zcregion} environment provided
+% by this package. This has some advantages, particularly the data
+% flexibility of \pkg{zref}, and the absence of the ubiquitous ``load-order''
+% and compatibility problems which are well known to afflict \LaTeX{} packages
+% of this area of functionality. On the other hand, the reliance on
+% \pkg{zref} labels may be seen as an inconvenience, since users of the
+% standard cross-reference infrastructure may need to add extra labels for
+% this. That's true. But \pkg{zref-check} is not meant to replace the
+% existing functionality of the kernel or of the traditional packages in this
+% area (to my knowledge, it only intersects directly with \pkg{varioref} and,
+% even so, it is quite different in scope). Indeed, it is easy to see the use
+% in tandem with standard references, for example:
+%
+% \begin{verbatim}
+% ... Figure~\ref{fig:figure-1}, \zcheck*{fig:figure-1}[nextpage]{on
+% the next page}.
+% \end{verbatim}
+%
+% Besides, \pkg{zref} does not share the label name-space with the standard
+% labels, so that you can call both \cs{label} and \cs{zlabel} with the same
+% label name (manually, or through a convenience macro), to ease the label set
+% administration. The example above presumes that was the case.
+%
+% All user commands of \pkg{zref-check} have their \marg{label} arguments
+% protected for \pkg{babel} active characters using \pkg{zref}'s
+% \cs{zref@wrapper@babel}, so that we should have equivalent support in that
+% regard, as \pkg{zref} itself does. However, \pkg{zref-check} sets labels
+% which either start with \texttt{zrefcheck@} or end with \texttt{@zrefcheck},
+% for internal use. Label names with either of those are considered reserved
+% by the package.
+%
+%
+% \section{Limitations}
+%
+% There are three qualitatively different kinds of checks being used by
+% \cs{zcheck}, according to the source and reliability of the information they
+% mobilize: page number checks, within page checks, and sectioning checks.
+%
+%
+% \subsection{Page number checks}
+%
+% Page number checks -- \opt{thispage}, \opt{prevpage}, \opt{nextpage},
+% \opt{pagesbefore}, \opt{pagesafter}, \opt{facing} -- use the
+% \texttt{abspage} property provided by the \pkg{zref-abspage} module. This
+% is a solid piece of information, on which we can rely upon. However,
+% despite that, page number checks may still become ill-defined, if the
+% \marg{text} argument in \cs{zcheck}, when typeset, crosses page boundaries,
+% starting in one page, and finishing in another. The same can happen with
+% the text in \cs{zctarget} and the \texttt{zcregion} environment.
+%
+% This is why the user commands of this package set always a pair or labels
+% around \meta{text}. So, when checking \cs{zcheck} against a regular
+% \texttt{zlabel} both the start and the end of the \meta{text} are checked
+% against the label, and the check fails if either of them fails. When
+% checking \cs{zcheck} against a \cs{zctarget} or a \texttt{zcregion}, both
+% beginnings and ends are checked against each other two by two, and if any of
+% them fails, the check fails. In other words, if a page number checks
+% passes, we know that the entire \meta{text} arguments pass it.
+%
+% This is a corner case (albeit relevant) which must be taken care of, and it
+% is possible to do so robustly. Hence, we can expect reliable results in
+% these tests.
+%
+%
+% \subsection{Within page checks}
+% \label{sec:within-page-checks}
+%
+% When both label and reference fall on the same page things become much
+% trickier. This is basically the case of the checks \opt{above} and
+% \opt{below} (and, through them, \opt{before} and \opt{after}). There is no
+% equally reliable information (that I know of) as we have for the page number
+% checks for this, especially when floats come into play. Which, of course,
+% is the interesting case to handle.
+%
+% To infer relative position of label and reference on the same page,
+% \pkg{zref-check} uses the labels' shipout sequence, which is retrieved at
+% load-time from the order in which the labels occur in the \file{.aux} file.
+% Indeed, \pkg{zref} writes labels to the \file{.aux} file at shipout (and,
+% hence, in shipout order), and needs to do so, because a number of its
+% properties are only available at that point.
+%
+% However, even if this method will buy us a correct check for a regular float
+% on a regular page (which, to be fair, is a good result), it is not difficult
+% do conceive situations in which this sequence may not be meaningful, or even
+% correct, for the case. A number of cases which may do so are: two column
+% documents, text wrapping, scaling, overlays, etc. (I don't know if those
+% make the method fail, I just don't know if they don't). Therefore, the
+% \texttt{labelseq} should be taken as a \emph{proxy} and not fully reliable,
+% meaning that the user should be watchful of its results.
+%
+% For this reason, \pkg{zref-check} provides an easy way to do so, by allowing
+% specific control of the messaging style of the checks which do within page
+% comparisons though the option \opt{onpage}. The concern is not really with
+% false positives (getting a warning when it was not due), but with false
+% negatives (not getting a warning when it was due). Hence, setting
+% \opt{onpage} to \opt{msg} at a final typesetting stage (or just set it to
+% \opt{obeydraft} or \opt{obeyfinal} if that's part of your workflow) provides
+% a way to easily identify all cases of such checks (failing or passing), and
+% double-check them. In case the test is passing though, the message is
+% different from that of a failing check, to quickly convey why you are
+% getting the message. This option can also be set at the local level, if the
+% page in question is known to be problematic, or just atypical.
+%
+%
+% \subsection{Sectioning checks}
+%
+% The information used by sectioning checks is provided by means of dedicated
+% counters for chapters and sections, similarly as standard counters for them,
+% but which are stepped and reset regardless of whether these sectioning
+% commands are numbered or not (that is, starred or not). And this for two
+% reasons. First, we don't need the absolute counter value to be able to make
+% the kind of relative statement we want to do here. Second, this allows us
+% to have these checks work for numbered and unnumbered sectioning commands
+% without having to worry about how those are used within the document.
+%
+% The caveat is that the package does this by hooking into \cs{chapter} and
+% \cs{section}, which poses two restrictions for the proper working of these
+% checks. First, we are using the new hook system for this, as provided by
+% \pkg{ltcmdhooks}, which means a \LaTeX{} kernel later than 2021-06-01 is
+% required. Second, since we are hooking into \cs{chapter} and \cs{section},
+% these checks presume these commands are being used by the document class for
+% this purpose (either directly, or internally as, for example, KOMA-Script's
+% \cs{addchap} and \cs{addsec} do). If that's not the case, additional setup
+% may be needed for these checks to work as expected.
+%
+%
+% \end{documentation}
+%
+%
+% \begin{implementation}
+%
+% \section{Initial setup}
+%
+% Start the \pkg{DocStrip} guards.
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%
+% Identify the internal prefix (\LaTeX3 \pkg{DocStrip} convention).
+% \begin{macrocode}
+%<@@=zrefcheck>
+% \end{macrocode}
+%
+%
+% For the \texttt{chapter} and \texttt{section} checks, \pkg{zref-check} uses
+% the new hook system in \pkg{ltcmdhooks}, which was released with the
+% 2021/06/01 \LaTeX{} kernel.
+% \begin{macrocode}
+\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
+\IfFormatAtLeastTF{2021-06-01}
+ {}
+ {%
+ \PackageError{zref-check}{LaTeX kernel too old}
+ {%
+ 'zref-check' requires a LaTeX kernel newer than 2021-06-01.%
+ \MessageBreak Loading will abort!%
+ }%
+ \endinput
+ }%
+% \end{macrocode}
+%
+% Identify the package.
+% \begin{macrocode}
+\ProvidesExplPackage {zref-check} {2021-08-04} {0.1.0}
+ {Flexible cross-references with contextual checks based on zref}
+% \end{macrocode}
+%
+% \section{Dependencies}
+%
+% \begin{macrocode}
+\RequirePackage { zref-user }
+\RequirePackage { zref-abspage }
+\RequirePackage { ifdraft }
+% \end{macrocode}
+%
+%
+% \section{\pkg{zref} setup}
+%
+% \begin{variable}{\g_@@_abschap_int, \g_@@_abssec_int}
+% Provide absolute counters for section and chapter, and respective
+% \pkg{zref} properties, so that we can make checks about relation of
+% chapters/sections regardless of internal counters, since we don't get
+% those for the unnumbered (starred) ones. About the proper place to make
+% the hooks for this purpose, see
+% \url{https://tex.stackexchange.com/q/605533/105447} (thanks Ulrike
+% Fischer).
+% \begin{macrocode}
+\int_new:N \g_@@_abschap_int
+\int_new:N \g_@@_abssec_int
+% \end{macrocode}
+% \end{variable}
+%
+%
+% If the documentclass does not define \cs{chapter} the only thing that
+% happens is that the chapter counter is never incremented, and the section
+% one never reset.
+% \begin{macrocode}
+\AddToHook { cmd / chapter / before }
+ {
+ \int_gincr:N \g_@@_abschap_int
+ \int_zero:N \g_@@_abssec_int
+ }
+\zref@newprop { abschap } [0] { \int_use:N \g_@@_abschap_int }
+\zref@addprop \ZREF@mainlist { abschap }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\AddToHook { cmd / section / before }
+ { \int_gincr:N \g_@@_abssec_int }
+\zref@newprop { abssec } [0] { \int_use:N \g_@@_abssec_int }
+\zref@addprop \ZREF@mainlist { abssec }
+% \end{macrocode}
+%
+%
+% This is the list of properties to be used by \pkg{zref-check}, that is, the
+% list of properties the references and targets store. This is the minimum
+% set required, more properties may be added according to options.
+% \begin{macrocode}
+\zref@newlist { zrefcheck }
+\zref@addprops { zrefcheck }
+ {
+ abspage ,
+ abschap ,
+ abssec ,
+ page
+ }
+% \end{macrocode}
+%
+%
+% \section{Plumbing}
+%
+% \subsection{Messages}
+%
+% \begin{macro}{\@@_message:nnnn, \@@_message:nnnx}
+% \begin{macrocode}
+\cs_new:Npn \@@_message:nnnn #1#2#3#4
+ {
+ \use:c { msg_ \l_@@_msglevel_tl :nnnnn }
+ { zref-check } {#1} {#2} {#3} {#4}
+ }
+\cs_generate_variant:Nn \@@_message:nnnn { nnnx }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\msg_new:nnn { zref-check } { check-failed }
+ {
+ Failed~check~'#1'~for~label~'#2' \iow_newline:
+ on~page~#3~on~input~line~\msg_line_number:.
+ }
+\msg_new:nnn { zref-check } { double-check }
+ {
+ Double-check~'#1'~for~label~'#2' \iow_newline:
+ on~page~#3~on~input~line~\msg_line_number:.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\msg_new:nnn { zref-check } { check-missing }
+ { Check~'#1'~not~defined~on~input~line~\msg_line_number:. }
+\msg_new:nnn { zref-check } { property-undefined }
+ { Property~'#1'~not~defined~on~input~line~\msg_line_number:. }
+\msg_new:nnn { zref-check } { property-not-in-label }
+ { Label~'#1'~has~no~property~'#2'~on~input~line~\msg_line_number:. }
+\msg_new:nnn { zref-check } { property-not-integer }
+ {
+ Property~'#1'~for~label~'#2'~not~an~integer \iow_newline:
+ on~input~line~\msg_line_number:.
+ }
+% \end{macrocode}
+%
+% \begin{macrocode}
+\msg_new:nnn { zref-check } { hyperref-preamble-only }
+ {
+ Option~'hyperref'~only~available~in~the~preamble. \iow_newline:
+ Use~the~starred~version~of~'\noexpand\zcheck'~instead.
+ }
+\msg_new:nnn { zref-check } { missing-hyperref }
+ { Missing~'hyperref'~package. \iow_newline: Setting~'hyperref=false'. }
+\msg_new:nnn { zref-check } { ignore-document-only }
+ {
+ Option~'ignore'~only~available~in~the~document. \iow_newline:
+ Use~option~'msglevel'~instead.
+ }
+\msg_new:nnn { zref-check } { option-preamble-only }
+ {
+ Option~'#1'~only~available~in~the~preamble \iow_newline:
+ on~input~line~\msg_line_number:.
+ }
+\msg_new:nnn { zref-check } { closerange-not-positive-integer }
+ {
+ Option~'closerange'~not~a~positive~integer \iow_newline:
+ on~input~line~\msg_line_number:.~Using~default~value.
+ }
+\msg_new:nnn { zref-check } { labelcmd-undefined }
+ {
+ Control~sequence~named~'#1'~used~in~option~'labelcmd'~is~not~defined.~
+ Using~default~value.
+ }
+% \end{macrocode}
+%
+%
+% \subsection{Integer testing}
+%
+% \begin{macro}{\@@_is_integer:n, \@@_int_to_roman:w}
+% From \url{https://tex.stackexchange.com/a/244405} (thanks Enrico Gregorio,
+% aka `egreg'), also see \url{https://tex.stackexchange.com/a/19769}.
+% Following the \texttt{l3styleguide}, I made a copy of
+% \cs{__int_to_roman:w}, since it is an internal function from the
+% \texttt{int} module, but we still get a warning from \texttt{l3build doc},
+% complaining about it. And we're using \cs{tl_if_empty:oTF} instead of
+% \cs{tl_if_blank:oTF} as in egreg's answer, since \cs{romannumeral} is
+% defined so that ``the expansion is empty if the number is zero or
+% negative'', not ``blank''. A couple of comments about this technique: the
+% underlying \cs{romannumeral} ignores space tokens and explicit signs
+% (\texttt{+} and \texttt{-}) in the expansion and hence it can only be used
+% to test positive integers; also the technique cannot distinguish whether
+% it received an empty argument or if ``the expansion was empty'' as a
+% result of receiving number as argument, so this must also be controlled
+% for since, in our use case, this may happen.
+% \begin{macrocode}
+\cs_new_eq:NN \@@_int_to_roman:w \__int_to_roman:w
+\prg_new_conditional:Npnn \@@_is_integer:n #1 { p, T , F , TF }
+ {
+ \tl_if_empty:oTF {#1}
+ { \prg_return_false: }
+ {
+ \tl_if_empty:oTF { \@@_int_to_roman:w -0#1 }
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_is_integer_rgx:n}
+% A possible alternative to \cs{@@_is_integer:n} is to use a straightforward
+% regexp match (see \url{https://tex.stackexchange.com/a/427559}). It does
+% not suffer from the mentioned caveats from the \cs{__int_to_roman:w}
+% technique, however, while \cs{@@_is_integer:n} is expandable,
+% \cs{@@_is_integer_rgx:n} is not. Also, \cs{@@_is_integer_rgx:n} is
+% probably slower.
+% \begin{macrocode}
+\prg_new_protected_conditional:Npnn \@@_is_integer_rgx:n #1 { TF }
+ {
+ \regex_match:nnTF { \A\d+\Z } {#1}
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsection{Options}
+%
+%
+% \subsubsection*{\opt{hyperref} option}
+%
+% \begin{variable}{\l_@@_use_hyperref_bool, \l_@@_warn_hyperref_bool}
+% \begin{macrocode}
+\bool_new:N \l_@@_use_hyperref_bool
+\bool_new:N \l_@@_warn_hyperref_bool
+\keys_define:nn { zref-check }
+ {
+ hyperref .choice: ,
+ hyperref / auto .code:n =
+ {
+ \bool_set_true:N \l_@@_use_hyperref_bool
+ \bool_set_false:N \l_@@_warn_hyperref_bool
+ } ,
+ hyperref / true .code:n =
+ {
+ \bool_set_true:N \l_@@_use_hyperref_bool
+ \bool_set_true:N \l_@@_warn_hyperref_bool
+ } ,
+ hyperref / false .code:n =
+ {
+ \bool_set_false:N \l_@@_use_hyperref_bool
+ \bool_set_false:N \l_@@_warn_hyperref_bool
+ } ,
+ hyperref .initial:n = auto ,
+ hyperref .default:n = auto
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macrocode}
+\AtBeginDocument
+ {
+ \@ifpackageloaded { hyperref }
+ {
+ \bool_if:NT \l_@@_use_hyperref_bool
+ {
+ \RequirePackage { zref-hyperref }
+ \zref@addprop { zrefcheck } { anchor }
+ }
+ }
+ {
+ \bool_if:NT \l_@@_warn_hyperref_bool
+ { \msg_warning:nn { zref-check } { missing-hyperref } }
+ \bool_set_false:N \l_@@_use_hyperref_bool
+ }
+ \keys_define:nn { zref-check }
+ {
+ hyperref .code:n =
+ { \msg_warning:nn { zref-check } { hyperref-preamble-only } }
+ }
+ }
+% \end{macrocode}
+%
+%
+% \subsubsection*{\opt{msglevel} option}
+%
+% \begin{variable}{\l_@@_msglevel_tl}
+% \begin{macrocode}
+\tl_new:N \l_@@_msglevel_tl
+\keys_define:nn { zref-check }
+ {
+ msglevel .choice: ,
+ msglevel / warn .code:n =
+ { \tl_set:Nn \l_@@_msglevel_tl { warning } } ,
+ msglevel / info .code:n =
+ { \tl_set:Nn \l_@@_msglevel_tl { info } } ,
+ msglevel / none .code:n =
+ { \tl_set:Nn \l_@@_msglevel_tl { none } } ,
+ msglevel / obeydraft .code:n =
+ {
+ \ifdraft
+ { \tl_set:Nn \l_@@_msglevel_tl { info } }
+ { \tl_set:Nn \l_@@_msglevel_tl { warning } }
+ } ,
+ msglevel / obeyfinal .code:n =
+ {
+ \ifoptionfinal
+ { \tl_set:Nn \l_@@_msglevel_tl { warning } }
+ { \tl_set:Nn \l_@@_msglevel_tl { info } }
+ } ,
+ msglevel .value_required:n = true ,
+ msglevel .initial:n = warn ,
+% \end{macrocode}
+% \opt{ignore} is a convenience alias for \opt{msglevel=none}, but only for
+% use in the document body.
+% \begin{macrocode}
+ ignore .code:n =
+ { \msg_warning:nn { zref-check } { ignore-document-only } } ,
+ ignore .value_forbidden:n = true
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macrocode}
+\AtBeginDocument
+ {
+ \keys_define:nn { zref-check }
+ { ignore .meta:n = { msglevel = none } }
+ }
+% \end{macrocode}
+%
+%
+% \subsubsection*{\opt{onpage} option}
+%
+% \begin{variable}{\l_@@_msgonpage_bool}
+% \begin{macrocode}
+\bool_new:N \l_@@_msgonpage_bool
+\keys_define:nn { zref-check }
+ {
+ onpage .choice: ,
+ onpage / labelseq .code:n =
+ {
+ \bool_set_false:N \l_@@_msgonpage_bool
+ } ,
+ onpage / msg .code:n =
+ {
+ \bool_set_true:N \l_@@_msgonpage_bool
+ } ,
+ onpage / obeydraft .code:n =
+ {
+ \ifdraft
+ { \bool_set_false:N \l_@@_msgonpage_bool }
+ { \bool_set_true:N \l_@@_msgonpage_bool }
+ } ,
+ onpage / obeyfinal .code:n =
+ {
+ \ifoptionfinal
+ { \bool_set_true:N \l_@@_msgonpage_bool }
+ { \bool_set_false:N \l_@@_msgonpage_bool }
+ } ,
+ onpage .value_required:n = true ,
+ onpage .initial:n = labelseq
+ }
+% \end{macrocode}
+% \end{variable}
+%
+%
+% \subsubsection*{\opt{closerange} option}
+%
+% \begin{variable}{\l_@@_close_range_int}
+% \begin{macrocode}
+\int_new:N \l_@@_close_range_int
+\keys_define:nn { zref-check }
+ {
+ closerange .code:n =
+ {
+ \@@_is_integer_rgx:nTF {#1}
+ { \int_set:Nn \l_@@_close_range_int { \int_eval:n {#1} } }
+ {
+ \msg_warning:nn { zref-check } { closerange-not-positive-integer }
+ \int_set:Nn \l_@@_close_range_int { 5 }
+ }
+ } ,
+ closerange .value_required:n = true ,
+ closerange .initial:n = 5
+ }
+% \end{macrocode}
+% \end{variable}
+%
+%
+% \subsubsection*{\opt{labelcmd} option}
+%
+% \begin{variable}{\l_@@_target_label_tl}
+% I'd love to receive the macro itself rather than it's name, but this would
+% bring unwarranted complications:
+% \url{https://tex.stackexchange.com/a/489570}.
+% \begin{macrocode}
+\tl_new:N \l_@@_target_label_tl
+\bool_new:N \l_@@_target_label_bool
+\keys_define:nn { zref-check }
+ {
+ labelcmd .code:n =
+ {
+ \tl_set:Nn \l_@@_target_label_tl {#1}
+ \bool_set_true:N \l_@@_target_label_bool
+ } ,
+ labelcmd .value_required:n = true ,
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\@@_target_label:n}
+% Default definition of the function for user label setting in \cs{zctarget}
+% and \texttt{zcregion}. It may be redefined at \texttt{begindocument}
+% according to option \opt{labelcmd}.
+% \begin{macrocode}
+\cs_new:Npn \@@_target_label:n #1
+ { \zref@labelbylist {#1} { zrefcheck } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\AtBeginDocument
+ {
+ \bool_if:NT \l_@@_target_label_bool
+ {
+ \tl_if_blank:VT \l_@@_target_label_tl
+ { \tl_clear:N \l_@@_target_label_tl }
+ \cs_if_exist:cTF { \l_@@_target_label_tl }
+ {
+ \cs_set:Npx \@@_target_label:n #1
+ {
+ \exp_not:o
+ { \cs:w \l_@@_target_label_tl \cs_end: }
+ {#1}
+ }
+ }
+ {
+ \exp_args:NnnV \msg_warning:nnn { zref-check }
+ { labelcmd-undefined } { \l_@@_target_label_tl }
+ }
+ }
+ \keys_define:nn { zref-check }
+ {
+ labelcmd .code:n =
+ {
+ \msg_warning:nnn { zref-check }
+ { option-preamble-only } { labelcmd }
+ }
+ }
+ }
+% \end{macrocode}
+%
+%
+% \subsubsection*{Package options}
+%
+% Process load-time package options
+% (\url{https://tex.stackexchange.com/a/15840}).
+% \begin{macrocode}
+\RequirePackage { l3keys2e }
+\ProcessKeysOptions { zref-check }
+% \end{macrocode}
+%
+%
+% \begin{macro}[int]{\zrefchecksetup}
+% Provide \cs{zrefchecksetup}.
+% \begin{macrocode}
+\NewDocumentCommand \zrefchecksetup { m }
+ { \keys_set:nn { zref-check } {#1} }
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsection{Position on page}
+%
+% Method for determining relative position within the page: the sequence in
+% which the labels get shipped out, inferred from the sequence in which the
+% labels occur in the \file{.aux} file.
+%
+% Some relevant info about the sequence of things:
+% \url{https://tex.stackexchange.com/a/120978} and \texttt{texdoc lthooks},
+% section ``Hooks provided by |\begin{document}|''.
+%
+%
+% One first attempt at this was to use \cs{zref@newlabel}, which is the macro
+% in which \pkg{zref} stores the label information in the aux file. When the
+% \file{.aux} file is read at the beginning of the compilation, this macro is
+% expanded for each of the labels. So, by redefining this macro we can feed a
+% variable (a L3 sequence), and then do what it usually does, which is to
+% define each label with the internal macro \cs{@newl@bel}, when the
+% \file{.aux} file is read.
+%
+% Patching this macro for this is not possible. First, \cs{zref@newlabel} is
+% one of those ``commands that look ahead'' mentioned in \pkg{ltcmdhooks}
+% documentation. Indeed, \cs{@newl@bel} receives 3 arguments, and
+% \cs{zref@newlabel} just passes the first, the following two will be scanned
+% ahead. Second, the \pkg{ltcmdhooks} hooks are not actually available when
+% the \file{.aux} file is read, they come only after |\begin{document}|.
+% Hence, redefinition would be the only alternative. My attempts at this
+% ended up registered at \url{https://tex.stackexchange.com/a/604744}. But
+% the best result in these lines was:
+%
+% \begin{verbatim}
+% \ZREF@Robust\edef\zref@newlabel#1{
+% \noexpand\seq_gput_right:Nn \noexpand\g__zrefcheck_auxfile_lblseq_seq {#1}
+% \noexpand\@newl@bel{\ZREF@RefPrefix}{#1}
+% }
+% \end{verbatim}
+%
+%
+% However, better than the above is to just read it from the \file{.aux} file
+% directly, which relieves us from hacking into any internals. That's what
+% David Carlisle's answer at \url{https://tex.stackexchange.com/a/147705}
+% does. This answer has actually been converted into the package
+% \pkg{listlbls} by Norbert Melzer, but it is made to work with regular
+% labels, not with \pkg{zref}'s. And it also does not really expose the
+% information in a retrievable way (as far as I can tell). So, the below is
+% adapted from Carlisle's answer's technique (a poor man's version of it...).
+%
+% There is some subtlety here as to whether this approach makes it safe for us
+% to read the labels at this point without \cs{zref@wrapper@babel}. The
+% common wisdom is that babel's shorthands are only active after
+% |\begin{document}| (e.g., \url{https://tex.stackexchange.com/a/98897}).
+% Alas, it is more complicated than that. Babel's documentation says (in
+% section 9.5 Shorthands): ``To prevent problems with the loading of other
+% packages after babel we reset the catcode of the character to the original
+% one at the end of the package and of each language file (except with
+% KeepShorthandsActive). It is re-activate[d] again at |\begin{document}|.
+% We also need to make sure that the shorthands are active during the
+% processing of the \file{.aux} file. Otherwise some citations may give
+% unexpected results in the printout when a shorthand was used in the optional
+% argument of |\bibitem| for example.'' This is done with
+% |\if@filesw \immediate\write\@mainaux{...}|. In other words, the
+% catcode change is written in the \file{.aux} file itself! Indeed, if you
+% inspect the file, you'll find them there. Besides, there is still the
+% ominous ``except with KeepShorthandsActive''.
+%
+% However, the \emph{method} we're using here is not quite the same as the
+% usual run of the \file{.aux} file, because we're actively discarding the
+% lines for which the first token is not equal to \cs{zref@newlabel}. I have
+% tested the famous sensitive case for this: \pkg{babel} \opt{french} and
+% labels with colons. And things worked as expected. Well, \emph{if}
+% \opt{KeepShorthandsActive} is enabled \emph{with \opt{french}} and we load
+% the package \emph{after babel} things do break, but not quite because of the
+% colons in the labels. Even \pkg{siunitx} breaks in the same
+% conditions\dots{}
+%
+% For reference: About what are valid characters for use in labels:
+% \url{https://tex.stackexchange.com/a/18312}. About some problems with
+% active colons: \url{https://tex.stackexchange.com/a/89470}. About the
+% difference between L3 strings and token lists, see
+% \url{https://tex.stackexchange.com/a/446381}, in particular Joseph Wright's
+% comment: ``Strings are for data that will never be typeset, for example file
+% names, identifiers, etc.: if the material may be used in typesetting, it
+% should be a token list.'' See also moewe's (CW) answer in the same lines.
+% Which suggests using L3 strings for the reference labels might be a good
+% catch all approach, and possibly more robust. David Carlisle's comment
+% about \pkg{inputenc} and how the strings work is a caveat (see
+% \url{https://tex.stackexchange.com/q/446123#comment1516961_446381}, thanks
+% David Carlisle). Still\dots{} let's stick to tradition as long as it works,
+% \pkg{zref} already does a great job in this regard anyway.
+%
+%
+% \begin{variable}{\g_@@_auxfile_lblseq_prop}
+% \begin{macrocode}
+\prop_new:N \g_@@_auxfile_lblseq_prop
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macrocode}
+\tl_set:Nn \g_tmpa_tl { \c_sys_jobname_str .aux }
+\file_if_exist:nT { \g_tmpa_tl }
+ {
+% \end{macrocode}
+% Retrieve the information from the \file{.aux} file, and store it in a
+% property list, so that the sequence can be retrieved in key-value fashion.
+% \begin{macrocode}
+ \ior_open:Nn \g_tmpa_ior { \g_tmpa_tl }
+ \group_begin:
+ \int_zero:N \l_tmpa_int
+ \tl_clear:N \l_tmpa_tl
+ \tl_clear:N \l_tmpb_tl
+ \bool_set_false:N \l_tmpa_bool
+ \ior_map_variable:NNn \g_tmpa_ior \l_tmpa_tl
+ {
+ \tl_map_variable:NNn \l_tmpa_tl \l_tmpb_tl
+ {
+ \tl_if_eq:NnTF \l_tmpb_tl { \zref@newlabel }
+ {
+% \end{macrocode}
+% Found a \cs{zref@label}, signal it.
+% \begin{macrocode}
+ \bool_set_true:N \l_tmpa_bool
+ }
+ {
+ \bool_if:NTF \l_tmpa_bool
+ {
+ \bool_set_false:N \l_tmpa_bool
+ \int_incr:N \l_tmpa_int
+ \prop_gput:Nxx \g_@@_auxfile_lblseq_prop
+ { \l_tmpb_tl } { \int_use:N \l_tmpa_int }
+ }
+ {
+% \end{macrocode}
+% If there is not a match of the first token with \cs{zref@newlabel}, break
+% the loop and discard the rest of the line, to ensure no babel calls to
+% \cs{catcode} in the \file{.aux} file get expanded. This also breaks the
+% loop and discards the rest of the \cs{zref@newlabel} lines after we got the
+% label we wanted, since we reset \cs{l_tmpa_bool} in the \texttt{T} branch.
+% \begin{macrocode}
+ \tl_map_break:
+ }
+ }
+ }
+ }
+ \group_end:
+ \ior_close:N \g_tmpa_ior
+ }
+% \end{macrocode}
+%
+%
+%
+% The alternate method I had considered (more than that...) for this was using
+% yx coordinates supplied by \pkg{zref}'s \pkg{savepos} module. However, this
+% approach brought in a number of complexities, including the need to patch
+% either \cs{zref@label} or \cs{ZREF@label}. In addition, the technique was
+% at the bottom fundamentally flawed. Ulrike Fischer was very much right when
+% she said that ``structure and position are two different beasts''
+% (\url{https://github.com/ho-tex/zref/issues/12#issuecomment-880022576}). It
+% is true that the checks based on it behaved decently, in normal
+% circumstances, and except for outrageous label placement by the user, it
+% would return the expected results. We don't really need exact coordinates
+% to decide ``above/below''. Besides, it would do an exact job for the
+% dedicated target macros of this package. However, I could not conceive a
+% situation where the \texttt{yx} criterion would perform clearly better than
+% the \texttt{labelseq} one. And, if that's the case, and considering the
+% complications it brings, this check was a slippery slope. All in all, I've
+% decided to drop it.
+%
+%
+%
+% \subsection{Counter}
+%
+% We need a dedicated counter for the labels generated by the checks and
+% targets. The value of the counter is not relevant, we just need it to be
+% able to set proper anchors with \cs{refstepcounter}. And, since I couldn't
+% find a \cs{refstepcounter} equivalent in L3, we use a standard 2e counter
+% here. I'm also using the technique to ensure the counter is never reset
+% that is used by \file{zref-abspage.sty} and \cs{zref@require@unique}.
+% Indeed, the requirements are the same, we need numbers ensured to be
+% \emph{unique} in the counter.
+%
+% \begin{macrocode}
+\begingroup
+ \let \@addtoreset \ltx@gobbletwo
+ \newcounter { zrefcheck }
+\endgroup
+\setcounter { zrefcheck } { 0 }
+% \end{macrocode}
+%
+%
+%
+% \subsection{Label formats}
+%
+% \begin{macro}{\@@_check_lblfmt:n}
+% \begin{syntax}
+% \cs{@@_check_lblfmt:n} \Arg{check id int}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \@@_check_lblfmt:n #1 { zrefcheck@ \int_use:N #1 }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_end_lblfmt:n}
+% \begin{syntax}
+% \cs{@@_end_lblfmt:n} \Arg{label}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \@@_end_lblfmt:n #1 { #1 @zrefcheck }
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsection{Property values}
+%
+%
+% \begin{macro}[int]{\zrefcheck_get_astl:nnn}
+% A convenience function to retrieve property values from labels. Uses
+% \cs{g_@@_auxfile_lblseq_prop} for \texttt{lblseq}, and calls
+% \cs{zref@extractdefault} for everything else.
+%
+% We cannot use the ``return value'' of \cs{@@_get_astl:nnn} or
+% \cs{@@_get_asint:nnn} directly, because we need to use the retrieved
+% property values as arguments in the checks, however we use here a number
+% of non-expandable operations. Hence, we receive a local \texttt{tl/int}
+% variable as third argument and set that, so that it is available (and
+% expandable) at the place of use. For this reason, we do not group here,
+% because we are passing a local variable around, but it is expected this
+% function will be called within a group.
+%
+% We're returning \cs{c_empty_tl} in case of failure to find the intended
+% property value (explicitly in \cs{zref@extractdefault}, but that is also
+% what \cs{tl_clear:N} does).
+%
+% \begin{syntax}
+% \cs{zrefcheck_get_astl:nnn} \Arg{label} \Arg{prop} \Arg{tl var}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \zrefcheck_get_astl:nnn #1#2#3
+ {
+ \tl_clear:N #3
+ \tl_if_eq:nnTF {#2} { lblseq }
+ {
+ \prop_get:NnNF \g_@@_auxfile_lblseq_prop {#1} #3
+ {
+ \msg_warning:nnnn { zref-check }
+ { property-not-in-label } {#1} {#2}
+ }
+ }
+ {
+% \end{macrocode}
+% There are three things we need to check to ensure the information we are
+% trying to retrieve here exists: the existence of \Arg{label}, the existence
+% of \Arg{prop}, and whether the particular label being queried actually
+% contains the property. If that's all in place, the value is passed to the
+% checks, and it's their responsibility to verify the consistency of this
+% value.
+%
+% The existence of the label is an user facing issue, and a warning for this
+% is placed in \cs{@@_zcheck:nnnnn} (and done with \cs{zref@refused}). We do
+% check here though for definition with \cs{zref@ifrefundefined} and silently
+% do nothing if it is undefined, to reduce irrelevant warnings in a fresh
+% compilation round. The other two are more ``internal'' problems, either
+% some problem with the checks, or with the configuration of \pkg{zref} for
+% their consumption.
+% \begin{macrocode}
+ \zref@ifrefundefined {#1}
+ {}
+ {
+ \zref@ifpropundefined {#2}
+ { \msg_warning:nnnn { zref-check } { property-undefined } {#2} }
+ {
+ \zref@ifrefcontainsprop {#1} {#2}
+ {
+ \tl_set:Nx #3
+ { \zref@extractdefault {#1} {#2} { \c_empty_tl } }
+ }
+ {
+ \msg_warning:nnnn
+ { zref-check } { property-not-in-label } {#1} {#2}
+ }
+ }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{variable}{\l_@@_integer_bool}
+% \cs{zrefcheck_get_asint:nnn} is a very convenient wrapper around the more
+% general \cs{zrefcheck_get_astl:nnn}, since almost always we'll be wanting
+% to compare numbers in the checks. However, it is quite hard for it to
+% ensure an integer is \emph{always} returned in the case of errors. And
+% those do occur, even in a well structured document (e.g., in a first round
+% of compilation). To complicate things, the L3 integer predicates are
+% \emph{very} sensitive to receiving any other kind of data, and they
+% \emph{scream}. To handle this \cs{zrefcheck_get_asint:nnn} uses
+% \cs{l_@@_integer_bool} to signal if an integer could not be returned. To
+% use this function always set \cs{l_@@_integer_bool} to true first, then
+% call it as much as you need. If any of these calls got is returning
+% anything which is not an integer, \cs{l_@@_integer_bool} will have been
+% set to false, and you should check that this hasn't happened before
+% actually comparing the integers (\cs{bool_lazy_and:nnTF} is your friend).
+% \begin{macrocode}
+\bool_new:N \l_@@_integer_bool
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_propval_tl}
+% \begin{macrocode}
+\tl_new:N \l_@@_propval_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}[int]{\zrefcheck_get_asint:nnn}
+% \begin{syntax}
+% \cs{zrefcheck_get_asint:nnn} \Arg{label} \Arg{prop} \Arg{int var}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \zrefcheck_get_asint:nnn #1#2#3
+ {
+ \zrefcheck_get_astl:nnn {#1} {#2} { \l_@@_propval_tl }
+ \@@_is_integer:nTF { \l_@@_propval_tl }
+ {
+% \end{macrocode}
+% Make it an integer data type.
+% \begin{macrocode}
+ \int_set:Nn #3 { \int_eval:n { \l_@@_propval_tl } }
+ }
+ {
+ \bool_set_false:N \l_@@_integer_bool
+ \zref@ifrefundefined {#1}
+% \end{macrocode}
+% Keep silent if ref is undefined to reduce irrelevant warnings in a fresh
+% compilation round. Again, this is also not the point to check for undefined
+% references, that's a task for \cs{@@_zcheck:nnnnn}.
+% \begin{macrocode}
+ { }
+ {
+ \msg_warning:nnnn { zref-check }
+ { property-not-integer } {#2} {#1}
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \section{User interface}
+%
+%
+% \subsection{\cs{zcheck}}
+%
+% \begin{macro}[int]{\zcheck}
+% The \marg{text} argument of \cs{zcheck} should not be long, since
+% \cs{hyperlink} cannot receive a long argument. Besides, there is no
+% reason for it to be. Note, also, that hyperlinks crossing page boundaries
+% have some known issues: \url{https://tex.stackexchange.com/a/182769},
+% \url{https://tex.stackexchange.com/a/54607},
+% \url{https://tex.stackexchange.com/a/179907}.
+%
+% \begin{syntax}
+% \cs{zcheck}\meta{*}\oarg{options}\marg{labels}\oarg{checks}\marg{text}
+% \end{syntax}
+%
+% \begin{macrocode}
+\NewDocumentCommand \zcheck
+ { s O { } > { \SplitList { , } } m > { \SplitList { , } } O { } m }
+ { \zref@wrapper@babel \@@_zcheck:nnnnn {#3} {#1} {#2} {#4} {#5} }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{variable}
+% {
+% \g_@@_id_int ,
+% \l_@@_checkbeg_tl ,
+% \l_@@_checkend_tl ,
+% \l_@@_link_label_tl ,
+% \l_@@_link_anchor_tl ,
+% \l_@@_link_star_tl
+% }
+% \begin{macrocode}
+\int_new:N \g_@@_id_int
+\tl_new:N \l_@@_checkbeg_tl
+\tl_new:N \l_@@_checkend_tl
+\tl_new:N \l_@@_link_label_tl
+\tl_new:N \l_@@_link_anchor_tl
+\bool_new:N \l_@@_link_star_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\@@_zcheck:nnnnn}
+% An intermediate internal function, which does the actual heavy lifting,
+% and places \Arg{labels} as first argument, so that it can be protected by
+% \cs{zref@wrapper@babel} in \cs{zcheck}. This is the same procedure as the
+% one used in the definition of \cs{zref} in \file{zref-user.sty} for
+% protection of \pkg{babel} active characters.
+%
+% \begin{syntax}
+% \cs{@@_zcheck:nnnnn} \Arg{labels} \Arg{*} \Arg{options} \Arg{checks} \Arg{text}
+% \end{syntax}
+%
+% \begin{macrocode}
+\cs_new:Npn \@@_zcheck:nnnnn #1#2#3#4#5
+ {
+ \group_begin:
+% \end{macrocode}
+% Process local options.
+% \begin{macrocode}
+ \keys_set:nn { zref-check } {#3}
+% \end{macrocode}
+% Names of the labels for this zrefcheck call.
+% \begin{macrocode}
+ \int_gincr:N \g_@@_id_int
+ \tl_set:Nx \l_@@_checkbeg_tl
+ { \@@_check_lblfmt:n { \g_@@_id_int } }
+ \tl_set:Nx \l_@@_checkend_tl
+ { \@@_end_lblfmt:n { \l_@@_checkbeg_tl } }
+% \end{macrocode}
+% Set checkbeg label.
+% \begin{macrocode}
+ \zref@labelbylist { \l_@@_checkbeg_tl } { zrefcheck }
+% \end{macrocode}
+% Typeset \marg{text}, with hyperlink when appropriate. Even though the first
+% argument can receive a list of labels, there is no meaningful way to set
+% links to multiple targets. Hence, only the first one is considered for
+% hyperlinking.
+% \begin{macrocode}
+ \tl_set:Nn \l_@@_link_label_tl { \tl_head:n {#1} }
+ \bool_set:Nn \l_@@_link_star_tl {#2}
+ \zref@ifrefundefined { \l_@@_link_label_tl }
+% \end{macrocode}
+% If the reference is undefined, just typeset.
+% \begin{macrocode}
+ {#5}
+ {
+ \bool_if:nTF
+ {
+ \l_@@_use_hyperref_bool &&
+ ! \l_@@_link_star_tl
+ }
+ {
+ \exp_args:Nx \zrefcheck_get_astl:nnn
+ { \l_@@_link_label_tl }
+ { anchor } { \l_@@_link_anchor_tl }
+ \hyperlink { \l_@@_link_anchor_tl } {#5}
+ }
+ {#5}
+ }
+% \end{macrocode}
+% Set checkend label.
+% \begin{macrocode}
+ \zref@labelbylist { \l_@@_checkend_tl } { zrefcheck }
+% \end{macrocode}
+% Check if \meta{labels} are defined.
+% \begin{macrocode}
+ \tl_map_function:nN {#1} \zref@refused
+% \end{macrocode}
+% Run the checks.
+% \begin{macrocode}
+ \@@_run_checks:nnV {#4} {#1} { \l_@@_checkbeg_tl }
+ \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Targets}
+%
+% \begin{macro}[int]{\zctarget}
+% \begin{syntax}
+% \cs{zctarget}\marg{label}\marg{text}
+% \end{syntax}
+% \begin{macrocode}
+\NewDocumentCommand \zctarget { m +m }
+ {
+% \end{macrocode}
+% Group contents of \cs{zctarget} to avoid leaking the effects of
+% \cs{refstepcounter} over \cs{@currentlabel}. The same care is not needed
+% for \texttt{zcregion}, since the environment is already grouped.
+% \begin{macrocode}
+ \group_begin:
+ \refstepcounter { zrefcheck }
+ \zref@wrapper@babel \@@_target_label:n {#1}
+ #2
+ \zref@wrapper@babel
+ \zref@labelbylist { \@@_end_lblfmt:n {#1} } { zrefcheck }
+ \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{zcregion}
+% \begin{syntax}
+% |\begin{zcregion}|\marg{label}
+% | ...|
+% |\end{zcregion}|
+% \end{syntax}
+% \begin{macrocode}
+\NewDocumentEnvironment {zcregion} { m }
+ {
+ \refstepcounter { zrefcheck }
+ \zref@wrapper@babel \@@_target_label:n {#1}
+ }
+ {
+ \zref@wrapper@babel
+ \zref@labelbylist { \@@_end_lblfmt:n {#1} } { zrefcheck }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \section{Checks}
+%
+% What is needed define a \pkg{zref-check} check?
+%
+% First, a conditional function defined with:
+%
+% \cs{prg_new_conditional:Npnn} \cs{@@_check_\meta{check}:nn} |#1#2 { F }|
+%
+% \noindent where \meta{check} is the name of the check, the first argument is
+% the \Arg{label} and the second the \Arg{reference}. The existence of the
+% check is verified by the existence of the function with this name-scheme
+% (and signatures). As usual, this function must return either
+% \cs{prg_return_true:} or \cs{prg_return_false:}. Of course, you can define
+% other variants if you need them internally, it is just that what the package
+% does expect and verifies is the existence of the \texttt{:nnF} variant.
+%
+% Note that the naming convention of the checks adopts the perspective of the
+% \meta{reference}. That is, the ``before'' check should return true if the
+% \meta{label} occurs before the ``reference''.
+%
+% The check conditionals are expected to retrieve \pkg{zref}'s label
+% information with \cs{zrefcheck_get_astl:nnn} or
+% \cs{zrefcheck_get_asint:nnn}. Also, technically speaking, the
+% \meta{reference} argument is also a label, actually a pair of them, as set
+% by \cs{zcheck}. For the ``labels'', any \pkg{zref} property in \pkg{zref}'s
+% main list is available, the ``references'' store the properties in the
+% \texttt{zrefcheck} list. Besides those, there is also the \texttt{lblseq}
+% (fake) property (for either ``labels'' or ``references''), stored in
+% \cs{g_@@_auxfile_lblseq_prop}.
+%
+% Second, the required properties of labels and references must be duly
+% registered for \pkg{zref}. This can be done with \cs{zref@newprop},
+% \cs{zref@addprop} and friends, as usual.
+%
+%
+% \subsection{Running}
+%
+% \begin{macro}{\@@_run_checks:nnn, \@@_run_checks:nnV}
+% \begin{syntax}
+% \cs{@@_run_checks:nnn} \Arg{checks} \Arg{labels} \Arg{reference}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \@@_run_checks:nnn #1#2#3
+ {
+ \group_begin:
+ \tl_map_inline:nn {#2}
+ {
+ \tl_map_inline:nn {#1}
+ { \@@_do_check:nnn {####1} {##1} {#3} }
+ }
+ \group_end:
+ }
+\cs_generate_variant:Nn \@@_run_checks:nnn { nnV }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{variable}
+% {
+% \l_@@_passedcheck_bool ,
+% \l_@@_onpage_bool ,
+% \c_@@_onpage_checks_seq
+% }
+% \begin{macrocode}
+\bool_new:N \l_@@_passedcheck_bool
+\bool_new:N \l_@@_onpage_bool
+\seq_new:N \c_@@_onpage_checks_seq
+\seq_set_from_clist:Nn \c_@@_onpage_checks_seq
+ { above , below , before , after }
+% \end{macrocode}
+% \end{variable}
+%
+%
+% Variant not provided by \pkg{expl3}.
+% \begin{macrocode}
+\cs_generate_variant:Nn \exp_args:Nnno { Nnoo }
+% \end{macrocode}
+%
+% \begin{macro}{\@@_do_check:nnn}
+% \begin{syntax}
+% \cs{@@_do_check:nnn} \Arg{check} \Arg{label beg} \Arg{reference beg}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \@@_do_check:nnn #1#2#3
+ {
+ \group_begin:
+% \end{macrocode}
+% \meta{label beg} may be defined or not, it is arbitrary user input. Whether
+% this is the case is checked in \cs{@@_zcheck:nnnnn}, and due warning already
+% ensues. And there is no point in checking ``relative position'' of an
+% undefined label. Hence, in the absence of |#2|, we do nothing at all here.
+% \begin{macrocode}
+ \zref@ifrefundefined {#2}
+ {}
+ {
+ \tl_if_empty:nF {#1}
+ {
+ \bool_set_true:N \l_@@_passedcheck_bool
+ \bool_set_false:N \l_@@_onpage_bool
+ \cs_if_exist:cTF { @@_check_ #1 :nnF }
+ {
+% \end{macrocode}
+% ``label beg'' vs ``reference beg''.
+% \begin{macrocode}
+ \use:c { @@_check_ #1 :nnF }
+ {#2} {#3}
+ { \bool_set_false:N \l_@@_passedcheck_bool }
+% \end{macrocode}
+% ``label beg'' vs ``reference end''.
+% \begin{macrocode}
+ \exp_args:Nnno \use:c { @@_check_ #1 :nnF }
+ {#2} { \@@_end_lblfmt:n {#3} }
+ { \bool_set_false:N \l_@@_passedcheck_bool }
+% \end{macrocode}
+% ``label end'' \emph{may} have been created by the target commands.
+% \begin{macrocode}
+ \zref@ifrefundefined { \@@_end_lblfmt:n {#2} }
+ {}
+ {
+% \end{macrocode}
+% ``label end'' vs ``reference beg''.
+% \begin{macrocode}
+ \exp_args:Nno \use:c { @@_check_ #1 :nnF }
+ { \@@_end_lblfmt:n {#2} } {#3}
+ { \bool_set_false:N \l_@@_passedcheck_bool }
+% \end{macrocode}
+% ``label end'' vs ``reference end''.
+% \begin{macrocode}
+ \exp_args:Nnoo \use:c { @@_check_ #1 :nnF }
+ { \@@_end_lblfmt:n {#2} }
+ { \@@_end_lblfmt:n {#3} }
+ { \bool_set_false:N \l_@@_passedcheck_bool }
+ }
+% \end{macrocode}
+% Handle option \opt{onpage=msg}. This is only granted for tests which
+% perform ``within this page'' checks (\opt{above}, \opt{below}, \opt{before},
+% \opt{after}) \emph{and} if any of the two by two checks uses a ``within this
+% page'' comparison. If both conditions are met, signal.
+% \begin{macrocode}
+ \seq_if_in:NnT \c_@@_onpage_checks_seq {#1}
+ {
+ \@@_check_thispage:nnT
+ {#2} {#3}
+ { \bool_set_true:N \l_@@_onpage_bool }
+ \@@_check_thispage:nnT
+ {#2} { \@@_end_lblfmt:n {#3} }
+ { \bool_set_true:N \l_@@_onpage_bool }
+ \zref@ifrefundefined { \@@_end_lblfmt:n {#2} }
+ {}
+ {
+ \@@_check_thispage:nnT
+ { \@@_end_lblfmt:n {#2} } {#3}
+ { \bool_set_true:N \l_@@_onpage_bool }
+ \@@_check_thispage:nnT
+ { \@@_end_lblfmt:n {#2} }
+ { \@@_end_lblfmt:n {#3} }
+ { \bool_set_true:N \l_@@_onpage_bool }
+ }
+ }
+ \bool_if:NTF \l_@@_passedcheck_bool
+ {
+ \bool_if:nT
+ {
+ \l_@@_msgonpage_bool &&
+ \l_@@_onpage_bool
+ }
+ {
+ \@@_message:nnnx { double-check } {#1} {#2}
+ { \zref@extractdefault {#3} {page} {'unknown'} }
+ }
+ }
+ {
+ \@@_message:nnnx { check-failed } {#1} {#2}
+ { \zref@extractdefault {#3} {page} {'unknown'} }
+ }
+ }
+ { \msg_warning:nnn { zref-check } { check-missing } {#1} }
+ }
+ }
+ \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Conditionals}
+%
+% \begin{variable}
+% {
+% \l_@@_lbl_int ,
+% \l_@@_ref_int ,
+% \l_@@_lbl_b_int ,
+% \l_@@_ref_b_int
+% }
+% More readable scratch variables for the tests.
+% \begin{macrocode}
+\int_new:N \l_@@_lbl_int
+\int_new:N \l_@@_ref_int
+\int_new:N \l_@@_lbl_b_int
+\int_new:N \l_@@_ref_b_int
+% \end{macrocode}
+% \end{variable}
+%
+%
+% \subsubsection{This page}
+%
+% \begin{macro}{\@@_check_thispage:nn}
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_check_thispage:nn #1#2 { T , F , TF }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abspage } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abspage } { \l_@@_ref_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } = { \l_@@_ref_int } &&
+% \end{macrocode}
+% `0' is the default value of \texttt{abspage}, but this value should not
+% happen normally for this property, since even the first page, after it gets
+% shipped out, will receive value `1'. So, if we do find `0' here, better
+% signal something is wrong. This comment extends to all page number checks.
+% \begin{macrocode}
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{On page}
+%
+% \begin{macro}{\@@_check_above:nn, \@@_check_below:nn}
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_check_above:nn #1#2 { F , TF }
+ {
+ \group_begin:
+ \@@_check_thispage:nnTF {#1} {#2}
+ {
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { lblseq } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { lblseq } { \l_@@_ref_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } < { \l_@@_ref_int } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\prg_new_conditional:Npnn \@@_check_below:nn #1#2 { F , TF }
+ {
+ \@@_check_thispage:nnTF {#1} {#2}
+ {
+ \@@_check_above:nnTF {#1} {#2}
+ { \prg_return_false: }
+ { \prg_return_true: }
+ }
+ { \prg_return_false: }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Before / After}
+%
+% \begin{macro}{\@@_check_before:nn, \@@_check_after:nn}
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_check_before:nn #1#2 { F }
+ {
+ \@@_check_pagesbefore:nnTF {#1} {#2}
+ { \prg_return_true: }
+ {
+ \@@_check_above:nnTF {#1} {#2}
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+ }
+\prg_new_conditional:Npnn \@@_check_after:nn #1#2 { F }
+ {
+ \@@_check_pagesafter:nnTF {#1} {#2}
+ { \prg_return_true: }
+ {
+ \@@_check_below:nnTF {#1} {#2}
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Pages}
+%
+% \begin{macro}
+% {
+% \@@_check_nextpage:nn ,
+% \@@_check_prevpage:nn ,
+% \@@_check_pagesbefore:nn ,
+% \@@_check_ppbefore:nn ,
+% \@@_check_pagesafter:nn ,
+% \@@_check_ppafter:nn ,
+% \@@_check_facing:nn
+% }
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_check_nextpage:nn #1#2 { F }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abspage } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abspage } { \l_@@_ref_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } = { \l_@@_ref_int + 1 } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\prg_new_conditional:Npnn \@@_check_prevpage:nn #1#2 { F }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abspage } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abspage } { \l_@@_ref_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } = { \l_@@_ref_int - 1 } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\prg_new_conditional:Npnn \@@_check_pagesbefore:nn #1#2 { F , TF }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abspage } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abspage } { \l_@@_ref_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } < { \l_@@_ref_int } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\cs_new_eq:NN \@@_check_ppbefore:nnF \@@_check_pagesbefore:nnF
+\prg_new_conditional:Npnn \@@_check_pagesafter:nn #1#2 { F , TF }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abspage } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abspage } { \l_@@_ref_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } > { \l_@@_ref_int } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\cs_new_eq:NN \@@_check_ppafter:nnF \@@_check_pagesafter:nnF
+\prg_new_conditional:Npnn \@@_check_facing:nn #1#2 { F }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abspage } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abspage } { \l_@@_ref_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+% \end{macrocode}
+% There exists no ``facing'' page if the document is not twoside.
+% \begin{macrocode}
+ \legacy_if_p:n { @twoside } &&
+% \end{macrocode}
+% Now we test ``facing''.
+% \begin{macrocode}
+ (
+ (
+ \int_if_odd_p:n { \l_@@_ref_int } &&
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } = { \l_@@_ref_int - 1 }
+ ) ||
+ (
+ \int_if_even_p:n { \l_@@_ref_int } &&
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } = { \l_@@_ref_int + 1 }
+ )
+ ) &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Close / Far}
+%
+% \begin{macro}{\@@_check_close:nn, \@@_check_far:nn}
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_check_close:nn #1#2 { F , TF }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abspage } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abspage } { \l_@@_ref_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \int_abs:n { \l_@@_lbl_int - \l_@@_ref_int } }
+ <
+ { \l_@@_close_range_int + 1 } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\prg_new_conditional:Npnn \@@_check_far:nn #1#2 { F }
+ {
+ \@@_check_close:nnTF {#1} {#2}
+ { \prg_return_false: }
+ { \prg_return_true: }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Chapter}
+%
+% \begin{macro}
+% {
+% \@@_check_thischap:nn ,
+% \@@_check_nextchap:nn ,
+% \@@_check_prevchap:nn ,
+% \@@_check_chapsafter:nn ,
+% \@@_check_chapsbefore:nn
+% }
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_check_thischap:nn #1#2 { F }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abschap } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abschap } { \l_@@_ref_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } = { \l_@@_ref_int } &&
+% \end{macrocode}
+% `0' is the default value of \texttt{abschap} property, and means here no
+% \cs{chapter} has yet been issued, therefore it cannot be ``this chapter'',
+% nor ``the next chapter'', nor ``the previous chapter'', it is just ``no
+% chapter''. Note, however, that a statement about a ``future'' chapter does
+% not require the ``current'' one to exist. This comment extends to all
+% chapter checks.
+% \begin{macrocode}
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\prg_new_conditional:Npnn \@@_check_nextchap:nn #1#2 { F }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abschap } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abschap } { \l_@@_ref_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } = { \l_@@_ref_int + 1 } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\prg_new_conditional:Npnn \@@_check_prevchap:nn #1#2 { F }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abschap } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abschap } { \l_@@_ref_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } = { \l_@@_ref_int - 1 } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\prg_new_conditional:Npnn \@@_check_chapsafter:nn #1#2 { F }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abschap } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abschap } { \l_@@_ref_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } > { \l_@@_ref_int } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\prg_new_conditional:Npnn \@@_check_chapsbefore:nn #1#2 { F }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abschap } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abschap } { \l_@@_ref_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } < { \l_@@_ref_int } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Section}
+%
+% \begin{macro}
+% {
+% \@@_check_thissec:nn ,
+% \@@_check_nextsec:nn ,
+% \@@_check_prevsec:nn ,
+% \@@_check_secsafter:nn ,
+% \@@_check_secsbefore:nn
+% }
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_check_thissec:nn #1#2 { F }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abssec } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abssec } { \l_@@_ref_int }
+ \zrefcheck_get_asint:nnn {#1} { abschap } { \l_@@_lbl_b_int }
+ \zrefcheck_get_asint:nnn {#2} { abschap } { \l_@@_ref_b_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_b_int } = { \l_@@_ref_b_int } &&
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } = { \l_@@_ref_int } &&
+% \end{macrocode}
+% `0' is the default value of \texttt{abssec} property, and means here no
+% \cs{section} has yet been issued since its counter has been reset, which
+% occurs at the beginning of the document and at every chapter. Hence, as is
+% the case for chapters, `0' is just ``not a section''. The same observation
+% about the need of the ``current'' section to exist to be able to refer to a
+% ``future'' one also holds. This comment extends to all section checks.
+% \begin{macrocode}
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\prg_new_conditional:Npnn \@@_check_nextsec:nn #1#2 { F }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abssec } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abssec } { \l_@@_ref_int }
+ \zrefcheck_get_asint:nnn {#1} { abschap } { \l_@@_lbl_b_int }
+ \zrefcheck_get_asint:nnn {#2} { abschap } { \l_@@_ref_b_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_b_int } = { \l_@@_ref_b_int } &&
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } = { \l_@@_ref_int + 1 } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\prg_new_conditional:Npnn \@@_check_prevsec:nn #1#2 { F }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abssec } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abssec } { \l_@@_ref_int }
+ \zrefcheck_get_asint:nnn {#1} { abschap } { \l_@@_lbl_b_int }
+ \zrefcheck_get_asint:nnn {#2} { abschap } { \l_@@_ref_b_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_b_int } = { \l_@@_ref_b_int } &&
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } = { \l_@@_ref_int - 1 } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\prg_new_conditional:Npnn \@@_check_secsafter:nn #1#2 { F }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abssec } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abssec } { \l_@@_ref_int }
+ \zrefcheck_get_asint:nnn {#1} { abschap } { \l_@@_lbl_b_int }
+ \zrefcheck_get_asint:nnn {#2} { abschap } { \l_@@_ref_b_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_b_int } = { \l_@@_ref_b_int } &&
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } > { \l_@@_ref_int } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+\prg_new_conditional:Npnn \@@_check_secsbefore:nn #1#2 { F }
+ {
+ \group_begin:
+ \bool_set_true:N \l_@@_integer_bool
+ \zrefcheck_get_asint:nnn {#1} { abssec } { \l_@@_lbl_int }
+ \zrefcheck_get_asint:nnn {#2} { abssec } { \l_@@_ref_int }
+ \zrefcheck_get_asint:nnn {#1} { abschap } { \l_@@_lbl_b_int }
+ \zrefcheck_get_asint:nnn {#2} { abschap } { \l_@@_ref_b_int }
+ \bool_lazy_and:nnTF
+ { \l_@@_integer_bool }
+ {
+ \int_compare_p:nNn
+ { \l_@@_lbl_b_int } = { \l_@@_ref_b_int } &&
+ \int_compare_p:nNn
+ { \l_@@_lbl_int } < { \l_@@_ref_int } &&
+ ! \int_compare_p:nNn { \l_@@_lbl_int } = { 0 } &&
+ ! \int_compare_p:nNn { \l_@@_ref_int } = { 0 }
+ }
+ { \group_insert_after:N \prg_return_true: }
+ { \group_insert_after:N \prg_return_false: }
+ \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \PrintIndex
+%
+% \end{implementation}
+%
diff --git a/macros/latex/contrib/zref-check/zref-check.ins b/macros/latex/contrib/zref-check/zref-check.ins
new file mode 100644
index 0000000000..4a18782a2d
--- /dev/null
+++ b/macros/latex/contrib/zref-check/zref-check.ins
@@ -0,0 +1,98 @@
+% \iffalse meta-comment
+%
+% File: zref-check.ins
+%
+% This file is part of the LaTeX package "zref-check".
+%
+% Copyright (C) 2021 Gustavo Barros
+%
+% It 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:
+%
+% https://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+%
+% This work is "maintained" (as per LPPL maintenance status) by
+% Gustavo Barros.
+%
+% This work consists of the files zref-check.dtx,
+% zref-check.ins,
+% zref-check.tex,
+% zref-check-code.tex,
+% and the derived files zref-check.sty and
+% zref-check.pdf,
+% zref-check-code.pdf.
+%
+% The released version of this package is available from CTAN.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the package can be found at
+%
+% https://github.com/gusbrs/zref-check
+%
+% for those people who are interested.
+%
+% -----------------------------------------------------------------------
+%
+% \fi
+
+\input l3docstrip.tex
+
+\keepsilent
+
+\askforoverwritefalse
+
+\preamble
+
+This file was generated from file(s) of the LaTeX package "zref-check".
+
+Copyright (C) 2021 Gustavo Barros
+
+It 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:
+
+ https://www.latex-project.org/lppl.txt
+
+and version 1.3 or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+
+This work is "maintained" (as per LPPL maintenance status) by
+ Gustavo Barros.
+
+This work consists of the files zref-check.dtx,
+ zref-check.ins,
+ zref-check.tex,
+ zref-check-code.tex,
+ and the derived files zref-check.sty and
+ zref-check.pdf,
+ zref-check-code.pdf.
+
+The released version of this package is available from CTAN.
+
+-----------------------------------------------------------------------
+
+The development version of the package can be found at
+
+ https://github.com/gusbrs/zref-check
+
+for those people who are interested.
+
+-----------------------------------------------------------------------
+
+\endpreamble
+
+\postamble
+\endpostamble
+
+\generate{\file{zref-check.sty}{\from{zref-check.dtx}{package}}}
+
+\endbatchfile
diff --git a/macros/latex/contrib/zref-check/zref-check.pdf b/macros/latex/contrib/zref-check/zref-check.pdf
new file mode 100644
index 0000000000..ffdf333037
--- /dev/null
+++ b/macros/latex/contrib/zref-check/zref-check.pdf
Binary files differ
diff --git a/macros/latex/contrib/zref-check/zref-check.tex b/macros/latex/contrib/zref-check/zref-check.tex
new file mode 100644
index 0000000000..0edf9557f8
--- /dev/null
+++ b/macros/latex/contrib/zref-check/zref-check.tex
@@ -0,0 +1,89 @@
+% \iffalse meta-comment
+%
+% File: zref-check.tex
+%
+% This file is part of the LaTeX package "zref-check".
+%
+% Copyright (C) 2021 Gustavo Barros
+%
+% It 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:
+%
+% https://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+%
+% This work is "maintained" (as per LPPL maintenance status) by
+% Gustavo Barros.
+%
+% This work consists of the files zref-check.dtx,
+% zref-check.ins,
+% zref-check.tex,
+% zref-check-code.tex,
+% and the derived files zref-check.sty and
+% zref-check.pdf,
+% zref-check-code.pdf.
+%
+% The released version of this package is available from CTAN.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the package can be found at
+%
+% https://github.com/gusbrs/zref-check
+%
+% for those people who are interested.
+%
+% -----------------------------------------------------------------------
+%
+% \fi
+
+\documentclass{l3doc}
+
+% Have \GetFileInfo pick up date and version data
+\usepackage{zref-check}
+
+\NewDocumentCommand\opt{m}{\texttt{#1}}
+
+\begin{document}
+
+\GetFileInfo{zref-check.sty}
+
+\title{%
+ The \pkg{zref-check} package%
+ \thanks{This file describes \fileversion, last revised \filedate.}%
+}
+
+\author{%
+ Gustavo Barros%
+ \thanks{\url{https://github.com/gusbrs/zref-check}}%
+}
+
+\date{\filedate}
+
+\maketitle
+
+\begin{abstract}
+ \pkg{zref-check} provides an user interface for making \LaTeX{}
+ cross-references flexibly, while allowing to have them checked for
+ consistency with the document structure as typeset. Statements such as
+ ``above'', ``on the next page'', ``previously'', ``as will be discussed'',
+ ``on the previous chapter'' and so on can be given to \cs{zcheck} in
+ free-form, and a set of ``checks'' can be specified to be run against a
+ given \texttt{label}, which will result in a warning at compilation time if
+ any of these checks fail. \cs{zctarget} and the \texttt{zcregion}
+ environment are also defined as a means to easily set label targets to
+ arbitrary places in the text which can be referred to by \cs{zcheck}.
+\end{abstract}
+
+\tableofcontents
+
+\DisableImplementation
+
+\DocInput{zref-check.dtx}
+
+\end{document}
diff --git a/macros/unicodetex/latex/nwafuthesis/README.md b/macros/unicodetex/latex/nwafuthesis/README.md
new file mode 100644
index 0000000000..61ae19da66
--- /dev/null
+++ b/macros/unicodetex/latex/nwafuthesis/README.md
@@ -0,0 +1,33 @@
+The nwafuthesis Class
+LaTeX thesis template for Northwest A&F University, China, v1.00
+
+Overview
+This template supports doctoral or master dissertion and undergraduate thesis in Chinese. With the help of modern LaTeX3 technology, nwafuthesis aims to create a simple interface, a normative format, as well as a hackable class for the users.
+
+At present, nwafuthesis only supports XETEX and LuaTEX engines. nwafuthesis only allows UTF-8 encoding.
+
+The documentation can be found in nwafuthesis.pdf (in Chinese).
+
+Gitee re­pos­i­tory: https://gitee.com/nwafu_nan/nwafuthesis-l3.
+
+Installation
+To install nwafuthesis, you can use one of the following methods:
+
+If you are running TEX Live or MikTeX, the simplest way is to run
+ tlmgr install nwafuthesis
+Get the source from Gitee:
+ git clone git@gitee.com:nwafu_nan/nwafuthesis-l3.git
+Run build-win.bat (on Windows) or build.sh (on Linux) to generate the templates file. This file would be found in a same folder. You can enjoy nwafuthesis here at once.
+
+For permanent installation, you may move the following files into a directory where LaTeX will find them (e.g. TEXMF/tex/LaTeX/nwafuthesis/):
+
+nwafuthesis.cls
+Do not forget to update the filename database afterwards.
+
+Contributing
+Issues and pull requests are always welcome.
+
+License
+This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license or (at your option) any later version.
+
+Copyright (C) 2017–2021 by Nan Geng <nangeng@nwafu.edu.cn>.
diff --git a/macros/unicodetex/latex/nwafuthesis/build-win.bat b/macros/unicodetex/latex/nwafuthesis/build-win.bat
new file mode 100755
index 0000000000..e8f223950b
--- /dev/null
+++ b/macros/unicodetex/latex/nwafuthesis/build-win.bat
@@ -0,0 +1,7 @@
+xetex nwafuthesis.dtx &&\
+xelatex nwafuthesis.dtx &&\
+makeindex -s gind.ist -o nwafuthesis.ind nwafuthesis.idx &&\
+makeindex -s gglo.ist -o nwafuthesis.gls nwafuthesis.glo &&\
+xelatex nwafuthesis.dtx &&\
+xelatex nwafuthesis.dtx &&\
+xelatex nwafuthesis.dtx
diff --git a/macros/unicodetex/latex/nwafuthesis/build.sh b/macros/unicodetex/latex/nwafuthesis/build.sh
new file mode 100755
index 0000000000..1e20a7b795
--- /dev/null
+++ b/macros/unicodetex/latex/nwafuthesis/build.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+xetex nwafuthesis.dtx &&\
+xelatex nwafuthesis.dtx &&\
+makeindex -s gind.ist -o nwafuthesis.ind nwafuthesis.idx &&\
+makeindex -s gglo.ist -o nwafuthesis.gls nwafuthesis.glo &&\
+xelatex nwafuthesis.dtx &&\
+xelatex nwafuthesis.dtx &&\
+xelatex nwafuthesis.dtx
diff --git a/macros/unicodetex/latex/nwafuthesis/logo/building.jpg b/macros/unicodetex/latex/nwafuthesis/logo/building.jpg
new file mode 100644
index 0000000000..0feb871593
--- /dev/null
+++ b/macros/unicodetex/latex/nwafuthesis/logo/building.jpg
Binary files differ
diff --git a/macros/unicodetex/latex/nwafuthesis/logo/motto.png b/macros/unicodetex/latex/nwafuthesis/logo/motto.png
new file mode 100644
index 0000000000..ebf42d0f3e
--- /dev/null
+++ b/macros/unicodetex/latex/nwafuthesis/logo/motto.png
Binary files differ
diff --git a/macros/unicodetex/latex/nwafuthesis/logo/nwafu-bar.pdf b/macros/unicodetex/latex/nwafuthesis/logo/nwafu-bar.pdf
new file mode 100644
index 0000000000..13837d2d69
--- /dev/null
+++ b/macros/unicodetex/latex/nwafuthesis/logo/nwafu-bar.pdf
Binary files differ
diff --git a/macros/unicodetex/latex/nwafuthesis/logo/nwafu-circle.pdf b/macros/unicodetex/latex/nwafuthesis/logo/nwafu-circle.pdf
new file mode 100644
index 0000000000..d615a4932e
--- /dev/null
+++ b/macros/unicodetex/latex/nwafuthesis/logo/nwafu-circle.pdf
Binary files differ
diff --git a/macros/unicodetex/latex/nwafuthesis/nwafuthesis-doc.dtx b/macros/unicodetex/latex/nwafuthesis/nwafuthesis-doc.dtx
new file mode 100644
index 0000000000..ded7e6aa8f
--- /dev/null
+++ b/macros/unicodetex/latex/nwafuthesis/nwafuthesis-doc.dtx
@@ -0,0 +1,2115 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2019--2022 by Nan Geng <nangeng@nwafu.edu.cn>
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either
+% version 1.3c of this license or (at your option) any later
+% version. The latest version of this license is in:
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of
+% LaTeX version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Nan Geng.
+%
+% \fi
+%
+% \EnableImplementation
+%
+% \begin{implementation}
+%
+% 代码部分的页边距
+% \newgeometry{
+% left = 2.25 in,
+% right = 1.00 in,
+% top = 1.25 in,
+% bottom = 1.00 in,
+% marginpar = 2.25 in
+% }
+%
+% \subsection{模板文档样式 \cls{nwafudoc}}
+%
+% \changes{v0.4}{2017/07/29}{在 \cls{ctxdoc} 的基础上完成
+% \cls{nwafudoc} 文档类,用于模板手册的编写。}
+%
+% 编写 \LaTeX{} 宏包文档,传统上会采用 \pkg{doc} 宏包或
+% \cls{ltxdoc} 文档类。而对于使用 \LaTeX3 开发的宏包,\cls{l3doc}
+% 文档类将是一个更好的选择。\CTeX{} 宏集所附带的
+% \href{https://github.com/CTeX-org/ctex-kit/blob/master/tool/ctxdoc.cls}
+% {\cls{ctxdoc}} 文档类,则在 \cls{l3doc} 的基础上进行了一些修正,
+% 特别是重新实现了 \env{macrocode} 环境,使之能更好地应用于中文
+% 文档。\cls{ctxdoc} 的主要功能如下:
+%
+% \begin{itemize}
+% \item 注释使用灰色、倾斜字体,以便与一般代码区分;
+% \item 模块、名字空间等使用彩色标注,并添加超链接;
+% \item 自动更新行号宽度;
+% \item 边注中的长命令使用盒子进行缩放,防止溢出;
+% \item 修订记录中将显示修改日期;
+% \item 添加中文支持。
+% \end{itemize}
+%
+% 然而,\cls{ctxdoc} 主要供内部使用,代码较为混乱和随意。
+% 本模板的文档样式(\cls{nwafudoc})为适应具体需求,对其代码
+% 进行了整理,添加了相关注释,并做了一些改动:
+%
+% \begin{itemize}
+% \item 允许模块标记 |<*|\meta{module}|>| 和
+% |</|\meta{module}|>| 出现在行号左侧;
+% \item 不再以直立、倾斜字体区分不同嵌套层次的模块;
+% \item 调整索引中版本号的排序方式;
+% \item 新增一系列实用命令;
+% \item 修改文档字体、配色等。
+% \end{itemize}
+%
+% 本文档样式的核心代码主要来自 \cls{ctxdoc} 文档类 v2.4.10。
+% 在此,本人要向原开发者
+% \href{https://github.com/CTeX-org/}{CTEX.ORG}
+% 团队表示由衷的感谢。
+%
+% 以下为 \cls{nwafudoc} 的具体实现。
+%
+% \subsubsection{载入宏包、文档类}
+%
+% \begin{macrocode}
+%<*doc>
+\ExplSyntaxOff
+% \end{macrocode}
+%
+% 无需载入 \pkg{thumbpdf}。
+% \begin{macrocode}
+\@namedef{ver@thumbpdf.sty}{9999/99/99}
+% \end{macrocode}
+%
+% 关闭 \pkg{xparse} 中的命令声明信息。
+% \begin{macrocode}
+\PassOptionsToPackage{log-declarations = false}{xparse}
+% \end{macrocode}
+%
+% 载入宏包和文档类。
+% \begin{macrocode}
+\LoadClass[a4paper, full]{l3doc}
+\RequirePackage[UTF8, heading, sub3section]{ctex}
+% \end{macrocode}
+% 与 \pkg{hypdoc}(由 \cls{l3doc} 调用)冲突,导致脚注超链接
+% 无法正常跳转。暂时禁用。
+% \begin{macrocode}
+% \RequirePackage[stable, bottom]{footmisc}
+\RequirePackage{%
+ caption,
+ geometry,
+ graphicx,
+ listings,
+ makecell,
+ siunitx,
+ tabularx,
+ threeparttable,
+ unicode-math,
+ xcolor,
+ xcolor-material,
+ xunicode,
+ zref-base
+}
+% \end{macrocode}
+%
+% \subsubsection{\env{macrocode} 环境}
+%
+% \paragraph{继承的代码}
+%
+% \begin{macro}[int]{\macro@code}
+% 在 \pkg{doc} 宏包中,\env{macrocode} 环境的核心功能由命令
+% \tn{macro@code} 负责实现,而 \tn{xmacro@code} 只用来结束
+% \env{macrocode} 环境。但在 \cls{l3doc} 以及 \cls{ctxdoc} 中,
+% \tn{xmacro\-@\-code} 则基本接管了 \tn{macro@code} 的功能。
+% 后者此时只起辅助作用。
+% \begin{macrocode}
+\def\macro@code{%
+% \end{macrocode}
+% 调整前后间距,禁止 \env{macrocode} 环境前的分页。
+% \begin{macrocode}
+ \topsep \MacrocodeTopsep
+ \@beginparpenalty \predisplaypenalty
+% \end{macrocode}
+% 将列表前后的附加垂直空白设为 0。根据 \cls{ctxdoc} 修改。
+% \begin{macrocode}
+ \partopsep \z@skip
+% \if@inlabel\leavevmode\fi
+% \end{macrocode}
+% 构建 \env{trivlist} 环境,设置段间距为 0。
+% 之后修改字体,并调节左右间距。\tn{MacroIndent} 会根据代码行数
+% 更新,具体细节见后文。
+% \tn{macro@font} 用来在不同模块见切换字体。本文档类不使用
+% \tn{AltMacroFont},因此这里改用 \tn{MacroFont} 代替。
+% \begin{macrocode}
+ \trivlist \parskip \z@ \item[]%
+% \macro@font
+ \MacroFont
+ \leftskip\@totalleftmargin \advance\leftskip\MacroIndent
+ \rightskip\z@ \parindent\z@ \parfillskip\@flushglue
+% \end{macrocode}
+% 按照 \LaTeXe{} 中 \tn{verbatim} 环境中定义 \tn{par},使得空行
+% 可以原样输出,否则空行会被吃掉。
+% \begin{macrocode}
+ \blank@linefalse \def\par{\ifblank@line
+ \leavevmode\fi
+ \blank@linetrue\@@par
+ \penalty\interlinepenalty}
+% \end{macrocode}
+% \tn{obeylines} 将把回车符 |^^M| 变成 \tn{par}。
+% 接下来将所有特殊符号的类别码设为 12,即“其他”类。
+% \begin{macrocode}
+ \obeylines
+ \let\do\do@noligs \verbatim@nolig@list
+ \let\do\@makeother \dospecials
+% \end{macrocode}
+% 相当于退出 |\begin{list}| 和 |\begin{minipage}|。
+% \begin{macrocode}
+ \global\@newlistfalse
+ \global\@minipagefalse
+% \end{macrocode}
+% 初始化交叉引用功能。
+% \begin{macrocode}
+ \init@crossref}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+%<@@=nwafudoc>
+\ExplSyntaxOn
+% \end{macrocode}
+%
+% \begin{variable}{\l_@@_tmpa_tl,\l_@@_tmpb_tl}
+% 临时变量。
+% \begin{macrocode}
+\tl_new:N \l_@@_tmpa_tl
+\tl_new:N \l_@@_tmpb_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\@@_patch_cmd:Nnn,\@@_preto_cmd:Nn,\@@_appto_cmd:Nn}
+% 补丁工具。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_cmd:Nnn #1#2#3
+ {
+ \ctex_patch_cmd_once:NnnnTF #1 { } {#2} {#3}
+ { } { \ctex_patch_failure:N #1 }
+ }
+\cs_new_protected:Npn \@@_preto_cmd:Nn #1#2
+ {
+ \ctex_preto_cmd:NnnTF #1 { } {#2}
+ { } { \ctex_patch_failure:N #1 }
+ }
+\cs_new_protected:Npn \@@_appto_cmd:Nn #1#2
+ {
+ \ctex_appto_cmd:NnnTF #1 { } {#2}
+ { } { \ctex_patch_failure:N #1 }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \paragraph{代码行处理}
+%
+% \begin{macro}[int]{\xmacro@code,\sxmacro@code}
+% 重新实现 \env{macrocode} 与 \env{macrocode*} 环境的核心功能,
+% 将对代码逐行处理。后者会将空格显示为“\verb*| |”。
+% \begin{macrocode}
+\cs_set_protected_nopar:Npn \xmacro@code
+ { \@@_marco_code:w }
+\cs_set_protected_nopar:Npn \sxmacro@code
+ {
+ \fontspec_print_visible_spaces:
+ \xmacro@code
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_marco_code:w}
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_marco_code:w
+ {
+% \end{macrocode}
+% 根据 \tn{codeline@index} 是否为 |true| 选择是否显示行号。
+% \begin{macrocode}
+ \ifcodeline@index
+ \@@_marco_code_every_par:n { \@@_code_line_no: }
+ \else:
+ \@@_marco_code_every_par:n { }
+ \fi:
+% \end{macrocode}
+% 设置代码段结束标记为“\verb*|% \end{macrocode}^^M|”。
+% \begin{macrocode}
+ \@@_make_finish_tag:x { \@currenvir }
+% \end{macrocode}
+% 开始 \env{macrocode}。
+% \begin{macrocode}
+ \@@_macro_code_start:w
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_marco_code_every_par:n}
+% 在每段之前插入内容。这里每段即相当于每行。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_marco_code_every_par:n #1
+ {
+ \everypar
+ {
+ \everypar {#1}
+ \if@inlabel
+ \global \@inlabelfalse \@noparlistfalse
+ \llap { \box \@labels \hskip \leftskip }
+ \fi
+ #1
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% 设置 \tn{endlinechar} 为 $-1$,表示行末不插入任何字符
+% (实际上相当于在行尾插入注释符 |%|)。
+% \begin{macrocode}
+\group_begin:
+ \int_set:Nn \tex_endlinechar:D { -1 }
+% \end{macrocode}
+%
+% \begin{variable}{\c_@@_active_space_tl}
+% 活动字符类的空格(ASCII 码为 32)。
+% \begin{macrocode}
+ \use:n
+ {
+ \char_set_catcode_active:n { 32 }
+ \tl_const:Nn \c_@@_active_space_tl
+ }
+ { }
+\group_end:
+% \end{macrocode}
+% \end{variable}
+%
+% ASCII 码 13 是回车符 |^^M|。将其设置为活动字符。
+% \begin{macrocode}
+\group_begin:
+ \char_set_catcode_active:n { 13 }
+% \end{macrocode}
+%
+% \begin{macro}{\@@_make_finish_tag:n,\@@_make_finish_tag:x}
+% \env{macrocode} 结尾标记。展开后变成
+% “\verb*|% \end{#1}^^M|”。
+% \begin{macrocode}
+ \cs_new_protected:Npx \@@_make_finish_tag:n #1
+ {
+ \tl_set:Nn \exp_not:N \l_@@_macro_code_finish_tl
+ {
+ \c_percent_str
+ \prg_replicate:nn { 4 }
+ { \exp_not:o { \c_@@_active_space_tl } }
+ \exp_not:o { \active@escape@char } end
+ \c_left_brace_str #1 \c_right_brace_str
+ \exp_not:N ^^M
+ }
+ }
+ \cs_generate_variant:Nn \@@_make_finish_tag:n { x }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_macro_code_start:w}
+% 开始代码环境。此命令主要是为了防止 |\begin{macrocode}|
+% 后出现多余的空行。
+% \begin{macrocode}
+ \cs_new_protected:Npn \@@_macro_code_start:w #1
+ {
+ \str_if_eq:nnTF {#1} { ^^M }
+ { \@@_macro_code_read_line:w }
+ { \@@_macro_code_read_line:w #1 }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_macro_code_read_line:w}
+% 逐行读取代码,并连同行尾回车符一并存入
+% \cs{l_@@_macro_code_line_tl}。如果该行与结束标记
+% “\verb*|% \end{macrocode}^^M|”相同,则结束此
+% \env{macrocode};否则继续处理该行代码。
+% \begin{macrocode}
+ \cs_new_protected:Npn \@@_macro_code_read_line:w #1 ^^M
+ {
+ \tl_set:Nn \l_@@_macro_code_line_tl { #1 ^^M }
+ \tl_if_eq:NNTF
+ \l_@@_macro_code_line_tl \l_@@_macro_code_finish_tl
+ { \exp_args:Nx \end { \@currenvir } }
+ {
+ \@@_macro_code_process_line:
+ \@@_macro_code_read_line:w
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \changes{v0.4}{2017/08/09}{[\pkg{nwafudoc}] 修复 \cls{ctxdoc}
+% 文档类 v2.4.10 之前版本中行距偏小的问题,见 ctex-kit
+% \href{https://github.com/CTeX-org/ctex-kit/issues/303}{\#303}。}
+%
+% \begin{macro}{\@@_swap_cr:,\@@_swap_cr_aux:w}
+% 把 \cs{l_@@_macro_code_line_tl} 中的回车符 |^^M| 挪到外面。
+% \begin{macrocode}
+ \cs_new_protected:Npn \@@_swap_cr:
+ {
+ \exp_after:wN
+ \@@_swap_cr_aux:w \l_@@_macro_code_line_tl
+ }
+ \cs_new_protected:Npn \@@_swap_cr_aux:w #1 ^^M
+ {
+ \group_insert_after:N ^^M
+ \tl_set:Nn \l_@@_macro_code_line_tl {#1}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{variable}{\c_@@_active_cr_tl}
+% 活动字符类的回车符。
+% \begin{macrocode}
+ \tl_const:Nn \c_@@_active_cr_tl { ^^M }
+\group_end:
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_macro_code_line_tl,
+% \l_@@_macro_code_finish_tl,
+% \g_@@_macro_code_verbatim_stop_tl}
+% 分别用来存储代码行、\env{macrocode} 结束标记以及抄录停止标记。
+% \begin{macrocode}
+\tl_new:N \l_@@_macro_code_line_tl
+\tl_new:N \l_@@_macro_code_finish_tl
+\tl_new:N \g_@@_macro_code_verbatim_stop_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\@@_process_normal_line:}
+% 普通代码行根据开头字符分别处理。
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_process_normal_line:
+ {
+ \str_case_e:nnF
+ { \str_head:N \l_@@_macro_code_line_tl }
+ {
+% \end{macrocode}
+% 以 |%| 开头的行先由 \cs{tl_tail:N} 去掉 |%|,之后再检查 |<|。
+% \begin{macrocode}
+ { \c_percent_str }
+ {
+ \@@_check_angle:x
+ { \tl_tail:N \l_@@_macro_code_line_tl }
+ }
+% \end{macrocode}
+% 以 |#| 开头的行按注释的格式输出。
+% \begin{macrocode}
+ { \c_hash_str }
+ { \@@_output_comment_line: }
+ }
+% \end{macrocode}
+% 其余正常输出。
+% \begin{macrocode}
+ { \@@_output_line: }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_process_verbatim_line:}
+% 处理抄录代码行(不检查 |%| 与 |<|)。
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_process_verbatim_line:
+ {
+% \end{macrocode}
+% 将该行与抄录停止标记进行比较。
+% \begin{macrocode}
+ \tl_if_eq:NNTF \l_@@_macro_code_line_tl
+ \g_@@_macro_code_verbatim_stop_tl
+% \end{macrocode}
+% 若相同,则结束抄录环境,清空抄录停止标记,并输出该标记;
+% \begin{macrocode}
+ {
+ \tl_gclear:N \g_@@_macro_code_verbatim_stop_tl
+ \cs_gset_eq:NN \@@_macro_code_process_line:
+ \@@_process_normal_line:
+ \@@_output_module:nn
+ { \color { verb@guard } }
+ {
+ \@@_swap_cr:
+ \@@_module_pop:n { \l_@@_macro_code_line_tl }
+ }
+ }
+% \end{macrocode}
+% 否则直接输出抄录代码。
+% \begin{macrocode}
+ { \tl_use:N \l_@@_macro_code_line_tl }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_macro_code_process_line:}
+% 处理代码行。该命令的作用如下:
+% \begin{itemize}
+% \item 正常情况下,等同于 \cs{@@_process_normal_line:};
+% \item 在 \cs{DontCheckModules} 之后,等价于
+% \cs{@@_output_line:},即不检查模块标记,直接输出;
+% \item 在抄录环境中,等价于 \cs{@@_process_verbatim_line:},
+% 此时将不再特殊处理以 |%| 开头的代码行。
+% \end{itemize}
+% \begin{macrocode}
+\cs_new_eq:NN \@@_macro_code_process_line:
+ \@@_process_normal_line:
+% \end{macrocode}
+% \end{macro}
+%
+% \paragraph{模块标记处理}
+%
+% \begin{macro}{\CheckModules,\DontCheckModules}
+% 选择是否检查模块标记。这两个命令在 \pkg{doc} 宏包中已有定义,
+% 此处重新声明。
+% \begin{macrocode}
+\DeclareDocumentCommand \CheckModules { }
+ {
+ \cs_set_eq:NN \@@_macro_code_process_line:
+ \@@_process_normal_line:
+ }
+\DeclareDocumentCommand \DontCheckModules { }
+ {
+ \cs_set_eq:NN \@@_macro_code_process_line:
+ \@@_output_line:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_check_angle:n,\@@_check_angle:x}
+% 检查第一个字符是否是 |<|。若是,则检查模块;否则立刻输出改行。
+% 该函数的参数不带 |%|。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_check_angle:n #1
+ {
+ \str_if_eq:eeTF { \str_head:n {#1} } { < }
+ { \@@_check_module:x { \tl_tail:n {#1} } }
+ { \@@_output_comment_line: }
+ }
+\cs_generate_variant:Nn \@@_check_angle:n { x }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_check_module:n,\@@_check_module:x}
+% 检查紧跟 |<| 之后的字符。共有四种情况:
+% \begin{itemize}
+% \item |*|:模块开始(|%<*|\meta{module}|>|);
+% \item |/|:模块结束(|%</|\meta{module}|>|);
+% \item |@|:名字空间(|%<@@=|\meta{namespace}|>|);
+% \item |<|:抄录环境开始(|%<<|\meta{end-tag})。
+% \end{itemize}
+% 若不是这几种情况,则为单独一行的独立模块
+% (|%<|\meta{module}|>|)。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_check_module:n #1
+ {
+ \str_case_e:nnF { \str_head:n {#1} }
+ {
+ { * } { \@@_module_star:w }
+ { / } { \@@_module_slash:w }
+ { @ } { \@@_module_at:w }
+ { < } { \@@_module_verb:w }
+ }
+ { \@@_module_pm:w }
+% \end{macrocode}
+% 参数 |#1| 将被上面几个 |:w| 型函数吃掉。
+% \begin{macrocode}
+ #1 \q_stop
+ }
+\cs_generate_variant:Nn \@@_check_module:n { x }
+% \end{macrocode}
+% \end{macro}
+%
+% 设置 |>| 为活动字符。
+% \begin{macrocode}
+\group_begin:
+ \char_set_catcode_active:N \>
+% \end{macrocode}
+%
+% \begin{macro}{\@@_module_star:w}
+% 模块开始标记。
+% \begin{arguments}
+% \item |*|\meta{module}
+% \item 之后的代码
+% \end{arguments}
+% \begin{macrocode}
+ \cs_new_protected:Npn \@@_module_star:w #1 > #2 \q_stop
+ {
+% \end{macrocode}
+% 临时变量 \cs{l_@@_tmp_tl} 保存 |<*|\meta{module}|>|
+% 之后的部分,即真实代码。
+% \begin{macrocode}
+ \tl_set:Nn \l_@@_tmpa_tl {#2}
+% \end{macrocode}
+% 判断该行是否为空(只含一个回车符 |^^M|)。
+% \begin{macrocode}
+ \tl_if_eq:NNTF \l_@@_tmpa_tl \c_@@_active_cr_tl
+% \end{macrocode}
+% 若是,则将 |<|\meta{module}|>| 放在行号的右侧;
+% \begin{macrocode}
+ {
+ \@@_output_module:nn
+ { \@@_star_color: }
+ {
+ \@@_module_push:n
+ { \@@_module_angle:n {#1} }
+ }
+ }
+% \end{macrocode}
+% 否则放在左侧,并输出相应代码。
+% \begin{macrocode}
+ {
+ \@@_output_module_left:nn
+ { \@@_star_color: }
+ {
+ \@@_module_push:n
+ { \@@_module_angle:n {#1} }
+ }
+ }
+ \@@_output_line:n {#2}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_module_slash:w}
+% 模块结束标记。结构与 \cs{@@_module_star:w} 相同。
+% \begin{arguments}
+% \item |/|\meta{module}
+% \item 之后的代码
+% \end{arguments}
+% \begin{macrocode}
+ \cs_new_protected:Npn \@@_module_slash:w #1 > #2 \q_stop
+ {
+ \tl_set:Nn \l_@@_tmpa_tl {#2}
+ \tl_if_eq:NNTF \l_@@_tmpa_tl \c_@@_active_cr_tl
+ {
+ \@@_output_module:nn
+ { \@@_slash_color: }
+ {
+ \@@_module_pop:n
+ { \@@_module_angle:n {#1} }
+ }
+ }
+ {
+ \@@_output_module_left:nn
+ { \@@_slash_color: }
+ {
+ \@@_module_pop:n
+ { \@@_module_angle:n {#1} }
+ }
+ }
+ \@@_output_line:n {#2}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_module_at:w}
+% 名字空间。
+% \begin{arguments}
+% \item 名字空间的名称(不含 |@@=|)
+% \item 之后的代码
+% \end{arguments}
+% \begin{macrocode}
+ \cs_new_protected:Npn \@@_module_at:w @ @ = #1 > #2 \q_stop
+ {
+ \@@_output_module:nn
+ { \color { at@guard } }
+ { \@@_module_angle:n { @ @ = #1 } }
+% \end{macrocode}
+% 设置名字空间为 |#1|。\cls{l3doc} 中将名字空间称为
+% “模块”(module),注意不要混淆。
+% \begin{macrocode}
+ \tl_gset:Nn \g__codedoc_module_name_tl {#1}
+ \@@_output_line:n {#2}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_module_verb:w}
+% 抄录开始。|#1|: |<|\meta{end-tag},只有一个 |<|。
+% \meta{end-tag} 的最后会带有一个回车符 |^^M|。
+% \begin{macrocode}
+ \cs_new_protected:Npn \@@_module_verb:w #1 \q_stop
+ {
+% \end{macrocode}
+% 重定义 \cs{@@_macro_code_process_line:},用以输出抄录行。
+% \begin{macrocode}
+ \cs_gset_eq:NN \@@_macro_code_process_line:
+ \@@_process_verbatim_line:
+% \end{macrocode}
+% 设置抄录停止标记。用 \cs{tl_tail:n} 去掉开头的 |<|。
+% \begin{macrocode}
+ \tl_gset:Nx \g_@@_macro_code_verbatim_stop_tl
+ { \c_percent_str \tl_tail:n {#1} }
+% \end{macrocode}
+% 输出 |%<<|\meta{end-tag}。
+% \begin{macrocode}
+ \@@_output_module:nn
+ { \color { verb@guard } }
+ {
+ \@@_swap_cr:
+ \@@_module_push:n { \l_@@_macro_code_line_tl }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_module_pm:w}
+% 处理单独一行的模块。|<|\meta{module}|>| 放在行号的左侧。
+% \begin{arguments}
+% \item \meta{module}
+% \item 之后的代码
+% \end{arguments}
+% \begin{macrocode}
+ \cs_new_protected:Npn \@@_module_pm:w #1 > #2 \q_stop
+ {
+ \@@_output_module_left:nn
+ { \@@_pm_color: }
+ { \@@_module_angle:n {#1} }
+ \@@_output_line:n {#2}
+ }
+\group_end:
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_output_line:n,\@@_output_line:}
+% 输出代码行。参数将被存入 \cs{l_@@_macro_code_line_tl},
+% 再由不带参数的版本调用。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_output_line:n #1
+ {
+ \tl_set:Nn \l_@@_macro_code_line_tl {#1}
+% \end{macrocode}
+% 若为空行(只含一个 |^^M|),则直接输出(换行)。
+% \begin{macrocode}
+ \tl_if_eq:NNTF
+ \l_@@_macro_code_line_tl \c_@@_active_cr_tl
+ { \tl_use:N \l_@@_macro_code_line_tl }
+ {
+% \end{macrocode}
+% 检查开头是否为 |%|,据此分别处理。
+% \begin{macrocode}
+ \str_if_eq:eeTF
+ { \str_head:N \l_@@_macro_code_line_tl } { \c_percent_str }
+ { \@@_output_comment_line: } { \@@_output_line: }
+ }
+ }
+\cs_new_protected_nopar:Npn \@@_output_line:
+ {
+ \tex_noindent:D
+% \end{macrocode}
+% 此处将把 |@@| 替换为相应的名字空间。
+% \begin{macrocode}
+ \@@_replace_at_at:N \l_@@_macro_code_line_tl
+ \tl_use:N \l_@@_macro_code_line_tl
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_output_comment_line:}
+% 输出注释代码行。用灰色、斜体显示。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_output_comment_line:
+ {
+ \tex_noindent:D
+ \group_begin:
+ \__nwafudoc_swap_cr:
+ \color { code@gray } \slshape \@@_output_line:
+ \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_replace_at_at:N,
+% \@@_replace_at_at_aux:Nn,\@@_replace_at_at_aux:No}
+% 把 |@@| 替换为相应的名字空间。其名称存放在全局变量
+% \cs{g__codedoc_module_name_tl} 中。
+% 它为空时(|%<@@=>|),不做替换。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_replace_at_at:N #1
+ {
+ \tl_if_empty:NF \g__codedoc_module_name_tl
+ { \@@_replace_at_at_aux:No #1 \g__codedoc_module_name_tl }
+ }
+\cs_new_protected:Npn \@@_replace_at_at_aux:Nn #1#2
+ {
+% \end{macrocode}
+% 以下代码分别对应两种名字空间的替换:
+% \begin{itemize}
+% \item 内部变量:|\|\meta{type}|_@@_|\meta{name} $\to$
+% |\|\meta{type}|__|\meta{namespace}|_|\meta{name};
+% \item 内部函数:|\@@_|\meta{name}” $\to$
+% |\__|\meta{namespace}|_|\meta{name}”)。
+% \end{itemize}
+% \begin{macrocode}
+ \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 }
+ \tl_replace_all:Nnn #1 { @ @ } { _ _ #2 }
+ }
+\cs_generate_variant:Nn \@@_replace_at_at_aux:Nn { No }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_module_push:n,
+% \@@_module_push_aux:nn,\@@_module_push_aux:on}
+% 将模块名压入栈中。此处的栈主要用来处理模块名(包括抄录标记)
+% 之间的超链接。
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_module_push:n
+ { \@@_module_push_aux:on { \int_use:N \c@HD@hypercount } }
+\cs_new_protected:Npn \@@_module_push_aux:nn #1
+ {
+ \seq_gpush:Nn \g_@@_module_dest_seq {#1}
+ \hypersetup { hidelinks }
+ \exp_args:Nx \hdclindex
+ { \zref@extractdefault { HD.#1 } { guard@end } { 1 } } { }
+ }
+\cs_generate_variant:Nn \@@_module_push_aux:nn { on }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_module_pop:n,
+% \@@_module_pop_aux:nn,\@@_module_pop_aux:on}
+% 将模块名释放出栈。
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_module_pop:n
+ {
+ \seq_gpop:NNTF \g_@@_module_dest_seq \l_@@_tmpa_tl
+ { \@@_module_pop_aux:on { \l_@@_tmpa_tl } }
+ { \BOOM \use:n }
+ }
+\cs_new_protected:Npn \@@_module_pop_aux:nn #1
+ {
+ \zref@labelbylist { HD.#1 } { nwafudoc }
+ \hypersetup { hidelinks }
+ \hdclindex {#1} { }
+ }
+\cs_generate_variant:Nn \@@_module_pop_aux:nn { on }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{variable}{\g_@@_module_dest_seq}
+% 存放模块名的序列(栈)。
+% \begin{macrocode}
+\seq_new:N \g_@@_module_dest_seq
+% \end{macrocode}
+% \end{variable}
+%
+% 处理行号超链接。使用 \pkg{zref} 宏包。
+% \begin{macrocode}
+\zref@newlist { nwafudoc }
+\zref@newprop { guard@end } [ 1 ]
+ { \int_eval:n { \c@HD@hypercount - 1 } }
+\zref@addprop { nwafudoc } { guard@end }
+% \end{macrocode}
+%
+% \paragraph{格式处理}
+%
+% \begin{macro}{\MacroFont}
+% 代码部分的字体。
+% \begin{macrocode}
+\cs_set_protected:Npn \MacroFont
+ {
+ \linespread { 1.05 }
+ \small \ttfamily \mdseries \upshape
+ \@@_verb_addon:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_output_module:nn,\@@_output_module_left:nn}
+% 输出模块名(分行内和行号左侧两种)。
+% \begin{arguments}
+% \item 颜色等样式
+% \item 模块名
+% \end{arguments}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_output_module:nn #1#2
+ {
+ \tex_noindent:D
+ \group_begin:
+ #1
+ \footnotesize \normalfont \sffamily #2
+ \group_end:
+ }
+\cs_new_protected:Npn \@@_output_module_left:nn #1#2
+ {
+ \tex_noindent:D
+ \hbox_overlap_left:n
+ {
+ \@@_output_module:nn {#1} {#2}
+ \skip_horizontal:n { \leftskip + \smallskipamount }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_star_color:,\@@_slash_color:,\@@_pm_color:}
+% 选择模块标记的颜色。模块标记的颜色会根据嵌套层次而改变。
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_star_color:
+ {
+ \seq_gpop:NNTF \g_@@_star_color_seq \current@color
+ { \set@color }
+ { \@@_select_color: }
+ \seq_gpush:No \g_@@_slash_color_seq { \current@color }
+ }
+\cs_new_protected_nopar:Npn \@@_slash_color:
+ {
+ \seq_gpop:NNTF \g_@@_slash_color_seq \current@color
+ {
+ \set@color
+ \seq_gpush:No \g_@@_star_color_seq { \current@color }
+ }
+% TODO: 需要报错:star 与 slash 没有匹配
+ { \BOOM }
+ }
+\cs_new_protected_nopar:Npn \@@_pm_color:
+ {
+ \seq_get:NNTF \g_@@_star_color_seq \current@color
+ { \set@color }
+ {
+ \@@_select_color:
+ \seq_gpush:No \g_@@_star_color_seq { \current@color }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{variable}{\g_@@_star_color_seq,\g_@@_slash_color_seq}
+% 存放模块标记颜色的序列。
+% \begin{macrocode}
+\seq_new:N \g_@@_star_color_seq
+\seq_new:N \g_@@_slash_color_seq
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\@@_select_color:}
+% \begin{macro}[int]{guard@series}
+% 设置模块标记的色系。
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_select_color:
+ { \color { guard@series!!+ } }
+\definecolorseries { guard@series }
+ { cmyk } { last } { blue } { purple }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% 设置色系的增量大小。可选参数 |3| 意味着基色(blue)与
+% 末色(purple)之间将等分为三份。该数字比嵌套最大深度小 1。
+% \begin{macrocode}
+\resetcolorseries [ 3 ] { guard@series }
+% \end{macrocode}
+%
+% \begin{macro}[int]{verb@guard,at@guard,code@gray}
+% 设置颜色。
+% \begin{macrocode}
+\definecolor { verb@guard } { named } { MaterialLime600 }
+\definecolor { at@guard } { named } { MaterialPink }
+\definecolor { code@gray } { named } { MaterialGrey }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_module_angle:n}
+% 输出“$\langle\cdots\rangle$”。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_module_angle:n #1
+ { < #1 > }
+% { \textlangle #1 \textrangle }
+% { \ensuremath \langle #1 \ensuremath \rangle }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_code_line_no:}
+% 行号。设置为阿拉伯数字。
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_code_line_no:
+ {
+ \int_gincr:N \c@CodelineNo
+ \hbox_overlap_left:n
+ {
+ \hbox_to_wd:nn
+ { \MacroIndent }
+ {
+ \HD@target
+ \tex_hss:D \@@_code_line_no_style:
+ \theCodelineNo \enspace
+ }
+ \tex_kern:D \@totalleftmargin
+ }
+ }
+\tl_set:Nn \theCodelineNo { \arabic { CodelineNo } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_code_line_no_style:}
+% 行号格式。
+% \begin{macrocode}
+\cs_new_protected_nopar:Npn \@@_code_line_no_style:
+ { \color { code@gray } \normalfont \sffamily \tiny }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{\HD@SetMacroIndent}
+% 设置代码缩进(行号一栏的宽度)。该命令会写进 |.aux| 辅助文件,
+% 以便在二次编译时确定最大行号宽度。
+% \begin{macrocode}
+\cs_set_protected:Npn \HD@SetMacroIndent #1
+ {
+ \group_begin:
+ \settowidth \MacroIndent
+ {
+ \@@_code_line_no_style:
+ \prg_replicate:nn { \tl_count:n {#1} } { 0 }
+ \enspace
+ }
+ \dim_gset_eq:NN \MacroIndent \MacroIndent
+ \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{\env{function} 环境}
+%
+% \begin{macro}{\@@_verb_addon:,
+% \@@_disable_ecglue:,
+% \@@_plain_punct_style:}
+% \begin{macro}[int]{\meta@font@select}
+% 调整文字间距,以便于让 CJK 字符占的宽度等于西文等宽字体中两个
+% 空格的宽度。需要按编译情况分别定义。
+% \begin{macrocode}
+\sys_if_engine_xetex:TF
+ {
+ \cs_set_eq:NN \@@_verb_addon: \xeCJKVerbAddon
+ \cs_set:Nn \@@_plain_punct_style:
+ { \xeCJKsetup { PunctStyle = plain } }
+ \cs_set:Nn \@@_disable_ecglue:
+ { \xeCJKsetup { CJKecglue } }
+ \@@_appto_cmd:Nn \meta@font@select
+ { \mode_if_inner:T { \@@_disable_ecglue: } }
+ }
+ {
+ \cs_set_eq:NN \@@_verb_addon: \prg_do_nothing:
+ \cs_set_eq:NN \@@_plain_punct_style: \prg_do_nothing:
+ \cs_set:Nn \@@_disable_ecglue:
+ { \ltjsetparameter { autoxspacing = false } }
+ \@@_appto_cmd:Nn \meta@font@select
+ { \@@_disable_ecglue: }
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{environment}{function}
+% \begin{macro}{\@@_fix_previous_depth:}
+% 调整 \env{function} 环境前后间距。
+% \begin{macrocode}
+\BeforeBeginEnvironment { function }
+ { \par \nointerlineskip }
+\AtEndEnvironment { function }
+ {
+ \par
+ \cs_gset:Nx \@@_fix_previous_depth:
+ { \prevdepth = \the \prevdepth \space }
+ }
+\AfterEndEnvironment { function }
+ { \@@_fix_previous_depth: }
+% \end{macrocode}
+% \end{macro}
+% \end{environment}
+%
+% \begin{environment}{syntax}
+% \begin{environment}{nwafusyntax}
+% 在 \env{syntax} 和 \env{nwafusyntax} 环境前设置若干活动字符。
+% \texttt{\textbar} 用于分隔多个选项,无需倾斜;|<xxx>| 表示选项,
+% |(xxx)| 表示默认选项。原来的括号用宏保存,并且使用直立字体。
+% \env{syntax} 环境另需要额外调整行距、标点样式及字符间距。
+% \begin{macrocode}
+\AtBeginEnvironment { syntax }
+ {
+ \linespread { 1.2 }
+ \@@_plain_punct_style:
+ \@@_disable_ecglue:
+% \char_set_catcode_active:N |
+% \char_set_catcode_active:N (
+% \char_set_active_eq:NN | \orbar
+% \char_set_active_eq:NN ( \defaultval@aux
+ }
+\AtBeginEnvironment { nwafusyntax }
+ {
+ \cs_set:Npn \lparen { \textup { ( } }
+ \cs_set:Npn \rparen { \textup { ) } }
+ \char_set_catcode_active:N |
+ \char_set_catcode_active:N <
+ \char_set_catcode_active:N (
+ \char_set_active_eq:NN | \orbar
+ \char_set_active_eq:NN < \syntaxopt@aux
+ \char_set_active_eq:NN ( \defaultval@aux
+ }
+% \end{macrocode}
+% \end{environment}
+% \end{environment}
+%
+% \subsubsection{修订记录索引项}
+%
+% \begin{macro}{\@@_ltx_changes:nnn}
+% 保存 \pkg{doc} 中 \tn{changes@} 的定义。
+% \begin{macrocode}
+\cs_new_eq:NN \@@_ltx_changes:nnn \changes@
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{\changes@}
+% \changes{v0.4}{2017/07/30}{调整索引排序方式。}
+% 重定义 \tn{changes@},在版本号一行显示修改日期。
+% \begin{macrocode}
+\cs_set_protected:Npn \changes@ #1#2
+ {
+ \@@_save_version_date:nn {#1} {#2}
+ \@@_ltx_changes:nnn {#1} {#2}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{variable}{\g_@@_version_date_prop}
+% 存放版本号与对应的修改日期。
+% key = 版本号,value = \{ 开始日期,结束日期 \}。
+% 开始日期与结束日期可以相同。
+% \begin{macrocode}
+\prop_new:N \g_@@_version_date_prop
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\@@_save_version_date:nn}
+% |nn| 版本最终将被 \tn{changes@} 调用。
+% \begin{arguments}
+% \item 版本号
+% \item 日期
+% \end{arguments}
+% 它们分别对应 \tn{change} 的前两个参数(第三个是说明文字)。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_save_version_date:nn #1#2
+ {
+ \prop_get:NnNTF \g_@@_version_date_prop
+ {#1} \l_@@_tmpa_tl
+ {
+% \end{macrocode}
+% \cs{l_@@_tmp_tl} 相当于两个参数(开始日期、结束日期),
+% 因此需要提前展开。
+% \begin{macrocode}
+ \exp_after:wN
+ \@@_save_version_date_aux:nnnn \l_@@_tmpa_tl
+ {#2} {#1}
+ }
+ { \@@_save_version_date_aux:nnn {#1} {#2} {#2} }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_save_version_date_aux:nnnn}
+% \begin{arguments}
+% \item 原开始日期
+% \item 原结束日期(显然应有 |#1| < |#2|)
+% \item 新读入的日期
+% \item 版本号
+% \end{arguments}
+% 如果 |#3| < |#1|,则读入日期 |#3|、|#2|;
+% 如果 |#3| > |#2|,则读入日期 |#1|、|#3|。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_save_version_date_aux:nnnn #1#2#3#4
+ {
+ \@@_if_date_later:nnTF {#1} {#3}
+ { \@@_save_version_date_aux:nnn {#4} {#3} {#2} }
+ {
+ \@@_if_date_later:nnT {#3} {#2}
+ { \@@_save_version_date_aux:nnn {#4} {#1} {#3} }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_save_version_date_aux:nnn}
+% 将版本号和日期存入 \cs{g_@@_version_date_prop}。
+% \begin{arguments}
+% \item 版本号
+% \item 开始日期
+% \item 结束日期
+% \end{arguments}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_save_version_date_aux:nnn #1#2#3
+ { \prop_gput:Nnn \g_@@_version_date_prop {#1} { {#2} {#3} } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[TF]{\@@_if_date_later:nn}
+% \begin{macro}{\@@_parse_date:w}
+% 比较两个日期。如果 |#1| 在 |#2| 之后,则为 |true|;反之为 |false|。
+% 日期的格式为 YYYY/MM/DD。比较方法是直接将日期化成 8 位数字,
+% 所以月、日前的 0 不可以省略。
+% \begin{macrocode}
+\prg_new_conditional:Npnn \@@_if_date_later:nn #1#2 { TF, T }
+ {
+ \if_int_compare:w
+ \@@_parse_date:w #1 / / / 0 \q_stop >
+ \@@_parse_date:w #2 / / / 0 \q_stop \exp_stop_f:
+ \prg_return_true:
+ \else:
+ \prg_return_false:
+ \fi:
+ }
+\cs_new:Npn \@@_parse_date:w #1/#2/#3/ #4 \q_stop
+ { #1#2#3 }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}[int]{\CTEX@versionitem}
+% 版本条目标签。如果版本号不在 \cs{g_@@_version_date_prop} 的
+% key 里面,则利用未定义的 \cs{BOOM} 报错。
+% \begin{macrocode}
+\cs_new_protected:Npn \CTEX@versionitem #1 \efill
+ {
+ \@idxitem
+ \prop_get:NnNTF \g_@@_version_date_prop
+ {#1} \l_@@_tmpa_tl
+ {
+ \exp_after:wN
+ \@@_print_version_date:nnn \l_@@_tmpa_tl
+ {#1}
+ }
+ { \BOOM }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_print_version_date:nnn}
+% 输出版本号和日期。如果开始日期和结束日期相同,则只输出一项。
+% \begin{arguments}
+% \item 开始日期
+% \item 结束日期
+% \item 版本号
+% \end{arguments}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_print_version_date:nnn #1#2#3
+ {
+ \noindent
+ \Hy@raisedlink { \belowpdfbookmark {#3} { HD.#3 } }
+ \textbf {#3} \hfill
+ \hbox:n
+ {
+ \footnotesize
+ \str_if_eq:nnTF {#1} {#2}
+ { ( #1 ) } { ( #1 ~ -- ~ #2 ) }
+ }
+ \par \nopagebreak
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{\HDorg@theglossary}
+% 该命令由 \pkg{hypdoc} 宏包定义,用于存放标准文档类 \cls{book}
+% 中定义的 \tn{theindex} 命令。
+% 此处的补丁将在版本号一行最后加上修改日期。
+% \begin{macrocode}
+\ctex_patch_cmd:Nnn \HDorg@theglossary
+ { \let \item \@idxitem }
+ { \let \item \CTEX@versionitem }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{\@wrglossary}
+% 该命令由 \LaTeXe{} 内核定义,又由 \pkg{hypdoc} 宏包作了修改。
+% 此处的补丁使得修订记录条目的页码能够指向对应行。
+% \begin{macrocode}
+\ctex_patch_cmd:Nnn \@wrglossary
+ { hdpindex }
+ {
+ \ifnum \c@HD@hypercount = \z@
+ hdpindex
+ \else
+ hdclindex { \the \c@HD@hypercount }
+ \fi
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{命令补丁}
+%
+% \paragraph{\LaTeXe{} 补丁}
+%
+% \begin{macro}[int]{\@addtocurcol}
+% 调整浮动体、代码等与文字的间距。
+% 见 \url{http://tex.stackexchange.com/a/40896}。
+% \begin{macrocode}
+\ctex_patch_cmd:Nnn \@addtocurcol
+ { \vskip \intextsep }
+ {
+ \edef \save@first@penalty { \the \lastpenalty } \unpenalty
+ \ifnum \lastpenalty = \@M
+ \unpenalty
+ \else
+ \penalty \save@first@penalty \relax
+ \fi
+ \ifnum \outputpenalty < -\@Mii
+ \addvspace\intextsep
+ \vskip\parskip
+ \else
+ \addvspace\intextsep
+ \fi
+ }
+\ctex_patch_cmd:Nnn \@addtocurcol
+ {
+ \vskip \intextsep
+ \ifnum \outputpenalty < -\@Mii
+ \vskip -\parskip
+ \fi
+ }
+ {
+ \ifnum \outputpenalty < -\@Mii
+ \aftergroup \vskip \aftergroup \intextsep
+ \aftergroup \nointerlineskip
+ \else
+ \vskip \intextsep
+ \fi
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{\@getpen}
+% 将换行或换页的最大罚值由 \num{10000} 改为 \num{10001}。
+% \begin{macrocode}
+\ctex_patch_cmd:Nnn \@getpen { \@M } { \@Mi }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{\l@section,\l@subsection}
+% 修改目录条目的缩进。
+% \begin{macrocode}
+\ctex_patch_cmd:Nnn \l@section { 2.5em } { 1.5em }
+\ctex_patch_cmd:Nnn \l@subsection { 2.5em } { 1.5em }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{\@thehead}
+% 修改页眉,禁用 \tn{MakeUppercase}。
+% \begin{macrocode}
+\@@_preto_cmd:Nn \@thehead
+ { \cs_set_eq:cN { MakeUppercase \space } \@iden }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\thebibliography}
+% \begin{macro}[int]{\HDorg@thebibliography}
+% 参考文献一节需要编号。
+% \begin{macrocode}
+\ctex_patch_cmd:Nnn \HDorg@thebibliography
+ { \section* } { \section }
+\cs_set_eq:NN \thebibliography \HDorg@thebibliography
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\GlossaryParms}
+% 修改修订记录中的一些缩进。
+% \begin{macrocode}
+\@@_appto_cmd:Nn \GlossaryParms
+ {
+ \raggedcolumns
+ \cs_set_eq:NN \Hy@writebookmark \HDorg@writebookmark
+ \cs_set:Npn \@idxitem { \par \hangindent 2em }
+ \cs_set:Npn \subitem { \@idxitem \hspace* { 1em } }
+ \cs_set:Npn \subsubitem { \@idxitem \hspace* { 2em } }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{\HoLogo@LaTeXe}
+% 由于使用了 \pkg{unicode-math},需要额外修改 \pkg{hologo} 中的
+% \tn{LaTeXe} 命令,以使粗体正常显示。
+% \begin{macrocode}
+\ctex_patch_cmd:Nnn \HoLogo@LaTeXe
+ { \hbox { \HOLOGO@MathSetup 2 $ _{ \textstyle \varepsilon } $ } }
+ {
+ \hbox
+ {
+ \mathsurround 0pt \relax
+ 2
+ \if b \expandafter \@car \f@series \@nil
+ $ _{ \textstyle \symbf { \varepsilon } } $
+ \else
+ $ _{ \textstyle \varepsilon } $
+ \fi
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SpecialMainEnvIndex}
+% 索引汉化。
+% \begin{macrocode}
+\ctex_patch_cmd:Nnn \SpecialMainEnvIndex
+ { (environment) } { ~ 环境 }
+\ctex_patch_cmd:Nnn \SpecialMainEnvIndex
+ { environments: } { 环境: }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{\HDorg@SpecialEnvIndex}
+% \pkg{hypdoc} 宏包重新定义了 \tn{SpecialEnvIndex} 命令,因此需要
+% 修改内部定义。
+% \begin{macrocode}
+\ctex_patch_cmd:Nnn \HDorg@SpecialEnvIndex
+ { (environment) } { ~ 环境 }
+\ctex_patch_cmd:Nnn \HDorg@SpecialEnvIndex
+ { environments: } { 环境: }
+% \end{macrocode}
+% \end{macro}
+%
+% \paragraph{\cls{l3doc} 补丁}
+%
+% \begin{macrocode}
+%<@@=codedoc>
+% \end{macrocode}
+%
+% \begin{macro}{\list}
+% \cls{l3doc} 会设置列表环境中 \tn{listparindent} |=| \tn{z@},
+% 这里将其恢复。
+% \begin{macrocode}
+\cs_set_eq:NN \list \@@_oldlist:nn
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_function_descr_start:w}
+% 抑制首段的 \tn{parskip}。
+% \begin{macrocode}
+\__nwafudoc_patch_cmd:Nnn \@@_function_descr_start:w
+ { \noindent }
+ { \skip_vertical:n { -\parskip } \noindent }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_function_assemble:}
+% 在 \cls{l3doc} 中,\env{function} 环境里的 \env{syntax} 和
+% \env{descr} 盒子中间存在一段 \tn{med\-skip\-amount} 的距离。
+% 但是如果 \env{syntax} 盒子为空(未使用 \env{syntax} 环境),
+% 就会显得不好看。此时通过把 \tn{medskipamount} 设置为零来修正。
+% 若盒子非空,则把 \tn{parskip} 还回去。
+% \begin{macrocode}
+\__nwafudoc_preto_cmd:Nn \@@_function_assemble:
+ {
+ \box_if_empty:NTF \g_@@_syntax_box
+ { \skip_zero:N \medskipamount }
+ { \skip_add:Nn \medskipamount { \parskip } }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_typeset_functions:}
+% 调整 \env{function} 环境的字体。
+% \begin{macrocode}
+\__nwafudoc_patch_cmd:Nnn \@@_typeset_functions:
+ { \small \ttfamily } { \footnotesize \ttfamily }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_typeset_functions:,\@@_macro_init:,
+% \@@_macro_dump:}
+% 左侧边注的函数列表采用单倍行距。
+% \begin{macrocode}
+\__nwafudoc_preto_cmd:Nn \@@_typeset_functions:
+ { \MacroFont }
+\__nwafudoc_patch_cmd:Nnn \@@_macro_init:
+ { \hbox:n } { \MacroFont \hbox:n }
+\__nwafudoc_patch_cmd:Nnn \@@_macro_dump:
+ { \hbox_unpack_drop:N } { \MacroFont \hbox_unpack_drop:N }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_meta_original:n}
+% 改用文本模式显示尖括号。
+% \begin{macrocode}
+\__nwafudoc_patch_cmd:Nnn \@@_meta_original:n
+ { \ensuremath \langle } { \textlangle }
+\__nwafudoc_patch_cmd:Nnn \@@_meta_original:n
+ { \ensuremath \rangle } { \textrangle }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_macro_end_style:n}
+% 禁止显示 \env{macro} 环境最后的 “(\emph{End definition for ...})”。
+% \begin{macrocode}
+\cs_set_eq:NN \@@_macro_end_style:n \use_none:n
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_typeset_TF:}
+% 关闭 |TF| 上的超链接,并且保证颜色与函数主体一致。
+% \begin{macrocode}
+\cs_set_protected:Npn \@@_typeset_TF:
+ {
+ \group_begin:
+ \exp_args:No \@@_if_macro_internal:nT \l_@@_tmpa_tl
+ { \color [ gray ] { 0.5 } }
+ \itshape TF
+ \makebox [ 0 pt ] [ r ]
+ {
+ \color { red }
+ \underline { \phantom { \itshape TF } \kern -0.1 em }
+ }
+ \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_macro_typeset_one:nN}
+% 在 \env{macro} 环境的侧边栏中,\cls{l3doc} 根据命令的长短,分别用
+% 普通字体和紧缩字体输出。然而很长的命令还是会超出页边。这里用缩放
+% 盒子的手段使得长命令也可正常显示。
+% \begin{macrocode}
+\cs_set_protected:Npn \@@_macro_typeset_one:nN #1#2
+ {
+ \vbox_set:Nn \l_@@_macro_box
+ {
+ \MacroFont
+ \vbox_unpack_drop:N \l_@@_macro_box
+ \hbox_set:Nn \l_tmpa_box
+ { \@@_print_macroname:nN {#1} #2 }
+% \end{macrocode}
+% \tn{marginparwidth} 和 \tn{marginparsep} 分别是边注的宽度及其到
+% 版心的距离,\tn{la\-bel\-sep} 则是编号盒子右端与条目首行文本之间
+% 的距离。
+% \begin{macrocode}
+ \dim_set:Nn \l_tmpa_dim
+ { \marginparwidth - \labelsep - \marginparsep }
+ \dim_compare:nNnT { \box_wd:N \l_tmpa_box } > \l_tmpa_dim
+ {
+ \box_resize_to_wd_and_ht:Nnn \l_tmpa_box
+ { \l_tmpa_dim } { \box_ht:N \l_tmpa_box }
+ }
+ \hbox_overlap_left:n
+ {
+ \box_use:N \l_tmpa_box
+ \skip_horizontal:n { \marginparsep - \labelsep }
+ }
+ }
+ \int_incr:N \l_@@_macro_int
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_print_macroname:nN}
+% 该函数不再需要根据命令的长短切换字体。
+% \begin{macrocode}
+\cs_set_protected:Npn \@@_print_macroname:nN #1#2
+ {
+ \strut
+ \@@_get_hyper_target:xN
+ {
+ \exp_not:n {#1}
+ \bool_if:NT #2 { \tl_to_str:n {TF} }
+ }
+ \l_@@_tmpa_tl
+ \cs_if_exist:cTF { r@ \l_@@_tmpa_tl }
+ { \exp_args:NNo \label@hyperref [ \l_@@_tmpa_tl ] }
+ { \use:n }
+ {
+ \tl_set:Nn \l_@@_tmpa_tl {#1}
+% \end{macrocode}
+% 命令中的空格改用“\textvisiblespace”显示。
+% \begin{macrocode}
+ \tl_replace_all:Non \l_@@_tmpa_tl
+ { \c_catcode_other_space_tl }
+ { \fontspec_visible_space: }
+ \@@_macroname_prefix:o \l_@@_tmpa_tl
+ \@@_macroname_suffix:N #2
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_special_index_module:nnnnN}
+% 索引汉化。
+% \begin{macrocode}
+\cs_set_protected:Npn \@@_special_index_module:nnnnN #1#2#3#4#5
+ {
+ \use:x
+ {
+ \exp_not:n { \@@_special_index_aux:nnnnnnn {#1} {#2} }
+ \tl_if_empty:nTF {#3}
+ { { } { } { } { } }
+ {
+ \str_if_eq:eeTF {#3} { TeX }
+ {
+ { TeX~ and~ LaTeX2e }
+ { \string \TeX{}~ 和~ \string \LaTeXe{} }
+ }
+ { {#3} { \string \pkg {#3} } }
+ \bool_if:NTF #5
+ { { commands~ internal } { ~ 内部命令: } }
+ { { commands } { ~ 命令: } }
+ }
+ }
+ {#4}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_special_index_aux:nnnnnnn}
+% 该函数在 \cls{l3doc} 中本来只有 6 个参数。这里增加了一个,用来辅助
+% 排序。
+% \begin{arguments}
+% \item 键(即宏名称字符串,用来排序)
+% \item 宏名称
+% \item 索引头排序字符串(排序)
+% \item 索引头文字
+% \item 索引头后缀字符串(排序,新增)
+% \item 索引头后缀文字
+% \item 索引类型(\opt{main}/\opt{usage} 等)
+% \end{arguments}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_special_index_aux:nnnnnnn #1#2#3#4#5#6#7
+ {
+ \tl_set:Nn \l_@@_index_escaped_key_tl {#1}
+ \@@_quote_special_char:N \l_@@_index_escaped_key_tl
+ \@@_special_index_set:Nn
+ \l_@@_index_escaped_macro_tl {#2}
+ \str_if_eq:onTF { \@currenvir } { macrocode }
+ { \codeline@wrindex }
+ {
+ \str_case:nnF {#7}
+ {
+ { main } { \codeline@wrindex }
+ { usage } { \index }
+ }
+ { \HD@target \index }
+ }
+ {
+ \tl_if_empty:nF { #3 #4 #5 #6 }
+ { #3 #5 \actualchar #4 #6 \levelchar }
+ \l_@@_index_escaped_key_tl
+ \actualchar
+ {
+ \token_to_str:N \verbatim@font \c_space_tl
+ \l_@@_index_escaped_macro_tl
+ }
+ \encapchar
+ hdclindex { \the \c@HD@hypercount } {#7}
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{杂项}
+%
+% \begin{macro}{\StopSpecialIndexModule,
+% \@@_special_index_module:nnnnN}
+% 不对 \cs{cs} 和 \cs{tn} 等编索引。用于目录、索引等。
+% \begin{macrocode}
+\DeclareDocumentCommand \StopSpecialIndexModule { }
+ {
+ \cs_set_eq:NN
+ \@@_special_index_module:nnnnN \use_none:nnnnn
+ }
+\tl_map_inline:nn { \actualchar \encapchar \levelchar }
+ { \exp_args:Nx \DoNotIndex { \bslash \tl_to_str:N #1 } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\meta}
+% 重定义 \cs{meta} 命令,需要禁用中文、西文之间的空格。
+% \begin{macrocode}
+\RenewDocumentCommand \meta { m }
+ {
+ \group_begin:
+ \sys_if_engine_xetex:T { \xeCJKsetup { CJKecglue = { } } }
+ \@@_meta:n {#1}
+ \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% 重定向 \cls{l3doc} 中的一些提示信息。
+% \begin{macrocode}
+\msg_redirect_name:nnn { l3doc } { foreign-internal } { log }
+\msg_redirect_name:nnn { l3doc } { print-changes-howto } { log }
+\msg_redirect_name:nnn { l3doc } { print-index-howto } { log }
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<@@=>
+\ExplSyntaxOff
+% \end{macrocode}
+%
+% \subsubsection{排版样式设置}
+%
+% 目录中禁止对 \cs{cs} 和 \cs{tn} 等的索引。
+% \begin{macrocode}
+\AtBeginDocument{%
+ \addtocontents{toc}{\StopSpecialIndexModule}}
+% \end{macrocode}
+%
+% 设置 PDF 字符串中的命令替换。
+% \begin{macrocode}
+\pdfstringdefDisableCommands{%
+ \let\path\meta
+ \let\opt\@firstofone}
+% \end{macrocode}
+%
+% \begin{macro}[int]{\@multitoc@starttoc,\@starttoc}
+% 目录分栏,相当于调用 \pkg{multitoc} 宏包。
+% \begin{macrocode}
+\let\@multitoc@starttoc\@starttoc
+\renewcommand*\@starttoc[1]{%
+ \begin{multicols}{2}%
+ \@multitoc@starttoc{#1}%
+ \end{multicols}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{\@makefntext}
+% 调整脚注文本缩进。
+% \begin{macrocode}
+\renewcommand\@makefntext[1]{\parindent 0em\noindent\@makefnmark~#1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\IndexLayout,\indexname}
+% 调整索引外观。
+% \begin{macrocode}
+\IndexPrologue{%
+ \section{\indexname}%
+ \textit{意大利体的数字表示对应索引项出现的页码;
+ 带下划线的数字表示定义对应索引项的代码行号;
+ 其他则表示使用对应索引项的代码行号.}}
+\def\IndexLayout{%
+ \newgeometry{%
+ left = 0.85 in,
+ right = 0.85 in,
+ top = 1.25 in,
+ bottom = 1.00 in}%
+ \setlength\IndexMin{0.5\textheight}%
+ \ctexset{section/numbering=false}%
+ \StopSpecialIndexModule}
+\def\indexname{代码索引}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\usage}
+% 控制“描述对应索引项的页码”样式。在 \pkg{doc} 宏包中的定义为
+% \tn{textit}。
+% \begin{macrocode}
+% \def\usage#1{\textsf{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\glossaryname}
+% 调整修订记录外观。
+% \begin{macrocode}
+\GlossaryPrologue{\section{\glossaryname}}
+\def\glossaryname{修订记录}
+% \end{macrocode}
+% \end{macro}
+%
+% 版式排版格式。
+% \begin{macrocode}
+\ctexset{%
+ section/name = {第,节},
+ section/format+ = \raggedright,
+ paragraph/runin = false,
+ paragraph/numbering = false,
+ punct = kaiming}
+\setcounter{secnumdepth}{4}
+\setcounter{tocdepth}{3}
+\pagestyle{plain}
+% \end{macrocode}
+%
+% 单位设置(\pkg{siunitx} 宏包)。
+% \begin{macrocode}
+\sisetup{%
+ number-math-rm = \ensuremath,
+ inter-unit-product = \ensuremath{{}\cdot{}},
+ group-digits = true,
+ group-minimum-digits = 4,
+ group-separator = \text{~},
+ range-phrase = \symbol{"FF5E},
+ separate-uncertainty = true}
+% \end{macrocode}
+%
+% 超链接设置(\pkg{hyperref} 宏包)。
+% \begin{macrocode}
+\hypersetup{%
+ bookmarksdepth = 4,
+ bookmarksnumbered = true,
+ colorlinks = true,
+ citecolor = MaterialGreen,
+ linkcolor = MaterialPink,
+ urlcolor = MaterialIndigo}
+% \end{macrocode}
+%
+% 浮动体标题设置(\pkg{caption} 宏包)。
+% \begin{macrocode}
+\captionsetup{labelsep = quad, labelfont+ = bf}
+% \end{macrocode}
+%
+% 设置标准列表环境样式。
+% \begin{macrocode}
+\setlist{noitemsep, topsep=\smallskipamount}
+\setlist[1]{labelindent=\parindent}
+\setlist[enumerate]{leftmargin=*}
+\setlist[itemize]{leftmargin=*}
+% \end{macrocode}
+%
+% \begin{environment}{optdesc}
+% 用于描述各选项。设置条目间距为 \tn{marginparsep},与
+% \cls{l3doc} 一致。
+% \begin{macrocode}
+\newlist{optdesc}{description}{3}
+\setlist[optdesc]{%
+ font=\mdseries\small\ttfamily, align=right,
+ listparindent=\parindent,
+ labelsep=\marginparsep, labelindent=-\marginparsep,
+ leftmargin=*}
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{tablenotes}
+% \begin{variable}{tpt@id}
+% 重新定义 \pkg{threeparttable} 包的 \env{tablenotes} 环境,
+% 用于表格的注释。
+% \begin{macrocode}
+\renewlist{tablenotes}{description}{1}
+\setlist[tablenotes]{%
+ format=\normalfont\tnote@item, align=right,
+ listparindent=\parindent, labelindent=\tabcolsep,
+ leftmargin=*, rightmargin=\tabcolsep,
+ after=\@noparlisttrue}
+\AtBeginEnvironment{tablenotes}{%
+ \setlength\parindent{2\ccwd}%
+ \normalfont\footnotesize}
+\AtBeginEnvironment{threeparttable}{%
+ \stepcounter{tpt@id}%
+ \edef\curr@tpt@id{tpt@\arabic{tpt@id}}}
+\newcounter{tpt@id}
+% \end{macrocode}
+% \end{variable}
+% \end{environment}
+%
+% \begin{macro}[int]{\tnote@item,\TPTtagStyle}
+% 为 \tn{tnote} 增加超链接。
+% \begin{macrocode}
+\def\tnote@item#1{%
+ \Hy@raisedlink{\hyper@anchor{\curr@tpt@id-#1}}#1}
+\def\TPTtagStyle#1{\hyperlink{\curr@tpt@id-#1}{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\UrlAlphabet,\UrlDigits}
+% 网址断行。\tn{UrlOrds}、\tn{UrlAlphabet} 和 \tn{UrlDigits}
+% 分别记录了特殊符号、字母和数字,把它们依次附加在 \pkg{url} 宏包
+% 提供的命令 \tn{UrlBreaks} 之后,即可允许在这些位置处断行。与
+% \cs{nwafu_allow_url_break:} 的原理是相同的。
+% \begin{macrocode}
+\def\UrlAlphabet{%
+ \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j%
+ \do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t%
+ \do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D%
+ \do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N%
+ \do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X%
+ \do\Y\do\Z}
+\def\UrlDigits{%
+ \do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\0}
+\g@addto@macro\UrlBreaks{\UrlOrds}
+\g@addto@macro\UrlBreaks{\UrlAlphabet}
+\g@addto@macro\UrlBreaks{\UrlDigits}
+% \end{macrocode}
+% \end{macro}
+%
+% 不对下列各项添加索引。
+% \begin{macrocode}
+\DoNotIndex{\begin,\end,
+ \a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,
+ \n,\o,\p,\q,\r,\s,\t,\u,\v,\w,\x,\y,\z,
+ \A,\B,\C,\D,\E,\F,\G,\H,\I,\J,\K,\L,\M,
+ \N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z,
+ \0,\1,\2,\3,\4,\5,\6,\7,\8,\9}
+% \end{macrocode}
+%
+% 启用索引、交叉引用、历史记录。
+% \begin{macrocode}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+% \end{macrocode}
+%
+% \subsubsection{文档层命令}
+%
+% \begin{macro}{\exptarget,\rexptarget,\expstar,\rexpstar,
+% \__codedoc_typeset_exp:,\__codedoc_typeset_rexp:}
+% 部分命令之后的特殊符号($\symbol{"263A}$ 或 $\symbol{"263B}$),表明其不同用法。
+% 这里的“exp”和“rexp”分别源自 \LaTeX3 中的“expandable”
+% 和“restricted-expandable”。
+% \begin{macrocode}
+\newcommand*\exptarget{\Hy@raisedlink{\hypertarget{expstar}{}}}
+\newcommand*\rexptarget{\Hy@raisedlink{\hypertarget{rexpstar}{}}}
+\newcommand*\expstar{\hyperlink{expstar}{$\symbol{"263B}$}}
+\newcommand*\rexpstar{\hyperlink{rexpstar}{$\symbol{"263A}$}}
+\ExplSyntaxOn
+\cs_set_eq:NN \__codedoc_typeset_exp: \expstar
+\cs_set_eq:NN \__codedoc_typeset_rexp: \rexpstar
+\ExplSyntaxOff
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\marg,\oarg,\parg}
+% 几种命令参数:
+% \begin{itemize}
+% \item 必选参数:|{|\meta{arg}|}|;
+% \item 可选参数:|[|\meta{arg}|]|;
+% \item 图形参数:|(|\meta{arg}|)|。
+% \end{itemize}
+% \begin{macrocode}
+\renewcommand*\marg[1]{\{\meta{#1}\}}
+\renewcommand*\oarg[1]{[\meta{#1}]}
+\renewcommand*\parg[1]{(\meta{#1})}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\opt}
+% 选项名。
+% \begin{macrocode}
+\DeclareDocumentCommand\opt{m}{\texttt{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\kvopt}
+% \meta{key} |=| \meta{value} 型选项。
+% \begin{macrocode}
+\DeclareDocumentCommand\kvopt{mm}
+ {\texttt{#1\breakablethinspace=\breakablethinspace#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\breakablethinspace}
+% 允许换行的细间距。
+% \begin{macrocode}
+\def\breakablethinspace{\hskip 0.16667em\relax}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\syntaxopt,\defaultval}
+% \begin{macro}[int]{\syntaxopt@aux,\defaultval@aux}
+% \env{syntax} 中的选项及命令选项。
+% |aux| 结尾的两个命令用于定义利用 |<>| 和 |()| 的简写形式。
+% \begin{macrocode}
+\def\syntaxopt#1{\textit{#1}}
+\def\defaultval#1{\textbf{\textup{#1}}}
+\def\syntaxopt@aux#1>{\syntaxopt{#1}}
+\def\defaultval@aux#1){\defaultval{#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\orbar,\TF,\TTF,\TFF}
+% \env{syntax} 中的选项分隔符,以及 \opt{true} 或 \opt{false}
+% 选项的几种快捷方式。
+% \begin{macrocode}
+\def\orbar{\textup{\textbar}}
+\def\TF{true\orbar false}
+\def\TTF{\defaultval{true}\orbar false}
+\def\TFF{true\orbar\defaultval{false}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{environment}{arguments}
+% 放在 \env{macro} 环境中,用于描述对应命令的参数。
+% \cls{l3doc} 中的定义 \opt{labelsep} 设置不太合理,会使标签被覆盖,
+% 这里重新定义。
+% \begin{macrocode}
+\DeclareDocumentEnvironment{arguments}{}
+ {\enumerate[%
+ label={\texttt{\#\arabic*:~}}, labelsep=0pt, nolistsep]}%
+ {\endenumerate}
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\TeX,\LaTeX,\LaTeXe,
+% \pdfTeX,\pdfLaTeX,\XeTeX,\XeLaTeX,\LuaTeX,\LuaLaTeX,
+% \AmSLaTeX,\TeXLive,\MiKTeX,\BibTeX,\biber,\TikZ}
+% \TeX{} 相关标志。
+% \begin{macrocode}
+\def\TeX{\hologo{TeX}}
+\def\LaTeX{\hologo{LaTeX}}
+\def\LaTeXe{\hologo{LaTeXe}}
+\def\pdfTeX{\hologo{pdfTeX}}
+\def\pdfLaTeX{\hologo{pdfLaTeX}}
+\def\XeTeX{\hologo{XeTeX}}
+\def\XeLaTeX{\hologo{XeLaTeX}}
+\def\LuaTeX{\hologo{LuaTeX}}
+\def\LuaLaTeX{\hologo{LuaLaTeX}}
+\def\AmSLaTeX{\hologo{AmSLaTeX}}
+\def\TeXLive{\TeX\ Live}
+\def\MiKTeX{\hologo{MiKTeX}}
+\def\BibTeX{\hologo{BibTeX}}
+\def\BibTeX{\hologo{BibTeX}}
+\def\biber{\hologo{biber}}
+% \end{macrocode}
+% 该定义来自 \file{pgfmanual-en-macros.tex}。
+% \begin{macrocode}
+\def\TikZ{Ti\emph{k}Z}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\cs,\tn}
+% \begin{macro}[int]{\codedoc@cs,\codedoc@tn}
+% 控制序列。
+%^^A Colors are used for debug.
+% \begin{macrocode}
+% \let\codedoc@cs=\cs
+% \let\codedoc@tn=\tn
+% \renewcommand*\cs[2][]{%
+% \textcolor{MaterialIndigo}{\codedoc@cs[#1]{#2}}}
+% \renewcommand*\tn[2][]{%
+% \textcolor{MaterialPink}{\codedoc@tn[#1]{#2}}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\file,\env,\pkg,\cls}
+% 文件、环境、宏包、文档类。
+% \begin{macrocode}
+% \renewcommand*\file[1]{%
+% \textcolor{MaterialGrey900}{\texttt{#1}}}
+\renewcommand*\env[1]{\textbf{\texttt{#1}}}
+% \renewcommand*\pkg[1]{\textsf{#1}}
+% \renewcommand*\cls[1]{\textit{\textsf{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bashcmd}
+% Bash 中的命令。
+% \begin{macrocode}
+\newcommand*\bashcmd[1]{\texttt{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\scite}
+% 位于上标的文献引用。
+% \begin{macrocode}
+\newcommand*\scite[1]{\textsuperscript{\cite{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \paragraph{示例代码环境}
+%
+% \pkg{listings} 宏包中连字符 |-| 原本以数学模式输出,此处改为普通文本。
+% 见 \url{https://tex.stackexchange.com/a/33188}。
+% \begin{macrocode}
+\lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}}
+\@empty\z@\@empty
+% \end{macrocode}
+%
+% \changes{v0.5}{2017/09/05}{[\pkg{nwafudoc}] 移除 \pkg{listings}
+% 关键字定义文件。}
+%
+% 定义几种代码样式。
+% \begin{macro}[int]{style@base}
+% \begin{macrocode}
+\lstdefinestyle{style@base}
+ {
+ basewidth = 0.5 em,
+ gobble = 3,
+ lineskip = 2 pt,
+ frame = l,
+ framerule = 1 pt,
+ framesep = 0 pt,
+ escapeinside = {(*}{*)},
+ basicstyle = \small\ttfamily\color{MaterialGrey900},
+ keywordstyle = \bfseries\color{MaterialIndigo},
+ commentstyle = \itshape\color{MaterialGrey600},
+ stringstyle = \color{MaterialRed},
+ backgroundcolor = \color{MaterialGrey50}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{style@shell}
+% \begin{macrocode}
+\lstdefinestyle{style@shell}
+ {
+ style = style@base,
+ rulecolor = \color{MaterialPink},
+ language = bash,
+ alsoletter = {-},
+ emphstyle = \color{MaterialGreen800}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{style@latex}
+% \begin{macrocode}
+\lstdefinestyle{style@latex}
+ {
+ style = style@base,
+ rulecolor = \color{MaterialIndigo},
+ language = [LaTeX]TeX,
+ alsoletter = {*, -},
+ texcsstyle = *\color{MaterialDeepOrange},
+ emphstyle = [1]\color{MaterialGreen800},
+ emphstyle = [2]\color{MaterialTeal}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[int]{style@syntax}
+% \begin{macrocode}
+\lstdefinestyle{style@syntax}
+ {
+ basewidth = 0.5 em,
+ gobble = 6,
+ escapeinside = {(*}{*)},
+ language = [LaTeX]TeX,
+ alsoletter = {*, -},
+ basicstyle = \footnotesize\ttfamily\color{MaterialGrey900},
+ keywordstyle = \bfseries\color{MaterialIndigo},
+ commentstyle = \itshape\color{MaterialGrey600},
+ texcsstyle = *\color{MaterialDeepOrange},
+ emphstyle = [1]\color{MaterialGreen800},
+ emphstyle = [2]\color{MaterialTeal}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{environment}{shellexample}
+% \begin{environment}{latexexample}
+% Shell 和 \LaTeX{} 示例代码。
+% \begin{macrocode}
+\lstnewenvironment{shellexample}[1][]{%
+ \lstset{style=style@shell, #1}}{}
+\lstnewenvironment{latexexample}[1][]{%
+ \lstset{style=style@latex, #1}}{}
+% \end{macrocode}
+% \end{environment}
+% \end{environment}
+%
+% \begin{environment}{nwafusyntax}
+% 语法说明。用于代替 \cls{l3doc} 中的 \env{syntax} 环境。
+% \begin{macrocode}
+\lstnewenvironment{nwafusyntax}[1][]{%
+ \lstset{style=style@syntax, #1}\vspace{-1.8ex}}{}
+%</doc>
+% \end{macrocode}
+% \end{environment}
+%
+% \changes{v0.7c}{2019/03/15}{不再附带 \pkg{latexmk} 配置文件。}
+%
+% \clearpage
+%
+% \end{implementation}
+%
diff --git a/macros/unicodetex/latex/nwafuthesis/nwafuthesis.dtx b/macros/unicodetex/latex/nwafuthesis/nwafuthesis.dtx
new file mode 100644
index 0000000000..65e14263b3
--- /dev/null
+++ b/macros/unicodetex/latex/nwafuthesis/nwafuthesis.dtx
@@ -0,0 +1,7911 @@
+% \iffalse meta-comment
+% !TeX program = XeLaTeX
+% !TeX encoding = UTF-8
+%
+% Copyright (C) 2019--2022 by Nan Geng <nangeng@nwafu.edu.cn>
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either
+% version 1.3c of this license or (at your option) any later
+% version. The latest version of this license is in:
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of
+% LaTeX version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Nan Geng.
+%
+% This work consists of the files nwafuthesis.dtx,
+% nwafuthesis-doc.dtx,
+% and the derived files nwafuthesis.ins,
+% nwafuthesis.cls,
+% nwafudoc.cls,
+%
+%<*internal>
+\iffalse
+%</internal>
+%
+%<*internal>
+\fi
+\begingroup
+ \def\NameOfLaTeXe{LaTeX2e}
+\expandafter\endgroup\ifx\NameOfLaTeXe\fmtname\else
+\csname fi\endcsname
+%</internal>
+%
+%<*install>
+\input l3docstrip.tex
+\keepsilent
+\askforoverwritefalse
+
+\preamble
+
+ Copyright (C) 2019--2022 by Nan Geng <nangeng@nwafu.edu.cn>
+
+ This work may be distributed and/or modified under the
+ conditions of the LaTeX Project Public License, either
+ version 1.3c of this license or (at your option) any later
+ version. The latest version of this license is in:
+
+ http://www.latex-project.org/lppl.txt
+
+ and version 1.3 or later is part of all distributions of
+ LaTeX version 2005/12/01 or later.
+
+ This work has the LPPL maintenance status `maintained'.
+
+ The Current Maintainer of this work is Nan Geng.
+
+ This work consists of the files nwafuthesis.dtx,
+ nwafuthesis-doc.dtx,
+ and the derived files nwafuthesis.ins,
+ nwafuthesis.cls,
+ nwafudoc.cls,
+
+\endpreamble
+
+\generate{
+ \usedir{tex/latex/nwafuthesis}
+ \file{\jobname.cls} {\from{\jobname.dtx}{class}}
+ \file{nwafudoc.cls} {\from{\jobname.dtx}{doc}
+ \from{\jobname-doc.dtx}{doc}}
+%</install>
+%<*internal>
+ \usedir{source/latex/nwafuthesis}
+ \file{\jobname.ins} {\from{\jobname.dtx}{install}}
+%</internal>
+%<*install>
+ \usedir{doc/latex/nwafuthesis}
+ \nopreamble\nopostamble
+}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* files into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* The recommended directory is TDS:tex/latex/nwafuthesis *}
+\Msg{* *}
+\Msg{* nwafuthesis.cls *}
+\Msg{* nwafudoc.cls *}
+\Msg{* *}
+\Msg{* To produce the documentation, run the file nwafuthesis.dtx*}
+\Msg{* through XeLaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile
+%</install>
+%
+%<*internal>
+\fi
+%</internal>
+%
+%<class|doc>\NeedsTeXFormat{LaTeX2e}
+%<class|doc>\RequirePackage{expl3}
+%<*!(driver|install)>
+%<!readme>\GetIdInfo $Id: nwafuthesis.dtx 1.00 2021-05-12 15:30:00Z Nan Geng <nangeng@nwafu.edu.cn> $
+%<class> {Thesis template for Northwest A\&F University}
+%<class>\ProvidesExplClass{\ExplFileName}
+%<definition> {Definition file for nwafuthesis}
+%<definition>\ProvidesExplFile{\ExplFileName.def}
+%<doc> {Documentation class for nwafuthesis}
+%<doc>\ProvidesExplClass{nwafudoc}
+%<!readme> {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
+%</!(driver|install)>
+%<*driver>
+% \PassOptionsToPackage{showframe}{geometry}
+\documentclass{nwafudoc}
+\usepackage{multirow,xeCJKfntef,xpinyin,csquotes}
+\hypersetup{
+ pdftitle = {nwafuthesis: 西北农林科技大学学位论文模板},
+ pdfauthor = {耿楠}
+ }
+% 全角标点放在引号中,需要改成半角式,否则间距过大,不好看
+\def\FSID{“{\xeCJKsetup{PunctStyle=banjiao}。}”} % U+3002
+\def\FSFW{“{\xeCJKsetup{PunctStyle=banjiao}.}”} % U+FF0E
+\def\COFW{“{\xeCJKsetup{PunctStyle=banjiao}:}”} % U+FF1A
+\def\SCFW{“{\xeCJKsetup{PunctStyle=banjiao};}”} % U+FF1B
+
+% nwafuthesis的LOGO
+\newcommand{\nwafuthesis}{%
+ \makebox{\rmfamily%
+ N\hspace{-0.2ex}\raisebox{-0.5ex}{W}\raisebox{0.5ex}{\hspace{-0.2ex}\textsc{AFU}}\hspace{0.3ex}%
+ \textsc{Thesis}}}
+
+\title{\textcolor{MaterialIndigo800}{%
+ \textbf{\nwafuthesis: 西北农林科技大学学位论文
+ \xpinyin[font=\sffamily,format=\color{MaterialIndigo800}]{模}{mu2}板}}}
+\author{耿楠}
+\date{\today\quad v1.00%
+ \thanks{\url{https://gitee.com/nwafu_nan/nwafuthesis-l3}.}}
+
+\begin{document}
+\DisableImplementation
+%<!--CODEDOC--> \EnableImplementation
+%<!--CODEDOC--> \def\nwafuCODEDOC{}
+ \DocInput{nwafuthesis.dtx}
+ \DocInput{nwafuthesis-doc.dtx}
+\IndexLayout
+\PrintChanges
+\PrintIndex
+\end{document}
+%</driver>
+% \fi
+%
+% \changes{v1.00}{2021/06/06}{开始发布测试。}
+% \changes{v1.00}{2021/05/12}{开始编写模板。}
+%
+% \CheckSum{0}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%^^A 禁止使用 " 符号作为抄录文本缩略符
+% \DeleteShortVerb\"
+%
+%^^A 封面与目录的页边距
+% \newgeometry{
+% left = 1.25 in,
+% right = 1.25 in,
+% top = 1.25 in,
+% bottom = 1.00 in
+% }
+%
+% \maketitle
+% \vfill
+% \begin{center}
+% \includegraphics[width=0.20\textwidth]{logo/nwafu-circle.pdf}\\[3ex]
+% \includegraphics[width=0.5\textwidth]{logo/motto}
+% \end{center}
+% \vfill
+% \begin{center}
+% \includegraphics[width=0.6\textwidth]{logo/building}
+% \end{center}
+% \vfill
+% \begin{center}
+% \bfseries\zihao{1}经国本\qquad{}解民生\qquad{}尚科学
+% \end{center}
+% \vfill
+% \thispagestyle{empty}
+% \clearpage
+%
+% \pagenumbering{Roman}
+% \tableofcontents
+% \clearpage
+%
+% \pagenumbering{arabic}
+% \EnableDocumentation
+%^^A \DisableDocumentation
+%
+% \begin{documentation}
+%
+%^^A 用户手册的页边距
+% \newgeometry{
+% left = 1.65 in,
+% right = 0.80 in,
+% top = 1.25 in,
+% bottom = 1.00 in
+% }
+%
+% \section{简介}
+%
+% 目前,西北农林科技大学 \LaTeX{} 学位论文模板是由信息工程学院
+% 耿楠老师编写的\cls{nwafuthesis}模板。
+% 该模板是基于\LaTeXe{}开发,虽然一直在维护,但由于初期开发代码的不规范,
+% 其维护成本较高,为此,在借鉴\scite{fduthesis}的基础上,
+% 用 \LaTeX3 \scite{source3}根据\scite{西北农林科技大学研究生论文写作指南}和
+% \scite{西北农林科技大学本科生论文撰写规范}
+% 重构了\cls{nwafuthesis}模板,以适应 \TeX{} 技术的发展。
+% 同时\cls{nwafuthesis}还构建了一套简洁的用户接口,以方便用户使用。
+% 新模板更加稳定,普适性更强,运行效率更高。
+%
+% \subsection*{\LaTeX{} 入门}
+%
+% 本文档并非是一份 \LaTeX{} 零基础教程。如果是完完全全的新手,
+% 建议先阅读相关入门文档,如刘海洋编著的《\LaTeX{} 入门》
+% \scite{刘海洋2013latex入门} 第一章,或大名鼎鼎的“\pkg{lshort}”
+% \scite{lshort} 及其中文翻译版 \scite{lshort-zh-cn}。当然,
+% 网络上诸如耿楠录制的\LaTeX{}教学系列视频等入门教程多如牛毛,可以自行选取学习。
+%
+% \subsection*{关于本文档}
+%
+% 本文采用不同字体表示不同内容。无衬线字体表示宏包名称,如
+% \pkg{xeCJK} 宏包、\cls{nwafuthesis} 文档类等;等宽字体表示代码或
+% 文件名,如 \cs{nwafuset} 命令、\env{abstract} 环境、\TeX{} 文档
+% \file{thesis.tex} 等;带有尖括号的楷体(或西文斜体)表示命令参数,
+% 如 \meta{模板选项}、\meta{English title} 等。在使用时,不必输入参数两侧
+% 的尖括号。示例代码进行了语法高亮处理,以方便阅读。
+%
+% 在用户手册中,带有蓝色侧边线的为 \LaTeX{} 代码,而带有粉色侧边线
+% 的则为电脑命令行代码,请注意区分。模板提供的选项、命令、环境等,
+% 均用横线框起,同时给出使用语法和相关说明。
+%
+% 手册中的代码实现部分主要面向对 \LaTeX{} 宏包开发感兴趣的用户。
+% 如果有任何改进意见或者功能需求,欢迎前往 Gitee 仓库提交issue。
+%
+% 文档的最后还提供了版本历史和代码索引,以供查阅。
+%
+% \section{安装}
+%
+% \changes{v1.00}{2021/08/05}{修改安装说明,提交ctan。}
+% \subsection{获取 \cls{nwafuthesis}}
+%
+% \subsubsection{标准安装}
+%
+% 如果没有特殊理由,强烈建议使用宏包管理器安装 \cls{nwafuthesis}。
+% 例如在 \TeXLive{} 中,执行(可能需要管理员权限)
+% \begin{shellexample}[morekeywords={tlmgr,install}]
+% tlmgr install nwafuthesis
+% \end{shellexample}
+% 即可完成安装。
+%
+% 当然,在 \TeXLive{} 和 \MiKTeX{} 中,也可以通过图形界面进行安装,
+% 此处不再赘述,请参阅软件帮助。
+%
+% \subsubsection{手动安装}
+%
+% 可以从\cls{nwafuthesis}源代码直接生成模板(不推荐):
+%
+% \begin{itemize}
+% \item 打开 \href{https://gitee.com/nwafu_nan/nwafuthesis-l3}^^A
+% {Gitee仓库主页},点击“克隆/下载”,并选择“下载ZIP”,
+% 下载 \file{nwafuthesis-master.zip};如果的电脑中安装有 git
+% 程序,也可通过以下命令直接克隆代码仓库:
+% \begin{shellexample}[gobble=7,alsoletter={.},^^A
+% morekeywords={git,clone}]
+% git clone git@gitee.com:nwafu_nan/nwafuthesis-l3.git
+% \end{shellexample}
+% \item 在解压后的目录中或进入克隆后的仓库目录,然后执行以下命令以生成
+% 模板的各组件:
+% \begin{shellexample}[gobble=7,morekeywords={xetex}]
+% xetex nwafuthesis.dtx
+% \end{shellexample}
+% \item 将生成的文档类(\file{.cls})复制到 \TeX{} 发行版本地 TDS 树
+% 的 \path{texmf-local/tex/latex/nwafuthesis/} 目录下,并执行
+% \bashcmd{mktexlsr} 刷新文件名数据库,方可完成安装。
+% \end{itemize}
+%
+% \subsubsection{扁平化安装}
+%
+% 如果您不希望安装本模板,但需要立刻使用,也可以使用模板提供的安装脚本。
+%
+% \begin{itemize}
+% \item 打开 \href{https://gitee.com/nwafu_nan/nwafuthesis-l3}^^A
+% {Gitee仓库主页},点击“克隆/下载”,并选择“下载ZIP”,
+% 下载 \file{nwafuthesis-master.zip};如果的电脑中安装有 git
+% 程序,也可通过以下命令直接克隆代码仓库:
+% \begin{shellexample}[gobble=7,alsoletter={.},^^A
+% morekeywords={git,clone}]
+% git clone git@gitee.com:nwafu_nan/nwafuthesis-l3.git
+% \end{shellexample}
+% \item 在解压后的目录中或进入克隆后的仓库目录,然后执行以下命令以生成
+% 模板的各组件:
+% \begin{itemize}
+% \item Windows系统:
+% \begin{shellexample}[gobble=11,morekeywords={build-win}]
+% build-win
+% \end{shellexample}
+% \item Linux系统:
+% \begin{shellexample}[gobble=11,morekeywords={build.sh}]
+% ./build.sh
+% \end{shellexample}
+% \end{itemize}
+% \item 将生成的文档类文件(\file{nwafuthesis.cls})复制到
+% 论文撰写工作目录,然后开始撰写论文。
+% \end{itemize}
+%
+% \subsection{模板组成}
+%
+% 本模板主要包含核心文档类、示例项目以及用户文档等几个
+% 部分,其具体组成见表~\ref{tab:nwafuthesis-components}。
+%
+% \begin{table}[ht]
+% \caption{\cls{nwafuthesis} 的主要组成部分}
+% \label{tab:nwafuthesis-components}
+% \centering
+% \begin{tabular}{lp{20em}}
+% \toprule
+% \textbf{文件} & \textbf{功能说明} \\
+% \midrule
+% \file{nwafuthesis.cls} & 模板文档类 \\
+% \file{nwafudoc.cls} & 编译该用户手册时需要的文档类 \\
+% \file{nwafuthesis.pdf} & 用户手册 \\
+% \file{main.tex} & 空白模板,可以此为基础撰写论文 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%
+% \section{使用说明}
+%
+% \subsection{基本用法}
+%
+% 以下是一份简单的 \TeX{} 文档,它演示了 \cls{nwafuthesis}
+% 的最基本用法:
+% \begin{latexexample}[deletetexcs={\documentclass},%
+% moretexcs={\chapter},morekeywords={\documentclass},%
+% emph={[2]document}]
+% % main.tex
+% \documentclass{nwafuthesis}
+% \begin{document}
+% \chapter{欢迎}
+% \section{欢迎使用nwafuthesis!}
+% 你好,\LaTeX{}!
+% \end{document}
+% \end{latexexample}
+%
+% 按照 \ref{subsec:编译方式}~小节中的方式编译该文档,应当得到
+% 一篇包含封面、独创声明等在内的空白论文(研究生7页,本科生3页)。
+%
+%
+% \subsection{编译方式} \label{subsec:编译方式}
+%
+% 本模板不支持 \pdfTeX{} 引擎,请使用 \XeLaTeX{} 或 \LuaLaTeX{}
+% 编译,推荐使用 \XeLaTeX{}编译。为了生成正确的目录、脚注、参考文献以及交叉引用,
+% 至少需要连续编译四次。
+%
+% 假设\TeX{} 源文件名为 \file{main.tex},使用 \XeLaTeX{} 编译论文。
+% 则在命令行中可以顺序执行:
+% \begin{shellexample}[morekeywords={xelatex}]
+% xelatex main
+% biber main
+% xelatex main
+% xelatex main
+% \end{shellexample}
+% 或使用带有参数\meta{-xelatex}的 \pkg{latexmk}命令:
+% \begin{shellexample}[morekeywords={latexmk},emph={-xelatex}]
+% latexmk -xelatex main
+% \end{shellexample}
+%
+% 如果使用 \LuaLaTeX{} 编译论文,请在命令行中顺序执行:
+% \begin{shellexample}[morekeywords={lualatex}]
+% lualatex main
+% biber main
+% lualatex main
+% lualatex main
+% \end{shellexample}
+% 或者执行带有\meta{-lualatex}的latexmk命令
+% \begin{shellexample}[morekeywords={latexmk},emph={-lualatex}]
+% latexmk -lualatex main
+% \end{shellexample}
+%
+% 由于我校参考文献格式的特殊性,本模板基于
+% 胡振震编写的符合GB/T7714-2015的biblatex样式文件\scite{biblatex-gb7714-2015}
+% 实现了参考文献排版,并在后台强制使用biber引擎编译参考文献。
+% 因此,在第2次编译时,请务必\textbf{使用biber进行编译}。
+%
+% 关于如何配置TeXStudio等IDE工具,以实现正确编译,请
+% 参阅其使用说明书。
+%
+% \subsection{模板选项}
+%
+% 所谓\enquote{模板选项}是指在用\tn{documentclass}命令引入文档类时能够指定的选项:
+% \begin{latexexample}[deletetexcs={\documentclass},%
+% morekeywords={\documentclass}]
+% \documentclass(*\oarg{模板选项}*){nwafuthesis}
+% \end{latexexample}
+%
+% 有些模板选项为布尔型,只能取 \opt{true} 或 \opt{false}。
+% 对于这些选项,\kvopt{\meta{选项}}{true} 中的“|= true|”
+% 可以省略。
+%
+% \begin{function}[added=2021-05-12]{type}
+% \begin{nwafusyntax}[emph={[1]type}]
+% type = (*<doctor|master|(bachelor)>*)
+% \end{nwafusyntax}
+% 选择论文类型。三种选项分别代表博士学位论文、硕士学位论文和本科
+% 毕业论文。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{oneside,twoside}
+% 指明论文的单双面模式,默认为 \opt{twoside}。
+% \end{function}
+%
+% 无论是双面模式(\opt{twoside}),还是单面模式(\opt{oneside}),
+% 第一章都是从奇数页开始,而其后各章都是接上一章另起一页起排。
+% 本模板中,目录、摘要、主要符号表对照表、附录、参考文献、致谢、
+% 个人简历等均视作章,也按相同方式排版。
+%
+% 对于研究生学位论文,奇数页页眉是章名称,偶数页页眉是
+% “西北农林科技大学博士(或硕士)学位论文”。
+% 对于本科生生毕业论文(设计),奇数页页眉是章名称,偶数页页眉是
+% 论文(设计)题目。
+%
+% \begin{function}[added=2021-05-12]{draft}
+% \begin{nwafusyntax}[emph={[1]draft}]
+% draft = (*<\TFF>*)
+% \end{nwafusyntax}
+% 选择是否开启草稿模式,默认关闭。
+% \end{function}
+%
+% 草稿模式为全局选项,会影响到很多宏包的工作方式。
+% 开启之后,主要的变化有:
+% \begin{itemize}
+% \item 将行溢出的盒子显示为黑色方块;
+% \item 不插入图片,只输出一个占位方框;
+% \item 关闭超链接渲染,也不生成 PDF 书签;
+% \item 显示页面边框。
+% \end{itemize}
+%
+% \subsection{参数设置}
+%
+% \begin{function}[added=2021-05-12]{\nwafuset}
+% \begin{nwafusyntax}[morekeywords={\nwafuset}]
+% \nwafuset(*\marg{键值列表}*)
+% \end{nwafusyntax}
+% 本模板提供了一系列选项,以实现论文格式和作者、指导教师等
+% 基本信息的配置。载入\pkg{nwafuthesis}文档类之后,以下
+% 所有选项均可通过统一的\cs{nwafuset}命令进行设置。
+% \end{function}
+%
+% \cs{nwafuset} 的参数是一组由(英文)逗号隔开的选项列表,列表中的
+% 选项通常是 \kvopt{\meta{key}}{\meta{value}} 形式。部分选项的
+% \meta{value} 可以省略。对于同一项,后续设置会覆盖以前的设置。
+% 在下文的说明中,将用\textbf{粗体}表示默认值。
+%
+% \cs{nwafuset} 采用 \LaTeX3 风格的键值设置,支持不同类型以及多种
+% 层次的选项设定。键值列表中,“|=|”左右的空格不影响设置;但需注意,
+% 参数列表中\textbf{不可以出现空行}。
+%
+% 与模板选项相同,布尔型的参数 \kvopt{\meta{选项}}{true}
+% 中的“|= true|”可以省略。
+%
+% 另有一些选项包含子选项,如 \opt{style} 、\opt{abstract}和 \opt{info} 等。它们可以
+% 按如下两种等价方式来设定:
+% \begin{latexexample}[morekeywords={\nwafuset},%
+% emph={[1]style,cjk-font,font-size,info,title,title*,author,author*,department}]
+% \nwafuset{
+% style = {cjk-font = adobe, font-size = -4},
+% info = {
+% title = {说C解C},
+% title* = {C Story},
+% author = {耿楠},
+% author* = {Nan Geng},
+% department = {信息工程学院}
+% }
+% }
+% \end{latexexample}
+% 或者
+% \begin{latexexample}[morekeywords={\nwafuset},%
+% emph={[1]style,cjk-font,font-size,info,title,title*,author,author*,department}]
+% \nwafuset{
+% style/cjk-font = adobe,
+% style/font-size = -4,
+% info/title = {说C解C},
+% info/title* = {C Story},
+% info/author = {耿楠},
+% info/author* = {Nan Geng},
+% info/department = {信息工程学院}
+% }
+% \end{latexexample}
+%
+% 注意 “|/|” 的前后均不可以出现空白字符。
+%
+% \subsubsection{论文格式} \label{subsubsec:论文格式}
+%
+% \begin{function}[added=2021-05-12]{style}
+% \begin{nwafusyntax}[emph={[1]style}]
+% style = (*\marg{键值列表}*)
+% style/(*\meta{key}*) = (*\meta{value}*)
+% \end{nwafusyntax}
+% 该选项包含多个子项目,用于设置字体、字号等论文格式,具体内容见下。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{style/font}
+% \begin{nwafusyntax}[emph={[1]font}]
+% font = (*<garamond|libertinus|lm|palatino|times|times*|none>*)
+% \end{nwafusyntax}
+% 设置西文字体(包括数学字体)。具体配置见表~\ref{tab:font}。
+% 该选项若未指定,则由根据操作系统进行选择,Windows取times*,MacOS取times*,Linux取times。
+% \end{function}
+%
+% \begin{table}[ht]
+% \begin{threeparttable}
+% \caption{西文字体配置}
+% \label{tab:font}
+% \centering
+% \begin{tabular}{ccccc}
+% \toprule
+% & \strong{正文字体} & \strong{无衬线字体} & \strong{等宽字体} & \strong{数学字体} \\
+% \midrule
+% |garamond| & EB Garamond & Libertinus Sans & LM Mono\tnote{a} & Garamond Math \\
+% |libertinus| & Libertinus Serif & Libertinus Sans & LM Mono & Libertinus Math \\
+% |lm| & LM Roman & LM Sans & LM Mono & LM Math \\
+% |palatino| & TG Pagella\tnote{b} & Libertinus Sans & LM Mono & TG Pagella Math \\
+% |times| & XITS & TG Heros & TG Cursor & XITS Math \\
+% |times*|\tnote{c} & Times New Roman & Arial & Courier New & XITS Math \\
+% \bottomrule
+% \end{tabular}
+% \begin{tablenotes}
+% \item[a] “LM”是 Latin Modern 的缩写。
+% \item[b] “TG”是 TeX Gyre 的缩写。
+% \item[c] 本行中,Times New Roman、Arial 和 Courier New 是商业字体,
+% 在 Windows 和 macOS 系统上均默认安装。
+% \end{tablenotes}
+% \end{threeparttable}
+% \end{table}
+%
+% \begin{function}[added=2021-05-12]{style/cjk-font}
+% \begin{nwafusyntax}[emph={[1]cjk-font}]
+% cjk-font = (*<adobe|fandol|founder|mac|sinotype|sourcehan|windows|none>*)
+% \end{nwafusyntax}
+% 设置中文字体。具体配置见表~\ref{tab:cjk-font}。
+% 该选项若未指定,则由根据操作系统进行选择,Windows取windows,MacOS取mac,Linux取fandol。
+% \end{function}
+%
+% \begin{table}[ht]
+% \caption{中文字体配置}
+% \label{tab:cjk-font}
+% \centering
+% \begin{tabular}{cccc}
+% \toprule
+% & \strong{正文字体(宋体)} & \strong{无衬线字体(黑体)} & \strong{等宽字体(仿宋)} \\
+% \midrule
+% \multirow{2}*{|adobe|} & Adobe 宋体 & Adobe 黑体 & Adobe 仿宋 \\
+% & Adobe Song Std & Adobe Heiti Std & Adobe Fangsong Std \\
+% \multirow{2}*{|fandol|} & Fandol 宋体 & Fandol 黑体 & Fandol 仿宋 \\
+% & FandolSong & FandolHei & FandolFang \\
+% \multirow{2}*{|founder|} & 方正书宋 & 方正黑体 & 方正仿宋 \\
+% & FZShuSong-Z01 & FZHei-B01 & FZFangSong-Z02 \\
+% \multirow{2}*{|mac|} & (华文)宋体-简 & (华文)黑体-简 & 华文仿宋 \\
+% & Songti SC & Heiti SC & STFangsong \\
+% \multirow{2}*{|sinotype|} & 华文宋体 & 华文黑体 & 华文仿宋 \\
+% & STSong & STHeiti & STFangsong \\
+% \multirow{2}*{|sourcehan|} & 思源宋体 & 思源黑体 & --- \\
+% & Source Han Serif SC & Source Han Sans SC & --- \\
+% \multirow{2}*{|windows|} & (中易)宋体 & (中易)黑体 & (中易)仿宋 \\
+% & SimSun & SimHei & FangSong \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%
+% 启用 \kvopt{font}{none} 或 \kvopt{cjk-font}{none} 之后,模板将关闭
+% 默认西文 / 中文字体设置。此时,需要自行使用 \cs{setmainfont}、
+% \cs{setCJKmainfont}、\cs{setmathfont} 等命令来配置字体。
+%
+% \emph{关于字体配置,本模板完全采用\cls{fduthesis}模板代码}。
+%
+% \begin{function}[added=2021-05-12]{style/font-size}
+% \begin{nwafusyntax}[emph={[1]font-size}]
+% font-size = (*<(-4)|5>*)
+% \end{nwafusyntax}
+% 设置论文的基础字号。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{style/fullwidth-stop}
+% \begin{nwafusyntax}[emph={[1]fullwidth-stop}]
+% fullwidth-stop = (*<catcode|mapping|(false)>*)
+% \end{nwafusyntax}
+% 选择是否把全角实心句点\FSFW 作为默认的句号形状。
+% 这种句号一般用于科技类文章,以避免与下标“$_o$”或“$_0$”混淆。
+% \end{function}
+%
+% 选择 \kvopt{fullwidth-stop}{catcode} 或 \opt{mapping} 后,都会实现
+% 上述效果。有所不同的是,在选择 \opt{catcode} 后,只有
+% \emph{显式的}\FSID 会被替换为\FSFW;但在选择 \opt{mapping} 后,
+% \emph{所有的}\FSID 都会被替换。例如,如果用宏保存了一些含有
+% \FSID 的文字,那么在选择 \opt{catcode} 时,其中的\FSID 不会被
+% 替换为\FSFW。
+%
+% 选项 \kvopt{fullwidth-stop}{mapping} 只在 \XeTeX{} 下有效。使用
+% \LuaTeX{} 编译时,该选项相当于 \kvopt{fullwidth-stop}{catcode}。
+%
+% 如果在选择 \kvopt{fullwidth-stop}{mapping} 后仍需要临时显示
+% \FSID,可以按如下方法操作:
+% \begin{latexexample}[moretexcs={\CJKfontspec},emph={[1]Mapping}]
+% % 请使用 XeTeX 编译
+% % 外侧的花括号表示分组
+% 这是一个句号{\CJKfontspec{(*\meta{字体名}*)}[Mapping=full-stop]。}
+% \end{latexexample}
+%
+% \emph{关于标点符号压缩,本模板完全采用\cls{fduthesis}模板代码}。
+%
+% \begin{function}[added=2021-05-12]{style/footnote-style}
+%^^A 这里奇怪的东西是用来控制对齐的。nwafusyntax 会吃掉开头的几个
+%^^A 空格,因此这里用 X 来占位。
+% \begin{nwafusyntax}[emph={[1]footnote-style}]
+% footnote-style = (*<plain|\\
+% XXXXXX\mbox{}~~~~~~~~~~~~~~~~~libertinus|libertinus*|libertinus-sans|\\
+% XXXXXX\mbox{}~~~~~~~~~~~~~~~~~pifont|pifont*|pifont-sans|pifont-sans*|\\
+% XXXXXX\mbox{}~~~~~~~~~~~~~~~~~xits|xits-sans|xits-sans*>*)
+% \end{nwafusyntax}
+% 设置脚注编号样式。西文字体设置会影响其默认取值(见
+% 表~\ref{tab:footnote-font})。因此,要使得该选项生效,需将其
+% 放置在 \opt{font} 选项之后。带有 |sans| 的为相应的无衬线字体
+% 版本;带有 |*| 的为阴文样式(即黑底白字)。
+% \end{function}
+%
+% \begin{table}[ht]
+% \caption{西文字体与脚注编号样式默认值的对应关系}
+% \label{tab:footnote-font}
+% \centering
+% \begin{tabular}{ccccc}
+% \toprule
+% \textbf{西文字体设置} &
+% |libertinus| & |lm| & |palatino| & |times| \\
+% \midrule
+% \textbf{脚注编号样式默认值} &
+% |libertinus| & |pifont| & |pifont| & |xits| \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%
+% \emph{关于脚注字体配置,本模板完全采用\cls{fduthesis}模板代码}。
+%
+% \begin{function}[added=2021-05-12]{style/hyperlink}
+% \begin{nwafusyntax}[emph={[1]hyperlink}]
+% hyperlink = (*<border|color|(none)>*)
+% \end{nwafusyntax}
+% 设置超链接样式。\opt{border} 表示在超链接四周绘制方框;
+% \opt{color} 表示用彩色显示超链接,可输出用于批阅的电子稿;
+% \opt{none} 表示没有特殊装饰,可用于生成最终的打印版文稿。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12,updated=2021-05-12]{style/hyperlink-color}
+% \begin{nwafusyntax}[emph={[1]hyperlink-color}]
+% hyperlink-color = (*<(default)|classic|elegant|fantasy|material|\\
+% XXXXXX\mbox{}~~~~~~~~~~~~~~~~~~business|science|summer|autumn|graylevel|prl>*)
+% \end{nwafusyntax}
+% 设置超链接颜色。该选项在 \kvopt{hyperlink}{none} 时无效。
+% 各选项所代表的颜色见表~\ref{tab:hyperlink-color}。
+% \end{function}
+%
+% \begin{table}[ht]
+% \centering
+% \newcommand\linkcolorexam[3]{^^A
+% {\small 图~\textcolor[HTML]{#1}{1-2},
+% (\textcolor[HTML]{#1}{3.4})~式} &
+% {\small \textcolor[HTML]{#2}{\texttt{http://g.cn}}} &
+% {\small 文献~[\textcolor[HTML]{#3}{1}],
+% (\textcolor[HTML]{#3}{Knuth~1986})}}
+% \begin{threeparttable}
+% \caption{预定义的超链接颜色方案}
+% \label{tab:hyperlink-color}
+% \begin{tabular}{c*{3}{>{\hspace{0.2cm}}c<{\hspace{0.2cm}}}}
+% \toprule
+% \textsf{选项} & \textsf{链接} & \textsf{URL} & \textsf{引用} \\
+% \midrule
+% \opt{default} & \linkcolorexam{990000}{0000B2}{007F00} \\
+% \opt{classic} & \linkcolorexam{FF0000}{0000FF}{00FF00} \\
+% \opt{elegant}\tnote{a} & \linkcolorexam{961212}{C31818}{9B764F} \\
+% \opt{fantasy}\tnote{b} & \linkcolorexam{FF4A19}{FF3F94}{934BA1} \\
+% \opt{material}\tnote{c} & \linkcolorexam{E91E63}{009688}{4CAF50} \\
+% \opt{business}\tnote{d} & \linkcolorexam{D14542}{295497}{1F6E43} \\
+% \opt{science}\tnote{e} & \linkcolorexam{CA0619}{389F9D}{FF8920} \\
+% \opt{summer}\tnote{f} & \linkcolorexam{00AFAF}{5F5FAF}{5F8700} \\
+% \opt{autumn}\tnote{f} & \linkcolorexam{D70000}{D75F00}{AF8700} \\
+% \opt{graylevel}\tnote{c} & \linkcolorexam{616161}{616161}{616161} \\
+% \opt{prl}\tnote{g} & \linkcolorexam{2D3092}{2D3092}{2D3092} \\
+% \bottomrule
+% \end{tabular}
+% \begin{tablenotes}
+% \item[a] 来自 \href{https://tex.stackexchange.com/}^^A
+% {\TeX{} - \LaTeX{} Stack Exchange 网站}。
+% \item[b] Adobe CC 产品配色。
+% \item[c] 取自 Material 色彩方案
+% (见 \url{https://material.io/guidelines/style/color.html})。
+% \item[d] Microsoft Office 2016 产品配色。
+% \item[e] 来自 \href{https://www.wolfram.com/}{Wolfram Research 网站}。
+% \item[f] 均取自 Solarized 色彩方案
+% (见 \url{http://ethanschoonover.com/solarized})。
+% \item[g] \textit{Physical Review Letter} 杂志配色。
+% \end{tablenotes}
+% \end{threeparttable}
+% \end{table}
+%
+% \emph{关于超链接配置,本模板完全采用\cls{fduthesis}模板的配置代码}。
+%
+% \begin{function}[added=2021-05-12]{style/bib-resource}
+% \begin{nwafusyntax}[emph={[1]bib-resource}]
+% bib-resource = (*\marg{文件}*)
+% \end{nwafusyntax}
+% 参考文献数据源。可以是单个文件,也可以是用英文逗号隔开的一组文件。
+% 其中,各文献数据源文件必须明确给出 \file{.bib}
+% 后缀名。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{style/logo}
+% \begin{nwafusyntax}[emph={[1]logo}]
+% logo = (*\marg{文件}*)
+% \end{nwafusyntax}
+% 封面中校名图片的文件名。默认值为 \file{logo/nwafu-bar.pdf}。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{style/logo-size}
+% \begin{nwafusyntax}[emph={[1]logo-size}]
+% logo-size = (*\marg{宽度}*)
+% logo-size = {(*\meta{宽度}*), (*\meta{高度}*)}
+% \end{nwafusyntax}
+% 校名图片的大小。默认仅指定了宽度,为 |0.65\textwidth|\/。
+% 如果仅需指定高度,可在 \meta{宽度} 处填入一个空的分组 |{}|。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12,updated=2021-5-22]{style/auto-make-cover}
+% \begin{nwafusyntax}[emph={[1]auto-make-cover}]
+% auto-make-cover = (*<\TTF>*)
+% \end{nwafusyntax}
+% 是否自动生成研究生论文的封面(封一)、英文封面(封二)、
+% 题名页(封三)、项目资助页(封四)、声明页(封五)和
+% 使用授权页(封六)。本科论文(设计)的封面(封一)和
+% 声明及使用授权页(封二)。
+% 封面中的各项信息,可通过 \cs{nwafuset} 录入,
+% 具体请参阅 \ref{subsubsec:信息录入}~节。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{style/withchapter}
+% \begin{nwafusyntax}[emph={[1]withchapter}]
+% withchapter = (*<\TTF>*)
+% \end{nwafusyntax}
+% 选择论文章标题格式为章格式(如:第1章 绪论)还是报告格式(如:1 绪论)。
+% \end{function}
+%
+% \subsubsection{信息录入} \label{subsubsec:信息录入}
+%
+% \emph{这一部分代码基于\cls{fduthesis},并针对西北农林科技大学的要求,
+% 进行了必要的删除和添加}。
+%
+% \begin{function}[added=2021-05-12]{info}
+% \begin{nwafusyntax}[emph={[1]info}]
+% info = (*\marg{键值列表}*)
+% info/(*\meta{key}*) = (*\meta{value}*)
+% \end{nwafusyntax}
+% 该选项包含许多子项目,用于录入论文信息。具体内容见下。以下带“|*|”
+% 的项目表示对应的英文字段。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{info/degree}
+% \begin{nwafusyntax}[emph={[1]degree}]
+% degree = (*<(academic)|professional>*)
+% \end{nwafusyntax}
+% 学位类型,仅适用于硕士学位论文。\opt{academic} 和 \opt{professional}
+% 分别表示学术学位和专业学位。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{info/btype}
+% \begin{nwafusyntax}[emph={[1]btype}]
+% btype = (*<(paper)|design>*)
+% \end{nwafusyntax}
+% 本科毕业类型,仅适用于本科。\opt{paper} 和 \opt{design}
+% 分别表示论文和设计。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{info/title,info/title*}
+% \begin{nwafusyntax}[emph={[1]title,title*}]
+% title = (*\marg{中文标题}*)
+% title* = (*\marg{英文标题}*)
+% \end{nwafusyntax}
+% 论文标题。默认会在约 20 个汉字字宽处强制断行,但为了语义的
+% 连贯以及排版的美观,如果的标题长于一行,建议使用“|\\|”
+% 进行手动断行。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{info/author,info/author*}
+% \begin{nwafusyntax}[emph={[1]author,author*}]
+% author = (*\marg{姓名}*)
+% author* = (*\marg{英文姓名或拼音}*)
+% \end{nwafusyntax}
+% 作者姓名。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{info/supervisor, info/supervisor*}
+% \begin{nwafusyntax}[emph={[1]supervisor, supervisor*}]
+% supervisor = (*\marg{姓名}*)
+% supervisor* = (*\marg{英文姓名或拼音}*)
+% \end{nwafusyntax}
+% 导师姓名。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{info/cosupervisor, info/cosupervisor*}
+% \begin{nwafusyntax}[emph={[1]cosupervisor, cosupervisor*}]
+% cosupervisor = (*\marg{姓名}*)
+% cosupervisor* = (*\marg{英文姓名或拼音}*)
+% \end{nwafusyntax}
+% 联合(协助)指导教师姓名。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{info/department, info/department*}
+% \begin{nwafusyntax}[emph={[1]department, department*}]
+% department = (*\marg{名称}*)
+% department* = (*\marg{英文名称}*)
+% \end{nwafusyntax}
+% 学院名称。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{info/major,info/major*}
+% \begin{nwafusyntax}[emph={[1]major, major*}]
+% major = (*\marg{名称}*)
+% major* = (*\marg{英文名称}*)
+% \end{nwafusyntax}
+% 专业名称。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{info/researchfield, info/researchfield*}
+% \begin{nwafusyntax}[emph={[1]researchfield, researchfield*}]
+% researchfield = (*\marg{名称}*)
+% researchfield* = (*\marg{英文名称}*)
+% \end{nwafusyntax}
+% 研究方向名称(仅学硕需要)。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{info/professionaltype, info/professionaltype*}
+% \begin{nwafusyntax}[emph={[1]professionaltype, professionaltype*}]
+% professionaltype = (*\marg{名称}*)
+% professionaltype* = (*\marg{英文名称}*)
+% \end{nwafusyntax}
+% 专业学位类型名称(仅专硕需要)。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{info/professionalfield, info/professionalfield*}
+% \begin{nwafusyntax}[emph={[1]professionalfield, professionalfield*}]
+% professionalfield = (*\marg{名称}*)
+% professionalfield* = (*\marg{英文名称}*)
+% \end{nwafusyntax}
+% 专业学位领域名称(仅专硕需要)。
+% \end{function}
+%
+% \begin{function}[added=2021-05-23]{info/mastertype}
+% \begin{nwafusyntax}[emph={[1]mastertype}]
+% mastertype = (*\marg{研究生学位英文名称}*)
+% \end{nwafusyntax}
+% 研究生学位英文名称(用于硕士研究生英文封面)。
+%
+% 对于学术硕士可以取:Philosophy(哲学);Economics(经济学);
+% Science(理学);Engineering(工学);Agriculture(农学);
+% Management(管理学)等(注意首字母需要大写)。
+%
+% 对于专业硕士可以取:Engineering(工程硕士);
+% Agricultural(农业硕士) 等(注意首字母需要大写)。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{info/student-id}
+% \begin{nwafusyntax}[emph={[1]student-id}]
+% student-id = (*\marg{数字}*)
+% \end{nwafusyntax}
+% 作者学号。
+% \end{function}
+%
+% 西北农林科技大学学号采用10位4段制编码:X1--X4/X5/X6/X7--X10。
+% 其中:
+%
+% X1--X4代表入学年份。
+%
+% X5=0表示学生,此时,X6=1-2表示本科生,
+% X6=3表示成人教育学生,X6=4表示预科生,X6=5-6表示研究生,
+% X6=7表示国际学院学生,X6=8表示水土保持研究所学生。
+% X7-X10为流水号。
+%
+% \begin{function}[added=2021-05-18]{info/class-id}
+% \begin{nwafusyntax}[emph={[1]class-id}]
+% class-id = (*\marg{数字}*)
+% \end{nwafusyntax}
+% 作者班级号,班号数字。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{info/grade}
+% \begin{nwafusyntax}[emph={[1]grade}]
+% grade = (*\marg{数字}*)
+% \end{nwafusyntax}
+% 毕业年份(届)。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{info/enroll}
+% \begin{nwafusyntax}[emph={[1]enroll}]
+% enroll = (*\marg{数字}*)
+% \end{nwafusyntax}
+% 入学年份(年级)。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12,updated=2021-05-23]{info/school-id}
+% \begin{nwafusyntax}[emph={[1]school-id}]
+% school-id = (*\marg{数字}*)
+% \end{nwafusyntax}
+% 学校代码。默认值为 10712(西北农林科技大学学校代码)。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12, updated=2021-05-24]{info/date, info/date*}
+% \begin{nwafusyntax}[emph={[1]date, date*}]
+% date = (*\marg{日期}*)
+% date* = (*\marg{英文日期}*)
+% \end{nwafusyntax}
+% 论文完成日期。默认值为文档编译年月(\tn{datezh}和\tn{dateen})。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{info/defensedate}
+% \begin{nwafusyntax}[emph={[1]defensedate}]
+% defensedate = (*\marg{日期}*)
+% \end{nwafusyntax}
+% 论文答辩日期。默认值为文档编译日期(\tn{today})。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12, updated=2021-05-18]{info/secret-level}
+% \begin{nwafusyntax}[emph={[1]secret-level}]
+% secret-level = (*<(none)|i|ii|iii|iv>*)
+% \end{nwafusyntax}
+% 密级。\opt{i}、\opt{ii}、\opt{iii}、\opt{iv} 分别表示限制、
+% 秘密、机密、绝密;
+% \opt{none} 表示论文不涉密,密级为公开。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{info/instructors}
+% \begin{nwafusyntax}[emph={[1]instructors}]
+% instructors = (*\marg{成员 1, 成员 2, ...}*)
+% \end{nwafusyntax}
+% 指导小组成员。各成员之间需使用英文逗号隔开。为防止歧义,
+% 可以用分组括号“|{...}|”把各成员字段括起来。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{info/defensecommittees}
+% \begin{nwafusyntax}[emph={[1]defensecommittees}]
+% defensecommittees = (*\marg{\{单位, 姓名, 职称\}, \{单位, 姓名, 职称\}, ...}*)
+% \end{nwafusyntax}
+% 答辩委员会构成(仅研究生需要),每个成员由单位、姓名和职称三部分构成,
+% 用英文逗号分隔后置于大括号内,不同成员间用英文逗号隔开。为防止歧义,
+% 可以用分组括号“|{...}|”把每个成员中的各个字段括起来。
+% \end{function}
+%
+% \begin{function}[added=2021-05-18]{info/foundation}
+% \begin{nwafusyntax}[emph={[1]foundation}]
+% foundation = (*\marg{\{来源, 名称, 编号\}, \{来源, 名称, 编号\}, ...}*)
+% \end{nwafusyntax}
+% 论文资助项目(仅研究生需要),每个项目由来源、名称和编号三部分构成,
+% 用英文逗号分隔后置于大括号内,不同项目间用英文逗号隔开。为防止歧义,
+% 可以用分组括号“|{...}|”把每个项目中的各个字段括起来。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{info/clc}
+% \begin{nwafusyntax}[emph={[1]clc}]
+% clc = (*\marg{分类号}*)
+% \end{nwafusyntax}
+% 中图分类号(CLC)。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{info/udc}
+% \begin{nwafusyntax}[emph={[1]udc}]
+% udc = (*\marg{UDC码}*)
+% \end{nwafusyntax}
+% UDC码(UDC)。
+% \end{function}
+%
+% \subsubsection{摘要数据录入} \label{subsubsec:摘要数据录入}
+%
+% \begin{function}[added=2021-05-31]{nwafu / abstract}
+% \begin{nwafusyntax}[emph={[1]abstract}]
+% abstract = (*\marg{键值列表}*)
+% abstract/(*\meta{key}*) = (*\meta{value}*)
+% \end{nwafusyntax}
+% 该选项包含多个子项目,用于录入或指定论文摘要数据文件,
+% 具体内容见下。以下带“|*|” 的项目表示对应的英文字段。
+% \end{function}
+%
+% \begin{function}[added=2021-05-31]{abstract/abstractfile,abstract/abstractfile*}
+% \begin{nwafusyntax}[emph={[1]abstractfile,abstractfile*}]
+% abstractfile = (*\marg{中文摘要文件名}*)
+% abstractfile* = (*\marg{英文摘要文件名}*)
+% \end{nwafusyntax}
+% 摘要内容\file{.tex}源文件的文件名称。在文件名中可以使用路径信息,
+% 文件名中需包括\file{.tex}扩展名。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12,updated=2021-05-31]{abstract/keywords,abstract/keywords*}
+% \begin{nwafusyntax}[emph={[1]keywords,keywords*}]
+% keywords = (*\marg{中文关键字}*)
+% keywords* = (*\marg{英文关键字}*)
+% \end{nwafusyntax}
+% 关键字列表。各关键字之间需\textbf{使用英文逗号隔开}。为防止歧义,
+% 可以用分组括号“|{...}|”把各关键字括起来。
+% \end{function}
+%
+% \begin{function}[added=2021-05-31]{abstract/notationfile}
+% \begin{nwafusyntax}[emph={[1]notationfile}]
+% notationfile = (*\marg{主要符号对照表文件名}*)
+% \end{nwafusyntax}
+% 主要符号对照表内容\file{.tex}源文件的文件名称。在文件名中可以使用路径信息。
+% 文件名中需包括\file{.tex}扩展名。
+% \end{function}
+%
+% \subsection{正文编写}
+%
+% \begin{quotation}
+% 喬孟符(吉)博學多能,以樂府稱。嘗云:「作樂府亦有法,曰^^A
+% \CJKunderdot{鳳頭、豬肚、豹尾}六字是也。」大概起要美麗,中要浩蕩,
+% 結要響亮。尤貴在首尾貫穿,意思清新。苟能若是,斯可以言樂府矣。
+% \end{quotation}
+% \hfill ——陶宗儀《南村輟耕錄·作今樂府法》
+%
+% \subsubsection{凤头}
+%
+% 对于研究生学位论文,该部分包含封面(研究生包括封面一$\sim$七,
+% 本科生包括封面一和封面七)、中英文摘要、主要符号对照表和目录。
+% 在前置部分中,中英文摘要开始至主要符号对照表,页码采用大写罗马字母,并且与目录分开计数。
+% 目录应该放在奇数页起排,页码采用大写罗马字母,并与正文分开计数
+%
+% 对于本科生毕业论文(设计),该部分包含中英文摘要和目录。其中,
+% 中英文摘要无页码。目录应该放在奇数页起排,部分页码采用大写罗马字母,并与正文分开计数
+%
+% 建议将中英文摘要内容分别写在不同\file{.tex}源文件中,然后用\cs{nwafuset}设置文件名后,
+% 自动排版。在摘要的最后,会显示关键字列表,可通过 \cs{nwafuset} 录入关键字列表。
+% 关于摘要数据录入,具体请参阅 \ref{subsubsec:摘要数据录入}~节。
+%
+% 建议将主要符号对照表写在\file{.tex}源文件中,然后用\cs{nwafuset}设置文件名后,
+% 自动排版。关于主要符号对照表数据录入,具体请参阅 \ref{subsubsec:摘要数据录入}~节。
+%
+% 为正确按要求实现排版顺序和页码,不建议手动排版封面、中英文摘要、主要符号对照表和目录,
+% 在提供基本内容后,由模板自动实现前置部分(凤头)排版
+%
+% \subsubsection{猪肚}
+%
+% \begin{function}[added=2021-05-29]{\mainmatter,\mainmatter*}
+% \begin{nwafusyntax}[deletetexcs={\mainmatter,\mainmatter*},
+% morekeywords={\mainmatter,\mainmatter*}]
+% \mainmatter(*\oarg{编号格式|(Roman)}*)
+% \mainmatter*(*\oarg{编号格式|(Roman)}*)
+% \end{nwafusyntax}
+% \cs{mainmatter} 为主文区命令,章标题正常编号,
+% 且页码为从1开始计数的阿拉伯数字,
+% 带有星号的命令 \cs{mainmatter*} 不使用清双页命令 \tn{cleardoublepage}。
+%
+% 注意,由于要求第一章从奇数页开始排版,
+% 因此应该使用不带星号的\cs{mainmatter}开始正文主体区的排版。
+% \end{function}
+%
+% 主体部分是论文的核心,可以分章节撰写。如有需求,也可以采用
+% 多文件方式撰写,然后用\cs{include}命令将各个子文件包含入主文件。
+% 主体部分的页码采用阿拉伯数字连续编号。
+%
+% \begin{function}[added=2021-05-12]{\footnote}
+% \begin{nwafusyntax}[deletetexcs={\footnote},%
+% morekeywords={\footnote}]
+% \footnote(*\marg{脚注文字}*)
+% \end{nwafusyntax}
+% 插入脚注。脚注编号样式可利用 \opt{style/footnote-style} 选项控制,
+% 具体见 \ref{subsubsec:论文格式}~小节。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{axiom,corollary,definition,example,lemma,
+% proof,theorem}
+% \begin{nwafusyntax}[emph={[2]proof}]
+% \begin{proof}(*\oarg{小标题}*)
+% (*\meta{证明过程}*)
+% \end{proof}
+% \end{nwafusyntax}
+% 一系列预定义的数学环境。具体含义见表~\ref{tab:theorem}。
+% \end{function}
+%
+% \begin{table}[ht]
+% \caption{预定义的数学环境} \label{tab:theorem}
+% \centering
+% \begin{tabular}{cccccccc}
+% \toprule
+% \textbf{名称} &
+% \env{axiom} & \env{corollary} & \env{definition} &
+% \env{example} & \env{lemma} & \env{proof} &
+% \env{theorem} \\
+% \midrule
+% \textbf{含义} &
+% 公理 & 推论 & 定义 & 例 & 引理 & 证明 & 定理 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%
+% 证明环境(\env{proof})的最后会添加证毕符号“$\QED$”。要确保
+% 该符号在正确的位置显示,需要按照 \ref{subsec:编译方式}~节
+% 中的有关说明至少编译\emph{两次},可不执行biber main参考文献编译操作。
+%
+% \begin{function}[added=2021-05-12]{\newtheorem}
+% \begin{nwafusyntax}[deletetexcs={\newtheorem},
+% morekeywords={\newtheorem,\newtheorem*}]
+% \newtheorem(*\oarg{选项}\marg{环境名}\marg{标题}*)
+% \newtheorem*(*\oarg{选项}\marg{环境名}\marg{标题}*)
+% \begin(*\marg{环境名}\oarg{小标题}*)
+% (*\meta{内容}*)
+% \end(*\marg{环境名}*)
+% \end{nwafusyntax}
+% 声明新的定理类环境(数学环境)。带星号的版本表示不进行编号,
+% 并且会默认添加证毕符号“$\QED$”。声明后,即可同预定义的数学环境
+% 一样使用。
+% \end{function}
+%
+% 事实上,表~\ref{tab:theorem} 中预定义的环境正是通过以下方式定义的:
+% \begin{latexexample}[deletetexcs={\newtheorem},
+% morekeywords={\newtheorem,\newtheorem*}]
+% \newtheorem*{proof}{证明}
+% \newtheorem{axiom}{公理}
+% \newtheorem{corollary}{定理}
+% ...
+% \end{latexexample}
+%
+% 与 \cs{nwafuset} 相同,\cs{newtheorem} 的可选参数 \meta{选项}
+% 也为一组键值列表。可用的选项见下。注意无需输入“|theorem/|”。
+%
+% \begin{function}[added=2021-05-12]{theorem/style}
+% \begin{nwafusyntax}[emph={[1]style}]
+% style = (*<(plain)|margin|change|\\
+% XXXXXX\mbox{}~~~~~~~~break|marginbreak|changebreak>*)
+% \end{nwafusyntax}
+% 定理类环境的总体样式。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{theorem/header-font}
+% \begin{nwafusyntax}[emph={[1]header-font}]
+% header-font = (*\marg{字体}*)
+% \end{nwafusyntax}
+% 定理头(即标题)的字体。中文模板默认为 \tn{sffamily},即无衬线体
+% (黑体);英文模板默认为 |\bfseries\upshape|,即加粗直立体。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{theorem/body-font}
+% \begin{nwafusyntax}[emph={[1]body-font}]
+% body-font = (*\marg{字体}*)
+% \end{nwafusyntax}
+% 定理内容的字体。中文模板默认为 \tn{nwafu@kai},即楷体;英文模板
+% 默认为 \tn{itshape},即斜体。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{theorem/qed}
+% \begin{nwafusyntax}[emph={[1]qed}]
+% qed = (*\marg{符号}*)
+% \end{nwafusyntax}
+% 定理结束标记(即证毕符号)。如果用 \cs{newtheorem} 声明定理,
+% 则默认为空;用 \cs{newtheorem*} 声明,则默认为
+% |\ensuremath{\QED}|,即“$\QED$”。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{theorem/counter}
+% \begin{nwafusyntax}[emph={[1]counter}]
+% counter = (*\marg{计数器}*)
+% \end{nwafusyntax}
+% 定理计数器,表示定理编号在 \meta{计数器} 的下一级,并会随
+% \meta{计数器} 的变化而清零。\scite{刘海洋2013latex入门}
+% 默认为 |chapter|,表示按章编号。使用 \cs{newtheorem*} 时,
+% 该选项无效。
+% \end{function}
+%
+% \emph{关于定理部分命令定义和设置,完全采用\cls{fduthesis}的代码实现}。
+%
+% \begin{function}[added=2021-05-12]{\caption}
+% \begin{nwafusyntax}[deletetexcs={\caption},morekeywords={\caption}]
+% \caption(*\marg{图表标题}*)
+% \caption(*\oarg{短标题}\marg{长标题}*)
+% \end{nwafusyntax}
+% 插入图表标题。可选参数 \meta{短标题} 用于图表目录。在
+% \meta{长标题} 中,可以进行长达多段的叙述;但 \meta{短标题}
+% 和单独的 \meta{图表标题} 中则不允许分段。
+% \scite{刘海洋2013latex入门}
+% \end{function}
+%
+% \begin{function}[added=2021-05-22]{\bicaption}
+% \begin{nwafusyntax}[deletetexcs={\bicaption},morekeywords={\bicaption}]
+% \bicaption(*\marg{中文标题}\marg{英文标题}*)
+% \end{nwafusyntax}
+% 插入图表双语标题。双语标题基于\cls{bicaption}宏包实现。
+% \end{function}
+%
+% 按照排版惯例,建议将表格的标题放置在绘制表格的命令之前,
+% 而将图片的标题放置在绘图或插图的命令之后。另需注意,
+% \tn{caption} 命令必须放置在浮动体环境(如 \env{table} 或
+% \env{figure})中。
+%
+% \subsubsection{豹尾}
+%
+% \begin{function}[added=2021-05-26]{\bibmatter}
+% 参考文献开始开始。
+% \end{function}
+%
+% 用于为参考文献部分设置正确的页眉,后续页码接正文区连续编码。
+%
+% \begin{function}[added=2021-05-12]{\printbibliography}
+% \begin{nwafusyntax}[morekeywords={\printbibliography}]
+% \printbibliography(*\oarg{选项}*)
+% \end{nwafusyntax}
+% 打印参考文献列表。
+% \meta{文献数据库} 可利用 \opt{style/bib-resource} 选项指定,具体见
+% \ref{subsubsec:论文格式}~小节。
+% \end{function}
+%
+% 注:本模板参考文献是胡振震根据西北农林科技大学的基本要求,通过
+% 添加部分样式控制代码实现的\scite{biblatex,biblatex-gb7714-2015},
+% 因此,\textbf{无法进行个性化定制}。
+%
+% \begin{function}[added=2021-05-24]{\appdendix}
+% 声明附录开始。
+% \end{function}
+%
+% 用于为附录部分设置正确的页眉及按要求实现附录中的图、表和公式编号。
+% 后续页码接参考文献区连续编码。
+%
+% \begin{function}[added=2021-05-29]{\backmatter}
+% \cs{backmatter} 为后置区命令,页码格式与编号保持不变,
+% 章标题不编号。
+% \end{function}
+%
+% 用于为后置部分设置正确页眉,后置部分主要包括致谢和个人简历。
+% 后续页码接附录区连续编码。
+%
+% \begin{function}[added=2021-06-01]{acknowledgement}
+% \begin{nwafusyntax}[emph={[2]acknowledgement}]
+% \begin{acknowledgement}
+% (*\meta{致谢内容}*)
+% \end{acknowledgement}
+% \end{nwafusyntax}
+% 致谢排版环境。使用该环境的主要作用是设置页眉及产生不编号章标题。
+% \end{function}
+%
+% \begin{function}[added=2021-06-01]{resume}
+% \begin{nwafusyntax}[emph={[2]resume}]
+% \begin{resume}
+% (*\meta{简历内容}*)
+% \end{resume}
+% \end{nwafusyntax}
+% 简历排版环境。使用该环境的主要作用是设置页眉及产生不编号章标题。
+% \end{function}
+%
+% \begin{function}[added=2021-06-01]{\researchitem}
+% \begin{nwafusyntax}[deletetexcs={\researchitem},morekeywords={\researchitem}]
+% \researchitem(*\oarg{个人简历分类名称}*)
+% \end{nwafusyntax}
+% 在简历排版中,指定成果类型,按标题的格式(非标题)居中排版。
+% \end{function}
+%
+% \begin{function}[added=2021-06-01]{publications}
+% \begin{nwafusyntax}[emph={[2]publications}]
+% \begin{publications}
+% (*\meta{简历中发表的学术论文列表}*)
+% \end{publications}
+% \end{nwafusyntax}
+% 简历中发表的学术论文排版列表环境。
+% \end{function}
+%
+% \begin{function}[added=2021-06-01]{achievements}
+% \begin{nwafusyntax}[emph={[2]achievements}]
+% \begin{achievements}
+% (*\meta{简历中发表的学术论文列表}*)
+% \end{achievements}
+% \end{nwafusyntax}
+% 简历中专利等研究成果排版列表环境。
+% \end{function}
+%
+% \section{其他命令接口}
+%
+% \begin{function}[added=2021-05-20]{\nwafuthesis}
+% \cs{nwafuthesis} 命令用于输出\cls{nwafuthesis}模板
+% 的LOGO:~\nwafuthesis{}。
+% \end{function}
+%
+% \begin{function}[added=2021-05-20]{\datezh}
+% \cs{datezh} 命令用于输出中文格式的当前年、月。
+% \end{function}
+%
+% \begin{function}[added=2021-05-20]{\dateen}
+% \cs{dateen} 命令用于输出英文格式的当前月,年。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12,updated=2021-5-28]{\makecoveri,
+% \makecoverii,\makecoveriii, \makecoveriv,
+% \makecoverv,\makecovervi,\makecovervii}
+% 分别用于生成封面(一)$\sim$(七)。单独使用这几个命令可能
+% 会造成页面顺序错误,因此若非必要,应避免直接使用这些命令排版。
+% \end{function}
+%
+% \begin{function}[added=2021-06-04]{\makecovers}
+% 生成所有封面。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{\tableofcontents,\listoffigures,\listoftables}
+% 修改 \cs{tableofcontents}、\cs{listoffigures} 和 \cs{listoftables} 的定义,
+% 使得页眉正确显示,并出现在目录及 PDF 书签中。来自于 \LaTeXe{} 标准文档类
+% \file{book.cls}
+% \footnote{原代码中只有 \cs{tableofcontents} 的 \cs{@mkboth} 出现在
+% \cs{chapter*} 内部,这是出于兼容性的考虑而非 typo。}。
+% \end{function}
+%
+% \begin{function}[added=2021-05-28]{\makefront}
+% 用于生成中英文摘要、目录和主要符号对照表。
+%
+% 注意:不建议直接使用该命令排版,
+% 应该由模板自动调用进行排版。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{abstract}
+% \begin{nwafusyntax}[emph={[2]abstract}]
+% \begin{abstract}
+% (*\meta{中文摘要}*)
+% \end{abstract}
+% \end{nwafusyntax}
+% \end{function}
+% \begin{function}[added=2021-05-12]{abstract*}
+% \begin{nwafusyntax}[emph={[2]abstract*}]
+% \begin{abstract*}
+% (*\meta{英文摘要}*)
+% \end{abstract*}
+% \end{nwafusyntax}
+% 摘要排版环境。不带星号和带星号的版本分别用来排版中文摘要
+% 和英文摘要。
+%
+% 注意:不建议直接排版摘要,应该提供摘要内容\file{.tex}源文件名后,由
+% \cs{makefront}命令自动排版。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{notation}
+% \begin{nwafusyntax}[emph={[2]notation}]
+% \begin{notation}(*\oarg{列格式说明}*)
+% (*\meta{符号 1}*) & (*\meta{说明}*) \\
+% (*\meta{符号 2}*) & (*\meta{说明}*) \\
+% (*\phantom{\meta{符号 $n$}}*) (*$\vdots$*)
+% (*\meta{符号\ \kern-0.1em$n$}*) & (*\meta{说明}*)
+% \end{notation}
+% \end{nwafusyntax}
+% 主要符号对照表环境。可选参数 \meta{列格式说明}与 \LaTeX{} 中标准表格的列格
+% 式说明语法一致,默认值为“|lp{7.5cm}|”,即第一列宽度自动调整,
+% 第二列限宽 \SI{7.5}{cm},两列均为左对齐。
+%
+% 注意:不建议直接排版主要符号对照表,
+% 应该提供主要符号对照表内容\file{.tex}源文件名后,由
+% \cs{makefront}命令自动排版。
+% \end{function}
+%
+% \begin{function}[added=2021-05-29]{\frontmatter,\frontmatter*}
+% \begin{nwafusyntax}[deletetexcs={\frontmatter,\frontmatter*},
+% morekeywords={\frontmatter,\frontmatter*}]
+% \frontmatter(*\oarg{编号格式|(Roman)}*)
+% \frontmatter*(*\oarg{编号格式|(Roman)}*)
+% \end{nwafusyntax}
+% \cs{frontmatter} 为前置区命令,章标题不编号,
+% 页码可设置为例如 \opt{roman}、\opt{Alph} 等格式,
+% 带有星号的命令 \cs{frontmatter*} 不使用清双页命令 \tn{cleardoublepage}。
+% \end{function}
+%
+% \begin{function}[added=2021-05-12]{\cleardoublepage}
+% \begin{nwafusyntax}[deletetexcs={\cleardoublepage},morekeywords={\cleardoublepage}]
+% \cleardoublepage(*\oarg{页面风格|(empty)}*)
+% \end{nwafusyntax}
+% 在奇数页使用命令 \tn{cleardoublepage} 时可选参数为
+% 下一页多出的空白偶数页的页面风格,默认为 \opt{empty} 即空的页眉页脚。
+% \end{function}
+%
+% \section{宏包依赖情况}
+%
+% 使用不同编译方式、指定不同选项,会导致宏包依赖情况有所不同。
+% 具体如下:
+% \begin{itemize}
+% \item 在任何情况下,本模板都会\emph{显式}调用以下宏包
+% (或文档类):
+% \begin{itemize}
+% \item \pkg{expl3}、\pkg{xparse}、\pkg{xtemplate} 和
+% \pkg{l3keys2e},用于构建 \LaTeX3 编程环境
+% \scite{source3}。它们分属 \pkg{l3kernel} 和
+% \pkg{l3packages} 宏集。
+% \item \cls{ctexbook},提供中文排版的通用框架。属于 \CTeX{}
+% 宏集 \scite{CTeX}。
+% \item \pkg{amsmath},对 \LaTeX{} 的数学排版功能进行了
+% 全面扩展。属于 \AmSLaTeX{} 套件。
+% \item \pkg{unicode-math},负责处理 Unicode 编码的
+% OpenType 数学字体。
+% \item \pkg{geometry},用于调整页面尺寸。
+% \item \pkg{fancyhdr},处理页眉页脚。
+% \item \pkg{footmisc},处理脚注。
+% \item \pkg{ntheorem},提供增强版的定理类环境。
+% \item \pkg{graphicx},提供图形插入的接口。
+% \item \pkg{longtable},长表格(允许跨页)支持。
+% \item \pkg{booktabs},三线表支持。
+% \item \pkg{caption},用于设置标题。
+% \item \pkg{bicaption},用于设置标题。
+% \item \pkg{xcolor},提供彩色支持。
+% \item \pkg{enumitem},提供列表环境的个性化设置。
+% \item \pkg{biblatex},提供参考文献排版。
+% \item \pkg{hyperref},提供交叉引用、超链接、电子书签等功能。
+% \end{itemize}
+% \item 开启 \kvopt{style/footnote-style}{pifont} 后,会调用
+% \pkg{pifont} 宏包。它属于 \pkg{psnfss} 套件。
+% \item \pkg{biblatex} 宏包需要依赖 \biber{} 程序。参考文献样式由
+% \pkg{biblatex-gb7714-2015} 宏包提供\scite{biblatex,biblatex-gb7714-2015}。
+% \end{itemize}
+%
+% 这里只列出了本模板直接调用的宏包。这些宏包自身的调用情况,
+% 此处不再具体展开。如有需要,请参阅相关文档。
+%
+% \begin{thebibliography}{99}
+%
+% \newcommand\urlprefix{\newline\hspace*{\fill}}
+% \let\OldUrl=\url
+% \renewcommand\url[2][]{{\small\textit{#1}~\OldUrl{#2}}}
+% \newcommand\CTANurl[2][]{{\small\textit{#1}~\href{http://mirror.ctan.org/#2}^^A
+% {\ttfamily CTAN://#2}}}
+%
+% \subsection{图书}
+%
+% \bibitem{knuth1986texbook}
+% \textsc{Knuth D E}.
+% \newblock \textit{The \TeX book: Computers \& Typesetting, volume A} [M].
+% \newblock Boston: Addison--Wesley Publishing Company, 1986
+% \urlprefix \CTANurl[源代码^^A
+% \footnote{此代码只可作为学习之用。未经 Knuth 本人同意,不应当编译此文档。}:]^^A
+% {systems/knuth/dist/tex/texbook.tex}
+%
+% \bibitem{mittelbach2004latexcompanion}
+% \textsc{Mittelbach F} and \textsc{Goossens M}.
+% \newblock \textit{The \LaTeX{} Companion} [M].
+% \newblock 2nd ed.
+% \newblock Boston: Addison--Wesley Publishing Company, 2004
+%
+% \bibitem{胡伟2017latex2e}
+% 胡伟.
+% \newblock \textit{\LaTeXe{} 文类和宏包学习手册} [M].
+% \newblock 北京: 清华大学出版社, 2017
+%
+% \bibitem{刘海洋2013latex入门}
+% 刘海洋.
+% \newblock \textit{\LaTeX{} 入门} [M].
+% \newblock 北京: 电子工业出版社, 2013
+%
+% \subsection{标准、规范}
+%
+% \bibitem{gb-t-7713.1-2006}
+% 国务院学位委员会办公室, 全国信息与文献标准化技术委员会.
+% \newblock \textit{学位论文编写规则: GB/T 7713.1--2006} [S].
+% \newblock 北京: 中国标准出版社, 2007
+%
+% \bibitem{gb-t-7714-2015}
+% 全国信息与文献标准化技术委员会.
+% \newblock \textit{信息与文献\quad 参考文献著录规则: GB/T 7714--2015} [S].
+% \newblock 北京: 中国标准出版社, 2015
+%
+% \bibitem{gb-t-15834-2011}
+% 教育部语言文字信息管理司.
+% \newblock \textit{标点符号用法: GB/T 15834--2011} [S/OL].
+% \newblock 北京: 中国标准出版社, 2012
+% \urlprefix\url{http://www.moe.gov.cn/ewebeditor/uploadfile/2015/01/13/20150113091548267.pdf}
+%
+% \bibitem{clreq}
+% W3C.
+% \newblock \textit{中文排版需求(Requirements for Chinese Text Layout)} [EB/OL].
+% \newblock (2020-08-17)
+% \urlprefix\url{https://w3c.github.io/clreq/}
+%
+% \bibitem{西北农林科技大学研究生论文写作指南}
+% 西北农林科技大学研究生院.
+% \newblock \textit{研究生学位论文写作指南(试用版)} [EB/OL].
+% \newblock 2021 年 3 月修订版.
+% \newblock (2021-03-17)
+% \urlprefix\url{https://yjshy.nwafu.edu.cn/docs//2021-03/0d686e7d3f204af9880822db5fd7045c.pdf}
+%
+% \bibitem{西北农林科技大学本科生论文撰写规范}
+% 西北农林科技大学教务处.
+% \newblock \textit{西北农林科技大学本科毕业论文(设计)写作规范(试用)} [EB/OL].
+% \newblock 2021 年 5 月修订版.
+% \newblock (2021-05-07)
+% \urlprefix\url{https://jiaowu.nwafu.edu.cn/docs//2021-05/8aa0ef88fcf94e5ebf0bdcc2a6f42785.pdf}
+%
+% \subsection{宏包、模版}
+%
+% \bibitem{source2e}
+% \textsc{Braams J}, \textsc{Carlisle D}, \textsc{Jeffrey A}, et al.
+% \newblock \textit{The \LaTeXe{} Sources} [CP/OL].
+% \newblock (2020-02-02)
+% \urlprefix\url{https://ctan.org/pkg/latex}
+% \urlprefix\CTANurl[源代码:]{macros/latex/base/source2e.pdf}
+%
+% \bibitem{CTeX}
+% \textsc{CTEX.ORG}.
+% \newblock \textit{\CTeX{} 宏集手册} [EB/OL].
+% \newblock version 2.5.4,
+% \newblock (2020-08-23)
+% \urlprefix\url{https://ctan.org/pkg/ctex}
+% \urlprefix\CTANurl[文档及源代码:]{language/chinese/ctex/ctex.pdf}
+%
+% \bibitem{xeCJK}
+% \textsc{CTEX.ORG}.
+% \newblock \textit{\pkg{xeCJK} 宏包} [EB/OL].
+% \newblock version 3.8.5,
+% \newblock (2020-08-23)
+% \urlprefix\url{https://ctan.org/pkg/xecjk}
+% \urlprefix\CTANurl[文档及源代码:]{macros/xetex/latex/xecjk/xeCJK.pdf}
+%
+% \bibitem{source3}
+% \textsc{The \LaTeX3 Project}.
+% \newblock \textit{The \LaTeX3 Sources} [CP/OL].
+% \newblock (2020-08-07)
+% \urlprefix\url{https://ctan.org/pkg/l3kernel}
+% \urlprefix\CTANurl[源代码:]{macros/latex/contrib/l3kernel/source3.pdf}
+%
+% \bibitem{biblatex}
+% \textsc{Lehman P}, \textsc{Kime P}, \textsc{Boruvka A}, et al.
+% \newblock \textit{The \pkg{biblatex} Package} [EB/OL].
+% \newblock version 3.15a,
+% \newblock (2020-08-23)
+% \urlprefix\url{https://ctan.org/pkg/biblatex}
+% \urlprefix\CTANurl[文档:]{macros/latex/contrib/biblatex/doc/biblatex.pdf}
+%
+% \bibitem{lshort}
+% \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al.
+% \newblock \textit{The Not So Short Introduction to \LaTeXe{}: Or \LaTeXe{} in 139 minutes} [EB/OL].
+% \newblock version 6.2,
+% \newblock (2018-02-28)
+% \urlprefix\url{https://ctan.org/pkg/lshort-english}
+% \urlprefix\CTANurl[文档:]{info/lshort/english/lshort.pdf}
+%
+% \bibitem{lshort-zh-cn}
+% \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al.
+% \newblock \textit{一份(不太)简短的 \LaTeXe{} 介绍: 或 112 分钟了解 \LaTeXe{}} [EB/OL].
+% \newblock \CTeX{} 开发小组, 译.
+% \newblock 原版版本 version 6.2, 中文版本 version 6.02,
+% \newblock (2020-08-03)
+% \urlprefix\url{https://ctan.org/pkg/lshort-zh-cn}
+% \urlprefix\CTANurl[文档:]{info/lshort/chinese/lshort-zh-cn.pdf}
+%
+% \bibitem{biblatex-gb7714-2015}
+% 胡振震.
+% \newblock \textit{符合 GB/T 7714-2015 标准的 biblatex 参考文献样式} [EB/OL].
+% \newblock version 1.0v,
+% \newblock (2020-07-21)
+% \urlprefix\url{https://ctan.org/pkg/biblatex-gb7714-2015}
+% \urlprefix\CTANurl[文档:]{biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf}
+%
+% \bibitem{fduthesis}
+% 曾祥东(\textsc{Xiangdong Z}).
+% \newblock \textit{\textsc{fduThesis}:复旦大学毕业论文 \LaTeX{} 模板} [EB/OL].
+% \newblock version 0.7e,
+% \newblock (2020-08-30)
+% \urlprefix\url{https://ctan.org/pkg/fduthesis}
+% \urlprefix\CTANurl[文档及源代码:]{macros/latex/contrib/fduthesis/fduthesis.pdf}
+%
+% \subsection{其他}
+%
+% \bibitem{wright2009dtxfile}
+% \textsc{Wright J}.
+% \newblock \textit{A model dtx file} [EB/OL].
+% \newblock (2009-10-06)
+% \urlprefix\url{https://www.texdev.net/2009/10/06/a-model-dtx-file/}
+%
+% \bibitem{孔雀计划}
+% 刘庆(\textsc{Eric Q L}).
+% \newblock \textit{孔雀计划:中文字体排印的思路} [EB/OL].
+% \urlprefix\url{https://thetype.com/kongque/}
+%
+% \end{thebibliography}
+%
+% \clearpage
+%
+% \end{documentation}
+%
+% \begin{implementation}
+%
+%^^A 代码部分的页边距
+% \newgeometry{
+% left = 2.25 in,
+% right = 1.00 in,
+% top = 1.25 in,
+% bottom = 1.00 in,
+% marginpar = 2.25 in
+% }
+%
+% \section{实现细节}
+%
+% 本模板使用 \LaTeX3 语法编写,依赖 \pkg{expl3} 环境,
+% 并需调用 \pkg{l3packages} 中的相关宏包。
+%
+% 按照 \LaTeX3 语法,代码中的空格、换行、回车与制表符完全被忽略,
+% 而下划线“|_|”和冒号“|:|”则可作为一般字母使用。
+% 正常的空格可以使用“|~|”代替;至于 |~| 原来所表示的“带子”,
+% 则要用 \LaTeXe{} 的原始命令 \tn{nobreakspace} 代替。
+%
+% 以下代码中有一些形如 \textcolor[HTML]{2E3191}{\textsf{<*class>}}
+% 的标记,这是 \pkg{DocStrip} 中的“guard”,用来选择性地提取文件。
+% “\textsf{*}”和“\textsf{/}”分别表示该部分的开始和结束。不含
+% “\textsf{*}”和“\textsf{/}”的 guard 出现在行号右侧,它们用来确定
+% 单独一行代码的归属。这些 guard 的颜色深浅不一,用以明确嵌套关系。
+%
+% 另有若干形如 \textcolor{MaterialPink}{\textsf{<@@=nwafu>}} 的 guard,
+% 它们由 \pkg{l3docstrip} 定义,用来标识名字空间(模块)。
+%
+% \subsection{准备}
+%
+% \begin{macrocode}
+%<@@=nwafu>
+%<*class>
+% \end{macrocode}
+%
+% 检查 \LaTeX3 编程环境。
+% \begin{macrocode}
+\RequirePackage { xparse, xtemplate, l3keys2e }
+\clist_map_inline:nn { expl3, xparse, xtemplate, l3keys2e }
+ {
+ \@ifpackagelater {#1} { 2018/05/12 }
+ { } { \msg_error:nnn { nwafuthesis } { l3-too-old } {#1} }
+ }
+\msg_new:nnn { nwafuthesis } { l3-too-old }
+ {
+ Package~ "#1"~ is~ too~ old. \\\\
+ Please~ update~ an~ up-to-date~ version~ of~ the~ bundles \\
+ "l3kernel"~ and~ "l3packages"~ using~ your~ TeX~ package \\
+ manager~ or~ from~ CTAN.
+ }
+% \end{macrocode}
+%
+% 目前 \cls{nwafuthesis} 仅支持 \XeTeX{} 和 \LuaTeX{}。
+% \begin{macrocode}
+\sys_if_engine_xetex:F
+ {
+ \sys_if_engine_luatex:F
+ {
+ \msg_fatal:nnx { nwafuthesis } { unsupported-engine }
+ { \c_sys_engine_str }
+ }
+ }
+\msg_new:nnn { nwafuthesis } { unsupported-engine }
+ {
+ The~ nwafuthesis~ class~ requires~ either~ XeTeX~ or~ LuaTeX. \\\\
+ "#1"~ is~ not~ supported~ at~ present.~ You~ must~ change \\
+ your~ typesetting~ engine~ to~ "xelatex"~ or~ "lualatex".
+ }
+\hook_gset_rule:nnnn { begindocument/before } { nwafuthesis } { < } { xeCJK }
+% \end{macrocode}
+%
+% \subsubsection{内部变量声明}
+%
+% \begin{variable}{\l_@@_tmpa_box,
+% \l_@@_tmpa_clist,
+% \l_@@_tmpb_clist,
+% \l_@@_tmpc_clist,
+% \l_@@_tmpt_clist,
+% \l_@@_tmpa_dim,
+% \l_@@_tmpb_dim,
+% \l_@@_tmpc_dim,
+% \l_@@_tmpd_dim,
+% \l_@@_tmpt_dim,
+% \l_@@_tmpa_skip,
+% \l_@@_tmpa_tl,
+% \l_@@_tmpb_tl,
+% \l_@@_tmpt_tl
+% }
+% 临时变量。
+% \begin{macrocode}
+\box_new:N \l_@@_tmpa_box
+\clist_new:N \l_@@_tmpa_clist
+\clist_new:N \l_@@_tmpb_clist
+\clist_new:N \l_@@_tmpc_clist
+\clist_new:N \l_@@_tmpd_clist
+\clist_new:N \l_@@_tmpt_clist
+\dim_new:N \l_@@_tmpa_dim
+\dim_new:N \l_@@_tmpb_dim
+\dim_new:N \l_@@_tmpc_dim
+\dim_new:N \l_@@_tmpd_dim
+\dim_new:N \l_@@_tmpt_dim
+\skip_new:N \l_@@_tmpa_skip
+\tl_new:N \l_@@_tmpa_tl
+\tl_new:N \l_@@_tmpb_tl
+\tl_new:N \l_@@_tmpc_tl
+\tl_new:N \l_@@_tmpd_tl
+\tl_new:N \l_@@_tmpt_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\g_@@_thesis_type_int}
+% 论文类型。取值 1、2、3 分别对应博士、硕士、本科(学士)。
+% \begin{macrocode}
+\int_new:N \g_@@_thesis_type_int
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\g_@@_to_ctexbook_clist,\g_@@_to_hyperref_clist}
+% 分别保存由 \cls{nwafuthesis} 传入 \cls{ctexbook} 文档类和
+% \pkg{hyperref} 宏包的选项列表。
+% \begin{macrocode}
+\clist_new:N \g_@@_to_ctexbook_clist
+\clist_new:N \g_@@_to_hyperref_clist
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_withchap_bool}
+% 是否按章编写论文(默认按章编写)。
+% 该选项是针对部分学院需要按报告形式(类似"1 绪论")撰写本科毕业论文(设计)
+% 而设置的。
+% \begin{macrocode}
+\bool_new:N \l_@@_withchap_bool
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\g_@@_twoside_bool}
+% 是否开启双页模式(默认打开)。
+% 本模板中,目前使用双页与单页模式的排版结果是一样的,
+% 保留该设置的目的是为了后续扩展。
+% \begin{macrocode}
+\bool_new:N \g_@@_twoside_bool
+\bool_set_true:N \g_@@_twoside_bool
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\g_@@_draft_bool}
+% 是否开启草稿模式。
+% \begin{macrocode}
+\bool_new:N \g_@@_draft_bool
+% \end{macrocode}
+% \end{variable}
+%
+% \subsubsection{内部函数}
+%
+% \begin{macro}{\cs_generate_variant:cn,
+% \file_input:V,
+% \int_to_arabic:v,
+% \keys_define:nx,
+% \tl_map_inline:xn}
+% \begin{macro}[TF]{\tl_if_eq:Vn}
+% \LaTeX3{} 函数的函数变体。
+% \begin{macrocode}
+\cs_generate_variant:Nn \cs_generate_variant:Nn { cn }
+\cs_generate_variant:Nn \file_input:n { V }
+\cs_generate_variant:Nn \int_to_arabic:n { v }
+\cs_generate_variant:Nn \keys_define:nn { nx }
+\cs_generate_variant:Nn \tl_map_inline:nn { xn }
+\prg_generate_conditional_variant:Nnn \tl_if_eq:nn { Vn } { T, TF }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@@_quad:,\@@_qquad:}
+% 等价于 \LaTeXe{} 中的 \tn{quad} 和 \tn{qquad}。
+% \begin{macrocode}
+\cs_new:Npn \@@_quad: { \skip_horizontal:n { 1 em } }
+\cs_new:Npn \@@_qquad: { \skip_horizontal:n { 2 em } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_vspace:N,\@@_vspace:n,\@@_vspace:c}
+% 类似 \LaTeXe{} 中的 \tn{vspace*}。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_vspace:N #1
+ {
+ \dim_set_eq:NN \l_@@_tmpa_dim \prevdepth
+ \hrule height \c_zero_dim
+ \nobreak
+ \skip_vertical:N #1
+ \skip_vertical:N \c_zero_skip
+ \dim_set_eq:NN \prevdepth \l_@@_tmpa_dim
+ }
+\cs_new_protected:Npn \@@_vspace:n #1
+ {
+ \skip_set:Nn \l_@@_tmpa_skip {#1}
+ \@@_vspace:N \l_@@_tmpa_skip
+ }
+\cs_generate_variant:Nn \@@_vspace:N { c }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_symbol:n}
+% 等价于 \LaTeXe{} 中的 \tn{symbol}。
+% \begin{macrocode}
+\cs_new:Npn \@@_symbol:n #1 { \tex_char:D #1 \scan_stop: }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_arabic:n}
+% 等价于 \LaTeXe{} 中的 \tn{arabic}。
+% \begin{macrocode}
+\cs_new:Npn \@@_arabic:n #1
+ { \int_to_arabic:v { c@ #1 } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_patch_cmd:Nnn,\@@_preto_cmd:Nn,\@@_appto_cmd:Nn}
+% 补丁工具,来自 \pkg{ctexpatch} 宏包。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_patch_cmd:Nnn #1#2#3
+ {
+ \ctex_patch_cmd_once:NnnnTF #1 { } {#2} {#3}
+ { } { \ctex_patch_failure:N #1 }
+ }
+\cs_new_protected:Npn \@@_preto_cmd:Nn #1#2
+ {
+ \ctex_preto_cmd:NnnTF #1 { } {#2}
+ { } { \ctex_patch_failure:N #1 }
+ }
+\cs_new_protected:Npn \@@_appto_cmd:Nn #1#2
+ {
+ \ctex_appto_cmd:NnnTF #1 { } {#2}
+ { } { \ctex_patch_failure:N #1 }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_at_begin_environment:nn}
+% 在环境开始添加代码的补丁函数。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_at_begin_environment:nn #1#2
+ {
+ \seq_set_from_clist:Nn \l_@@_env_hook_name_seq {#1}
+ \seq_map_inline:Nn \l_@@_env_hook_name_seq
+ { \AtBeginEnvironment{##1}{#2} }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_at_end_preamble:n}
+% 在导言区结束位置添加代码的补丁函数。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_at_end_preamble:n
+ {
+ \ctex_gadd_ltxhook:nn { env/document/before }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_define_fn_style:nn,
+% \@@_define_punct:nn,
+% \@@_define_name:nn,
+% \@@_define_name:nnn}
+% 用来定义脚注样式、标点、默认名称的辅助函数。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_define_fn_style:nn #1#2
+ { \tl_const:cn { c_@@_fn_style_ #1 _tl } {#2} }
+\cs_new_protected:Npn \@@_define_punct:nn #1#2
+ { \tl_const:cn { c_@@_ #1 _tl } { \@@_symbol:n {#2} } }
+\cs_new_protected:Npn \@@_define_name:nn #1#2
+ { \tl_const:cn { c_@@_name_ #1 _tl } {#2} }
+\cs_new_protected:Npn \@@_define_name:nnn #1#2#3
+ {
+ \tl_const:cn { c_@@_name_ #1 _tl } {#2}
+ \tl_const:cn { c_@@_name_ #1 _en_tl } {#3}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_msg_new:nn,
+% \@@_error:n,\@@_error:nn,\@@_error:nx,\@@_error:nnn,
+% \@@_warning:n,\@@_warning:nn,\@@_warning:nxx,
+% \@@_info:nx}
+% 各种信息函数的缩略形式。
+% \begin{macrocode}
+\cs_new:Npn \@@_msg_new:nn { \msg_new:nnn { nwafuthesis } }
+\cs_new:Npn \@@_error:n { \msg_error:nn { nwafuthesis } }
+\cs_new:Npn \@@_error:nn { \msg_error:nnn { nwafuthesis } }
+\cs_new:Npn \@@_error:nx { \msg_error:nnx { nwafuthesis } }
+\cs_new:Npn \@@_error:nnn { \msg_error:nnnn { nwafuthesis } }
+\cs_new:Npn \@@_warning:n { \msg_warning:nn { nwafuthesis } }
+\cs_new:Npn \@@_warning:nn { \msg_warning:nnn { nwafuthesis } }
+\cs_new:Npn \@@_warning:nxx { \msg_warning:nnxx { nwafuthesis } }
+\cs_new:Npn \@@_info:nx { \msg_info:nnx { nwafuthesis } }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{选项处理}
+%
+% 定义 |nwafu/option| 键值类。
+% \begin{macrocode}
+\keys_define:nn { nwafu / option }
+ {
+% \end{macrocode}
+%
+% \begin{macro}{type}
+% 设置论文类型。设为模板选项主要是为了以后的兼容性。论文类型可能会
+% 影响很多设置,默认为本科毕业论文。
+% \begin{macrocode}
+ type .choice:,
+ type .value_required:n = true,
+ type .choices:nn =
+ { doctor, master, bachelor }
+ { \int_set_eq:NN \g_@@_thesis_type_int \l_keys_choice_int },
+ type .initial:n = bachelor,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{oneside,twoside}
+% 设置页面类型为单面或双面。
+% \begin{macrocode}
+ oneside .value_forbidden:n = true,
+ twoside .value_forbidden:n = true,
+ oneside .code:n =
+ {
+ \clist_gput_right:Nn \g_@@_to_ctexbook_clist { oneside }
+ \bool_set_false:N \g_@@_twoside_bool
+ },
+ twoside .code:n =
+ {
+% \end{macrocode}
+% 将双面设置为openany,从结果来讲与单面一样,
+% 此处是为后续诸如页边距调整为左右不同保留的设置。
+% \begin{macrocode}
+ \clist_gput_right:Nn \g_@@_to_ctexbook_clist { twoside, openany }
+ \bool_set_true:N \g_@@_twoside_bool
+ },
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{draft}
+% 是否开启草稿模式(默认关闭)。
+% \begin{macrocode}
+ draft .choice:,
+ draft / true .code:n =
+ {
+ \bool_set_true:N \g_@@_draft_bool
+ \clist_gput_right:Nn \g_@@_to_ctexbook_clist { draft }
+ },
+ draft / false .code:n =
+ { \bool_set_false:N \g_@@_draft_bool },
+ draft .default:n = true,
+ draft .initial:n = false,
+% \end{macrocode}
+% \end{macro}
+%
+% 处理未知选项。
+% \begin{macrocode}
+ unknown .code:n = { \@@_error:n { unknown-option } }
+ }
+\@@_msg_new:nn { unknown-option }
+ { Class~ option~ "\l_keys_key_tl"~ is~ unknown. }
+% \end{macrocode}
+%
+% 将文档类选项传给 |nwafu/option|。
+% \begin{macrocode}
+\ProcessKeysOptions { nwafu / option }
+% \end{macrocode}
+%
+% \subsection{模板参数配置}
+%
+% \subsubsection{定义模板LOGO和中英文年月命令}
+%
+% \begin{macro}{\nwafuthesis}
+% nwafuthesis模板的LOGO。
+% \begin{macrocode}
+\NewDocumentCommand \nwafuthesis { }
+ {%
+ \makebox{\rmfamily%
+ N\hspace{-0.2ex}\raisebox{-0.5ex}{W}\raisebox{0.5ex}{\hspace{-0.2ex}\textsc{AFU}}\hspace{0.3ex}%
+ \textsc{Thesis}
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\datezh}
+% 取得中文年月。
+% \begin{macrocode}
+\NewDocumentCommand \datezh { }
+ {
+ \int_use:N \c_sys_year_int 年
+ \int_use:N \c_sys_month_int 月
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\dateen}
+% 取得英文月年,详见:
+% 1 = Jan.(January),
+% 2 = Feb.(February),
+% 3 = Mar.(March),
+% 4 = Apr.(April),
+% 5 = May.(May),
+% 6 = Jun.(June),
+% 7 = Jul.(July),
+% 8 = Aug.(August),
+% 9 = Sept.(September),
+% 10 = Oct.(October),
+% 11 = Nov.(November),
+% 12 = Dec.(December),
+% \begin{macrocode}
+\prop_new:N \l_@@_dateen_prop
+\prop_set_from_keyval:Nn \l_@@_dateen_prop
+ {
+ 1 = Jan.,
+ 2 = Feb.,
+ 3 = Mar.,
+ 4 = Apr.,
+ 5 = May.,
+ 6 = Jun.,
+ 7 = Jul.,
+ 8 = Aug.,
+ 9 = Sept.,
+ 10 = Oct.,
+ 11 = Nov.,
+ 12 = Dec.,
+ }
+\NewDocumentCommand \dateen { }
+ {
+ \prop_get:NVN \l_@@_dateen_prop \c_sys_month_int \l_@@_tmpa_tl
+ \l_@@_tmpa_tl ,~ \int_use:N \c_sys_year_int
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{通用常量}
+%
+% 这一部分内容在原\cls{fduthesis}中,是通过``*.def''文件实现的,
+% 由于针对本校而言这些内容极少发生改变,为了减少文件依赖,将其
+% 全部写入了\cls{nwafuthesis.cls}文件。
+%
+% \begin{variable}{\c_@@_name_simp_tl,\c_@@_name_trad_tl,
+% \c_@@_name_en_tl}
+% 学校名称。
+% \begin{macrocode}
+\tl_const:Nn \c_@@_name_simp_tl { 西北农林科技大学 }
+\tl_const:Nn \c_@@_name_trad_tl { 西北農林科技大學 }
+\tl_const:Nn \c_@@_name_en_tl { Northwest~ A\&F~ University }
+% \end{macrocode}
+% \end{variable}
+%
+% 常用标点符号,见表~\ref{tab:punctuations}。
+% \begin{macrocode}
+\clist_map_inline:nn
+ {
+ { ideo_comma } { "3001 },
+ { ideo_full_stop } { "3002 },
+ { fwid_comma } { "FF0C },
+ { fwid_full_stop } { "FF0E },
+ { fwid_colon } { "FF1A },
+ { fwid_semicolon } { "FF1B },
+ { fwid_left_paren } { "FF08 },
+ { fwid_right_paren } { "FF09 }
+ }
+ { \@@_define_punct:nn #1 }
+% \end{macrocode}
+%
+% \begin{table}[ht]
+% \caption{常用标点符号}
+% \label{tab:punctuations}
+% \centering
+% \begin{tabular}{cccc}
+% \toprule
+% \textbf{中文名称} & \textbf{英文名称} & \textbf{符号} & \textbf{Unicode} \\
+% \midrule
+% 中文顿号 & Ideographic comma & \symbol{"3001} & U+3001 \\
+% 中文句号 & Ideographic full stop & \symbol{"3002} & U+3002 \\
+% 中文逗号 & Fullwidth comma & \symbol{"FF0C} & U+FF0C \\
+% 全角西文句点 & Fullwidth full stop & \symbol{"FF0E} & U+FF0E \\
+% 中文冒号 & Fullwidth colon & \symbol{"FF1A} & U+FF1A \\
+% 中文分号 & Fullwidth semicolon & \symbol{"FF1B} & U+FF1B \\
+% 中文左圆括号 & Fullwidth left parenthesis & \symbol{"FF08} & U+FF08 \\
+% 中文右圆括号 & Fullwidth right parenthesis & \symbol{"FF09} & U+FF09 \\
+% \bottomrule
+% \end{tabular}
+% \end{table}
+%
+% \begin{variable}{\c_@@_line_spread_fp}
+% 行距倍数。行距倍数 $k$ 由下式确定:
+% \begin{equation*}
+% \num{1.2} \times k \times \SI{12}{bp} = \SI{20}{pt}.
+% \end{equation*}
+% 式中,\num{1.2} 是基本行距与文字大小之比,\SI{12}{bp} 是小四号字
+% 的大小,\SI{20}{pt} 是行距固定值。
+% \begin{macrocode}
+\fp_const:Nn \c_@@_line_spread_fp
+ { \dim_ratio:nn { 20 pt } { 12 bp } / 1.2 }
+% \end{macrocode}
+% \end{variable}
+%
+% \subsubsection{声明页内容常量}
+%
+% \begin{variable}{\c_@@_orig_decl_text_tl}
+% 论文独创性声明。
+% \begin{macrocode}
+\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生独创性声明,注意测试后,此处分段只能用\tn{par}实现。
+% \begin{macrocode}
+ \tl_const:Nn \c_@@_orig_decl_text_tl
+ {
+ 本人声明:所呈交的学位论文是我个人在导师指导下独立进行的研究工作及取
+ 得的研究结果;论文中的研究数据及结果的获得完全符合学校《关于规范西北
+ 农林科技大学研究生学术道德的暂行规定》,如果违反此规定,一切后果与法
+ 律责任均由本人承担。\par
+ 尽我所知,除了文中特别加以标注和致谢的地方外,论文中不包含其他人已经
+ 发表或撰写过的研究结果,也不包含其他人和自己本人已获得西北农林科技大
+ 学或其它教育机构的学位或证书而使用过的材料。与我一同工作的同事对本
+ 研究所做的任何贡献均已在论文的致谢中作了明确的说明并表示了谢意。
+ }
+ }
+ {
+% \end{macrocode}
+% 本科生生独创性声明,注意测试后,此处分段只能用\tn{par}实现。
+% \begin{macrocode}
+ \tl_const:Nn \c_@@_orig_decl_text_tl
+ {
+ 本人声明:所呈交的毕业
+ \clist_item:Nn \c__@@_bachelor_type_clist { \l__@@_info_bachelor_type_int }
+ 是我个人在导师指导下
+ 独立进行的研究工作及取得的研究结果。尽我所知,除了文中特别加
+ 以标注和致谢的地方外,论文中不包含其他人已经发表或撰写过的研究结果,
+ 也不包含其他人和自己本人已获得\c_@@_name_simp_tl{}或其它教育
+ 机构的学位或证书而使用过的材料。与我一同工作的同事对本研究所做
+ 的任何贡献均已在论文的致谢中作了明确的说明并表示了谢意。
+ 如违反此声明,一切后果与法律责任均由本人承担。
+ }
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\c_@@_super_decl_text_tl}
+% 研究生学位导师承诺。
+% \begin{macrocode}
+\tl_const:Nn \c_@@_super_decl_text_tl
+ {
+ 本人承诺:我的研究生{\@@_text_uline:V \l_@@_info_author_tl}所呈交的
+ 学位论文是在我指导下独立开展研究工作及取得的研究结果,属于我现
+ 岗职务工作的结果,并严格按照学校《关于规范西北农林科技大学研究生学术
+ 道德的暂行规定》而获得的研究结果。如果违反学校《关于规范西北农林科
+ 技大学研究生学术道德的暂行规定》,我愿接受按学校有关规定的处罚处理并
+ 承担相应导师连带责任。
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\c_@@_auth_decl_text_tl}
+% 论文使用授权声明。
+% \begin{macrocode}
+\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生使用授权声明,注意测试后,此处分段只能用\tn{par}实现。
+% \begin{macrocode}
+ \tl_const:Nn \c_@@_auth_decl_text_tl
+ {
+ 本学位论文的知识产权归属西北农林科技大学。本人同意西北农林科技大学
+ 保存或向国家有关部门或机构送交论文的纸质版和电子版,允许论文被查阅和
+ 借阅;同意西北农林科技大学将本学位论文的全部或部分内容授权汇编录入
+ 中国博士/硕士学位论文全文数据库》和《中国学位论文全文数据库》进行
+ 出版,并享受相关权益。\par
+
+ 本人保证,在毕业离开(或者工作调离)西北农林科技大学后,发表或者使用本
+ 学位论文及其相关的工作成果时,将以西北农林科技大学为第一署名单位,否
+ 则,愿意按《中华人民共和国著作权法》等有关规定接受处理并承担法律责任。\par
+
+ 任何收存和保管本论文各种版本的其他单位和个人(包括研究生本人)未经本
+ 论文作者的导师同意,不得有对本论文进行复制、修改、发行、出租、改编等
+ 侵犯著作权的行为,否则,按违背《中华人民共和国著作权法》等有关规定处
+ 理并追究法律责任。\par
+
+ {\sffamily (保密的学位论文在保密期限内,不得以任何方式发表、借阅、复印、
+ 缩印或扫描复制手段保存、汇编论文)}
+ }
+ }
+ {
+% \end{macrocode}
+% 本科生使用授权声明,注意测试后,此处分段只能用\tn{par}实现。
+% \begin{macrocode}
+ \tl_const:Nn \c_@@_auth_decl_text_tl
+ {
+ 本毕业
+ \clist_item:Nn \c__@@_bachelor_type_clist { \l__@@_info_bachelor_type_int }
+ 的知识产权归属\c_@@_name_simp_tl{}。
+ 本人同意\c_@@_name_simp_tl{}保存或向国家有关部门或机构
+ 送交论文的纸质版和电子版,允许论文被查阅和借阅。\par
+
+ 本人保证,在毕业离开\c_@@_name_simp_tl{}后,发表或者使用本毕业
+ \clist_item:Nn \c__@@_bachelor_type_clist { \l__@@_info_bachelor_type_int }
+ 及其相关的工作成果时,将以\c_@@_name_simp_tl{}
+ 为第一署名单位,否则,愿意按《中华人民共和国著作权法》等
+ 有关规定接受处理并承担法律责任。\par
+
+ 任何收存和保管本论文各种版本的其他单位和个人(包括作者本人)未经
+ 本论文作者的导师同意,不得有对本论文进行复制、修改、发行、出租、
+ 改编等侵犯著作权的行为,否则,按违背《中华人民共和国著作权法》
+ 等有关规定处理并追究法律责任。
+ }
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\c_@@_orig_decl_sign_tl,
+% \c_@@_super_decl_sign_tl}
+% 声明页签名项目。
+% \begin{macrocode}
+\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生。
+% \begin{macrocode}
+ \tl_const:Nn \c_@@_orig_decl_sign_tl
+ { 研究生签名 }
+ \tl_const:Nn \c_@@_super_decl_sign_tl
+ { 导师签名 }
+ }
+ {
+% \end{macrocode}
+% 本科生。
+% \begin{macrocode}
+ \tl_const:Nn \c_@@_orig_decl_sign_tl
+ { 本科生签名 }
+ \tl_const:Nn \c_@@_super_decl_sign_tl
+ { 指导教师签名 }
+ }
+\clist_const:Nn \c_@@_auth_decl_sign_clist
+ { 作者签名, 导师签名, 日期 }
+% \end{macrocode}
+% \end{variable}
+%
+% \subsubsection{杂项常量定义}
+%
+% \begin{variable}{\c_@@_thesis_type_clist,
+% \c_@@_degree_type_clist,
+% \c_@@_bachelor_type_clist}
+% 论文类型与学位类型。
+% \begin{macrocode}
+\clist_const:Nn \c_@@_thesis_type_clist
+ { 博士学位论文, 硕士学位论文, 本科毕业 }
+\clist_const:Nn \c_@@_degree_type_clist
+ { 学术学位, 专业学位 }
+\clist_const:Nn \c_@@_bachelor_type_clist
+ { 论文, 设计 }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\c_@@_secret_clist}
+% 四种密级,公开直接用,未列入。
+% \begin{macrocode}
+\clist_const:Nn \c_@@_secret_clist { 限制, 秘密, 机密, 绝密 }
+% \end{macrocode}
+% \end{variable}
+%
+% 各字段默认名称,注意会忽略空格。
+% 研究生和本科名称存在不一样现象,例如研究生用“研究生学号”,本科生用“学号”。
+%
+% 研究生和本科生名称相同中文字段。
+% \begin{macrocode}
+%
+\clist_map_inline:nn
+ {
+ { secret_level } { 密级 },
+ { udc } { UDC },
+ { school_id } { 学校代码 },
+ { department } { 学院 },
+ { enroll } { 年级 },
+ { class_id } { 班级 },
+ { instructors } { 指导小组 },
+ { author_sign } { 作者签名 },
+ { supervisor_sign } { 导师签名 },
+ { sign_date } { 日期 },
+ { toc } { 目 \quad 录 },
+ { lof } { 插图目录 },
+ { lot } { 表格目录 },
+ { bib_en } { Bibliography },
+ { ack } { 致 \quad 谢 },
+ { resume } { 个人简历 },
+ { pdf_creator } { LaTeX~ with~ nwafuthesis~ class },
+ }
+ { \@@_define_name:nn #1 }
+\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+%
+% \end{macrocode}
+% 研究生的字段。
+% \begin{macrocode}
+%
+ \clist_map_inline:nn
+ {
+ { student_id } { 研究生学号 },
+ { orig_decl } { 研究生学位论文的独创性声明 },
+ { super_decl } { 导师指导研究生学位论文的承诺 },
+ { auth_decl } { 关于研究生学位论文使用授权的说明 }
+ }
+ { \@@_define_name:nn #1 }
+ }{
+%
+% \end{macrocode}
+% 本科生的字段。
+% \begin{macrocode}
+%
+ \clist_map_inline:nn
+ {
+ { major } { 专业 },
+ { student_id } { 学号 },
+ { author } { 学生姓名 },
+ { cosupervisor } { 协助指导教师 },
+ { date } { 完成日期 },
+ { orig_decl } { 本科生毕业\clist_item:Nn
+ \c__@@_bachelor_type_clist {
+ \l__@@_info_bachelor_type_int
+ }的独创性声明 },
+ { auth_decl } { 关于本科生毕业\clist_item:Nn
+ \c__@@_bachelor_type_clist {
+ \l__@@_info_bachelor_type_int
+ }知识产权的说明 }
+ }
+ { \@@_define_name:nn #1 }
+ }
+%
+% \end{macrocode}
+% 研究生与本科生相同的中英文字段。
+% \begin{macrocode}
+%
+\clist_map_inline:nn
+ {
+ { supervisor } { 指导教师 } { Supervisor },
+ }
+ { \@@_define_name:nnn #1 }
+%
+\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+%
+% \end{macrocode}
+% 研究生。
+% \begin{macrocode}
+%
+ \clist_map_inline:nn
+ {
+ { major } { 学科专业 } { Major },
+ { researchfield } { 研究方向 } { Research~ Field },
+ { professionaltype } { 专业学位类型 } { Degree~ Type },
+ { professionalfield } { 领域名称 } { Field },
+ { author } { 论文作者 } { Candidate },
+ { cosupervisor } { 联合指导教师 } { Co-Supervisor },
+ { date } { 论文提交时间 } { Date~ of~ Submission },
+ { abstract } { 摘 \quad 要 } { ABSTRACT },
+ { keywords } { 关键字 } { KEYWORDS },
+ { clc } { 分类号 } { CLC~ number: },
+ { notation } { 主要符号对照表 } { List~ of~ Symbols }
+ }
+ { \@@_define_name:nnn #1 }
+ }{
+%
+% \end{macrocode}
+% 本科生。
+% \begin{macrocode}
+%
+ \clist_map_inline:nn
+ {
+ { abstract } { 摘要 } { Abstract },
+ { keywords } { 关键字 } { Keywords },
+ { clc } { 分类号 } { CLC~ number },
+ }
+ { \@@_define_name:nnn #1 }
+ }
+% \end{macrocode}
+%
+% 定理标题中英文名称常量。
+% \begin{macrocode}
+%
+\clist_map_inline:nn
+ {
+ { proof } { 证明 } { Proof },
+ { axiom } { 公理 } { Axiom },
+ { corollary } { 推论 } { Corollary },
+ { definition } { 定义 } { Definition },
+ { example } { 例 } { Example },
+ { lemma } { 引理 } { Lemma },
+ { theorem } { 定理 } { Theorem }
+ }
+ { \@@_define_name:nnn #1 }
+% \end{macrocode}
+%
+% \subsection{载入宏包、文档类}
+%
+% 将选项传入 \cls{ctexbook} 文档类。
+% \begin{macrocode}
+\PassOptionsToClass
+ {
+ UTF8,
+ heading = true,
+ fontset = none,
+ zihao = -4,
+ linespread = \c_@@_line_spread_fp,
+ \g_@@_to_ctexbook_clist
+ }
+ { ctexbook }
+% \end{macrocode}
+%
+% 传入各宏包选项。
+% \begin{macrocode}
+\clist_map_inline:nn
+ {
+ { shortlabels } { enumitem },
+ { no-math } { fontspec },
+ { perpage } { footmisc },
+ { amsmath, thmmarks } { ntheorem }
+ }
+ { \PassOptionsToPackage #1 }
+% \end{macrocode}
+%
+% 本模板会在 \pkg{ctexhook} 提供的钩子 \cs{ctex_at_end_preamble:n}
+% 中调用 \pkg{biblatex},而 \pkg{biblatex} 自身又会使用 \pkg{etoolbox}
+% 的钩子 \tn{AtEndPreamble},因此需要在载入 \cls{ctexbook} 之前调用
+% \pkg{etoolbox}。钩子的顺序为:
+% \[ \text{\tn{CTEX@document@left@hook}}
+% \prec \text{\tn{@endpreamblehook}}
+% \prec \text{\texttt{\textbackslash begin\{document\}}}. \]
+% \begin{macrocode}
+\RequirePackage { etoolbox }
+% \end{macrocode}
+%
+% 载入 \cls{ctexbook} 文档类。
+% 在使用 \XeLaTeX{} 编译时,\cls{ctexbook} 的底层将调用 \pkg{xeCJK}
+% 宏包;而在使用 \LuaLaTeX{} 编译时,则将调用 \pkg{LuaTeX-ja} 宏包。
+% 两种情况下 \cls{ctexbook} 均会调用 \pkg{fontspec} 宏包。
+% \begin{macrocode}
+\LoadClass { ctexbook }
+% \end{macrocode}
+%
+%
+% 载入各宏包。其中,\pkg{amsmath} 必须在 \pkg{unicode-math} 之前引入。
+% \begin{macrocode}
+\RequirePackage
+ {
+ amsmath,
+ unicode-math,
+ geometry,
+ fancyhdr,
+ titletoc,
+ footmisc,
+ ntheorem,
+ enumitem,
+ graphicx,
+ longtable,
+ booktabs,
+ caption,
+ xcolor,
+ }
+% \end{macrocode}
+%
+% \begin{macro}{\@@_check_package:nnn}
+% 检查过时宏包。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_check_package:nnn #1#2#3
+ {
+ \@ifpackagelater {#1} {#2}
+ { } { \@@_error:nnn { package-too-old } {#1} {#3} }
+ }
+\@@_msg_new:nn { package-too-old }
+ {
+ Package~ "#1"~ is~ too~ old. \\
+ The~ nwafuthesis~ class~ only~ supports~ "#1"~ with~ a~ version \\
+ higher~ than~ v#2. \\\\
+ Please~ update~ an~ up-to-date~ version~ of~ it~ using~ your \\
+ TeX~ package~ manager~ or~ from~ CTAN.
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\@@_check_package:nnn { ctex } { 2017/08/07 } { 2.4.10 }
+\@@_check_package:nnn { fontspec } { 2017/09/22 } { 2.6e }
+\@@_check_package:nnn { unicode-math } { 2017/11/18 } { 0.8i }
+\sys_if_engine_xetex:T
+ { \@@_check_package:nnn { xeCJK } { 2017/08/07 } { 3.5.0 } }
+\sys_if_engine_luatex:T
+ { \@@_check_package:nnn { xunicode-addon } { 2018/04/30 } { 3.7.1 } }
+% \end{macrocode}
+%
+% \subsection{页面布局}
+%
+% 利用 \pkg{geometry} 宏包设置纸张大小、页面边距以及页眉高度。这里,
+% $\SI{2.54}{\centi\meter}=\SI{1}{in}$,
+% $\SI{3.18}{\centi\meter}=\SI{1.25}{in}$。
+%
+% 研究论文页面尺寸与本科生毕业论文(设计)的
+% 页面尺寸不一致,需要分开设置。
+% \begin{macrocode}
+\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生论文页边距
+% \begin{macrocode}
+ \geometry
+ {
+ paper=a4paper,
+ top=3.1cm,
+ bottom=3.3cm,
+ left=2.6cm,
+ right=2.6cm,
+ headheight=0.8cm,
+ headsep=0.7cm,
+ footskip=1.4cm,
+ %includehead,
+ %includefoot,
+ }
+ }{
+% \end{macrocode}
+% 本科生论文页边距
+% \begin{macrocode}
+ \geometry
+ {
+ paper=a4paper,
+ top=3.14cm,
+ bottom=3.8cm,
+ left=2.45cm,
+ right=2.45cm,
+ headheight=0.8cm,
+ headsep=0.63cm,
+ footskip=2.3cm,
+ }
+ }
+% \end{macrocode}
+%
+% 草稿模式下显示页面边框及页眉、页脚线 。
+% \begin{macrocode}
+\bool_if:NT \g_@@_draft_bool { \geometry { showframe } }
+% \end{macrocode}
+%
+% \subsection{字体}
+%
+% \subsubsection{预定义字体配置}
+%
+% \begin{variable}{\g_@@_fontset_tl, \g_@@_cjk_fontset_tl}
+% 存放字体选项值。
+% \begin{macrocode}
+\tl_new:N \g_@@_fontset_tl
+\tl_new:N \g_@@_cjk_fontset_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{style/font}
+% 预定义西文字体。
+% \begin{macrocode}
+\keys_define:nn { nwafu / style }
+ {
+ font .choices:nn =
+ { garamond, libertinus, lm, palatino, times, times*, none }
+ { \tl_set_eq:NN \g_@@_fontset_tl \l_keys_choice_tl }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{style/cjk-font}
+% 预定义中文字体。
+% \begin{macrocode}
+%<*class>
+\keys_define:nn { nwafu / style }
+ {
+ cjk-font .choices:nn =
+ { adobe, fandol, founder, mac, sinotype, sourcehan, windows, none }
+ { \tl_set_eq:NN \g_@@_cjk_fontset_tl \l_keys_choice_tl }
+ }
+% \end{macrocode}
+%</class>
+% \end{macro}
+%
+% \begin{macro}{withchapter}
+% 设置本科论文章标题是否为章格式。
+% \begin{macrocode}
+\keys_define:nn { nwafu / style }
+ {
+ withchapter .bool_set:N = \l_@@_withchap_bool,
+ withchapter .default:n = true,
+ withchapter .initial:n = true,
+ }
+% \end{macrocode}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{
+% \@@_setmainfont:nn,
+% \@@_setsansfont:nn,
+% \@@_setmonofont:nn,
+% \@@_setmathfont:nn}
+% 用于设置西文字体的辅助函数,来源于 \pkg{fontspec} 和 \pkg{unicode-math}。
+% \begin{arguments}
+% \item 字体名
+% \item 选项
+% \end{arguments}
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_setmainfont:nn #1#2
+ { \__fontspec_main_setmainfont:nn {#2} {#1} }
+\cs_new_protected:Npn \@@_setsansfont:nn #1#2
+ { \__fontspec_main_setsansfont:nn {#2} {#1} }
+\cs_new_protected:Npn \@@_setmonofont:nn #1#2
+ { \__fontspec_main_setmonofont:nn {#2} {#1} }
+\cs_new_protected:Npn \@@_setmathfont:nn #1#2
+ { \__um_setmathfont:nn {#2} {#1} }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{
+% \@@_setCJKmainfont:nn,
+% \@@_setCJKsansfont:nn,
+% \@@_setCJKmonofont:nn}
+% 用于设置中文字体的辅助函数,来源于 \pkg{xeCJK} 和 \pkg{ctex} 宏包。
+% \begin{macrocode}
+%<*class>
+\cs_new_protected:Npn \@@_setCJKmainfont:nn #1#2
+ { \@@_set_family:nnn { \CJKrmdefault } {#2} {#1} }
+\cs_new_protected:Npn \@@_setCJKsansfont:nn #1#2
+ { \@@_set_family:nnn { \CJKsfdefault } {#2} {#1} }
+\cs_new_protected:Npn \@@_setCJKmonofont:nn #1#2
+ { \@@_set_family:nnn { \CJKttdefault } {#2} {#1} }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_set_cjk_font_hei:nn,\nwafu@hei}
+% 中文黑体需要单独设置。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_set_cjk_font_hei:nn #1#2
+ { \@@_set_family:nnn { nwafu@hei } {#2} {#1} }
+\cs_new_protected:Npn \nwafu@hei
+ { \@@_switch_family:n { nwafu@hei } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_set_cjk_font_kai:nn,\nwafu@kai}
+% 楷体需要单独设置。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_set_cjk_font_kai:nn #1#2
+ { \@@_set_family:nnn { nwafu@kai } {#2} {#1} }
+\cs_new_protected:Npn \nwafu@kai
+ { \@@_switch_family:n { nwafu@kai } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{
+% \@@_cjk_font_options:,
+% \@@_cjk_font_hei_options:,
+% \@@_setCJKmainfont:n,
+% \@@_setCJKsansfont:n,
+% \@@_setCJKmonofont:n,
+% \@@_set_cjk_font_hei:n,
+% \@@_set_cjk_font_kai:n}
+% 将 bold、italic 和 bold italic 统一按照 roman 设置。
+% \begin{macrocode}
+\tl_const:Nn \@@_cjk_font_options:
+ { UprightFont = *, ItalicFont = *, AutoFakeBold = true }
+% \end{macrocode}
+% 设置为黑体时不启用伪粗体
+% \begin{macrocode}
+\tl_const:Nn \@@_cjk_font_hei_options:
+ { UprightFont = *, ItalicFont = *, AutoFakeBold = false }
+% \end{macrocode}
+% 设置正文常规字体
+% \begin{macrocode}
+\cs_new_protected:Npx \@@_setCJKmainfont:n #1
+ { \@@_setCJKmainfont:nn {#1} { \@@_cjk_font_options: } }
+% \end{macrocode}
+% 设置无衬线字体
+% \begin{macrocode}
+\cs_new_protected:Npx \@@_setCJKsansfont:n #1
+ { \@@_setCJKsansfont:nn {#1} { \@@_cjk_font_hei_options: } }
+% \end{macrocode}
+% 设置等宽字体
+% \begin{macrocode}
+\cs_new_protected:Npx \@@_setCJKmonofont:n #1
+ { \@@_setCJKmonofont:nn {#1} { \@@_cjk_font_options: } }
+% \end{macrocode}
+% 设置黑体字体
+% \begin{macrocode}
+\cs_new_protected:Npx \@@_set_cjk_font_hei:n #1
+ { \@@_set_cjk_font_hei:nn {#1} { \@@_cjk_font_hei_options: } }
+% \end{macrocode}
+% 设置楷体字体
+% \begin{macrocode}
+\cs_new_protected:Npx \@@_set_cjk_font_kai:n #1
+ { \@@_set_cjk_font_kai:nn {#1} { \@@_cjk_font_options: } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_set_family:nnn,\@@_switch_family:n}
+% 封装 CJK 字体族的设定和切换命令。
+% \begin{macrocode}
+\sys_if_engine_xetex:TF
+ {
+ \cs_new_eq:NN \@@_set_family:nnn \xeCJK_set_family:nnn
+ \cs_new_eq:NN \@@_switch_family:n \xeCJK_switch_family:n
+ }
+ {
+ \cs_new_eq:NN \@@_set_family:nnn \ctex_ltj_set_family:nnn
+ \cs_new_eq:NN \@@_switch_family:n \ctex_ltj_switch_family:n
+ }
+%</class>
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{
+% \setmainfont,
+% \setsansfont,
+% \setmonofont,
+% \setmathfont,
+% \setCJKmainfont,
+% \setCJKsansfont,
+% \setCJKmonofont,
+% \@@_set_font:n}
+% 重新定义以上宏包提供的字体选择命令。把它放在导言区末尾,使得用户配置不被
+% 模板配置覆盖。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_set_font_helper:n #1
+ {
+ \exp_args:Nc \RenewDocumentCommand { set #1 font } { O { } m O { } }
+ {
+ \ctex_at_end_preamble:n
+ { \use:c { @@_set #1 font:nn } {##2} { ##1, ##3 } }
+ }
+ }
+\clist_map_inline:nn { main, sans, mono, math } { \@@_set_font_helper:n {#1} }
+\clist_map_inline:nn { CJKmain, CJKsans, CJKmono } { \@@_set_font_helper:n {#1} }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{
+% \g_@@_font_family_libertinus_serif_tl,
+% \g_@@_font_family_libertinus_sans_tl,
+% \g_@@_font_style_libertinus_rm_tl,
+% \g_@@_font_style_libertinus_bf_tl,
+% \g_@@_font_style_libertinus_it_tl,
+% \g_@@_font_style_libertinus_bfit_tl,
+% \g_@@_font_style_libertinus_bfsl_tl,
+% \g_@@_font_family_xits_tl,
+% \g_@@_font_style_xits_rm_tl,
+% \g_@@_font_style_xits_bf_tl,
+% \g_@@_font_style_xits_it_tl,
+% \g_@@_font_style_xits_bfit_tl,
+% \g_@@_font_name_libertinus_serif_tl,
+% \g_@@_font_name_libertinus_sans_tl,
+% \g_@@_font_name_libertinus_math_tl,
+% \g_@@_font_name_xits_tl,
+% \g_@@_font_name_xits_math_rm_tl,
+% \g_@@_font_name_xits_math_bf_tl}
+% Libertinus 和 XITS 字体的文件名做过变动,需要特殊处理。
+% \begin{macrocode}
+\tl_new:N \g_@@_font_family_libertinus_serif_tl
+\tl_new:N \g_@@_font_family_libertinus_sans_tl
+\tl_new:N \g_@@_font_style_libertinus_rm_tl
+\tl_new:N \g_@@_font_style_libertinus_bf_tl
+\tl_new:N \g_@@_font_style_libertinus_it_tl
+\tl_new:N \g_@@_font_style_libertinus_bfit_tl
+\tl_new:N \g_@@_font_style_libertinus_bfsl_tl
+\tl_new:N \g_@@_font_family_xits_tl
+\tl_new:N \g_@@_font_style_xits_rm_tl
+\tl_new:N \g_@@_font_style_xits_bf_tl
+\tl_new:N \g_@@_font_style_xits_it_tl
+\tl_new:N \g_@@_font_style_xits_bfit_tl
+\tl_new:N \g_@@_font_name_libertinus_serif_tl
+\tl_new:N \g_@@_font_name_libertinus_sans_tl
+\tl_new:N \g_@@_font_name_libertinus_math_tl
+\tl_new:N \g_@@_font_name_xits_tl
+\tl_new:N \g_@@_font_name_xits_math_rm_tl
+\tl_new:N \g_@@_font_name_xits_math_bf_tl
+\fontspec_font_if_exist:nTF { LibertinusSerif-Regular.otf }
+ {
+ \tl_set:Nn \g_@@_font_family_libertinus_serif_tl { LibertinusSerif }
+ \tl_set:Nn \g_@@_font_family_libertinus_sans_tl { LibertinusSans }
+ \tl_set:Nn \g_@@_font_family_libertinus_math_tl { LibertinusMath }
+ \tl_set:Nn \g_@@_font_style_libertinus_rm_tl { Regular }
+ \tl_set:Nn \g_@@_font_style_libertinus_bf_tl { Bold }
+ \tl_set:Nn \g_@@_font_style_libertinus_it_tl { Italic }
+ \tl_set:Nn \g_@@_font_style_libertinus_bfit_tl { BoldItalic }
+ \tl_set:Nn \g_@@_font_style_libertinus_bfsl_tl { BoldOblique }
+ }
+ {
+ \tl_set:Nn \g_@@_font_family_libertinus_serif_tl { libertinusserif }
+ \tl_set:Nn \g_@@_font_family_libertinus_sans_tl { libertinussans }
+ \tl_set:Nn \g_@@_font_family_libertinus_math_tl { libertinusmath }
+ \tl_set:Nn \g_@@_font_style_libertinus_rm_tl { regular }
+ \tl_set:Nn \g_@@_font_style_libertinus_bf_tl { bold }
+ \tl_set:Nn \g_@@_font_style_libertinus_it_tl { italic }
+ \tl_set:Nn \g_@@_font_style_libertinus_bfit_tl { bolditalic }
+ \tl_set:Nn \g_@@_font_style_libertinus_bfsl_tl { bolditalic }
+ }
+\fontspec_font_if_exist:nTF { XITS-Regular.otf }
+ {
+ \tl_set:Nn \g_@@_font_family_xits_tl { XITS }
+ \tl_set:Nn \g_@@_font_style_xits_rm_tl { Regular }
+ \tl_set:Nn \g_@@_font_style_xits_bf_tl { Bold }
+ \tl_set:Nn \g_@@_font_style_xits_it_tl { Italic }
+ \tl_set:Nn \g_@@_font_style_xits_bfit_tl { BoldItalic }
+ \tl_set:Nn \g_@@_font_name_xits_math_rm_tl { XITSMath-Regular }
+ \tl_set:Nn \g_@@_font_name_xits_math_bf_tl { XITSMath-Bold }
+ }
+ {
+ \tl_set:Nn \g_@@_font_family_xits_tl { xits }
+ \tl_set:Nn \g_@@_font_style_xits_rm_tl { regular }
+ \tl_set:Nn \g_@@_font_style_xits_bf_tl { bold }
+ \tl_set:Nn \g_@@_font_style_xits_it_tl { italic }
+ \tl_set:Nn \g_@@_font_style_xits_bfit_tl { bolditalic }
+ \tl_set:Nn \g_@@_font_name_xits_math_rm_tl { xits-math }
+ \tl_set:Nn \g_@@_font_name_xits_math_bf_tl { xits-mathbold }
+ }
+\tl_set:Nx \g_@@_font_name_libertinus_serif_tl
+ { \g_@@_font_family_libertinus_serif_tl - \g_@@_font_style_libertinus_rm_tl }
+\tl_set:Nx \g_@@_font_name_libertinus_sans_tl
+ { \g_@@_font_family_libertinus_sans_tl - \g_@@_font_style_libertinus_rm_tl }
+\tl_set:Nx \g_@@_font_name_libertinus_math_tl
+ { \g_@@_font_family_libertinus_math_tl - \g_@@_font_style_libertinus_rm_tl }
+\tl_set:Nx \g_@@_font_name_xits_tl
+ { \g_@@_font_family_xits_tl - \g_@@_font_style_xits_rm_tl }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_load_font_garamond:}
+% EB Garamond 系列。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_load_font_garamond:
+ {
+ \@@_setmainfont:nn { EBGaramond }
+ {
+ Extension = .otf,
+ UprightFont = *-Regular,
+ BoldFont = *-Bold,
+ ItalicFont = *-Italic,
+ BoldItalicFont = *-BoldItalic
+ }
+ \@@_setsansfont:nn { \g_@@_font_family_libertinus_sans_tl }
+ {
+ Extension = .otf,
+ UprightFont = *-\g_@@_font_style_libertinus_rm_tl,
+ BoldFont = *-\g_@@_font_style_libertinus_bf_tl,
+ ItalicFont = *-\g_@@_font_style_libertinus_it_tl,
+ BoldItalicFont = *-\g_@@_font_style_libertinus_bfsl_tl
+ }
+ \@@_setmonofont:nn { lmmonolt10 }
+ {
+ Extension = .otf,
+ UprightFont = *-regular,
+ BoldFont = *-bold,
+ ItalicFont = *-oblique,
+ BoldItalicFont = *-boldoblique
+ }
+ \@@_setmathfont:nn { Garamond-Math.otf } { }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_load_font_libertinus:}
+% Libertinus 系列。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_load_font_libertinus:
+ {
+ \@@_setmainfont:nn { \g_@@_font_family_libertinus_serif_tl }
+ {
+ Extension = .otf,
+ UprightFont = *-\g_@@_font_style_libertinus_rm_tl,
+ BoldFont = *-\g_@@_font_style_libertinus_bf_tl,
+ ItalicFont = *-\g_@@_font_style_libertinus_it_tl,
+ BoldItalicFont = *-\g_@@_font_style_libertinus_bfit_tl
+ }
+ \@@_setsansfont:nn { \g_@@_font_family_libertinus_sans_tl }
+ {
+ Extension = .otf,
+ UprightFont = *-\g_@@_font_style_libertinus_rm_tl,
+ BoldFont = *-\g_@@_font_style_libertinus_bf_tl,
+ ItalicFont = *-\g_@@_font_style_libertinus_it_tl,
+ BoldItalicFont = *-\g_@@_font_style_libertinus_bfsl_tl
+ }
+ \@@_setmonofont:nn { lmmonolt10 }
+ {
+ Extension = .otf,
+ UprightFont = *-regular,
+ BoldFont = *-bold,
+ ItalicFont = *-oblique,
+ BoldItalicFont = *-boldoblique
+ }
+ \@@_setmathfont:nn { \g_@@_font_name_libertinus_math_tl .otf } { }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_load_font_lm:}
+% Latin Modern 系列。在 \XeLaTeX{} 和 \LuaLaTeX{} 中已作为默认字体,所以仅需
+% 额外处理数学部分。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_load_font_lm:
+ { \@@_setmathfont:nn { latinmodern-math.otf } { } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_load_font_palatino:}
+% Palatino 系列。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_load_font_palatino:
+ {
+ \@@_setmainfont:nn { texgyrepagella }
+ {
+ Extension = .otf,
+ UprightFont = *-regular,
+ BoldFont = *-bold,
+ ItalicFont = *-italic,
+ BoldItalicFont = *-bolditalic
+ }
+ \@@_setsansfont:nn { \g_@@_font_family_libertinus_sans_tl }
+ {
+ Extension = .otf,
+ UprightFont = *-\g_@@_font_style_libertinus_rm_tl,
+ BoldFont = *-\g_@@_font_style_libertinus_bf_tl,
+ ItalicFont = *-\g_@@_font_style_libertinus_it_tl,
+ BoldItalicFont = *-\g_@@_font_style_libertinus_bfsl_tl,
+ Scale = MatchUppercase
+ }
+ \@@_setmonofont:nn { lmmonolt10 }
+ {
+ Extension = .otf,
+ UprightFont = *-regular,
+ BoldFont = *-bold,
+ ItalicFont = *-oblique,
+ BoldItalicFont = *-boldoblique
+ }
+ \@@_setmathfont:nn { texgyrepagella-math.otf } { }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_load_font_times:}
+% Times 系列。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_load_font_times:
+ {
+ \@@_setmainfont:nn { \g_@@_font_family_xits_tl }
+ {
+ Extension = .otf,
+ UprightFont = *-\g_@@_font_style_xits_rm_tl,
+ BoldFont = *-\g_@@_font_style_xits_bf_tl,
+ ItalicFont = *-\g_@@_font_style_xits_it_tl,
+ BoldItalicFont = *-\g_@@_font_style_xits_bfit_tl
+ }
+ \@@_setsansfont:nn { texgyreheros }
+ {
+ Extension = .otf,
+ UprightFont = *-regular,
+ BoldFont = *-bold,
+ ItalicFont = *-italic,
+ BoldItalicFont = *-bolditalic
+ }
+ \@@_setmonofont:nn { texgyrecursor }
+ {
+ Extension = .otf,
+ UprightFont = *-regular,
+ BoldFont = *-bold,
+ ItalicFont = *-italic,
+ BoldItalicFont = *-bolditalic,
+ Ligatures = CommonOff
+ }
+ \@@_setmathfont:nn { \g_@@_font_name_xits_math_rm_tl .otf }
+ { BoldFont = \g_@@_font_name_xits_math_bf_tl .otf }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_load_font_times*:}
+% Times* 系列,除数学部分外采用系统字体。
+% \begin{macrocode}
+\cs_new_protected:cpn { @@_load_font_ times* : }
+ {
+ \@@_setmainfont:nn { Times~ New~ Roman } { }
+ \@@_setsansfont:nn { Arial } { }
+ \@@_setmonofont:nn { Courier~ New } { }
+ \@@_setmathfont:nn { \g_@@_font_name_xits_math_rm_tl .otf }
+ { BoldFont = \g_@@_font_name_xits_math_bf_tl .otf }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_load_cjk_font_adobe:}
+% Adobe 字库。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_load_cjk_font_adobe:
+ {
+ \@@_setCJKmainfont:n { AdobeSongStd-Light }
+ \@@_setCJKsansfont:n { AdobeHeitiStd-Regular }
+ \@@_setCJKmonofont:n { AdobeFangsongStd-Regular }
+ \@@_set_cjk_font_hei:n { AdobeHeitiStd-Regular }
+ \@@_set_cjk_font_kai:n { AdobeKaitiStd-Regular }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_load_cjk_font_fandol:}
+% Fandol 字库。注意它是安装在 TeX 发行版中的,所以使用文件名调用。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_load_cjk_font_fandol:
+ {
+ \@@_setCJKmainfont:nn { FandolSong }
+ {
+ Extension = .otf,
+ UprightFont = *-Regular,
+ BoldFont = *-Bold,
+ ItalicFont = *-Regular,
+ BoldItalicFont = *-Bold
+ }
+ \@@_setCJKsansfont:nn { FandolHei }
+ {
+ Extension = .otf,
+ UprightFont = *-Regular,
+ BoldFont = *-Bold,
+ ItalicFont = *-Regular,
+ BoldItalicFont = *-Bold
+ }
+ \@@_setCJKmonofont:nn { FandolFang }
+ {
+ Extension = .otf,
+ UprightFont = *-Regular,
+ BoldFont = *-Regular,
+ ItalicFont = *-Regular,
+ BoldItalicFont = *-Regular
+ }
+ \@@_set_cjk_font_hei:nn { FandolHei }
+ {
+ Extension = .otf,
+ UprightFont = *-Regular,
+ BoldFont = *-Bold,
+ ItalicFont = *-Regular,
+ BoldItalicFont = *-Bold
+ }
+ \@@_set_cjk_font_kai:nn { FandolKai }
+ {
+ Extension = .otf,
+ UprightFont = *-Regular,
+ BoldFont = *-Regular,
+ ItalicFont = *-Regular,
+ BoldItalicFont = *-Regular
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_load_cjk_font_founder:}
+% 方正字库。虽然有粗体(方正小标宋)等,但并非免费,故这里不做处理。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_load_cjk_font_founder:
+ {
+ \@@_setCJKmainfont:nn { FZShuSong-Z01 }
+ {
+ UprightFont = *,
+ BoldFont = FZHei-B01,
+ ItalicFont = FZKai-Z03,
+ }
+ \@@_setCJKsansfont:n { FZHei-B01 }
+ \@@_setCJKmonofont:n { FZFangSong-Z02 }
+ \@@_set_cjk_font_hei:n { FZHei-B01 }
+ \@@_set_cjk_font_kai:n { FZKai-Z03 }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_load_cjk_font_mac:}
+% macOS 自带中文字体。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_load_cjk_font_mac:
+ {
+ \@@_setCJKmainfont:nn { STSongti-SC }
+ {
+ UprightFont = *-Light,
+ BoldFont = *-Bold,
+ ItalicFont = *-Light,
+ BoldItalicFont = *-Bold
+ }
+ \@@_setCJKsansfont:nn { STHeitiSC }
+ {
+ UprightFont = *-Medium,
+ BoldFont = *-Medium,
+ ItalicFont = *-Medium,
+ BoldItalicFont = *-Medium
+ }
+ \@@_setCJKmonofont:n { STFangsong }
+ \@@_set_cjk_font_hei:nn { STHeitiSC }
+ {
+ UprightFont = *-Medium,
+ BoldFont = *-Medium,
+ ItalicFont = *-Medium,
+ BoldItalicFont = *-Medium
+ }
+ \@@_set_cjk_font_kai:nn { STKaitiSC }
+ {
+ UprightFont = *-Regular,
+ BoldFont = *-Bold,
+ ItalicFont = *-Regular,
+ BoldItalicFont = *-Bold
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_load_cjk_font_sinotype:}
+% 华文字库。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_load_cjk_font_sinotype:
+ {
+ \@@_setCJKmainfont:n { STSong }
+ \@@_setCJKsansfont:n { STHeiti }
+ \@@_setCJKmonofont:n { STFangsong }
+ \@@_set_cjk_font_hei:n { STHeiti }
+ \@@_set_cjk_font_kai:n { STKaiti }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_load_cjk_font_sourcehan:}
+% 思源宋体、思源黑体。由于没有对应的楷体和仿宋,这里直接给出警告。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_load_cjk_font_sourcehan:
+ {
+ \@@_setCJKmainfont:nn { SourceHanSerifSC }
+ {
+ UprightFont = *-Regular,
+ BoldFont = *-Bold,
+ ItalicFont = *-Regular,
+ BoldItalicFont = *-Bold
+ }
+ \@@_setCJKsansfont:nn { SourceHanSansSC }
+ {
+ UprightFont = *-Regular,
+ BoldFont = *-Bold,
+ ItalicFont = *-Regular,
+ BoldItalicFont = *-Bold
+ }
+ \@@_warning:n { source-han }
+ }
+\@@_msg_new:nn { source-han }
+ { Font~ set~ `sourcehan'~ does~ not~ contain~ kaiti~ and~ fangsong. }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_load_cjk_font_windows:}
+% Windows 自带中文字体。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_load_cjk_font_windows:
+ {
+ \@@_setCJKmainfont:n { SimSun }
+ \@@_setCJKsansfont:n { SimHei }
+ \@@_setCJKmonofont:n { FangSong }
+ \@@_set_cjk_font_hei:n { SimHei }
+ \@@_set_cjk_font_kai:n { KaiTi }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% 探测操作系统,以设置中英文字体。
+% \begin{macrocode}
+\tl_new:N \l_@@_cjkfont_tl
+\tl_new:N \l_@@_font_tl
+\cs_new_protected:Npn \@@_detect_platform:
+ {
+ \sys_if_platform_windows:TF
+ {
+ \tl_set:Nn \l_@@_cjkfont_tl { windows }
+ \tl_set:Nn \l_@@_font_tl { times* }
+ }
+ {
+ \@@_if_platform_macos:TF
+ {
+ \tl_set:Nn \l_@@_cjkfont_tl { mac }
+ \tl_set:Nn \l_@@_font_tl { times* }
+ }{
+ \tl_set:Nn \l_@@_cjkfont_tl { fandol }
+ \tl_set:Nn \l_@@_font_tl { times }
+ }
+ }
+ }
+\cs_new_protected:Npn \@@_if_platform_macos:TF
+ { \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } }
+% \end{macrocode}
+%
+% \begin{macro}{\@@_load_font:}
+% 字体加载命令。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_load_font:
+ {
+ \tl_if_empty:NTF \g_@@_fontset_tl
+ {
+ \@@_detect_platform:
+ \tl_gset_eq:NN \g_@@_fontset_tl \l_@@_font_tl
+ }{
+ }
+ \tl_if_empty:NTF \g_@@_cjk_fontset_tl
+ {
+ \@@_detect_platform:
+ \tl_gset_eq:NN \g_@@_cjk_fontset_tl \l_@@_cjkfont_tl
+ }{
+ }
+ \use:c { @@_load_font_ \g_@@_fontset_tl : }
+ \use:c { @@_load_cjk_font_ \g_@@_cjk_fontset_tl : }
+ }
+\ctex_at_end_preamble:n { \@@_load_font: }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{数学字体设置}
+%
+% 根据 GB 3102.11--93 以及 ISO 80000-2:2009 的规定,数学表达式中
+% 表示变量的拉丁字母和希腊字母均应当使用斜体。
+% 这里的 |\keys_set:nn{unicode-math}| 实际相当于 \cs{unimathsetup}。
+% \begin{macrocode}
+\keys_set:nn { unicode-math }
+ {
+ math-style = ISO,
+ bold-style = ISO,
+% mathrm = sym
+ }
+% \end{macrocode}
+%
+% \subsubsection{字号}
+%
+% \begin{macrocode}
+\keys_define:nn { nwafu / style }
+ {
+% \end{macrocode}
+%
+% \begin{macro}{style/font-size}
+% |font-size| 不是文档类选项,不能传给 \cls{ctexbook} 文档类,因此
+% 只能手动重定义字号命令。
+% \begin{macrocode}
+ font-size .choice:,
+ font-size .value_required:n = true,
+ font-size / -4 .code:n = { },
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tiny,\scriptsize,\footnotesize,\small,
+% \normalsize,\large,\Large,\LARGE,\huge,\Huge}
+% 默认使用小四号字,所以只有五号字需要重新设置。
+% \begin{macrocode}
+ font-size / 5 .code:n =
+ {
+ \RenewDocumentCommand \tiny { } { \zihao { 7 } }
+ \RenewDocumentCommand \scriptsize { } { \zihao { -6 } }
+ \RenewDocumentCommand \footnotesize { } { \zihao { 6 } }
+ \RenewDocumentCommand \small { } { \zihao { -5 } }
+ \RenewDocumentCommand \normalsize { } { \zihao { 5 } }
+ \RenewDocumentCommand \large { } { \zihao { -4 } }
+ \RenewDocumentCommand \Large { } { \zihao { -3 } }
+ \RenewDocumentCommand \LARGE { } { \zihao { -2 } }
+ \RenewDocumentCommand \huge { } { \zihao { 2 } }
+ \RenewDocumentCommand \Huge { } { \zihao { 1 } }
+%<*class>
+ },
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{句号}
+%
+% \begin{macro}{style/fullwidth-stop}
+% 设置句号形状(圆圈或是圆点)。
+% \begin{macrocode}
+ fullwidth-stop .choice:,
+ fullwidth-stop .value_required:n = true,
+% \end{macrocode}
+% 利用类别码机制切换,只有显式的\FSID 会被替换。
+% \begin{macrocode}
+ fullwidth-stop / catcode .code:n =
+ { \@@_set_fullwidth_stop_catcode: },
+% \end{macrocode}
+% 利用 TECKit 映射机制切换,相当于设置了 \tn{defaultCJKfontfeatures}
+% |{|\kvopt{Map\-ping}{fullwidth-stop}|}|。这种手段会替换所有出现的\FSID,
+% 并且将影响所有字体。只在 \XeTeX{} 下可用。
+% \begin{macrocode}
+ fullwidth-stop / mapping .code:n =
+ {
+ \sys_if_engine_xetex:TF
+ {
+ \clist_gset:Nn \g__xeCJK_default_features_clist
+ { Mapping = fullwidth-stop }
+ }
+ {
+% \end{macrocode}
+% \LuaTeX{} 下改用类别码机制代替,并给出警告。
+% \begin{macrocode}
+ \sys_if_engine_luatex:T
+ {
+ \@@_warning:n { mapping-not-available }
+ \@@_set_fullwidth_stop_catcode:
+ }
+ }
+ },
+ fullwidth-stop / false .code:n = { }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% 提示信息。
+% \begin{macrocode}
+\@@_msg_new:nn { mapping-not-available }
+ {
+ Option~ "fullwidth-stop = mapping"~ is~ not~ available~ in~ LuaTeX. \\
+ "fullwidth-stop = catcode"~ will~ be~ set~ instead.
+ }
+% \end{macrocode}
+%
+% \begin{macro}{\@@_set_fullwidth_stop_catcode:}
+% 将\FSID 设置为活动符,并定义为句点\FSFW。
+% \begin{macrocode}
+\cs_new:Npn \@@_set_fullwidth_stop_catcode:
+ {
+ \char_set_active_eq:nN { "3002 } \c_@@_fwid_full_stop_tl
+ \char_set_catcode_active:n { "3002 }
+ }
+%</class>
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{页眉页脚}
+%
+% 清除默认页眉页脚格式。
+% \begin{macrocode}
+\fancyhf { }
+% \end{macrocode}
+%
+% \begin{variable}{\l_@@_header_center_mark_tl}
+% 保存中间页眉的文字。正文中设置为空,目录、摘要、符号表、
+% 参考文献、附录、致谢、个人简历等设置为相应标题。
+% \begin{macrocode}
+\tl_new:N \l_@@_header_center_mark_tl
+% \end{macrocode}
+% \end{variable}
+%
+% 关闭横线显示(未启用)。
+% \begin{macrocode}
+% \RenewDocumentCommand \headrulewidth { } { 0 pt }
+% \end{macrocode}
+%
+% \begin{macro}{\cleardoublepage}
+% 重定义 \tn{cleardoublepage},使得偶数页面在没有内容时也不显示页眉页脚,见
+% \url{https://tex.stackexchange.com/a/1683}。最后清空中间页眉,确保正文部分
+% 页眉显示正确。
+% \begin{macrocode}
+\RenewDocumentCommand \cleardoublepage { }
+ {
+ \clearpage
+ \bool_if:NT \g_@@_twoside_bool
+ {
+ \int_if_odd:nF \c@page
+ { \hbox:n { } \thispagestyle { empty } \newpage }
+ }
+ \tl_gset:Nn \l_@@_header_center_mark_tl { }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \pkg{ctex} 宏包使用 \opt{heading} 选项后,会把页面格式设置为 |headings|。
+% 因此必须在 \pkg{ctex} 调用之后重新设置 \cs{pagestyle} 为 |fancy|。
+% \begin{macrocode}
+\pagestyle { fancy }
+% \end{macrocode}
+%
+% \begin{macro}{\frontmatter,\mainmatter}
+% 重定义 \tn{frontmatter}和\tn{frontmatter},
+% 以根据学校要求定制摘要、目录、主要符号对照表等前置部分的页眉页脚。
+% \begin{macrocode}
+\cs_gset_eq:NN \nwafuhead\fancyhead
+\cs_gset_eq:NN \nwafufoot\fancyfoot
+% \end{macrocode}
+% 重定义 \tn{frontmatter},带星号的命令不会启用\cs{cleardoublepage}。
+% \begin{macrocode}
+\RenewDocumentCommand{\frontmatter}{sO{Roman}}
+ {
+% \end{macrocode}
+% 判断是否有*号参数
+% \begin{macrocode}
+ \IfBooleanTF{#1}{\clearpage}{\cleardoublepage}
+ \@mainmatterfalse
+% \end{macrocode}
+% 页码格式
+% \begin{macrocode}
+ \pagenumbering{#2}
+% \end{macrocode}
+% 双面模式
+% \begin{macrocode}
+ \bool_if:NTF \g_@@_twoside_bool
+ {
+% \end{macrocode}
+% 奇数页页眉
+% \begin{macrocode}
+ \nwafuhead[OC]{\small \nouppercase{ \leftmark } }
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生偶数页页眉
+% \begin{macrocode}
+ \nwafuhead[EC]{\small \nouppercase{
+ \c_@@_name_simp_tl \clist_item:Nn
+ \c_@@_thesis_type_clist { \g_@@_thesis_type_int } }
+ }
+ }{
+% \end{macrocode}
+% 本科生偶数页页眉
+% \begin{macrocode}
+ \nwafuhead[EC]{\small \nouppercase{ \leftmark } }
+ }
+ }{
+% \end{macrocode}
+% 单面模式,奇偶页设成一样
+% \begin{macrocode}
+ \nwafuhead [ C ]
+ {
+ \small \nouppercase { \l_@@_header_center_mark_tl }
+ }
+ }
+ \nwafufoot[C]{\small\thepage}
+ }
+% \end{macrocode}
+% 重定义 \tn{mainmatter},带星号的命令不会启用\cs{cleardoublepage}。
+% \begin{macrocode}
+\RenewDocumentCommand{\mainmatter}{s}
+ {
+% \end{macrocode}
+% 判断是否有*号参数
+% \begin{macrocode}
+ \IfBooleanTF{#1}{\clearpage}{\cleardoublepage}
+ \@mainmattertrue
+% \end{macrocode}
+% 页码格式
+% \begin{macrocode}
+ \pagenumbering{arabic}
+% \end{macrocode}
+% 双面模式
+% \begin{macrocode}
+ \bool_if:NTF \g_@@_twoside_bool
+ {
+% \end{macrocode}
+% 奇数页页眉
+% \begin{macrocode}
+ \nwafuhead[OC]{\small \nouppercase{ \leftmark } }
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生偶数页页眉
+% \begin{macrocode}
+ \nwafuhead[EC]{\small \nouppercase{
+ \c_@@_name_simp_tl \clist_item:Nn
+ \c_@@_thesis_type_clist { \g_@@_thesis_type_int } }
+ }
+ }{
+% \end{macrocode}
+% 本科生偶数页页眉
+% \begin{macrocode}
+ \nwafuhead[EC]{\small \nouppercase{ \l__@@_info_title_tl } }
+ }
+ }{
+% \end{macrocode}
+% 单面模式,奇偶页设成一样
+% \begin{macrocode}
+ \nwafuhead [ C ]
+ {
+ \int_if_odd:nTF \c@page
+ {
+% \end{macrocode}
+% 奇数页页眉
+% \begin{macrocode}
+ \small \nouppercase{ \leftmark }
+ }{
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生偶数页页眉
+% \begin{macrocode}
+ \small \nouppercase{
+ \c_@@_name_simp_tl \clist_item:Nn
+ \c_@@_thesis_type_clist { \g_@@_thesis_type_int } }
+ }{
+% \end{macrocode}
+% 本科生偶数页页眉
+% \begin{macrocode}
+ \small \nouppercase{ \l__@@_info_title_tl }
+ }
+ }
+ }
+ }
+ \int_compare:nNnTF{ \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生页脚
+% \begin{macrocode}
+ \nwafufoot[C]{\small\thepage}
+ }{
+% \end{macrocode}
+% 本科生页脚
+% \begin{macrocode}
+ \nwafufoot[C]{\small-\ \thepage\ -}
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bibmatter}
+% 新定义 \cs{bibmatter},以根据学校要求定制参考文献页眉页脚。
+% \begin{macrocode}
+\NewDocumentCommand{\bibmatter}{s}
+ {
+% \end{macrocode}
+% 判断是否有*号参数
+% \begin{macrocode}
+ \IfBooleanTF{#1}{\clearpage}{\cleardoublepage}
+ \@mainmattertrue
+% \end{macrocode}
+% 是否为双面排版
+% \begin{macrocode}
+ \bool_if:NTF \g_@@_twoside_bool
+ {
+% \end{macrocode}
+% 奇数页页眉
+% \begin{macrocode}
+ \nwafuhead[OC]{\small \nouppercase{ \leftmark } }
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生偶数页页眉
+% \begin{macrocode}
+ \nwafuhead[EC]{\small \nouppercase{
+ \c_@@_name_simp_tl \clist_item:Nn
+ \c_@@_thesis_type_clist { \g_@@_thesis_type_int } }
+ }
+ }{
+% \end{macrocode}
+% 本科生偶数页页眉
+% \begin{macrocode}
+ \nwafuhead[EC]{\small \nouppercase{ \leftmark } }
+ }
+ }{
+% \end{macrocode}
+% 单面排版
+% \begin{macrocode}
+ \nwafuhead [ C ]
+ {
+ \int_if_odd:nTF \c@page
+ {
+% \end{macrocode}
+% 奇数页页眉
+% \begin{macrocode}
+ \small \nouppercase{ \leftmark }
+ }{
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生偶数页页眉
+% \begin{macrocode}
+ \small \nouppercase{
+ \c_@@_name_simp_tl \clist_item:Nn
+ \c_@@_thesis_type_clist { \g_@@_thesis_type_int } }
+ }{
+% \end{macrocode}
+% 本科生偶数页页眉
+% \begin{macrocode}
+ \small \nouppercase{ \leftmark }
+ }
+ }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\appendix,\backmatter}
+% 为 \cs{appendix}和\cs{backmatter}命令追加代码,
+% 以根据学校要求定制附录及后置(致谢、个人简历等)页眉页脚。
+% \begin{macrocode}
+\@@_appto_cmd:Nn \appendix
+ {
+ \clearpage
+ \bool_if:NTF \g_@@_twoside_bool
+% \end{macrocode}
+% 双面
+% \begin{macrocode}
+ {
+% \end{macrocode}
+% 奇数页页眉
+% \begin{macrocode}
+ \nwafuhead[OC]{\small \nouppercase{ \@chapapp } }
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生偶数页页眉
+% \begin{macrocode}
+ \nwafuhead[EC]{\small \nouppercase{
+ \c_@@_name_simp_tl \clist_item:Nn
+ \c_@@_thesis_type_clist { \g_@@_thesis_type_int } }
+ }
+ }{
+% \end{macrocode}
+% 本科生偶数页页眉
+% \begin{macrocode}
+ \nwafuhead[EC]{\small \nouppercase{ \@chapapp } }
+ }
+ }{
+% \end{macrocode}
+% 单面
+% \begin{macrocode}
+ \nwafuhead [ C ]
+ {
+% \end{macrocode}
+% 奇数页页眉
+% \begin{macrocode}
+ \int_if_odd:nTF \c@page
+ {
+ \small \nouppercase{ \@chapapp }
+ }{
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生偶数页页眉
+% \begin{macrocode}
+ \small \nouppercase{
+ \c_@@_name_simp_tl \clist_item:Nn
+ \c_@@_thesis_type_clist { \g_@@_thesis_type_int } }
+ }{
+% \end{macrocode}
+% 本科生偶数页页眉
+% \begin{macrocode}
+ \small \nouppercase{ \@chapapp }
+ }
+ }
+ }
+ }
+ }
+
+\@@_appto_cmd:Nn \backmatter
+ {
+ \clearpage
+ \bool_if:NTF \g_@@_twoside_bool
+ {
+% \end{macrocode}
+% 奇数页页眉
+% \begin{macrocode}
+ \nwafuhead[OC]{\small \nouppercase{ \leftmark } }
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生偶数页页眉
+% \begin{macrocode}
+ \nwafuhead[EC]{\small \nouppercase{
+ \c_@@_name_simp_tl \clist_item:Nn
+ \c_@@_thesis_type_clist { \g_@@_thesis_type_int } }
+ }
+ }{
+% \end{macrocode}
+% 本科生偶数页页眉
+% \begin{macrocode}
+ \nwafuhead[EC]{\small \nouppercase{ \leftmark } }
+ }
+ }{
+% \end{macrocode}
+% 单面
+% \begin{macrocode}
+ \nwafuhead [ C ]
+ {
+ \int_if_odd:nTF \c@page
+ {
+% \end{macrocode}
+% 奇数页页眉
+% \begin{macrocode}
+ \small \nouppercase{ \leftmark }
+ }{
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生偶数页页眉
+% \begin{macrocode}
+ \small \nouppercase{
+ \c_@@_name_simp_tl \clist_item:Nn
+ \c_@@_thesis_type_clist { \g_@@_thesis_type_int } }
+ }{
+% \end{macrocode}
+% 本科生偶数页页眉
+% \begin{macrocode}
+ \small \nouppercase{ \leftmark }
+ }
+ }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{章节标题设置}
+%
+% |\keys_set:nn{ctex}| 实际相当于 \cs{ctexset}。
+%
+% 设置章(chapter)、节(section)与小节(sub-section)标题样式。
+% 此处使用 \kvopt{fixskip}{true} 选项来抑制前后的多余间距。
+%
+% 设置标题级别
+% \begin{macrocode}
+\int_compare:nNnTF{ \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生
+% \begin{macrocode}
+ \keys_set:nn { ctex }
+ {
+ secnumdepth = 3,
+ chapter =
+ {
+ pagestyle = fancy,
+ aftername = \hspace*{1.0\ccwd},
+ format = \zihao{3} \normalfont \nwafu@hei \bfseries \centering,
+ beforeskip = 1.47\baselineskip,
+ afterskip = 1.24\baselineskip,
+ number = \@@_arabic:n { chapter },
+ fixskip = true
+ },
+ section =
+ {
+ format = \zihao{-3} \normalfont \nwafu@hei \bfseries \raggedright,
+ beforeskip = 1.09\baselineskip,
+ afterskip = 0.80\baselineskip,
+ fixskip = true
+ },
+ subsection =
+ {
+ format = \zihao{4} \normalfont \nwafu@hei \bfseries \raggedright,
+ beforeskip = 0.80\baselineskip,
+ fixskip = true
+ },
+ subsubsection =
+ {
+ format = \zihao{-4} \normalfont \nwafu@hei \bfseries \raggedright,
+ beforeskip = 0.40\baselineskip,
+ afterskip = 0.40\baselineskip,
+ fixskip = true
+ }
+ }
+ }{
+% \end{macrocode}
+% 本科生
+% \begin{macrocode}
+ \keys_set:nn { ctex }
+ {
+ secnumdepth = 3,
+ chapter =
+ {
+ pagestyle = fancy,
+ name = { \bool_if:NT \l_@@_withchap_bool {第},
+ \bool_if:NT \l_@@_withchap_bool {章} },
+ number = \@@_arabic:n { chapter },
+ aftername = \hspace*{\ccwd},
+ format = \zihao{3} \normalfont \nwafu@hei \bfseries \centering,
+ beforeskip = 0.25\baselineskip,
+ afterskip = 0.65\baselineskip,
+ fixskip = true
+ },
+ section =
+ {
+ aftername = \hspace*{0.5\ccwd},
+ format = \zihao{4} \normalfont \nwafu@hei \bfseries \raggedright,
+ beforeskip = 0.60\baselineskip,
+ afterskip = 0.65\baselineskip,
+ fixskip = true,
+ afterindent = true,
+ },
+ subsection =
+ {
+ aftername = \hspace*{0.5\ccwd},
+ format = \zihao{-4} \normalfont \nwafu@hei \bfseries,
+ beforeskip = 0.60\baselineskip,
+ afterskip = 0.65\baselineskip,
+ fixskip = true,
+ afterindent = true,
+ % indent = 2\ccwd,
+ },
+ subsubsection =
+ {
+ name = {(,)},
+ aftername = \hspace*{0.5\ccwd},
+ number = \@@_arabic:n { subsubsection },
+ format = \zihao{-4} \normalfont,
+ beforeskip = 0.60\baselineskip,
+ afterskip = 0.65\baselineskip,
+ fixskip = true,
+ % afterindent = true,
+ indent = 2\ccwd,
+ }
+ }
+ }
+% \end{macrocode}
+%
+%
+% \begin{macro}{\@@_chapter:n,\@@_chapter:V}
+% 手动生成章的标题,用于摘要、参考文献等。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_chapter:n #1
+ {
+ \group_begin:
+ \ctexset { chapter / numbering = false }
+ \chapter {#1}
+ \@@_chapter_header:n {#1}
+ \group_end:
+ }
+\cs_generate_variant:Nn \@@_chapter:n { V }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_chapter_no_toc:n,\@@_chapter_no_toc:V}
+% 目录自身不出现在目录中,需特别处理。参考
+% \url{https://tex.stackexchange.com/a/1821}。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_chapter_no_toc:n #1
+ {
+ \chapter * {#1}
+ \@@_chapter_header:n {#1}
+ \pdfbookmark [0] {#1} { toc }
+ }
+\cs_generate_variant:Nn \@@_chapter_no_toc:n { V }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_chapter_header:n}
+% 单页模式下,目录、摘要、符号表等的页眉中间为相应标题,左右为空。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_chapter_header:n #1
+ {
+ \bool_if:NTF \g_@@_twoside_bool
+ { \markboth {#1} {#1} }
+ {
+ \markboth { } { }
+ \tl_gset:Nn \l_@@_header_center_mark_tl {#1}
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{脚注}
+%
+% \emph{脚注部分的代码完全使用\cls{fduthesis}模板的代码}。
+%
+% \subsubsection{编号样式}
+%
+% 各种脚注编号样式的名称。
+% \begin{macrocode}
+\clist_map_inline:nn
+ {
+ { plain } { plain },
+ { libertinus } { libertinus },
+ { libertinus_neg } { libertinus* },
+ { libertinus_sans } { libertinus-sans },
+ { pifont } { pifont },
+ { pifont_neg } { pifont* },
+ { pifont_sans } { pifont-sans },
+ { pifont_sans_neg } { pifont-sans* },
+ { xits } { xits },
+ { xits_sans } { xits-sans },
+ { xits_sans_neg } { xits-sans* }
+ }
+ { \@@_define_fn_style:nn #1 }
+% \end{macrocode}
+%
+% \begin{variable}{\l_@@_fn_style_tl}
+% 保存当前使用的脚注编号样式。
+% \begin{macrocode}
+\tl_new:N \l_@@_fn_style_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macrocode}
+\keys_define:nn { nwafu / style }
+ {
+% \end{macrocode}
+%
+% \begin{macro}{style/footnote-style}
+% 脚注类型共分四大类:
+% \begin{itemize}
+% \item \opt{plain}:使用当前字体;
+% \item \opt{libertinus}:取自 Libertinus Serif 和 Libertinus Sans
+% 字体;
+% \item \opt{pifont}:使用 \pkg{pifont} 宏包;
+% \item \opt{xits}:取自 XITS 字体。
+% \end{itemize}
+% 不带任何修饰的为衬线阳文符号,带“|sans|”的为无衬线符号,带“|*|”的
+% 为阴文版本。
+% \begin{macrocode}
+ footnote-style .choices:nn =
+ {
+ plain,
+ libertinus, libertinus*, libertinus-sans,
+ pifont, pifont*, pifont-sans, pifont-sans*,
+ xits, xits-sans, xits-sans*
+ }
+% \end{macrocode}
+% 若使用 \opt{pifont} 类型,则需引入 \pkg{pifont} 宏包。
+% \begin{macrocode}
+ {
+ \tl_gset_eq:NN \l_@@_fn_style_tl \l_keys_choice_tl
+ \int_compare:nT { 5 <= \l_keys_choice_int <= 8 }
+ { \RequirePackage { pifont } }
+ },
+ footnote-style .value_required:n = true
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_fn_symbol_libertinus:n}
+% \opt{libertinus} 普通版。\numrange{1}{20} 为数字,\numrange{21}{46}
+% 为小写英文字母,\numrange{47}{72} 为大写英文字母。
+% \begin{macrocode}
+\cs_new:Npn \@@_fn_symbol_libertinus:n #1
+ {
+ \int_compare:nTF { #1 >= 21 }
+ {
+ \int_compare:nTF { #1 >= 47 }
+ { \@@_symbol:n { \int_eval:n { "24B6 - 47 + #1 } } }
+ { \@@_symbol:n { \int_eval:n { "24D0 - 21 + #1 } } }
+ }
+ { \@@_symbol:n { \int_eval:n { "2460 - 1 + #1 } } }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_fn_symbol_libertinus_neg:n}
+% \opt{libertinus} 阴文衬线版。只含 \numrange{1}{20}。
+% \begin{macrocode}
+\cs_new:Npn \@@_fn_symbol_libertinus_neg:n #1
+ {
+ \int_compare:nTF { #1 >= 11 }
+ { \@@_symbol:n { \int_eval:n { "24EB - 11 + #1 } } }
+ { \@@_symbol:n { \int_eval:n { "2776 - 1 + #1 } } }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_fn_symbol_libertinus_sans:n}
+% \opt{libertinus} 阳文无衬线版。符号排列与普通版相同。
+% \begin{macrocode}
+\cs_new_eq:NN \@@_fn_symbol_libertinus_sans:n \@@_fn_symbol_libertinus:n
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_fn_symbol_pifont:n}
+% \opt{pifont} 普通版。以下四种都只包含 \numrange{1}{10}。
+% \begin{macrocode}
+\cs_new:Npn \@@_fn_symbol_pifont:n #1
+ { \ding { \int_eval:n { 171 + #1 } } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_fn_symbol_pifont_neg:n}
+% \opt{pifont} 阴文衬线版。
+% \begin{macrocode}
+\cs_new:Npn \@@_fn_symbol_pifont_neg:n #1
+ { \ding { \int_eval:n { 181 + #1 } } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_fn_symbol_pifont_sans:n}
+% \opt{pifont} 阳文无衬线版。
+% \begin{macrocode}
+\cs_new:Npn \@@_fn_symbol_pifont_sans:n #1
+ { \ding { \int_eval:n { 191 + #1 } } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_fn_symbol_pifont_sans_neg:n}
+% \opt{pifont} 阴文无衬线版。
+% \begin{macrocode}
+\cs_new:Npn \@@_fn_symbol_pifont_sans_neg:n #1
+ { \ding { \int_eval:n { 201 + #1 } } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_fn_symbol_xits:n}
+% \opt{xits} 普通版。\numrange{1}{9} 为数字,\numrange{10}{35}
+% 为小写英文字母,\numrange{36}{61} 为大写英文字母。
+% \begin{macrocode}
+\cs_new:Npn \@@_fn_symbol_xits:n #1
+ {
+ \int_compare:nTF { #1 >= 10 }
+ {
+ \int_compare:nTF { #1 >= 36 }
+ { \@@_symbol:n { \int_eval:n { "24B6 - 36 + #1 } } }
+ { \@@_symbol:n { \int_eval:n { "24D0 - 10 + #1 } } }
+ }
+ { \@@_symbol:n { \int_eval:n { "2460 - 1 + #1 } } }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_fn_symbol_xits_sans:n}
+% \opt{xits} 阳文无衬线版。只包含 \numrange{1}{10}。
+% \begin{macrocode}
+\cs_new:Npn \@@_fn_symbol_xits_sans:n #1
+ { \@@_symbol:n { \int_eval:n { "2780 - 1 + #1 } } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_fn_symbol_xits_sans_neg:n}
+% \opt{xits} 阴文无衬线版。也只包含 \numrange{1}{10}。
+% \begin{macrocode}
+\cs_new:Npn \@@_fn_symbol_xits_sans_neg:n #1
+ { \@@_symbol:n { \int_eval:n { "278A - 1 + #1 } } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\thefootnote}
+% 重定义脚注编号。
+% \begin{macrocode}
+\cs_set:Npn \thefootnote { \nwafu_footnote_number:N \c@footnote }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\nwafu_footnote_number:N}
+% 脚注编号样式。
+% \begin{macrocode}
+\cs_new:Npn \nwafu_footnote_number:N #1
+ {
+ \tl_case:NnF \l_@@_fn_style_tl
+ {
+% \end{macrocode}
+% \opt{plain} 类型直接使用计数器 |footnote| 的值。
+% \begin{macrocode}
+ \c_@@_fn_style_plain_tl
+ { \int_use:N #1 }
+% \end{macrocode}
+% \opt{libertinus} 类型需要使用 Libertinus Serif 或
+% Libertinus Sans 字体。
+% \begin{macrocode}
+ \c_@@_fn_style_libertinus_tl
+ {
+ \fontspec { \g_@@_font_name_libertinus_serif_tl .otf }
+ \@@_fn_symbol_libertinus:n {#1}
+ }
+ \c_@@_fn_style_libertinus_neg_tl
+ {
+ \fontspec { \g_@@_font_name_libertinus_serif_tl .otf }
+ \@@_fn_symbol_libertinus_neg:n {#1}
+ }
+ \c_@@_fn_style_libertinus_sans_tl
+ {
+ \fontspec { \g_@@_font_name_libertinus_sans_tl .otf }
+ \@@_fn_symbol_libertinus_sans:n {#1}
+ }
+% \end{macrocode}
+% \opt{pifont} 类型无需进行额外的操作。
+% \begin{macrocode}
+ \c_@@_fn_style_pifont_tl
+ { \@@_fn_symbol_pifont:n {#1} }
+ \c_@@_fn_style_pifont_neg_tl
+ { \@@_fn_symbol_pifont_neg:n {#1} }
+ \c_@@_fn_style_pifont_sans_tl
+ { \@@_fn_symbol_pifont_sans:n {#1} }
+ \c_@@_fn_style_pifont_sans_neg_tl
+ { \@@_fn_symbol_pifont_sans_neg:n {#1} }
+% \end{macrocode}
+% \opt{xits} 类型需要临时切换数学字体。
+% \begin{macrocode}
+ \c_@@_fn_style_xits_tl
+ {
+ \fontspec { \g_@@_font_name_xits_tl .otf }
+ \@@_fn_symbol_xits:n {#1}
+ }
+ \c_@@_fn_style_xits_sans_tl
+ {
+ \fontspec { \g_@@_font_name_xits_tl .otf }
+ \@@_fn_symbol_xits_sans:n {#1}
+ }
+ \c_@@_fn_style_xits_sans_neg_tl
+ {
+ \fontspec { \g_@@_font_name_xits_tl .otf }
+ \@@_fn_symbol_xits_sans_neg:n {#1}
+ }
+ }
+% \end{macrocode}
+% 变量 \cs{l_@@_fn_style_tl} 保存的类型未知时,默认使用 \opt{plain}
+% 类型。
+% \begin{macrocode}
+ { \int_use:N #1 }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{整体样式}
+%
+% \begin{macro}[int]{\@makefntext}
+% 重定义内部脚注文字命令,使脚注编号不使用上标,宽度为 \SI{1.5}{em}。
+% 见 \url{http://tex.stackexchange.com/q/19844} 和
+% \url{https://www.zhihu.com/question/53030087}。
+% \begin{macrocode}
+\cs_set:Npn \@makefntext #1
+ {
+ \mode_leave_vertical:
+ \hbox_to_wd:nn { 1.5 em } { \@thefnmark \hfil }
+ #1
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{定理环境}
+%
+% \emph{定理环境部分的代码完全使用\cls{fduthesis}模板的代码}。
+%
+% \begin{variable}{\c_@@_thm_style_plain_clist,
+% \c_@@_thm_style_break_clist}
+% 保存 \opt{plain}、\opt{break} 两种类型的定理样式名称。
+% \begin{macrocode}
+\clist_const:Nn \c_@@_thm_style_plain_clist
+ { plain, margin, change }
+\clist_const:Nn \c_@@_thm_style_break_clist
+ { break, marginbreak, changebreak }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_thm_style_tl,
+% \l_@@_thm_header_font_tl,
+% \l_@@_thm_body_font_tl,
+% \l_@@_thm_qed_tl,
+% \l_@@_thm_counter_tl}
+% 定理所需的一些字段。
+% \begin{macrocode}
+\tl_new:N \l_@@_thm_style_tl
+\tl_new:N \l_@@_thm_header_font_tl
+\tl_new:N \l_@@_thm_body_font_tl
+\tl_new:N \l_@@_thm_qed_tl
+\tl_new:N \l_@@_thm_counter_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{theorem/style,
+% theorem/header-font,
+% theorem/body-font,
+% theorem/qed,
+% theorem/counter}
+% 定义 |nwafu/theorem| 键值类。
+% \begin{macrocode}
+\keys_define:nn { nwafu / theorem }
+ {
+ style .tl_set:N = \l_@@_thm_style_tl,
+ header-font .tl_set:N = \l_@@_thm_header_font_tl,
+ body-font .tl_set:N = \l_@@_thm_body_font_tl,
+ qed .tl_set:N = \l_@@_thm_qed_tl,
+ counter .tl_set:N = \l_@@_thm_counter_tl
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_thm_ntheorem_style:n,\@@_thm_ntheorem_new:w}
+% 拷贝 \pkg{ntheorem} 命令。
+% \begin{macrocode}
+\cs_new_eq:NN \@@_thm_ntheorem_style:n \theoremstyle
+\cs_new_eq:NN \@@_thm_ntheorem_new:w \newtheorem
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\newtheorem}
+% 定义新的定理环境。
+% \begin{macrocode}
+\RenewDocumentCommand \newtheorem { s o m m }
+ {
+% \end{macrocode}
+% 默认情况下,由 \cs{newtheorem*} 创建的定理其证毕符号为 \cs{QED},
+% 而由 \cs{new\-the\-orem} 创建的则不带证毕符号。符号 \cs{QED} 由
+% \pkg{unicode-math} 宏包提供。
+% \begin{macrocode}
+ \IfBooleanTF {#1}
+ { \tl_set:Nn \l_@@_thm_qed_tl { \ensuremath { \QED } } }
+ { \tl_set:Nn \l_@@_thm_qed_tl { } }
+% \end{macrocode}
+% 设置默认样式为 \opt{plain}。
+% \begin{macrocode}
+% TODO: (2017-12-07) Move to interface
+ \tl_set:Nn \l_@@_thm_style_tl { plain }
+% \end{macrocode}
+% 处理可选参数。利用 |nwafu/theorem| 键值对设置,并按此修改证毕符号、
+% 定理头字体和定理正文字体。
+% \begin{macrocode}
+ \IfValueT {#2} { \keys_set:nn { nwafu / theorem } {#2} }
+ \nwafu_thm_set_header_font:V \l_@@_thm_header_font_tl
+ \nwafu_thm_set_body_font:V \l_@@_thm_body_font_tl
+ \nwafu_thm_set_qed:V \l_@@_thm_qed_tl
+% \end{macrocode}
+% \cs{newtheorem} 负责创建编号定理,而 \cs{newtheorem*}
+% 则负责创建无编号定理。以下分这两种情况处理。
+% \begin{macrocode}
+ \IfBooleanTF {#1}
+ {
+% \end{macrocode}
+% 带 |*| 的版本原则上只接受 \opt{plain} 和 \opt{break} 两种样式,
+% 其余样式将被转换成这两者其中之一。
+% \begin{macrocode}
+ \clist_if_in:nVF { plain, break } \l_@@_thm_style_tl
+ {
+ \clist_if_in:NVTF
+ \c_@@_thm_style_plain_clist \l_@@_thm_style_tl
+ { \@@_thm_redefine_style:n { plain } }
+ {
+ \clist_if_in:NVTF
+ \c_@@_thm_style_break_clist \l_@@_thm_style_tl
+ { \@@_thm_redefine_style:n { break } }
+ {
+ \@@_error:nx { unknown-theorem-style }
+ { \l_@@_thm_style_tl }
+ }
+ }
+ }
+% \end{macrocode}
+% \pkg{ntheorem} 宏包提供的无编号定理带有 |nonumber| 前缀,
+% 这里将其加上。
+% \begin{macrocode}
+ \tl_put_left:Nn \l_@@_thm_style_tl { nonumber }
+ \nwafu_thm_new_no_number:Vxx \l_@@_thm_style_tl {#3} {#4}
+ }
+ {
+% \end{macrocode}
+% 不带 |*| 的版本支持不含“|nonumber|”的所有定理样式。
+% \begin{macrocode}
+ \clist_clear:N \l_@@_tmpa_clist
+ \clist_concat:NNN \l_@@_tmpa_clist
+ \c_@@_thm_style_plain_clist \c_@@_thm_style_break_clist
+ \clist_if_in:NVF \l_@@_tmpa_clist \l_@@_thm_style_tl
+ {
+ \@@_error:nx { unknown-theorem-style }
+ { \l_@@_thm_style_tl }
+ }
+ \nwafu_thm_new:VVxx \l_@@_thm_style_tl \l_@@_thm_counter_tl
+ {#3} {#4}
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_thm_redefine_style:n}
+% 重定义定理样式,并给出警告。
+% \begin{macrocode}
+\cs_new:Npn \@@_thm_redefine_style:n #1
+ {
+ \@@_warning:nxx { redefine-theorem-style }
+ {#1} { \l_@@_thm_style_tl }
+ \tl_set:Nn \l_@@_thm_style_tl {#1}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% 提示信息。
+% \begin{macrocode}
+\@@_msg_new:nn { redefine-theorem-style }
+ { Theorem~ style~ "#2"~ will~ be~ redefined~ as~ "#1". }
+\@@_msg_new:nn { unknown-theorem-style }
+ { Theorem~ style~ "#1"~ is~ unknown. }
+% \end{macrocode}
+%
+% \begin{macro}{\nwafu_thm_new:nnnn,\nwafu_thm_new:VVxx}
+% 带编号的定理环境。
+% \begin{arguments}
+% \item 样式
+% \item 计数器
+% \item 定理环境名称
+% \item 定理头文字
+% \end{arguments}
+% \begin{macrocode}
+\cs_new:Npn \nwafu_thm_new:nnnn #1#2#3#4
+ {
+ \@@_thm_ntheorem_style:n {#1}
+ \@@_thm_ntheorem_new:w {#3} {#4} [#2]
+ }
+\cs_generate_variant:Nn \nwafu_thm_new:nnnn { VVxx }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\nwafu_thm_new_no_number:nnn,
+% \nwafu_thm_new_no_number:Vxx}
+% 不带编号的定理环境。
+% \begin{arguments}
+% \item 样式
+% \item 定理环境名称
+% \item 定理头文字
+% \end{arguments}
+% \begin{macrocode}
+\cs_new:Npn \nwafu_thm_new_no_number:nnn #1#2#3
+ {
+ \@@_thm_ntheorem_style:n {#1}
+ \@@_thm_ntheorem_new:w {#2} {#3}
+ }
+\cs_generate_variant:Nn \nwafu_thm_new_no_number:nnn { Vxx }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\nwafu_thm_set_qed:n,
+% \nwafu_thm_set_header_font:n,
+% \nwafu_thm_set_body_font:n,
+% \nwafu_thm_set_qed:V,
+% \nwafu_thm_set_header_font:V,
+% \nwafu_thm_set_body_font:V}
+% 封装 \pkg{ntheorem} 宏包提供的若干命令,分别用以设置证毕符号、
+% 定理头字体和定理正文字体。
+% \begin{macrocode}
+\cs_new:Npn \nwafu_thm_set_qed:n #1 { \theoremsymbol {#1} }
+\cs_new:Npn \nwafu_thm_set_header_font:n #1 { \theoremheaderfont {#1} }
+\cs_new:Npn \nwafu_thm_set_body_font:n #1 { \theorembodyfont {#1} }
+\cs_generate_variant:Nn \nwafu_thm_set_qed:n { V }
+\cs_generate_variant:Nn \nwafu_thm_set_header_font:n { V }
+\cs_generate_variant:Nn \nwafu_thm_set_body_font:n { V }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{图表绘制;浮动体}
+%
+%
+% 分别设置浮动体 \env{figure} 和 \env{table} 的标题样式。
+% \begin{macrocode}
+\DeclareCaptionLabelSeparator{ccwd}{\hspace{0.5\ccwd}}
+\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{~}(#2)}
+\DeclareCaptionFont{nwafu@table@font}{\sffamily\small}
+\DeclareCaptionFont{nwafu@figure@font}{\sffamily\small}
+\DeclareCaptionFont{nwafu@subtable@font}{\small}
+\DeclareCaptionFont{nwafu@subfigure@font}{\small}
+% \end{macrocode}
+% 图表题注设置。
+% \begin{macrocode}
+\captionsetup
+ {
+ format = hang,
+ font = {stretch = 1},
+ labelsep = ccwd,
+ singlelinecheck = true,
+ skip=4bp,
+ }
+% \end{macrocode}
+% 图表题注字体设置。
+% \begin{macrocode}
+\captionsetup[table]{font += nwafu@table@font}
+\captionsetup[longtable]{font += nwafu@table@font}
+\captionsetup[figure]{font += nwafu@figure@font}
+% \end{macrocode}
+% 子图题注设置。
+% \begin{macrocode}
+\captionsetup[subfigure]
+ {
+ labelformat = parens,
+ font = nwafu@subfigure@font,
+ belowskip = 2pt,
+ aboveskip = 6pt
+ }
+% \end{macrocode}
+% 设置双语标题前缀
+% 直接采用类似\cs{captionsetup}[figure][bi-first]{name=图}
+% 设置会与longtable宏包的caption冲突
+% 需要改成如下设置,[]中的可选参数可以根据需要选择
+% \begin{macrocode}
+\DeclareCaptionOption{bi-first}[format=hang,hangindent=-0.5em]{
+ \def\tablename{表}
+ \def\figurename{图}
+ }
+\DeclareCaptionOption{bi-second}[format=hang,hangindent=-2em]{
+ \def\tablename{Tab.}
+ \def\figurename{Fig.}
+ }
+\captionsetup[bi-first]{bi-first}
+\captionsetup[bi-second]{bi-second}
+%
+\AddToHook
+ { env/figure/end }
+ {
+ \centering
+ }
+\AddToHook
+ { env/table/end }
+ {
+ \centering
+ }
+%
+% \end{macrocode}
+% 在tabular、tabularx、longtable环境开始处添加代码,
+% 设置表格行距和字号。
+% \begin{macrocode}
+\@@_at_begin_environment:nn { tabular,tabularx,longtable,tblr }
+ {
+ \exp_args:Nx \linespread { 1.05 }
+ \small\selectfont\ignorespaces
+ }
+% \end{macrocode}
+%
+% \begin{macro}{\thefigure,\thetable}
+% 重定义图表编号。
+% \begin{macrocode}
+\cs_set:Npn \thefigure
+ { \thechapter - \@@_arabic:n { figure } }
+\cs_set:Npn \thetable
+ { \thechapter - \@@_arabic:n { table } }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{封面}
+%
+% \subsubsection{信息录入}
+%
+% \begin{variable}{\l_@@_info_title_tl,
+% \l_@@_info_date_tl,
+% \l_@@_info_grade_tl,
+% \l_@@_info_enroll_tl,
+% \l_@@_info_author_tl,
+% \l_@@_info_supervisor_tl,
+% \l_@@_info_cosupervisor_tl,
+% \l_@@_info_department_tl,
+% \l_@@_info_major_tl,
+% \l_@@_info_researchfield_tl,
+% \l_@@_info_professionaltype_tl,
+% \l_@@_info_professionalfield_tl,
+% \l_@@_info_class_id_tl,
+% \l_@@_info_student_id_tl,
+% \l_@@_info_school_id_tl,
+% \l_@@_info_clc_tl,
+% \l_@@_info_defensedate_tl,
+% \l_@@_info_instructors_clist,
+% \l_@@_info_defensecommittees_clist,
+% \l_@@_info_foundation_clist}
+% 封面所需的一些字段。
+% \begin{macrocode}
+\clist_map_inline:nn
+ {
+ title, date, grade, enroll, author, supervisor, cosupervisor
+ department, major, researchfield, professionaltype, professionalfield,
+ class_id, student_id, school_id, clc, defensedate, udc
+ }
+ { \tl_new:c { l_@@_info_ #1 _tl } }
+\clist_new:N \l_@@_info_instructors_clist
+\clist_new:N \l_@@_info_defensecommittees_clist
+\clist_new:N \l_@@_info_foundation_clist
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_info_title_en_tl,
+% \l_@@_info_author_en_tl,
+% \l_@@_info_supervisor_en_tl,
+% \l_@@_info_cosupervisor_en_tl,
+% \l_@@_info_department_en_tl,
+% \l_@@_info_major_en_tl,
+% \l_@@_info_mastertype_en_tl,
+% \l_@@_info_researchfield_en_tl,
+% \l_@@_info_professionaltype_en_tl,
+% \l_@@_info_professionalfield_en_tl,
+% \l_@@_info_date_en_tl}
+% 对应的英文字段。
+% \begin{macrocode}
+\clist_map_inline:nn
+ { title, author, supervisor, cosupervisor, department,
+ major, mastertype, researchfield, professionaltype, professionalfield,date }
+ { \tl_new:c { l_@@_info_ #1 _en_tl } }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_info_degree_type_int}
+% 学位类型。1 为学术学位,2 为专业学位。仅对研究生有效。
+% \begin{macrocode}
+\int_new:N \l_@@_info_degree_type_int
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_info_bachelor_type_int}
+% 本科毕业类型。1 为论文,2 为设计。仅对本科生有效。
+% \begin{macrocode}
+\int_new:N \l_@@_info_bachelor_type_int
+% \end{macrocode}
+% \end{variable}
+%
+% 定义 |nwafu/info| 键值类。
+% \begin{macrocode}
+\keys_define:nn { nwafu / info }
+ {
+% \end{macrocode}
+%
+% \begin{macro}{info/degree}
+% 学位类型。只对硕士论文有效。
+% \begin{macrocode}
+ degree .choices:nn =
+ { academic, professional }
+ { \int_set_eq:NN \l_@@_info_degree_type_int \l_keys_choice_int },
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/btype}
+% 本科毕业类型。仅对本科生有效。
+% \begin{macrocode}
+ btype .choice:,
+ btype .value_required:n = true,
+ btype .choices:nn =
+ { paper, design }
+ { \int_set_eq:NN \l_@@_info_bachelor_type_int \l_keys_choice_int },
+ btype .initial:n = paper,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/title,info/title*}
+% 论文题目。以下带星号的项目均表示相应的英文字段。
+% \begin{macrocode}
+ title .tl_set:N = \l_@@_info_title_tl,
+ title* .tl_set:N = \l_@@_info_title_en_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/date, info/date*}
+% 论文完成日期。
+% \begin{macrocode}
+ date .tl_set:N = \l_@@_info_date_tl,
+ date* .tl_set:N = \l_@@_info_date_en_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/grade}
+% 毕业年份(届)。
+% \begin{macrocode}
+ grade .tl_set:N = \l_@@_info_grade_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/enroll}
+% 入学年份(级)。
+% \begin{macrocode}
+ enroll .tl_set:N = \l_@@_info_enroll_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/author,info/author*}
+% 作者姓名。
+% \begin{macrocode}
+ author .tl_set:N = \l_@@_info_author_tl,
+ author* .tl_set:N = \l_@@_info_author_en_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/supervisor,info/supervisor*}
+% 导师姓名。
+% \begin{macrocode}
+ supervisor .tl_set:N = \l_@@_info_supervisor_tl,
+ supervisor* .tl_set:N = \l_@@_info_supervisor_en_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/cosupervisor, info/cosupervisor}
+% 协助指导教师。
+% \begin{macrocode}
+ cosupervisor .tl_set:N = \l_@@_info_cosupervisor_tl,
+ cosupervisor* .tl_set:N = \l_@@_info_cosupervisor_en_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/instructors}
+% 指导小组成员。
+% \begin{macrocode}
+ instructors .clist_set:N = \l_@@_info_instructors_clist,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/defensecommittees}
+% 答辩委员会成员,每个成员包含单位、姓名、职称。仅研究生需要。
+% \begin{macrocode}
+ defensecommittees .clist_set:N = \l_@@_info_defensecommittees_clist,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/defensedate}
+% 论文答辩日期。
+% \begin{macrocode}
+ defensedate .tl_set:N = \l_@@_info_defensedate_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/foundation}
+% 资助项目,每个项目包含项目类型、项目名称、项目编号。仅研究生需要。
+% \begin{macrocode}
+ foundation .clist_set:N = \l_@@_info_foundation_clist,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/department,info/department*}
+% 院系。
+% \begin{macrocode}
+ department .tl_set:N = \l_@@_info_department_tl,
+ department* .tl_set:N = \l_@@_info_department_en_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/major,info/major*}
+% 专业。
+% \begin{macrocode}
+ major .tl_set:N = \l_@@_info_major_tl,
+ major* .tl_set:N = \l_@@_info_major_en_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/mastertype}
+% 硕士学位类型英文名称,仅硕士需要。
+% \begin{macrocode}
+ mastertype .tl_set:N = \l_@@_info_mastertype_en_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/researchfield,info/researchfield*}
+% 研究方向,仅博士、学历硕士需要。
+% \begin{macrocode}
+ researchfield .tl_set:N = \l_@@_info_researchfield_tl,
+ researchfield* .tl_set:N = \l_@@_info_researchfield_en_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/professionaltype,info/professionaltype*}
+% 专业学位类型,仅专业学位硕士需要。
+% \begin{macrocode}
+ professionaltype .tl_set:N = \l_@@_info_professionaltype_tl,
+ professionaltype* .tl_set:N = \l_@@_info_professionaltype_en_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/professionalfield,info/professionalfield*}
+% 领域名称,仅专业学位硕士需要。
+% \begin{macrocode}
+ professionalfield .tl_set:N = \l_@@_info_professionalfield_tl,
+ professionalfield* .tl_set:N = \l_@@_info_professionalfield_en_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/class-id}
+% 班级号。仅本科生需要
+% \begin{macrocode}
+ class-id .tl_set:N = \l_@@_info_class_id_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/student-id}
+% 学号。
+% \begin{macrocode}
+ student-id .tl_set:N = \l_@@_info_student_id_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/school-id}
+% 学校代码。
+% \begin{macrocode}
+ school-id .tl_set:N = \l_@@_info_school_id_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/clc}
+% 中图分类号。
+% \begin{macrocode}
+ clc .tl_set:N = \l_@@_info_clc_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{info/udc}
+% UDC码。
+% \begin{macrocode}
+ udc .tl_set:N = \l_@@_info_udc_tl,
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{variable}{\l_@@_cover_logo_tl,\l_@@_cover_logo_size_clist}
+% \begin{macrocode}
+\tl_new:N \l_@@_cover_logo_tl
+\clist_new:N \l_@@_cover_logo_size_clist
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{style/logo,style/logo-size}
+% 校名图片的文件名和尺寸。
+% \begin{macrocode}
+\keys_define:nn { nwafu / style }
+ {
+ logo .tl_set:N = \l_@@_cover_logo_tl,
+ logo-size .clist_set:N = \l_@@_cover_logo_size_clist
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{密级}
+%
+% \begin{variable}{\l_@@_secret_bool}
+% 是否显示密级。
+% \begin{macrocode}
+\bool_new:N \l_@@_secret_bool
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{variable}{\l_@@_info_secret_level_tl}
+% 保存当前的密级。
+% \begin{macrocode}
+\tl_new:N \l_@@_info_secret_level_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macrocode}
+\keys_define:nn { nwafu / info }
+ {
+% \end{macrocode}
+%
+% \begin{macro}{info/secret-level}
+ % 密级。\opt{none} 表示公开,\opt{i}、\opt{ii}、\opt{iii}、\opt{iv} 分别为
+% 限制、秘密、机密、绝密。
+% \begin{macrocode}
+ secret-level .choices:nn =
+ { none, i, ii, iii, iv }
+ {
+ \int_compare:nNnTF { \l_keys_choice_int } > { 1 }
+ {
+ \bool_set_true:N \l_@@_secret_bool
+ \tl_set:Nn \l_@@_info_secret_level_tl
+ {
+ \clist_item:Nn \c_@@_secret_clist
+ { \l_keys_choice_int - 1 }
+ }
+ }
+ {
+ \bool_set_false:N \l_@@_secret_bool
+ \tl_set:Nn \l_@@_info_secret_level_tl { 公开 }
+ }
+ },
+ secret-level .value_required:n = true,
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{定义内部函数}
+%
+% \begin{macro}{\@@_spread_box:nn,\@@_spread_box:Vn,\@@_spread_box:nV}
+% 分散对齐的水平盒子。
+% \begin{arguments}
+% \item 宽度
+% \item 内容
+% \end{arguments}
+% 利用 \cs{tl_map_inline:nn} 在字符间插入 \tn{hfil};紧随其后的 \tn{unskip}
+% 将会去掉最后一个 \tn{hfil}。见 \url{https://tex.stackexchange.com/q/169689}。
+% |#2| 需要完全展开以避免 underfull 警告。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_spread_box:nn #1#2
+ {
+ \mode_leave_vertical:
+ \hbox_to_wd:nn {#1}
+ { \tl_map_inline:xn {#2} { ##1 \hfil } \unskip }
+ }
+\cs_generate_variant:Nn \@@_spread_box:nn { Vn }
+\cs_generate_variant:Nn \@@_spread_box:nn { nV }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_center_box:nn,\@@_center_box:Vn}
+% 居中对齐的下划线水平盒子。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_center_box:nn #1#2
+ {
+ \mode_leave_vertical:
+ \dim_set:Nn \l_@@_tmpt_dim {#1}
+ \dim_add:Nn \l_@@_tmpt_dim {0.6em}
+ \makebox[0cm][l]{\rule[-0.5ex]{\l_@@_tmpt_dim}{0.4 pt}}
+ {\hbox_to_wd:nn {\l_@@_tmpt_dim} { \hfil #2 \hfil }}
+ % \fbox[b]{\parbox {#1} { \centering #2 }}
+ }
+\cs_generate_variant:Nn \@@_center_box:nn { Vn }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_fixed_width_box:nn,\@@_fixed_width_box:Vn}
+% 限宽盒子(允许换行)。
+% \begin{macrocode}
+\cs_new:Npn \@@_fixed_width_box:nn #1#2
+ { \parbox {#1} {#2} }
+\cs_generate_variant:Nn \@@_fixed_width_box:nn { Vn }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_fixed_width_center_box:nn}
+% 居中对齐的限宽盒子(允许换行)。
+% \begin{macrocode}
+\cs_new:Npn \@@_fixed_width_center_box:nn #1#2
+ { \parbox {#1} { \centering #2 } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_get_text_width:Nn,\@@_get_text_width:NV}
+% 获取文本宽度,并存入 |dim| 型变量。
+% \begin{arguments}
+% \item |dim| 型变量
+% \item 内容
+% \end{arguments}
+% \begin{macrocode}
+\cs_new:Npn \@@_get_text_width:Nn #1#2
+ {
+ \hbox_set:Nn \l_@@_tmpa_box {#2}
+ \dim_set:Nn #1 { \box_wd:N \l_@@_tmpa_box }
+ }
+\cs_generate_variant:Nn \@@_get_text_width:Nn { NV }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_get_max_text_width:NN}
+% 获取多个文本中的最大宽度,并存入 |dim| 型变量。
+% \begin{arguments}
+% \item |dim| 型变量
+% \item 文本 |clist|
+% \end{arguments}
+% 当 \cs{l_@@_tmpa_clist} 非空时,弹出最后一个元素
+% 赋给 \cs{l_@@_tmpa_tl},获取其长度后与 |#1| 进行比较,
+% 二者中较大的那一个将成为 |#1| 的新值。
+% 不断循环,直至 \cs{l_@@_tmpa_clist} 为空。
+% \begin{macrocode}
+\cs_new:Npn \@@_get_max_text_width:NN #1#2
+ {
+% \end{macrocode}
+% 这里用 |group| 确保局部变量不会被污染。
+% \begin{macrocode}
+ \group_begin:
+ \dim_set:Nn #1 {-999pt}
+ \clist_set_eq:NN \l_@@_tmpt_clist #2
+ \bool_until_do:nn { \clist_if_empty_p:N \l_@@_tmpt_clist }
+ {
+ \clist_pop:NN \l_@@_tmpt_clist \l_@@_tmpt_tl
+ \@@_get_text_width:NV \l_@@_tmpt_dim \l_@@_tmpt_tl
+ \dim_gset:Nn #1 { \dim_max:nn {#1} { \l_@@_tmpt_dim } }
+ }
+ \group_end:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_blank_underline:n}
+% 下划线占位符。|#1|: 长度。
+% \begin{macrocode}
+\cs_new:Npn \@@_blank_underline:n #1
+ { \rule [ -0.5 ex ] {#1} { 0.4 pt } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_text_uline:n,\@@_text_uline:V}
+% 下划线文字。|#1|: 文字。
+% \begin{macrocode}
+\cs_new:Npn \@@_text_uline:n #1
+ {
+ \@@_get_text_width:Nn \l_@@_tmpt_dim {#1}
+ \dim_add:Nn \l_@@_tmpt_dim {0.6em}
+ \makebox[0cm][l]{\rule[-0.5ex]{\l_@@_tmpt_dim}{0.4 pt}}
+ \rule{.3em}{0cm}#1\rule{.3em}{0cm}
+ }
+\cs_generate_variant:Nn \@@_text_uline:n { V }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_line_spread:N,\@@_line_spread:n}
+% 设置行距。|#1|: 行距倍数 |fp| 变量。
+% \begin{macrocode}
+\cs_new:Npn \@@_line_spread:N #1
+ { \linespread { \fp_use:N #1 } \selectfont }
+\cs_new:Npn \@@_line_spread:n #1
+ { \linespread {#1} \selectfont }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{封面各部件}
+%
+% \begin{macro}{\@@_cover_id:,\@@_cover_id_aux:n}
+% 封面中的中图分类号、udc码、密级、学校代码和学号。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_cover_id:
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生
+% \begin{macrocode}
+ \group_begin:
+% \end{macrocode}
+% 将中图分类号、udc码和密级标记名称存入逗号分隔列表,并计算最宽宽度赋给
+% \cs{l_@@_tmpa_dim}。
+% \begin{macrocode}
+ \clist_clear:N \l_@@_tmpa_clist
+ \clist_set:Nx \l_@@_tmpa_clist
+ {
+ { \c_@@_name_clc_tl },
+ { \c_@@_name_udc_tl },
+ { \c_@@_name_secret_level_tl }
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist
+% \end{macrocode}
+% 将中图分类号、udc码和密级信息值存入逗号分隔列表,并计算最宽宽度赋给
+% \cs{l_@@_tmpb_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpb_clist
+ {
+ { \l_@@_info_clc_tl },
+ { \l_@@_info_udc_tl },
+ { \l_@@_info_secret_level_tl }
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist
+% \end{macrocode}
+% 将学校代码、研究生学号标记名称存入逗号分隔列表,并计算最宽宽度赋给
+% \cs{l_@@_tmpc_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpc_clist
+ {
+ { \c_@@_name_school_id_tl },
+ { },
+ { \c_@@_name_student_id_tl }
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpc_dim \l_@@_tmpc_clist
+% \end{macrocode}
+% 将学校代码、研究生学号信息值存入逗号分隔列表,并计算最宽宽度赋给
+% \cs{l_@@_tmpd_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpd_clist
+ {
+ { \l_@@_info_school_id_tl },
+ { },
+ { \l_@@_info_student_id_tl }
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpd_dim \l_@@_tmpd_clist
+% \end{macrocode}
+% 用minipage环境通过循环输出结果。
+% \begin{macrocode}
+ \begin{minipage} [ c ] { \textwidth }
+ \bool_until_do:nn { \clist_if_empty_p:N \l_@@_tmpa_clist }
+ {
+ \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl
+ \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl
+ \clist_pop:NN \l_@@_tmpc_clist \l_@@_tmpc_tl
+ \clist_pop:NN \l_@@_tmpd_clist \l_@@_tmpd_tl
+% \end{macrocode}
+% udc码标记需要左对齐。
+% \begin{macrocode}
+ \tl_if_eq:NNTF \l_@@_tmpa_tl \c_@@_name_udc_tl
+ {
+ \@@_fixed_width_box:Vn \l_@@_tmpa_dim { \l_@@_tmpa_tl }
+ }{
+ \@@_spread_box:Vn \l_@@_tmpa_dim { \l_@@_tmpa_tl }
+ }
+ \c_@@_fwid_colon_tl
+ \@@_center_box:Vn \l_@@_tmpb_dim { \l_@@_tmpb_tl }
+ \hfill
+% \end{macrocode}
+% 用空值占有一行。
+% \begin{macrocode}
+ \tl_if_empty:NTF \l_@@_tmpc_tl
+ {
+ }{
+ \@@_spread_box:Vn \l_@@_tmpc_dim { \l_@@_tmpc_tl }
+ \c_@@_fwid_colon_tl
+ \@@_center_box:Vn \l_@@_tmpd_dim { \l_@@_tmpd_tl }
+ }
+ \par
+ }
+ \end{minipage}
+ \group_end:
+ }
+ {
+% \end{macrocode}
+% 本科生。
+% \begin{macrocode}
+ \@@_fixed_width_box:nn { 120 pt }
+ {
+ \@@_cover_id_aux:n { student_id }
+ }
+ }
+ }
+\cs_new:Npn \@@_cover_id_aux:n #1
+ {
+ \tl_use:c { c_@@_name_ #1 _tl }
+ \c_@@_fwid_colon_tl
+ \@@_text_uline:n {\tl_use:c { l_@@_info_ #1 _tl }}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_cover_logo:}
+% 插入校名图片。根据参数 \opt{width} 和 \opt{height} 是否为空依次
+% 判断。\cs{l_@@_cover_logo_size_clist} 中超过两个的参数将被忽略。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_cover_logo:
+ {
+ \clist_pop:NN \l_@@_cover_logo_size_clist \l_@@_tmpa_tl
+ \clist_pop:NNTF \l_@@_cover_logo_size_clist \l_@@_tmpb_tl
+ {
+ \tl_if_empty:NTF \l_@@_tmpa_tl
+ { \includegraphics [ height = \l_@@_tmpb_tl ] }
+ {
+ \includegraphics
+ [ width = \l_@@_tmpa_tl, height = \l_@@_tmpb_tl ]
+ }
+ }
+ { \includegraphics [ width = \l_@@_tmpa_tl ] }
+ { \l_@@_cover_logo_tl }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_cover_type:}
+% 论文类型。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_cover_type:
+ {
+ \tl_set:Nx \l_@@_tmpa_tl
+ {
+% \end{macrocode}
+% 取出论文类型。
+% \begin{macrocode}
+ \clist_item:Nn \c_@@_thesis_type_clist { \g_@@_thesis_type_int }
+ }
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生论文。
+% \begin{macrocode}
+ \@@_spread_box:nn { 0.75 \textwidth } { \l_@@_tmpa_tl }
+ }{
+% \end{macrocode}
+% 本科毕业年份(届)。
+% \begin{macrocode}
+ \@@_get_text_width:NV \l__@@_tmpa_dim \l__@@_info_grade_tl
+ \@@_center_box:Vn \l__@@_tmpa_dim { \l__@@_info_grade_tl }
+ \@@_spread_box:nn { 0.50 \textwidth }{
+ 届
+ \l_@@_tmpa_tl
+% \end{macrocode}
+% 本科的论文或设计。
+% \begin{macrocode}
+ \clist_item:Nn \c__@@_bachelor_type_clist { \l__@@_info_bachelor_type_int }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_cover_info:}
+% 作者信息栏。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_cover_info:
+ {
+ \begin{minipage} [ c ] { \textwidth }
+ \centering
+% \end{macrocode}
+% 根据论文类型(博士、硕士、本科)分支输出不同信息
+% \begin{macrocode}
+ \int_case:nn {\g_@@_thesis_type_int}
+ {
+% \end{macrocode}
+% 博士论文
+% \begin{macrocode}
+ {1}{
+% \end{macrocode}
+% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpa_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpa_clist
+ {
+ \c_@@_name_major_tl,
+ \c_@@_name_researchfield_tl,
+ \c_@@_name_author_tl,
+ \c_@@_name_supervisor_tl,
+ \c_@@_name_cosupervisor_tl,
+ \c_@@_name_date_tl,
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist
+% \end{macrocode}
+% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpb_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpb_clist
+ {
+ { \l_@@_info_major_tl },
+ { \l_@@_info_researchfield_tl },
+ { \l_@@_info_author_tl },
+ { \l_@@_info_supervisor_tl },
+ { \l_@@_info_cosupervisor_tl },
+ { \l_@@_info_date_tl }
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist
+ }
+% \end{macrocode}
+% 硕士论文
+% \begin{macrocode}
+ {2}{
+ \int_case:nn {\l_@@_info_degree_type_int}
+ {
+% \end{macrocode}
+% 学术硕士
+% \begin{macrocode}
+ {1}{
+% \end{macrocode}
+% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpa_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpa_clist
+ {
+ \c_@@_name_major_tl,
+ \c_@@_name_researchfield_tl,
+ \c_@@_name_author_tl,
+ \c_@@_name_supervisor_tl,
+ \c_@@_name_cosupervisor_tl,
+ \c_@@_name_date_tl,
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist
+% \end{macrocode}
+% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpb_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpb_clist
+ {
+ { \l_@@_info_major_tl },
+ { \l_@@_info_researchfield_tl },
+ { \l_@@_info_author_tl },
+ { \l_@@_info_supervisor_tl },
+ { \l_@@_info_cosupervisor_tl },
+ { \l_@@_info_date_tl }
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist
+ }
+% \end{macrocode}
+% 专业学位硕士
+% \begin{macrocode}
+ {2}{
+% \end{macrocode}
+% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpa_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpa_clist
+ {
+ \c_@@_name_professionaltype_tl,
+ \c_@@_name_professionalfield_tl,
+ \c_@@_name_author_tl,
+ \c_@@_name_supervisor_tl,
+ \c_@@_name_cosupervisor_tl,
+ \c_@@_name_date_tl,
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist
+% \end{macrocode}
+% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpb_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpb_clist
+ {
+ { \l_@@_info_professionaltype_tl },
+ { \l_@@_info_professionalfield_tl },
+ { \l_@@_info_author_tl },
+ { \l_@@_info_supervisor_tl },
+ { \l_@@_info_cosupervisor_tl },
+ { \l_@@_info_date_tl }
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist
+ }
+ }
+ }
+% \end{macrocode}
+% 本科论文
+% \begin{macrocode}
+ {3}{
+% \end{macrocode}
+% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpa_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpa_clist
+ {
+ \c_@@_name_department_tl,
+ \c_@@_name_major_tl,
+ \c_@@_name_enroll_tl\c_@@_name_class_id_tl,
+ \c_@@_name_author_tl,
+ \c_@@_name_supervisor_tl,
+ \c_@@_name_cosupervisor_tl,
+ \c_@@_name_date_tl,
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist
+% \end{macrocode}
+% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpb_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpb_clist
+ {
+ { \l_@@_info_department_tl },
+ { \l_@@_info_major_tl },
+ { \l_@@_info_enroll_tl 级 \l_@@_info_class_id_tl 班 },
+ { \l_@@_info_author_tl },
+ { \l_@@_info_supervisor_tl },
+ { \l_@@_info_cosupervisor_tl },
+ { \l_@@_info_date_tl }
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist
+ }
+ }
+% \end{macrocode}
+% 用循环输出各字段。
+% \begin{macrocode}
+ \bool_until_do:nn
+ { \clist_if_empty_p:N \l_@@_tmpa_clist }
+ {
+ \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl
+ \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl
+ \@@_spread_box:Vn \l_@@_tmpa_dim { \l_@@_tmpa_tl }
+ \c_@@_fwid_colon_tl
+ \@@_center_box:Vn \l_@@_tmpb_dim { \l_@@_tmpb_tl }
+ \skip_vertical:n { 1 ex }
+ }
+ \end{minipage}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_cover_info_en:}
+% 英文作者信息栏,仅对研究生有效。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_cover_info_en:
+ {
+ \int_case:nn {\g_@@_thesis_type_int}
+ {
+ {1}{
+% \end{macrocode}
+% 计算各标识名称和信息字段的总计宽度,并将最宽者的宽度赋给
+% \cs{l_@@_tmpa_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpa_clist
+ {
+ {\c_@@_name_major_en_tl{\l_@@_info_major_en_tl}},
+ {\c_@@_name_researchfield_en_tl{\l_@@_info_researchfield_en_tl}},
+ {\c_@@_name_author_en_tl{\l_@@_info_author_en_tl}},
+ {\c_@@_name_supervisor_en_tl{\l_@@_info_supervisor_en_tl}},
+ {\c_@@_name_cosupervisor_en_tl{\l_@@_info_cosupervisor_en_tl}},
+ {\c_@@_name_date_en_tl{\l_@@_info_date_en_tl}},
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist
+% \end{macrocode}
+% 将宽度值适当放宽。
+% \begin{macrocode}
+ \dim_add:Nn \l_@@_tmpa_dim {2.5em}
+ \begin{minipage} [ c ] { \l_@@_tmpa_dim }
+ \flushleft
+% \end{macrocode}
+% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpa_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpa_clist
+ {
+ \c_@@_name_major_en_tl,
+ \c_@@_name_researchfield_en_tl,
+ \c_@@_name_author_en_tl,
+ \c_@@_name_supervisor_en_tl,
+ \c_@@_name_cosupervisor_en_tl,
+ \c_@@_name_date_en_tl,
+ }
+% \end{macrocode}
+% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpb_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpb_clist
+ {
+ { \l_@@_info_major_en_tl },
+ { \l_@@_info_researchfield_en_tl },
+ { \l_@@_info_author_en_tl },
+ { \l_@@_info_supervisor_en_tl },
+ { \l_@@_info_cosupervisor_en_tl },
+ { \l_@@_info_date_en_tl }
+ }
+% \end{macrocode}
+% 用循环输出各字段。
+% \begin{macrocode}
+ \bool_until_do:nn
+ { \clist_if_empty_p:N \l_@@_tmpa_clist }
+ {
+ \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl
+ \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl
+ \l_@@_tmpa_tl
+ \c_@@_fwid_colon_tl
+ \l_@@_tmpb_tl
+ \skip_vertical:n { 1 ex }
+ }
+ \end{minipage}
+ }
+ {2}{
+ \int_case:nn {\l_@@_info_degree_type_int}
+ {
+% \end{macrocode}
+% 学术硕士
+% \cs{l_@@_tmpa_dim}。
+% \begin{macrocode}
+ {1}{
+% \end{macrocode}
+% 计算各标识名称和信息字段的总计宽度,并将最宽者的宽度赋给
+% \cs{l_@@_tmpa_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpa_clist
+ {
+ {\c_@@_name_major_en_tl{\l_@@_info_major_en_tl}},
+ {\c_@@_name_researchfield_en_tl{\l_@@_info_researchfield_en_tl}},
+ {\c_@@_name_author_en_tl{\l_@@_info_author_en_tl}},
+ {\c_@@_name_supervisor_en_tl{\l_@@_info_supervisor_en_tl}},
+ {\c_@@_name_cosupervisor_en_tl{\l_@@_info_cosupervisor_en_tl}},
+ {\c_@@_name_date_en_tl{\l_@@_info_date_en_tl}},
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist
+% \end{macrocode}
+% 将宽度值适当放宽。
+% \begin{macrocode}
+ \dim_add:Nn \l_@@_tmpa_dim {2.5em}
+ \begin{minipage} [ c ] { \l_@@_tmpa_dim }
+ \flushleft
+% \end{macrocode}
+% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpa_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpa_clist
+ {
+ \c_@@_name_major_en_tl,
+ \c_@@_name_researchfield_en_tl,
+ \c_@@_name_author_en_tl,
+ \c_@@_name_supervisor_en_tl,
+ \c_@@_name_cosupervisor_en_tl,
+ \c_@@_name_date_en_tl,
+ }
+% \end{macrocode}
+% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpb_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpb_clist
+ {
+ { \l_@@_info_major_en_tl },
+ { \l_@@_info_researchfield_en_tl },
+ { \l_@@_info_author_en_tl },
+ { \l_@@_info_supervisor_en_tl },
+ { \l_@@_info_cosupervisor_en_tl },
+ { \l_@@_info_date_en_tl }
+ }
+% \end{macrocode}
+% 用循环输出各字段。
+% \begin{macrocode}
+ \bool_until_do:nn
+ { \clist_if_empty_p:N \l_@@_tmpa_clist }
+ {
+ \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl
+ \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl
+ \l_@@_tmpa_tl
+ \c_@@_fwid_colon_tl
+ \l_@@_tmpb_tl
+ \skip_vertical:n { 1 ex }
+ }
+ \end{minipage}
+ }
+% \end{macrocode}
+% 专业学位硕士。
+% \begin{macrocode}
+ {2}{
+% \end{macrocode}
+% 计算各标识名称和信息字段的总计宽度,并将最宽者的宽度赋给
+% \cs{l_@@_tmpa_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpa_clist
+ {
+ {\c_@@_name_professionaltype_en_tl{Master~of~\l_@@_info_professionaltype_en_tl}},
+ {\c_@@_name_professionalfield_en_tl{\l_@@_info_professionalfield_en_tl}},
+ {\c_@@_name_author_en_tl{\l_@@_info_author_en_tl}},
+ {\c_@@_name_supervisor_en_tl{\l_@@_info_supervisor_en_tl}},
+ {\c_@@_name_cosupervisor_en_tl{\l_@@_info_cosupervisor_en_tl}},
+ {\c_@@_name_date_en_tl{\l_@@_info_date_en_tl}},
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist
+% \end{macrocode}
+% 将宽度值适当放宽。
+% \begin{macrocode}
+ \dim_add:Nn \l_@@_tmpa_dim {2.5em}
+ \begin{minipage} [ c ] { \l_@@_tmpa_dim }
+ \flushleft
+% \end{macrocode}
+% 读取左侧作者信息标识名称字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpa_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpa_clist
+ {
+ \c_@@_name_professionaltype_en_tl,
+ \c_@@_name_professionalfield_en_tl,
+ \c_@@_name_author_en_tl,
+ \c_@@_name_supervisor_en_tl,
+ \c_@@_name_cosupervisor_en_tl,
+ \c_@@_name_date_en_tl,
+ }
+% \end{macrocode}
+% 读取右侧作者信息各栏字段,并将最宽者的宽度赋给
+% \cs{l_@@_tmpb_dim}。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpb_clist
+ {
+ { Master ~ of ~ \l_@@_info_professionaltype_en_tl },
+ { \l_@@_info_professionalfield_en_tl },
+ { \l_@@_info_author_en_tl },
+ { \l_@@_info_supervisor_en_tl },
+ { \l_@@_info_cosupervisor_en_tl },
+ { \l_@@_info_date_en_tl }
+ }
+% \end{macrocode}
+% 用循环输出各字段。
+% \begin{macrocode}
+ \bool_until_do:nn
+ { \clist_if_empty_p:N \l_@@_tmpa_clist }
+ {
+ \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl
+ \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl
+ \l_@@_tmpa_tl
+ \c_@@_fwid_colon_tl
+ \l_@@_tmpb_tl
+ \skip_vertical:n { 1 ex }
+ }
+ \end{minipage}
+ }
+ }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_cover_instructors:}
+% 标题内页作者、指导教师、指导小组签名,仅对研究生有效。
+% 此处应该是签名,在此直接设计为打印出姓名。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_cover_instructors:
+ {
+ \int_case:nn {\g_@@_thesis_type_int}
+ {
+% \end{macrocode}
+% 博士生,需要指导小组。
+% \begin{macrocode}
+ {1}{
+% \end{macrocode}
+% 作者、导师、指导小组标识,并取得最宽宽度。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpa_clist
+ {
+ {\c_@@_name_author_tl },
+ {\c_@@_name_supervisor_tl },
+ {\c_@@_name_instructors_tl },
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist
+% \end{macrocode}
+% 取得指导小组名单。
+% \begin{macrocode}
+ \tl_set:Nn \l_@@_tmpa_tl {\clist_use:Nn \l_@@_info_instructors_clist {\@@_quad: }}
+% \end{macrocode}
+% 作者、导师、指导小组信息,并取得最宽宽度。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpb_clist
+ {
+ {\l_@@_info_author_tl },
+ {\l_@@_info_supervisor_tl },
+ {\l_@@_tmpa_tl },
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist
+% \end{macrocode}
+% 计算小页环境宽度。
+% \begin{macrocode}
+ \dim_set_eq:NN \l_@@_tmpt_dim \l_@@_tmpa_dim
+ \dim_add:Nn \l_@@_tmpt_dim { \l_@@_tmpb_dim }
+ \dim_add:Nn \l_@@_tmpt_dim {2.5em}
+ \begin{minipage} [ c ] { \l_@@_tmpt_dim }
+ \centering
+% \end{macrocode}
+% 用循环输出各字段。
+% \begin{macrocode}
+ \bool_until_do:nn
+ { \clist_if_empty_p:N \l_@@_tmpa_clist }
+ {
+ \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl
+ \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl
+ \l_@@_tmpa_tl
+ \c_@@_fwid_colon_tl
+ \@@_center_box:Vn \l_@@_tmpb_dim { \l_@@_tmpb_tl }
+ \skip_vertical:n { 1 ex }
+ }
+% \end{macrocode}
+% 不输出姓名,输出下划线,留作签名空间(暂未启用)。
+% \begin{macrocode}
+ % \c_@@_name_author_tl
+ % \c_@@_fwid_colon_tl
+ % \@@_blank_underline:n{ 12em }
+ % \skip_vertical:n { 1 ex }
+ % \c_@@_name_supervisor_tl
+ % \c_@@_fwid_colon_tl
+ % \@@_blank_underline:n{ 12em }
+ % \skip_vertical:n { 1 ex }
+ % \c_@@_name_instructors_tl
+ % \c_@@_fwid_colon_tl
+ % \@@_blank_underline:n{ 12em }
+ % \skip_vertical:n { 1 ex }
+ \end{minipage}
+ }
+% \end{macrocode}
+% 硕士生,仅需作者和导师。
+% \begin{macrocode}
+ {2}{
+% \end{macrocode}
+% 作者、导师标识,并取得最宽宽度。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpa_clist
+ {
+ {\c_@@_name_author_tl },
+ {\c_@@_name_supervisor_tl },
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist
+% \end{macrocode}
+% 作者、导师信息,并取得最宽宽度。
+% \begin{macrocode}
+ \clist_set:Nx \l_@@_tmpb_clist
+ {
+ {\l_@@_info_author_tl },
+ {\l_@@_info_supervisor_tl },
+ }
+ \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist
+ \dim_add:Nn \l_@@_tmpb_dim { \l_@@_tmpb_dim }
+% \end{macrocode}
+% 计算小页环境宽度。
+% \begin{macrocode}
+ \dim_set_eq:NN \l_@@_tmpt_dim \l_@@_tmpa_dim
+ \dim_add:Nn \l_@@_tmpt_dim { \l_@@_tmpb_dim }
+ \dim_add:Nn \l_@@_tmpt_dim {2.5em}
+ \begin{minipage} [ c ] { \l_@@_tmpt_dim }
+ \centering
+% \end{macrocode}
+% 用循环输出各字段。
+% \begin{macrocode}
+ \bool_until_do:nn
+ { \clist_if_empty_p:N \l_@@_tmpa_clist }
+ {
+ \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl
+ \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl
+ \l_@@_tmpa_tl
+ \c_@@_fwid_colon_tl
+ \@@_center_box:Vn \l_@@_tmpb_dim { \l_@@_tmpb_tl }
+ \skip_vertical:n { 1 ex }
+ }
+% \end{macrocode}
+% 不输出姓名,输出下划线,留作签名空间(暂未启用)。
+% \begin{macrocode}
+ % \begin{minipage} [ c ] { 17em }
+ % \flushleft
+ % \c_@@_name_author_tl
+ % \c_@@_fwid_colon_tl
+ % \@@_blank_underline:n{ 12em }
+ % \skip_vertical:n { 1 ex }
+ % \c_@@_name_supervisor_tl
+ % \c_@@_fwid_colon_tl
+ % \@@_blank_underline:n{ 12em }
+ % \skip_vertical:n { 1 ex }
+ \end{minipage}
+ }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_cover_defensecommittees:}
+% 答辩委员会名单,仅对研究生有效。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_cover_defensecommittees:
+ {
+% \end{macrocode}
+% 清空临时变量。
+% \begin{macrocode}
+ \clist_set:Nn \l_@@_tmpa_clist {}
+ \clist_set:Nn \l_@@_tmpb_clist {}
+ \clist_set:Nn \l_@@_tmpc_clist {}
+ \bool_until_do:nn { \clist_if_empty_p:N \l_@@_info_defensecommittees_clist }
+ {
+ \clist_set:Nn \l_@@_tmpt_clist {}
+% \end{macrocode}
+% 取出一个答辩委员的信息。
+% \begin{macrocode}
+ \clist_pop:NN \l_@@_info_defensecommittees_clist \l_@@_tmpa_tl
+ \clist_set:NV \l_@@_tmpt_clist \l_@@_tmpa_tl
+% \end{macrocode}
+% 构造单位列表。
+% \begin{macrocode}
+ \clist_put_right:Nx \l_@@_tmpa_clist {
+ \clist_item:Nn \l_@@_tmpt_clist {1}
+ }
+% \end{macrocode}
+% 构造姓名列表。
+% \begin{macrocode}
+ \clist_put_right:Nx \l_@@_tmpb_clist {
+ \clist_item:Nn \l_@@_tmpt_clist {2}
+ }
+% \end{macrocode}
+% 构造职称列表。
+% \begin{macrocode}
+ \clist_put_right:Nx \l_@@_tmpc_clist {
+ \clist_item:Nn \l_@@_tmpt_clist {3}
+ }
+ }
+% \end{macrocode}
+% 分别计算单位列表、姓名列表、职称列表的最宽宽度。
+% \begin{macrocode}
+ \@@_get_max_text_width:NN \l_@@_tmpa_dim \l_@@_tmpa_clist
+ \@@_get_max_text_width:NN \l_@@_tmpb_dim \l_@@_tmpb_clist
+ \@@_get_max_text_width:NN \l_@@_tmpc_dim \l_@@_tmpc_clist
+% \end{macrocode}
+% 输出答辩委员会信息。
+% \begin{macrocode}
+ \begin{minipage} [ c ] { \textwidth }
+ \centering
+ \bool_until_do:nn { \clist_if_empty_p:N \l_@@_tmpa_clist }
+ {
+ \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl
+ \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl
+ \clist_pop:NN \l_@@_tmpc_clist \l_@@_tmpc_tl
+ \@@_spread_box:Vn \l_@@_tmpa_dim { \l_@@_tmpa_tl }
+ \@@_center_box:Vn \l_@@_tmpb_dim { \l_@@_tmpb_tl }
+ \@@_spread_box:Vn \l_@@_tmpc_dim { \l_@@_tmpc_tl }
+ \skip_vertical:n { 0.5 ex }
+ }
+ \end{minipage}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_cover_foundation:}
+% 项目资助列表,仅对研究生有效。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_cover_foundation:
+ {
+% \end{macrocode}
+% 清空临时变量。
+% \begin{macrocode}
+ \clist_set:Nn \l_@@_tmpa_clist {}
+ \clist_set:Nn \l_@@_tmpb_clist {}
+ \clist_set:Nn \l_@@_tmpc_clist {}
+ \bool_until_do:nn { \clist_if_empty_p:N \l_@@_info_foundation_clist }
+ {
+ \clist_set:Nn \l_@@_tmpt_clist {}
+% \end{macrocode}
+% 取出一个资助项目的信息。
+% \begin{macrocode}
+ \clist_pop:NN \l_@@_info_foundation_clist \l_@@_tmpa_tl
+ \clist_set:NV \l_@@_tmpt_clist \l_@@_tmpa_tl
+% \end{macrocode}
+% 构造项目来源列表。
+% \begin{macrocode}
+ \clist_put_right:Nx \l_@@_tmpa_clist {
+ \clist_item:Nn \l_@@_tmpt_clist {1}
+ }
+% \end{macrocode}
+% 构造项目名称列表。
+% \begin{macrocode}
+ \clist_put_right:Nx \l_@@_tmpb_clist {
+ \clist_item:Nn \l_@@_tmpt_clist {2}
+ }
+% \end{macrocode}
+% 构造项目编号列表。
+% \begin{macrocode}
+ \clist_put_right:Nx \l_@@_tmpc_clist {
+ \clist_item:Nn \l_@@_tmpt_clist {3}
+ }
+ }
+% \end{macrocode}
+% 输出资助项目信息。
+% \begin{macrocode}
+ \begin{minipage} [ c ] { \textwidth }
+ \bool_until_do:nn { \clist_if_empty_p:N \l_@@_tmpa_clist }
+ {
+ \clist_pop:NN \l_@@_tmpa_clist \l_@@_tmpa_tl
+ \clist_pop:NN \l_@@_tmpb_clist \l_@@_tmpb_tl
+ \clist_pop:NN \l_@@_tmpc_clist \l_@@_tmpc_tl
+ \indent
+ \@@_qquad:
+ 本研究得到
+ \l_@@_tmpa_tl
+ \c_@@_fwid_colon_tl
+ \l_@@_tmpb_tl
+ (编号\c_@@_fwid_colon_tl
+ \l_@@_tmpc_tl
+ )资助
+ \par
+ }
+ \end{minipage}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_cover_signature:N}
+% 签名行。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_cover_signature:N #1
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生。
+% \begin{macrocode}
+ \@@_qquad:
+ \@@_spread_box:nV { 5 em } #1
+ \c_@@_fwid_colon_tl
+ \hspace*{\fill}
+ }{
+% \end{macrocode}
+% 本科生。
+% \begin{macrocode}
+ \@@_spread_box:nV { 6 em } #1
+ \c_@@_fwid_colon_tl
+ % \@@_blank_underline:n { 6 em }
+ \hspace*{\fill}
+ }
+% \end{macrocode}
+% 签名时间。
+% \begin{macrocode}
+ 时间\c_@@_fwid_colon_tl
+ \@@_qquad:\@@_qquad: 年
+ \@@_qquad: 月
+ \@@_qquad: 日
+ \hspace*{\fill}
+ % \@@_qquad:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{封面模板}
+%
+% 声明封面对象。不需要带参数(\emph{完全复制fduthesis.dtx未做任何修改})。
+% \begin{macrocode}
+%<@@=nwafu_cover>
+\DeclareObjectType { nwafu / cover } { \c_zero_int }
+% \end{macrocode}
+%
+% \begin{macro}{\DeclareCoverTemplate,\nwafu_cover_declare_template:nn}
+% 声明封面模板。
+% \begin{arguments}
+% \item 模板名称
+% \item 封面部件列表,以逗号分隔
+% \end{arguments}
+% \begin{macrocode}
+\NewDocumentCommand \DeclareCoverTemplate { m m }
+ { \nwafu_cover_declare_template:nn {#1} {#2} }
+\cs_new_protected:Npn \nwafu_cover_declare_template:nn #1#2
+ {
+ \tl_set:Nn \l_@@_template_tl {#1}
+% \end{macrocode}
+% 构建模板接口。
+% \begin{macrocode}
+ \@@_declare_template_interface:nx {#1}
+ {
+ format : tokenlist,
+ top-skip : skip,
+ bottom-skip : skip,
+ \clist_map_function:nN {#2} \@@_key_type:n
+ }
+% \end{macrocode}
+% 声明所用变量。
+% \begin{macrocode}
+ \tl_new:c { l_@@ / #1 / format_tl }
+ \skip_new:c { l_@@ / #1 / top_skip }
+ \skip_new:c { l_@@ / #1 / bottom_skip }
+ \clist_map_inline:nn {#2}
+ {
+ \tl_new:c { l_@@ / #1 / ##1 / content_tl }
+ \tl_new:c { l_@@ / #1 / ##1 / format_tl }
+ \skip_new:c { l_@@ / #1 / ##1 / bottom_skip }
+ }
+% \end{macrocode}
+% 声明模板代码。^^A 以下名字空间为 `nwafu_cover' 而非 `nwafu'
+% \begin{macrocode}
+ \@@_declare_template_code:nxn {#1}
+ {
+ format = \exp_not:c { l_@@ / #1 / format_tl },
+ top-skip = \use:c { l_@@ / #1 / top_skip },
+ bottom-skip = \use:c { l_@@ / #1 / bottom_skip },
+ \clist_map_function:nN {#2} \@@_key_binding:n
+ }
+ {
+ \AssignTemplateKeys
+ \tl_use:c { l_@@ / #1 / format_tl }
+ \__nwafu_vspace:c { l_@@ / #1 / top_skip }
+ \clist_map_inline:nn {#2}
+ {
+ \use:c { @@ / #1 / ####1 / align:n }
+ {
+ \tl_use:c { l_@@ / #1 / ####1 / format_tl }
+ \tl_use:c { l_@@ / #1 / ####1 / content_tl }
+ \par
+ }
+ \__nwafu_vspace:c { l_@@ / #1 / ####1 / bottom_skip }
+ }
+ \__nwafu_vspace:c { l_@@ / #1 / bottom_skip }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{variable}{\l_@@_template_tl}
+% 保存模板名称。
+% \begin{macrocode}
+\tl_new:N \l_@@_template_tl
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\@@_declare_template_interface:nn,
+% \@@_declare_template_code:nnn,
+% \@@_declare_template_interface:nx,
+% \@@_declare_template_code:nxn}
+% 为了展开的方便,这里需要封装 \pkg{xtemplate} 的一些函数。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_declare_template_interface:nn #1#2
+ { \DeclareTemplateInterface { nwafu / cover } {#1} { \c_zero_int } {#2} }
+\cs_new_protected:Npn \@@_declare_template_code:nnn #1#2#3
+ { \DeclareTemplateCode { nwafu / cover } {#1} { \c_zero_int } {#2} {#3} }
+\cs_generate_variant:Nn \@@_declare_template_interface:nn { nx }
+\cs_generate_variant:Nn \@@_declare_template_code:nnn { nxn }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_key_type:n}
+% \begin{macrocode}
+\cs_new:Npn \@@_key_type:n #1
+ {
+ #1 / content : tokenlist,
+ #1 / format : tokenlist,
+ #1 / bottom-skip : skip,
+ #1 / align : choice { left, right, center, normal } = normal,
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_key_binding:n}
+% \begin{macrocode}
+\cs_new:Npn \@@_key_binding:n #1
+ {
+ #1 / content =
+ \exp_not:c
+ { l_@@ / \l_@@_template_tl / #1 / content_tl },
+ #1 / format =
+ \exp_not:c
+ { l_@@ / \l_@@_template_tl / #1 / format_tl },
+ #1 / bottom-skip =
+ \exp_not:c
+ { l_@@ / \l_@@_template_tl / #1 / bottom_skip },
+ #1 / align =
+ {
+ left =
+ \exp_not:N \cs_set_protected:cpn
+ { @@ / \l_@@_template_tl / #1 / align:n }
+ \exp_not:n {##1}
+ {
+ \exp_not:n
+ {
+ \group_begin:
+ \flushleft ##1 \endflushleft
+ \group_end:
+ }
+ },
+ right =
+ \exp_not:N \cs_set_protected:cpn
+ { @@ / \l_@@_template_tl / #1 / align:n }
+ \exp_not:n {##1}
+ {
+ \exp_not:n
+ {
+ \group_begin:
+ \flushright ##1 \endflushright
+ \group_end:
+ }
+ },
+ center =
+ \exp_not:N \cs_set_protected:cpn
+ { @@ / \l_@@_template_tl / #1 / align:n }
+ \exp_not:n {##1}
+ {
+ \exp_not:n
+ {
+ \group_begin:
+ \center ##1 \endcenter
+ \group_end:
+ }
+ },
+ normal =
+ \exp_not:N \cs_set_protected:cpn
+ { @@ / \l_@@_template_tl / #1 / align:n }
+ \exp_not:n {##1}
+ { \exp_not:n { \group_begin: ##1 \group_end: } }
+ },
+ }
+%<@@=nwafu>
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{绘制封面}
+%
+% \begin{macro}{\makecoveri,\makecoverii,\makecoveriii,
+% \makecoveriv,\makecoverv,\makecovervi,\makecovervii}
+% 封面一~七,其中一~六为研究生使用,一和七为本科生使用。
+% \begin{macrocode}
+% 封面一,研究生、本科生中文封面
+\NewDocumentCommand \makecoveri { }
+ {
+ \thispagestyle { empty }
+ \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in}
+ \UseInstance { nwafu / cover } { cover-i-default }
+ \restoregeometry
+ }
+% \end{macrocode}
+% 封面二,研究生英文封面
+% \begin{macrocode}
+\NewDocumentCommand \makecoverii { }
+ {
+ \thispagestyle { empty }
+ \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in}
+ \UseInstance { nwafu / cover } { cover-ii-default }
+ \restoregeometry
+ }
+% \end{macrocode}
+% 封面三,研究生封面内页(ID、答辩委员会等)
+% \begin{macrocode}
+\NewDocumentCommand \makecoveriii { }
+ {
+ % \cleardoublepage
+ \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in}
+ \thispagestyle { empty }
+ \UseInstance { nwafu / cover } { cover-iii-default }
+ \restoregeometry
+ }
+% \end{macrocode}
+% 封面四,研究生项目资助页
+% \begin{macrocode}
+\NewDocumentCommand \makecoveriv { }
+ {
+ % \cleardoublepage
+ \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in}
+ \thispagestyle { empty }
+ \UseInstance { nwafu / cover } { cover-iv-default }
+ \restoregeometry
+ }
+% \end{macrocode}
+% 封面五,研究生独创性声明与导师承诺
+% \begin{macrocode}
+\NewDocumentCommand \makecoverv { }
+ {
+ % \cleardoublepage
+ \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in}
+ \thispagestyle { empty }
+ \UseInstance { nwafu / cover } { cover-v-default }
+ \restoregeometry
+ }
+% \end{macrocode}
+% 封面六,研究生论文使用授权说明
+% \begin{macrocode}
+\NewDocumentCommand \makecovervi { }
+ {
+ % \cleardoublepage
+ \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in}
+ \thispagestyle { empty }
+ \UseInstance { nwafu / cover } { cover-vi-default }
+ \restoregeometry
+ }
+% \end{macrocode}
+% 封面七,本科生独创性声明及论文使用授权说明
+% \begin{macrocode}
+\NewDocumentCommand \makecovervii { }
+ {
+ % \cleardoublepage
+ \newgeometry{top=1.0in, bottom=1.0in, left=1.25in, right=1.25in}
+ \thispagestyle { empty }
+ \UseInstance { nwafu / cover } { cover-vii-default }
+ \restoregeometry
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% 声明各封面模板组成部分。
+% \begin{macrocode}
+\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生封面一
+% \begin{macrocode}
+ \DeclareCoverTemplate { cover-i }
+ { logo, type, title, info }
+ }{
+% \end{macrocode}
+% 本科生封面一
+% \begin{macrocode}
+ \DeclareCoverTemplate { cover-i }
+ { id, logo, type, title, info }
+ }
+% \end{macrocode}
+% 研究生封面二
+% \begin{macrocode}
+\DeclareCoverTemplate { cover-ii } {
+ type, title, info, department, nwafu
+ }
+% \end{macrocode}
+% 研究生封面三
+% \begin{macrocode}
+\DeclareCoverTemplate { cover-iii } { id, name, title, instructors,
+ ctitle, committees, dtitle, date
+ }
+% \end{macrocode}
+% 研究生封面四
+% \begin{macrocode}
+\DeclareCoverTemplate { cover-iv } { name-list }
+% \end{macrocode}
+% 研究生封面五
+% \begin{macrocode}
+\DeclareCoverTemplate { cover-v }
+ {
+ originality-decl-name,
+ originality-decl-text,
+ originality-decl-sig,
+ supervisor-decl-name,
+ supervisor-decl-text,
+ supervisor-decl-sig
+ }
+% \end{macrocode}
+% 研究生封面六
+% \begin{macrocode}
+\DeclareCoverTemplate { cover-vi }
+ {
+ authorization-decl-name,
+ authorization-decl-text,
+ authorization-decl-sig,
+ supervisor-decl-sig
+ }
+% \end{macrocode}
+% 封面七,仅用于本科生独创性声明和授权说明
+% \begin{macrocode}
+\DeclareCoverTemplate { cover-vii }
+ {
+ originality-decl-name,
+ originality-decl-text,
+ originality-decl-sig,
+ authorization-decl-name,
+ authorization-decl-text,
+ authorization-decl-sig,
+ supervisor-decl-sig
+ }
+% \end{macrocode}
+%
+% 定义封面的具体配置参数。
+% 封面一
+% \begin{macrocode}
+\int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生
+% \begin{macrocode}
+ \DeclareInstance { nwafu / cover } { cover-i-default } { cover-i }
+ {
+ bottom-skip = 0 pt plus 1.5 fill,
+ logo / content = \@@_cover_logo:,
+ logo / bottom-skip = -45 pt plus 0.3 fill,
+ logo / align = center,
+ type / content = \@@_cover_type:,
+ type / format = \sffamily \zihao { 0 },% \bfseries,
+ type / bottom-skip = -20 pt plus 0.3 fill,
+ type / align = center,
+ title / content =
+ \@@_fixed_width_center_box:nn
+ { 0.9 \textwidth } { \l_@@_info_title_tl },
+ title / format = \nwafu@hei \bfseries \zihao { 2 },
+ title / bottom-skip = 80 pt plus 0.3 fill,
+ title / align = center,
+ info / content = \@@_cover_info:,
+ info / format = \@@_line_spread:n {1.05}\nwafu@hei \zihao { -3 },
+ info / align = center,
+ }
+ }{
+% \end{macrocode}
+% 本科生
+% \begin{macrocode}
+ \DeclareInstance { nwafu / cover } { cover-i-default } { cover-i }
+ {
+ bottom-skip = 0 pt plus 0.5 fill,
+ id / content = \@@_cover_id:,
+ id / format = \bfseries\zihao { 4 },
+ id / bottom-skip = 0 pt plus 0.3 fill,
+ id / align = right,
+ logo / content = \@@_cover_logo:,
+ logo / bottom-skip = -30 pt,% plus 0.3 fill,
+ logo / align = center,
+ type / content = \@@_cover_type:,
+ type / format = \bfseries\nwafu@kai\zihao { 1 },
+ type / bottom-skip = -20 pt plus 0.3 fill,
+ type / align = center,
+ title / content =
+ \@@_fixed_width_center_box:nn
+ { 0.9 \textwidth } { \l_@@_info_title_tl },
+ title / format = \nwafu@hei \bfseries\zihao { 2 },
+ title / bottom-skip = 80 pt plus 0.3 fill,
+ title / align = center,
+ info / content = \@@_cover_info:,
+ info / format = \rmfamily\zihao { 3 },
+ info / align = center,
+ }
+ }
+% \end{macrocode}
+% 封面二
+% \begin{macrocode}
+\int_case:nn {\g_@@_thesis_type_int}
+ {
+ {1}{
+% \end{macrocode}
+% 博士研究生
+% \begin{macrocode}
+ \DeclareInstance { nwafu / cover } { cover-ii-default } { cover-ii }
+ {
+ bottom-skip = 0 pt plus 0.5 fill,
+ type / content =
+ \@@_fixed_width_center_box:nn { 0.7\textwidth } {
+ Thesis~Submitted~to~\c_@@_name_en_tl\\
+ in~Partial~Fulfillment~of~the~Requirements\\
+ for~Degree~of\\
+ Doctor~of~Philosophy
+ },
+ type / format = \@@_line_spread:n {1.22} \zihao { -3 },
+ type / bottom-skip = 42 pt,% plus 0.3 fill,
+ type / align = center,
+ title / content = \l_@@_info_title_en_tl,
+ title / format = \@@_line_spread:n {0.90}
+ \zihao { 1 } \bfseries,
+ title / bottom-skip = 35 pt,% plus 0.3 fill,
+ title / align = center,
+ info / content = \@@_cover_info_en:,
+ info / format = \@@_line_spread:n {1.12} \zihao { -3 },
+ info / bottom-skip = 72 pt,% plus 0.3 fill,
+ info / align = center,
+ department / content = \l_@@_info_department_en_tl,
+ department / format = \zihao { -3 },
+ department / bottom-skip = -32 pt,% plus 0.3 fill,
+ department / align = center,
+ nwafu / content = \c_@@_name_en_tl,
+ nwafu / format = \zihao { -3 },
+ nwafu / align = center,
+ }
+ }
+ {2}{
+% \end{macrocode}
+% 硕士研究生
+% \begin{macrocode}
+ \DeclareInstance { nwafu / cover } { cover-ii-default } { cover-ii }
+ {
+ bottom-skip = 0 pt plus 0.5 fill,
+ type / content =
+ \@@_fixed_width_center_box:nn { 0.7\textwidth } {
+ Thesis~Submitted~to~\c_@@_name_en_tl\\
+ in~Partial~Fulfillment~of~the~Requirements\\
+ for~Degree~of\\
+ Master~of
+ \int_case:nn {\l_@@_info_degree_type_int}
+ {
+ {1}{
+ \@@_text_uline:V \l_@@_info_mastertype_en_tl
+ }
+ {2}{
+ \@@_text_uline:V \l_@@_info_professionaltype_en_tl
+ }
+ }
+ },
+ type / format = \@@_line_spread:n {1.22} \zihao { -3 },
+ type / bottom-skip = 42 pt,% plus 0.3 fill,
+ type / align = center,
+ title / content = \l_@@_info_title_en_tl,
+ title / format = \@@_line_spread:n {0.90} \zihao { 1 } \bfseries,
+ title / bottom-skip = 35 pt,% plus 0.3 fill,
+ title / align = center,
+ info / content = \@@_cover_info_en:,
+ info / format = \@@_line_spread:n {1.12} \zihao { -3 },
+ info / bottom-skip = 72 pt,% plus 0.3 fill,
+ info / align = center,
+ department / content = \l_@@_info_department_en_tl,
+ department / format = \zihao { -3 },
+ department / bottom-skip = -32 pt,% plus 0.3 fill,
+ department / align = center,
+ nwafu / content = \c_@@_name_en_tl,
+ nwafu / format = \zihao { -3 },
+ nwafu / align = center,
+ }
+ }
+ }
+% \end{macrocode}
+% 封面三
+% \begin{macrocode}
+\DeclareInstance { nwafu / cover } { cover-iii-default } { cover-iii }
+ {
+ top-skip = -55 pt plus 0.1 fill,
+ bottom-skip = 0 pt plus 0.5 fill,
+ id / content = \@@_cover_id:,
+ id / format = \@@_line_spread:n {1.12}\zihao { -4 },
+ id / bottom-skip = 35 pt plus 0.3 fill,
+ id / align = center,
+ name / content = \c_@@_name_simp_tl
+ \clist_item:Nn \c_@@_thesis_type_clist { \g_@@_thesis_type_int },
+ name / format = \zihao { -2 }\bfseries,
+ name / bottom-skip = 0 pt plus 0.3 fill,
+ name / align = center,
+ title / content = \l_@@_info_title_tl,
+ title / format = \zihao { 2 } \sffamily,
+ title / bottom-skip = 65 pt plus 0.3 fill,
+ title / align = center,
+ instructors / content = \@@_cover_instructors:,
+ instructors / format = \@@_line_spread:n {0.88}\zihao { 3 }\bfseries,
+ instructors / bottom-skip = 75 pt plus 0.3 fill,
+ instructors / align = center,
+ ctitle / content = 答辩委员会\c_@@_fwid_colon_tl,
+ ctitle / format = \zihao { -3 }\bfseries,
+ ctitle / bottom-skip = -20 pt plus 0.3 fill,
+ ctitle / align = left,
+ committees / content = \@@_cover_defensecommittees:,
+ committees / format = \@@_line_spread:n {1.12}\zihao { -3 },
+ committees / bottom-skip = 60 pt plus 0.3 fill,
+ committees / align = center,
+ date / content = {\bfseries{}答辩日期}\c_@@_fwid_colon_tl\l_@@_info_defensedate_tl,
+ date / format = \zihao { -3 },
+ date / bottom-skip = 0 pt plus 0.3 fill,
+ date / align = left,
+ }
+% \end{macrocode}
+% 封面四
+% \begin{macrocode}
+\DeclareInstance { nwafu / cover } { cover-iv-default } { cover-iv }
+ {
+ name-list / content = \@@_cover_foundation:,
+ name-list / format = \sffamily\zihao{3},
+ name-list / align = center,
+ }
+% \end{macrocode}
+% 封面五
+% \begin{macrocode}
+\DeclareInstance { nwafu / cover } { cover-v-default } { cover-v }
+ {
+ format =
+ \@@_line_spread:n { 1.25 },
+ top-skip = 0 pt plus 0.2 fill,
+ bottom-skip = 0 pt plus 2.5 fill,
+ originality-decl-name / content = \c_@@_name_orig_decl_tl,
+ originality-decl-text / content = \c_@@_orig_decl_text_tl,
+ originality-decl-sig / content =
+ \@@_cover_signature:N \c_@@_orig_decl_sign_tl,
+ supervisor-decl-name / content = \c_@@_name_super_decl_tl,
+ supervisor-decl-text / content = \c_@@_super_decl_text_tl,
+ supervisor-decl-sig / content =
+ \@@_cover_signature:N \c_@@_super_decl_sign_tl,
+ originality-decl-name / format =
+ \@@_line_spread:n { 1.2 } \zihao { 3 } \sffamily,
+ supervisor-decl-name / format =
+ \@@_line_spread:n { 1.2 } \zihao { 3 } \sffamily,
+ originality-decl-text / format = \zihao { -4 },
+ supervisor-decl-text / format = \zihao { -4 },
+ originality-decl-name / bottom-skip = 0.25 cm,
+ originality-decl-text / bottom-skip = 0.4 cm,
+ originality-decl-sig / bottom-skip = 0.4 cm,
+ supervisor-decl-name / bottom-skip = 0.25 cm,
+ supervisor-decl-text / bottom-skip = 0.4 cm,
+ originality-decl-name / align = center,
+ originality-decl-sig / align = left,
+ supervisor-decl-name / align = center,
+ supervisor-decl-sig / align = left,
+ }
+% \end{macrocode}
+% 封面六
+% \begin{macrocode}
+\DeclareInstance { nwafu / cover } { cover-vi-default } { cover-vi }
+ {
+ format =
+ \@@_line_spread:n { 1.25 },
+ top-skip = 0 pt plus 0.2 fill,
+ bottom-skip = 0 pt plus 2.5 fill,
+ authorization-decl-name / content = \c_@@_name_auth_decl_tl,
+ authorization-decl-text / content = \c_@@_auth_decl_text_tl,
+ authorization-decl-sig / content =
+ \@@_cover_signature:N \c_@@_orig_decl_sign_tl,
+ supervisor-decl-sig / content =
+ \@@_cover_signature:N \c_@@_super_decl_sign_tl,
+ authorization-decl-name / format =
+ \@@_line_spread:n { 1.2 } \zihao { 3 } \sffamily,
+ authorization-decl-text / format = \zihao { -4 },
+ authorization-decl-name / bottom-skip = 0.25 cm,
+ authorization-decl-text / bottom-skip = 0.8 cm,
+ authorization-decl-sig / bottom-skip = -0.50 cm,
+ authorization-decl-name / align = center,
+ authorization-decl-sig / align = left,
+ supervisor-decl-sig / align = left,
+ }
+% \end{macrocode}
+% 封面七
+% \begin{macrocode}
+\DeclareInstance { nwafu / cover } { cover-vii-default } { cover-vii }
+ {
+ format =
+ \@@_line_spread:n { 1.25 },
+ top-skip = 0 pt plus 0.2 fill,
+ bottom-skip = 0 pt plus 2.5 fill,
+ originality-decl-name / content = \c_@@_name_orig_decl_tl,
+ originality-decl-text / content = \c_@@_orig_decl_text_tl,
+ originality-decl-sig / content =
+ \@@_cover_signature:N \c_@@_orig_decl_sign_tl,
+ authorization-decl-name / content = \c_@@_name_auth_decl_tl,
+ authorization-decl-text / content = \c_@@_auth_decl_text_tl,
+ authorization-decl-sig / content =
+ \@@_cover_signature:N \c_@@_orig_decl_sign_tl,
+ supervisor-decl-sig / content =
+ \@@_cover_signature:N \c_@@_super_decl_sign_tl,
+ originality-decl-name / format =
+ \@@_line_spread:n { 1.2 } \zihao { 3 } \sffamily,
+ authorization-decl-name / format =
+ \@@_line_spread:n { 1.2 } \zihao { 3 } \sffamily,
+ originality-decl-text / format = \zihao { -4 } \nwafu@kai,
+ authorization-decl-text / format = \zihao { -4 } \nwafu@kai,
+ originality-decl-sig / format = \zihao { -4 } \nwafu@kai,
+ authorization-decl-sig / format = \zihao { -4 } \nwafu@kai,
+ supervisor-decl-sig / format = \zihao { -4 } \nwafu@kai,
+ originality-decl-name / bottom-skip = 0.25 cm,
+ originality-decl-text / bottom-skip = 0.4 cm,
+ originality-decl-sig / bottom-skip = 0.4 cm,
+ authorization-decl-name / bottom-skip = 0.25 cm,
+ authorization-decl-text / bottom-skip = 0.4 cm,
+ authorization-decl-sig / bottom-skip = -0.5 cm,
+ originality-decl-name / align = center,
+ originality-decl-sig / align = left,
+ authorization-decl-name / align = center,
+ authorization-decl-sig / align = left,
+ supervisor-decl-sig / align = left,
+ }
+% \end{macrocode}
+%
+% \begin{macro}{style/auto-make-cover}
+% \begin{variable}{\l_@@_auto_make_cover_bool}
+% 是否自动生成封面。
+% \begin{macrocode}
+\bool_new:N \l_@@_auto_make_cover_bool
+\keys_define:nn { nwafu / style }
+ {
+ auto-make-cover .bool_set:N = \l_@@_auto_make_cover_bool,
+ auto-make-cover .default:n = true
+ }
+% \end{macrocode}
+% \end{variable}
+% \end{macro}
+%
+% \begin{macro}{\makecovers}
+% 在排版所有封面。
+% \begin{macrocode}
+\NewDocumentCommand \makecovers { }
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生
+% \begin{macrocode}
+ \begin{titlepage}
+ \makecoveri
+ \newpage
+ \makecoverii
+ \newpage
+ \makecoveriii
+ \newpage
+ \makecoveriv
+ \newpage
+ \makecoverv
+ \newpage
+ \makecovervi
+ \end{titlepage}
+ }{
+% \end{macrocode}
+% 本科生
+% \begin{macrocode}
+ \begin{titlepage}
+ \makecoveri
+ \cleardoublepage
+ \makecovervii
+ \end{titlepage}
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{摘要及符号表}
+%
+% \begin{variable}{\l_@@_abstract_file_tl,
+% \l_@@_abstract_file_en_tl,
+% \l_@@_abstract_keywords_clist,
+% \l_@@_abstract_keywords_en_clist,
+% \l_@@_notation_file_tl}
+% 摘要数据所需字段。
+% \begin{macrocode}
+\tl_new:c { l_@@_abstract_file_tl }
+\tl_new:c { l_@@_abstract_file_en_tl }
+\clist_new:N \l_@@_abstract_keywords_clist
+\clist_new:N \l_@@_abstract_keywords_en_clist
+\tl_new:c { l_@@_notation_file_tl }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macrocode}
+\keys_define:nn { nwafu / abstract }
+ {
+% \end{macrocode}
+%
+% \begin{macro}{abstract/abstractfile, abstract/abstractfile*}
+% 摘要文件的文件名
+% \begin{macrocode}
+ abstractfile .tl_set:N = \l_@@_abstract_file_tl,
+ abstractfile* .tl_set:N = \l_@@_abstract_file_en_tl,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{abstract/keywords, abstract/keywords*}
+% 论文关键字列表。
+% \begin{macrocode}
+ keywords .clist_set:N = \l_@@_abstract_keywords_clist,
+ keywords* .clist_set:N = \l_@@_abstract_keywords_en_clist,
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{abstract/notation}
+% 论文符号表文件的文件名。
+% \begin{macrocode}
+ notationfile .tl_set:N = \l_@@_notation_file_tl,
+ notationfile .default:n = {},
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\makefront}
+% 排版摘要、目录等前料。
+% \begin{macrocode}
+\NewDocumentCommand \makefront { }
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+% \end{macrocode}
+% 研究生,\cs{frontmatter}命令用于设置页眉页脚,页码格式
+% 并于奇数页起排。
+% \begin{macrocode}
+ \frontmatter
+ \tl_if_empty:NF \l_@@_abstract_file_tl
+ {
+% \end{macrocode}
+% 根据提供的文件,排版中文摘要,否则什么都不做。
+% \begin{macrocode}
+ \begin{abstract}
+ \file_input:V \l_@@_abstract_file_tl
+ \end{abstract}
+ }
+ \tl_if_empty:NF \l_@@_abstract_file_en_tl
+ {
+% \end{macrocode}
+% 根据提供的文件,排版英文摘要,否则什么都不做。
+% \begin{macrocode}
+ \begin{abstract*}
+ \file_input:V \l_@@_abstract_file_en_tl
+ \end{abstract*}
+ }
+% \end{macrocode}
+% 排版目录,需要在奇数页起排。
+% \begin{macrocode}
+ \cleardoublepage
+ \pagenumbering{Roman}
+ \tableofcontents
+% \end{macrocode}
+% 排版主要符号对照表,需要在奇数页起排。
+% \begin{macrocode}
+ % \frontmatter
+ \tl_if_empty:NF \l_@@_notation_file_tl
+ {
+% \end{macrocode}
+% 根据提供的文件,排版主要符号对照表,否则什么都不做。
+% \begin{macrocode}
+ \cleardoublepage
+ \pagenumbering{Roman}
+ \file_input:V \l_@@_notation_file_tl
+ }
+ }{
+% \end{macrocode}
+% 本科生,无页眉页脚
+% \begin{macrocode}
+ \cleardoublepage
+ \thispagestyle { empty }
+ \tl_if_empty:NF \l_@@_abstract_file_tl
+ {
+% \end{macrocode}
+% 根据提供的文件,排版中文摘要,否则什么都不做。
+% \begin{macrocode}
+ \begin{abstract}
+ \@@_get_text_width:Nn \l_@@_tmpa_dim {\c_@@_name_keywords_tl}
+ \group_begin:
+ \par \indent
+ {\sffamily\zihao{-4}
+ \@@_spread_box:Vn \l_@@_tmpa_dim {\c_@@_name_abstract_tl}
+ \c_@@_fwid_colon_tl}
+ \normalfont
+ \file_input:V \l_@@_abstract_file_tl
+ \group_end:
+ \end{abstract}
+ }
+ \clearpage
+ \thispagestyle { empty }
+ \tl_if_empty:NF \l_@@_abstract_file_en_tl
+ {
+% \end{macrocode}
+% 根据提供的文件,排版英文摘要,否则什么都不做。
+% \begin{macrocode}
+ \begin{abstract*}
+ \group_begin:
+ \par \indent
+ {\bfseries\zihao{-4}
+ \c_@@_name_abstract_en_tl : ~}
+ \normalfont
+ \file_input:V \l_@@_abstract_file_en_tl
+ \group_end:
+ \end{abstract*}
+ }
+ \frontmatter
+ \tableofcontents
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\AfterEndPreamble
+ {
+ \bool_if:NT \l_@@_auto_make_cover_bool
+ {
+ \makecovers
+ \makefront
+ }
+ }
+% \end{macrocode}
+%
+% \subsection{目录}
+%
+% 设置目录标题。
+% \begin{macrocode}
+\keys_set:nn { ctex }
+ {
+ contentsname = \c_@@_name_toc_tl,
+ listfigurename = \c_@@_name_lof_tl,
+ listtablename = \c_@@_name_lot_tl,
+ }
+% \end{macrocode}
+%
+% \begin{variable}{\@@_toc_chapter_format_tl,
+% \@@_toc_chapter_indent_tl,
+% \@@_toc_chapter_rule_tl,
+% \@@_toc_chapter_numsep_tl,
+% \@@_toc_chapter_offset_dim,
+% \@@_toc_section_format_tl,
+% \@@_toc_section_indent_tl,
+% \@@_toc_section_rule_tl,
+% \@@_toc_section_numsep_tl,
+% \@@_toc_section_offset_dim,
+% \@@_toc_subsection_format_tl,
+% \@@_toc_subsection_indent_tl,
+% \@@_toc_subsection_rule_tl,
+% \@@_toc_subsection_numsep_tl,
+% \@@_toc_subsection_offset_dim,
+% \@@_toc_list_format_tl,
+% \@@_toc_list_indent_tl,
+% \@@_toc_list_rule_tl,
+% \@@_toc_list_numsep_tl,
+% \@@_toc_list_offset_dim,
+% \@@_toc_line_align_bool,
+% \@@_titletoc_hang_fix_bool}
+% 目录设置中需要的字段。
+% \begin{macrocode}
+\clist_map_inline:nn
+ {
+ chapter, section, subsection, figure, table
+ }
+ {
+ \clist_map_inline:nn
+ {
+ format, indent, rule, numsep
+ }
+ {
+ \tl_new:c {@@_toc_ #1 _ ##1 _ tl}
+ }
+ }
+\clist_map_inline:nn
+ {
+ chapter, section, subsection, figure, table
+ }
+ { \dim_new:c { @@_toc_ #1 _offset_dim } }
+\bool_new:N \@@_toc_line_align_bool
+\bool_new:N \@@_titletoc_hang_fix_bool
+% \end{macrocode}
+% \end{variable}
+%
+% 目录格式设置,研究生与本科生需设置不同参数
+% \begin{macrocode}
+\tl_set:Nn \@@_toc_chapter_format_tl { \addvspace{1pt}\nwafu@hei \bfseries }
+\tl_set:Nn \@@_toc_chapter_indent_tl {0pc}
+\tl_set:Nn \@@_toc_chapter_rule_tl {\tocrule{$\cdot$}}
+\tl_set:Nn \@@_toc_chapter_numsep_tl {0.5\ccwd}
+\dim_set:Nn \@@_toc_chapter_offset_dim
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+ 0pc
+ }{
+ 1pt
+ }
+ }
+\tl_set:Nn \@@_toc_section_format_tl
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+ \addvspace{0pt}
+ }{
+ \addvspace{1pt}\small
+ }
+ }
+\tl_set:Nn \@@_toc_section_indent_tl { \ccwd }
+\tl_set:Nn \@@_toc_section_rule_tl {\tocrule{$\cdot$}}
+\tl_set:Nn \@@_toc_section_numsep_tl {0.5\ccwd}
+\dim_set:Nn \@@_toc_section_offset_dim
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+ 0pc
+ }{
+ 1pt
+ }
+ }
+\tl_set:Nn \@@_toc_subsection_format_tl
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+ \addvspace{0pt}
+ }{
+ \addvspace{1pt}\small
+ }
+ }
+\tl_set:Nn \@@_toc_subsection_indent_tl {2.0\ccwd}
+\tl_set:Nn \@@_toc_subsection_rule_tl {\tocrule{$\cdot$}}
+\tl_set:Nn \@@_toc_subsection_numsep_tl {0.5\ccwd}
+\dim_set:Nn \@@_toc_subsection_offset_dim
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+ 0pc
+ }{
+ 1pt
+ }
+ }
+\tl_set:Nn \@@_toc_figure_format_tl
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+ \addvspace{0pt}
+ }{
+ \addvspace{1pt}
+ }
+ }
+\tl_set:Nn \@@_toc_figure_indent_tl {0pc}
+\tl_set:Nn \@@_toc_figure_rule_tl {\tocrule{$\cdot$}}
+\tl_set:Nn \@@_toc_figure_numsep_tl {0.5\ccwd}
+\dim_set:Nn \@@_toc_figure_offset_dim
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+ 0pc
+ }{
+ 1pt
+ }
+ }
+\tl_set:Nn \@@_toc_table_format_tl
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+ \addvspace{0pt}
+ }{
+ \addvspace{1pt}
+ }
+ }
+\tl_set:Nn \@@_toc_table_indent_tl {0pc}
+\tl_set:Nn \@@_toc_table_rule_tl {\tocrule{$\cdot$}}
+\tl_set:Nn \@@_toc_table_numsep_tl {0.5\ccwd}
+\dim_set:Nn \@@_toc_table_offset_dim
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+ 0pc
+ }{
+ 1pt
+ }
+ }
+\bool_set_false:N \@@_toc_line_align_bool
+\bool_set_false:N \@@_titletoc_hang_fix_bool
+%
+% \end{macrocode}
+% 循环设置各级别目录格式。
+% 代码借鉴于easybook(\url{https://gitee.com/texl3/easybook})。
+% \begin{macrocode}
+%
+\clist_map_inline:nn
+ {
+ chapter, section, subsection, figure, table
+ }
+ {
+ \titlecontents{#1}
+% \end{macrocode}
+% 左侧缩进距离。
+% \begin{macrocode}
+ [ \use:c { @@_toc_#1_indent_tl } ]
+% \end{macrocode}
+% 标题格式,可以设置字体、加入垂直间距等,
+% 垂直间距最好使用无间距重合的\textbackslash addvspace命令。
+% \begin{macrocode}
+ { \use:c { @@_toc_#1_format_tl } }
+% \end{macrocode}
+% 标题标志格式,如序号格式、序号宽度、序号与标题内容之间的间距等。
+% 该参数若为空,则无标题标志。
+% \begin{macrocode}
+ {
+ \bool_if:NT \@@_titletoc_hang_fix_bool
+ {
+ \contentspush
+ {
+ \thecontentslabel
+% \end{macrocode}
+% 有编号的标题在目录中编号与标题的间距。
+% \begin{macrocode}
+ \hspace{\use:c { @@_toc_#1_numsep_tl }}
+ }
+ }
+ }
+% \end{macrocode}
+% 无序号标题格式。
+% \begin{macrocode}
+ {}
+% \end{macrocode}
+% 标题与页码之间的导引线。
+% \begin{macrocode}
+ {\use:c { @@_toc_#1_rule_tl }}
+% \end{macrocode}
+% 下间距,可选参数, 用于设置标题排版后还需要执行的命令,
+% 例如与下个标题的垂直间距等。
+% \begin{macrocode}
+ [\addvspace{\use:c{ @@_toc_ #1 _offset_dim }}]
+ }
+
+% \end{macrocode}
+% 自定义导引线命令。
+% 代码借鉴于easybook(\url{https://gitee.com/texl3/easybook})。
+% \begin{macrocode}
+\cs_new:Npn \NWAFUNumberLine #1
+ {
+ \CTEXifname
+ {
+ \use:c { CTEXthe#1 }
+ \hspace{\use:c { @@_toc_#1_numsep_tl }}
+ }{}
+ }
+
+% \end{macrocode}
+% 导引线。
+% \begin{macrocode}
+\bool_if:NTF \@@_titletoc_hang_fix_bool
+ {
+% \end{macrocode}
+% CTeX格式导引线。
+% \begin{macrocode}
+ \keys_set:nn { ctex }
+ {
+ chapter/tocline = \CTEXnumberline{#1}#2,
+ section/tocline = \CTEXnumberline{#1}#2,
+ subsection/tocline = \CTEXnumberline{#1}#2
+ }
+ }{
+% \end{macrocode}
+% 自定义导引线。
+% \begin{macrocode}
+ \keys_set:nn { ctex }
+ {
+ chapter/tocline = \NWAFUNumberLine{#1}#2,
+ section/tocline = \NWAFUNumberLine{#1}#2,
+ subsection/tocline = \NWAFUNumberLine{#1}#2
+ }
+ }
+%
+% \end{macrocode}
+% 定义tocrule目录导引线命令。
+% *星号命令能够使右侧与页码连接与不是对齐。
+% 代码借鉴于easybook(\url{https://gitee.com/texl3/easybook})。
+% \begin{macrocode}
+%
+\NewDocumentCommand{\tocrule}{sO{0.3pc}D(){1.2}mO{}}
+ {
+ \small\normalfont
+ \titlerule*[#2]{\scalebox{#3}{#4}}#5
+ \IfBooleanTF{#1}
+ {\thecontentspage}
+ {
+ \bool_if:NTF \@@_toc_line_align_bool
+ {\contentspage}{\thecontentspage}
+ }
+ }
+% \end{macrocode}
+%
+% \begin{macro}{\tableofcontents,\listoffigures,\listoftables}
+% 修改 \cs{tableofcontents}、\cs{listoffigures} 和 \cs{listoftables} 的定义,
+% 使得页眉正确显示,并出现在目录及 PDF 书签中。来自于 \LaTeXe{} 标准文档类
+% \file{book.cls}
+% \footnote{原代码中只有 \cs{tableofcontents} 的 \cs{@mkboth} 出现在
+% \cs{chapter*} 内部,这是出于兼容性的考虑而非 typo。}。
+% \begin{macrocode}
+\@@_patch_cmd:Nnn \tableofcontents
+ {
+ \chapter*{\contentsname
+ \@mkboth{\MakeUppercase\contentsname}
+ {\MakeUppercase\contentsname}}
+ }
+ { \@@_chapter_no_toc:V \contentsname }
+\@@_patch_cmd:Nnn \listoffigures
+ {
+ \chapter*{\listfigurename}
+ \@mkboth{\MakeUppercase\listfigurename}
+ {\MakeUppercase\listfigurename}
+ }
+ { \@@_chapter:V \listfigurename }
+\@@_patch_cmd:Nnn \listoftables
+ {
+ \chapter*{\listtablename}
+ \@mkboth{\MakeUppercase\listtablename}
+ {\MakeUppercase\listtablename}
+ }
+ { \@@_chapter:V \listtablename }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{摘要}
+%
+% \begin{environment}{abstract}
+% \begin{environment}{abstract*}
+% 摘要环境,定义中英文双语摘要。
+% \begin{macrocode}
+\NewDocumentEnvironment { abstract } { }
+ { \@@_abstract_begin: } { \@@_abstract_end: }
+%<*class>
+\NewDocumentEnvironment { abstract* } { }
+ { \@@_abstract_en_begin: } { \@@_abstract_en_end: }
+%</class>
+% \end{macrocode}
+% \end{environment}
+% \end{environment}
+%
+% \begin{macro}{\@@_abstract_begin:,\@@_abstract_en_begin:}
+% 摘要页标题。
+% \begin{macrocode}
+%<*class>
+\cs_new_protected:Npn \@@_abstract_begin:
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+ \@@_chapter:V \c_@@_name_abstract_tl
+ }{
+ \par \mode_leave_vertical: \par
+ \begin{center}\nwafu@hei\bfseries\zihao{3}\l_@@_info_title_tl\end{center}
+ }
+ }
+%</class>
+\cs_new_protected:Npn \@@_abstract_en_begin:
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+ \@@_chapter:n \c_@@_name_abstract_en_tl
+ }{
+ \par \mode_leave_vertical: \par
+ \begin{center}\bfseries\zihao{3}\l_@@_info_title_en_tl\end{center}
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_abstract_end:,\@@_abstract_en_end:}
+% 摘要正文完成后,输出关键字列表。
+% \begin{macrocode}
+%<*class>
+\cs_new_protected:Npn \@@_abstract_end:
+ {
+ \@@_keywords:nNn
+ { \sffamily \zihao{-4} \c_@@_name_keywords_tl \c_@@_fwid_colon_tl }
+ \l_@@_abstract_keywords_clist { ; ~}
+ }
+%</class>
+\cs_new_protected:Npn \@@_abstract_en_end:
+ {
+ \@@_keywords:nNn
+ { \bfseries \c_@@_name_keywords_en_tl : ~ }
+ \l_@@_abstract_keywords_en_clist { ; ~ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_keywords:nNn,\@@_keywords_prevdepth:}
+% 关键字列表前要空一行,使用悬挂缩进。|\parbox| 之后的间距
+% 需要调整,见 \url{https://tex.stackexchange.com/a/34982}。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_keywords:nNn #1#2#3
+ {
+ \int_compare:nNnTF { \g_@@_thesis_type_int } < { 3 }
+ {
+ \par \mode_leave_vertical: \par \noindent
+ \@@_get_text_width:Nn \l_@@_tmpa_dim {#1}
+ \group_begin: \MakeUppercase{#1} \group_end:
+ \parbox [t] { \dim_eval:n { \textwidth - \l_@@_tmpa_dim } }
+ {
+ \clist_use:Nn #2 {#3} \par
+ \cs_gset:Npx \@@_keywords_prevdepth: { \dim_use:N \tex_prevdepth:D }
+ }
+ }{
+ \par \mode_leave_vertical: \par
+ \@@_get_text_width:Nn \l_@@_tmpa_dim {#1}
+ \group_begin: #1 \group_end:
+ \clist_use:Nn #2 {#3} \par
+ \cs_gset:Npx \@@_keywords_prevdepth: { \dim_use:N \tex_prevdepth:D }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{符号表}
+%
+% \begin{environment}{notation}
+% 符号表环境,利用 \env{longtable} 封装。可选参数为表格列格式说明符。
+% \begin{macrocode}
+\NewDocumentEnvironment { notation } { O { l p { 7.5 cm } } }
+ {
+ \@@_notation_begin:
+ \group_begin:
+ \@@_notation_long_table_setup:
+ \longtable {#1}
+ }
+ {
+ \endlongtable
+ \group_end:
+ }
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\@@_notation_begin:}
+% 符号表页标题。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_notation_begin:
+ {
+ \@@_chapter_no_toc:V \c_@@_name_notation_tl
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_notation_long_table_setup:}
+% 调整 \cs{LTpre} 和 \cs{LTpost},以删去 \env{longtable} 前后的空白。
+% 英文模板中还需要调整表格的行距。注意 \tn{arraystretch} 只是一个简单
+% 宏,不能使用 \cs{fp_set:Nn}。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_notation_long_table_setup:
+ {
+ \dim_set_eq:NN \LTpre \c_zero_dim
+ \dim_set_eq:NN \LTpost \c_zero_dim
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{致谢}
+%
+% \begin{environment}{acknowledgement}
+% 致谢环境,只是简单地设置章节不编号标题。
+% \begin{macrocode}
+\NewDocumentEnvironment { acknowledgement } { }
+ {
+ \group_begin:
+ \@@_chapter:V \c_@@_name_ack_tl
+ }
+ {
+ \group_end:
+ }
+% \end{macrocode}
+% \end{environment}
+%
+% \subsection{个人简历}
+%
+% \begin{environment}{resume}
+% 致谢环境,只是简单地设置章节不编号标题。
+% \begin{macrocode}
+\NewDocumentEnvironment { resume } { }
+ {
+ \group_begin:
+ \@@_chapter:V \c_@@_name_resume_tl
+ }
+ {
+ \group_end:
+ }
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\resumeitem,\researchitem}
+% 摘要页标题。
+% \begin{macrocode}
+\NewDocumentCommand{ \resumitem }{ O{ 学习经历 } }
+ {%
+ \vspace{24bp}{\zihao{-4}\nwafu@hei\bfseries\centerline{#1}}\par\vspace{6bp}
+ }
+\NewDocumentCommand{ \researchitem }{ O{ 发表的学术论文 } }
+ {%
+ \vspace{32bp}{\zihao{-4}\nwafu@hei\bfseries\centerline{#1}}\par\vspace{14bp}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{environment}{publications}
+% \begin{environment}{achievements}
+% 个人简历中发论文和研究成果列表环境。
+% \begin{macrocode}
+\newlist{publications}{enumerate}{1}
+\setlist[publications]{label=[\arabic*],align=left,nosep,itemsep=6bp,
+ leftmargin=10mm,before=\zihao{-4},resume}
+\newlist{achievements}{enumerate}{1}
+\setlist[achievements]{label=[\arabic*],align=left,nosep,itemsep=6bp,
+ leftmargin=10mm,before=\zihao{-4}}
+\def\publicationskip{\bigskip\bigskip}
+% \end{macrocode}
+% \end{environment}
+% \end{environment}
+%
+% \subsection{参考文献著录与引用}
+%
+% \begin{variable}{\l_@@_bib_resource_clist}
+% 保存参考文献数据库列表。
+% \begin{macrocode}
+\clist_new:N \l_@@_bib_resource_clist
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macrocode}
+\keys_define:nn { nwafu / style }
+ {
+% \end{macrocode}
+% \begin{macro}{style/bib-resource}
+% 参考文献数据源。
+% \begin{macrocode}
+ bib-resource .clist_set:N = \l_@@_bib_resource_clist
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% 为了保证导言区中的设置能起作用,\pkg{biblatex} 宏包均需要在
+% 导言区末尾载入(仍在 \pkg{hyperref} 之前),并做相关设置。
+% \begin{macrocode}
+% \AddToHook
+% { env/document/begin }
+\@@_at_end_preamble:n
+ {
+ \@@_biblatex_pre_setup:
+ \RequirePackage { biblatex }
+ \@@_biblatex_post_setup:
+ }
+% \end{macrocode}
+%
+% \begin{macro}{
+% \@@_biblatex_pre_setup:,
+% \@@_biblatex_post_setup:,
+% \@@_pass_options_to_biblatex:n}
+% \pkg{biblatex} 相关设置。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_biblatex_pre_setup:
+ {
+% \end{macrocode}
+% 参考文献引用与著录样式。
+% \begin{macrocode}
+ \@@_pass_options_to_biblatex:n { style = gb7714-2015ay }
+% \end{macrocode}
+% 其它参数。
+% \begin{macrocode}
+ \@@_pass_options_to_biblatex:n { backend = biber, sortlocale=zh__pinyin,
+ gbtype=false, maxbibnames=99, maxcitenames=2, mincitenames=1,
+ gbpub=false, uniquename=false, uniquelist=false, gbnamefmt=lowercase,
+ doi=false, isbn=false, gbfieldtype=true, gbpunctin=false,
+ }
+ }
+\cs_new_protected:Npn \@@_biblatex_post_setup:
+ {
+% \end{macrocode}
+% 载入参考文献数据源文件。
+% \begin{macrocode}
+ \@@_biblatex_misc:
+ \clist_map_function:NN \l_@@_bib_resource_clist \addbibresource
+ \@@_biblatex_allow_url_break:
+% \end{macrocode}
+% 修改参考文献标题。
+% \begin{macrocode}
+ \defbibheading { bibliography } [ \bibname ] { \@@_chapter:n {##1} }
+ }
+\cs_new_protected:Npn \@@_pass_options_to_biblatex:n #1
+ { \PassOptionsToPackage {#1} { biblatex } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_biblatex_misc:}
+% \pkg{biblatex} 中需要针对西北农林科技大学参考文献规范的特殊设置。
+% 由符合 GB/T 7714-2015 标准的 biblatex 参考文献样式
+% (\url{https://github.com/hushidong/biblatex-gb7714-2015})
+% 作者胡振震协助实现。
+% \begin{macrocode}
+\cs_new:Npn \@@_biblatex_misc:
+ {
+% \end{macrocode}
+% 表示范围的波浪线符号
+% \begin{macrocode}
+ \DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{$\sim$}}
+% \end{macrocode}
+% 设置全局字体字号(5号字,行间距为1.3)
+% \begin{macrocode}
+ \newcommand\nwafu@font@bib{\@@_line_spread:n {1.3}\zihao{5}}
+ \renewcommand{\bibfont}{\nwafu@font@bib}
+% \end{macrocode}
+% 英文期刊名称用斜休(Italic体)
+% \begin{macrocode}
+ \DeclareFieldFormat[article]{journaltitle}{\iffieldequalstr{userd}{chinese}{##1}{\textit{##1}}\isdot}
+% \end{macrocode}
+% \tn{parencite}命令引用标注后导分割符
+% \begin{macrocode}
+ \renewcommand{\postnotedelim}{\addcolon\space}
+% \end{macrocode}
+% 删除\tn{parencite}命令引用标注中有页码选项时的p. pp.字符
+% \begin{macrocode}
+ \DeclareFieldFormat{postnote}{##1}
+% \end{macrocode}
+% 引用标注作者年制中作者和年份之间的标点(人名与年之间用空格分隔)
+% \begin{macrocode}
+ \DeclareDelimFormat[cite,parencite,pagescite]{nameyeardelim}{\space}
+ \DeclareDelimFormat[textcite]{nameyeardelim}{\space}
+% \end{macrocode}
+% 文献著录列表中作者与年之间的分割符(最后一个作者后用点)
+% \begin{macrocode}
+ \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addperiod\space}
+% \end{macrocode}
+% 删除文献著录列表中最后的点
+% \begin{macrocode}
+ \renewcommand*{\finentrypunct}{}
+% \end{macrocode}
+% 修改部分中文化字符串
+% \begin{macrocode}
+ \DefineBibliographyStrings{english}{
+ andincitecn = {和},
+ andincite = {and},
+ mathesiscn={[硕士学位论文]},
+ phdthesiscn={[博士学位论文]},
+ in={In:\addspace},
+ incn={见:\addspace},
+ }
+% \end{macrocode}
+% 修改最后一个作者前的字符串,比如“and”、“和”。
+%
+% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。
+% 非默认情况,根据选项信息,选择选择强制中文或英文
+% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
+% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
+% \begin{macrocode}
+ \DeclareDelimFormat{finalnamedelim}{%
+ \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbcitelocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\addspace\bibstring{andincite}\addspace}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\addspace\bibstring{and}\addspace}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\addspace\bibstring{and}\addspace}{}%
+ \or%
+ \bibstring{andincitecn}%
+ \or%
+ \addspace\bibstring{andincite}\addspace%
+ \fi
+ }
+% \end{macrocode}
+% 20190215, 胡振震邮件指导代码
+% 去掉超过3个著者时汉字“等”前的空格(GB/T 7714-2015规定需要有空格)
+% \begin{macrocode}
+ \DeclareDelimFormat{strandothersdelim}{%
+ \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+ %\addspace%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbcitelocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andothersincitecn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andothersjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothersincite}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%
+ \or%
+ \bibstring{andothersincitecn}%
+ \or%
+ \bibstring{andothersincite}%
+ \fi
+ }
+% \end{macrocode}
+% 设置andothersdelim
+% \begin{macrocode}
+ \AtEveryCitekey{%
+ \iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{}}%\addthinspace
+ {\renewcommand*{\andothersdelim}{\addspace}}%
+ }
+% \end{macrocode}
+% 标注压缩时,直接用date+extradate代替extradate实现2006a,2006b的效果
+% \begin{macrocode}
+ \renewbibmacro*{cite:extradate}{%
+ \iffieldundef{extradate} {}
+ {\printtext[bibhyperref]{\printlabeldateextra}}%\printfield{extradate}
+ }
+% \end{macrocode}
+% 文献表中的日期格式
+% \begin{macrocode}
+ \renewbibmacro*{date+extradate}{%
+ \iffieldundef{labelyear}{}%
+ {\ifboolexpr{%
+ test {\ifentrytype{patent}}
+ or
+ (test {\ifentrytype{newspaper}} )%
+ }%
+ {\printtext{\blx@isodate{}{}}}%
+ {\printtext{%
+ \iflabeldateisdate
+ {\printdateextra}
+ {\printlabeldateextra}
+ }
+ }%
+ }%
+ }
+ \newbibmacro*{origdate+extradate}{%
+ \printtext{\printorigdate}%
+ }
+% \end{macrocode}
+% 修改译者位置格式
+% \begin{macrocode}
+ \renewbibmacro*{bytranslator+others}{%
+ \ifnameundef{translator}
+ {}
+ {\printnames[bytranslator]{translator}%
+ \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
+ \newunit
+ }%
+ \usebibmacro{withothers}%
+ \ifboolexpr{%
+ test {\iffieldundef{origyear}} or test {\ifnameundef{translator}}%%
+ }{}{\printtext{\printdate}}%
+ }
+% \end{macrocode}
+% url和url日期格式
+% \begin{macrocode}
+ \renewbibmacro*{url+urldate}{%
+ \usebibmacro{url}%
+ \iffieldundef{urlyear}%
+ {}
+ {\usebibmacro{urldate}
+ }
+ }
+ \DeclareFieldFormat{addnumflag}{%
+ \ifentrytype{newspaper}
+ {\setunit{\addcomma\addspace}\printtext{##1}}
+ {\nobreak\printtext{(}\nobreak ##1\nobreak\printtext{)}}
+ }
+% \end{macrocode}
+% 重设专利title的输出,输出文献类型标识符
+% \begin{macrocode}
+ \renewbibmacro*{patenttitle}{%原输出来自biblatex.def文件
+ \ifboolexpr{%
+ test{\iffieldundef{title}}%
+ and%
+ test{\iffieldundef{subtitle}}%
+ }%
+ {}%
+ {
+ \printtext[title]{\bibtitlefont%
+ \printfield[titlecase]{title}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}
+ {
+ \setunit{\subtitlepunct}%
+ \printfield[titlecase]{subtitle}}%
+ \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
+ {\setunit{\subtitlepunct}\printfield{titleaddon}}%
+ \setunit{\adddot\addspace}\printfield{number}%写专利号
+ \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
+ }%
+ }%
+ }
+% \end{macrocode}
+% 修改作者数量超过限定值,省略时的处理格式
+% 20190103,hzz,修改利用新定义的一个分隔符strandothersdelim
+%
+% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
+% \begin{macrocode}
+ \renewbibmacro*{name:andothers}{%
+ \ifboolexpr{
+ test {\ifnumequal{\value{listcount}}{\value{liststop}}}
+ and
+ test \ifmorenames
+ }{\ifnumgreater{\value{liststop}}{1}%
+ {\finalandcomma}%
+ {}%
+ \printdelim{andothersdelim}\printdelim{strandothersdelim}%
+ }{%当是译者的时候需要特殊处理
+ \ifcurrentname{translator}{\addcomma}{}%
+ }
+ }
+% \end{macrocode}
+% 修改对edition版本信息格式
+% \begin{macrocode}
+ \DeclareFieldFormat{edition}{%
+ \testCJKfirst{userd}%
+ \iftoggle{ifCJKforgbt}%
+ {\ifinteger{##1}%
+ {\printtext{\bibstring{serialcn}\zhnumber{##1}\str@edition}}%
+ {##1\isdot}
+ }%
+ {\ifinteger{##1}%
+ {\mkbibordedition{##1}~\bibstring{edition}}%
+ {##1\isdot}
+ }
+ }
+% \end{macrocode}
+% 注意这里当没有作者只有标题时在年份之前的标点是否需要
+% 标准并未涉及,所以未做处理。
+% \begin{macrocode}
+ \renewbibmacro*{author}{%
+ \ifboolexpr{
+ test \ifuseauthor
+ and
+ not test {\ifnameundef{author}}
+ }{\usebibmacro{bbx:dashcheck}
+ {\printnames{author}\setunit{\printdelim{nameyeardelim}}%把标点也带上
+ }{\usebibmacro{bbx:savehash}%
+ \printnames{author}%
+ \iffieldundef{authortype}
+ {\setunit{\printdelim{nameyeardelim}}}
+ {\setunit{\printdelim{authortypedelim}}}
+ }%
+ \iffieldundef{authortype}
+ {}
+ {\usebibmacro{authorstrg}%
+ \setunit{\printdelim{nameyeardelim}}
+ }
+ }%
+ {\global\undef\bbx@lasthash
+ \usebibmacro{labeltitle}%
+ \setunit*{\printdelim{nonameyeardelim}}
+ }%
+ \ifboolexpr{%
+ test {\iffieldundef{origyear}} or test {\ifnameundef{translator}}%
+ }{\usebibmacro{date+extradate}}%
+ {\usebibmacro{origdate+extradate}}%
+ }
+% \end{macrocode}
+% book条目类的驱动
+% \begin{macrocode}
+ \DeclareBibliographyDriver{book}{%源来自standard.bbx文件
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/editor+others/translator+others}%
+ \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{maintitle+title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock%
+ \usebibmacro{byauthor}%
+ \newunit\newblock%
+ }%
+ \newunit%
+ \printfield{edition}%
+ \newunit%
+ \usebibmacro{byeditor+others}%
+ \newunit\newblock%
+ \iftoggle{bbx:gbstrict}{}{%
+ \iffieldundef{maintitle}%
+ {%
+ \printfield{volume}%
+ \printfield{part}%
+ }%
+ {}%
+ \newunit%
+ \printfield{volumes}%
+ \newunit\newblock%
+ \usebibmacro{series+number}%
+ }%
+ \newunit\newblock%
+ \usebibmacro{publisher+location+date}%
+ \usebibmacro{chapter+pages}%
+ \iffieldundef{url}{}{%当没有网址时也不输出
+ \usebibmacro{modifydate}%带括号的修改或更新日期,
+ }%
+ \usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。
+ \newunit\newblock%
+ \printfield{pagetotal}%
+ \newunit\newblock%
+ \iftoggle{bbx:isbn}%
+ {\printfield{isbn}}
+ {}%
+ \newunit\newblock%
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock%
+ \iftoggle{bbx:related}%
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}%
+ }{}%
+ \usebibmacro{finentry}
+ }
+% \end{macrocode}
+% 在线文献驱动
+% \begin{macrocode}
+ \DeclareBibliographyDriver{online}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/editor+others/translator+others}%
+ \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%
+ \newunit\newblock
+ \printfield{note}
+ }%
+ \newunit
+ \printfield{version}%
+ \newunit\newblock
+ \printlist{institution}%
+ \newunit\newblock
+ \ifboolexpr{%
+ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+ }{\usebibmacro{date}}%
+ \usebibmacro{url+urldate}%从下面移上来
+ \newunit\newblock
+ \iftoggle{bbx:eprint}
+ {\usebibmacro{eprint}}
+ {}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}
+ }
+% \end{macrocode}
+% 专利文献驱动
+% \begin{macrocode}
+ \DeclareBibliographyDriver{patent}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+ \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{patenttitle}%给出专利专用的标题输出
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}
+ }%
+ \newunit\newblock
+ \printfield{type}%
+ \setunit*{\addspace}%
+ \iflistundef{location}
+ {}
+ {\setunit*{\addspace}%
+ \printtext{%[parens]
+ \printlist[][-\value{listtotal}]{location}}
+ }%
+ \newunit\newblock
+ \usebibmacro{byholder}%
+ \newunit\newblock
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}
+ }
+ {}%
+ \usebibmacro{finentry}
+ }
+% \end{macrocode}
+% 间距的控制
+% \begin{macrocode}
+ \setlength{\bibitemsep}{2pt}
+ \setlength{\bibnamesep}{0ex}
+ \setlength{\bibinitsep}{0ex}
+% \end{macrocode}
+% 文献著录条目缩进控制(悬挂缩进4英文字符)
+% \begin{macrocode}
+ \setlength{\bibitemindent}{-2\ccwd}% bibitemindent表示一条文献中第一行相对后面各行的缩进
+ \setlength{\bibhang}{2\ccwd} % 表示的各行起始位置到页边的距离
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_biblatex_allow_url_break:}
+% \pkg{biblatex} 下允许 URL 在字母、数字和一些特殊符号处断行。
+% \begin{macrocode}
+\cs_new:Npn \@@_biblatex_allow_url_break:
+ {
+ \int_set_eq:NN \c@biburlucpenalty \c_one_int
+ \int_set_eq:NN \c@biburlnumpenalty \c_one_int
+ \int_set_eq:NN \c@biburllcpenalty \c_one_int
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_set_cite_style_author_year:}
+% 著者—出版年制下的引用样式。
+% \begin{macrocode}
+\cs_new:Npn \@@_set_cite_style_author_year:
+ {
+ \NAT@numbersfalse
+%<*class>
+ \cs_set_eq:NN \NAT@open \c_@@_fwid_left_paren_tl
+ \cs_set_eq:NN \NAT@close \c_@@_fwid_right_paren_tl
+ \cs_set_eq:NN \NAT@sep \c_@@_fwid_semicolon_tl
+ \cs_set_eq:NN \NAT@aysep \c_@@_fwid_comma_tl
+ \cs_set_eq:NN \NAT@yrsep \c_@@_ideo_comma_tl
+%</class>
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{间距设置}
+%
+% 段落间距
+% \begin{macrocode}
+\skip_set:Nn \parskip { 0pt plus 2pt minus 1pt }
+% \end{macrocode}
+% 浮动体顶商与底端所留距离
+% \begin{macrocode}
+\skip_set:Nn \intextsep { 14pt plus 2pt minus 2pt }
+% \end{macrocode}
+% 最后一个浮动对象顶端或第一个浮动对象底端与正文之间的距离
+% \begin{macrocode}
+\skip_set:Nn \textfloatsep { 16pt plus 2pt minus 4pt }
+\allowdisplaybreaks[4]
+\ctex_after_end_preamble:n
+ {
+% \end{macrocode}
+% 公式前的距离
+% \begin{macrocode}
+ \skip_set:Nn \abovedisplayskip { 5pt plus 1pt minus 1pt }
+% \end{macrocode}
+% 公式后的距离
+% \begin{macrocode}
+ \skip_set:Nn \belowdisplayskip { 5pt plus 1pt minus 1pt }
+% \end{macrocode}
+% 公式前与文本的距离
+% \begin{macrocode}
+ \skip_set:Nn \abovedisplayshortskip { 0pt }
+% \end{macrocode}
+% 公式后与文本的距离
+% \begin{macrocode}
+ \skip_set:Nn \belowdisplayshortskip { 5pt plus 1pt minus 1pt }
+ }
+% \end{macrocode}
+%
+% \subsection{\env{enumerate}列表环境设置}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_enumitem_label_set:nn #1#2
+ { \SetEnumitemValue{label}{#1}{#2} }
+\clist_map_inline:nn
+ {
+ { bullet } { \textbullet },
+ { endash } { \normalfont\bfseries\textendash },
+ { asterisk } { \textasteriskcentered },
+ { arabic } { \bool_if:NTF \l_@@_withchap_bool
+ { \arabic*. }{ (\arabic*) } },
+ { alph } { \bool_if:NTF \l_@@_withchap_bool
+ { \alph*. }{ (\alph*) } },
+ { roman } { \bool_if:NTF \l_@@_withchap_bool
+ { \roman*. }{ (\roman*) } },
+ { alph } { (\alph*) },
+ { roman } { \roman*. },
+ { outline } { \upshape\ding{111} }
+ }
+ { \@@_enumitem_label_set:nn #1 }
+\SetEnumitemValue{font}{sf}{\normalfont\sffamily}
+\SetEnumitemValue{ref}{enumii}{\arabic{enumi}.\alph*}
+\SetEnumitemValue{ref}{enumiii}{\arabic{enumi}.\alph{enumii}.\roman*}
+\setlist
+ {
+ nosep,
+ leftmargin = *,
+ labelindent = \dimexpr\parindent+0pt\relax,
+ wide=\parindent,
+ }
+\setlist[itemize,1]{label = bullet}
+\setlist[itemize,2]{label = endash}
+\setlist[itemize,3]{label = asterisk}
+\setlist[enumerate,1]{label = arabic,ref = \arabic*}
+\setlist[enumerate,2]{label = alph,ref = enumii}
+\setlist[enumerate,3]{label = roman,ref = enumiii,labelwidth = *}
+\setlist[description]{font = sf,labelwidth = *,leftmargin = 2\ccwd}
+% \end{macrocode}
+%
+% \subsection{\pkg{hyperref} 相关配置}
+%
+% \emph{\pkg{hyperref}相关配置完成使用\cls{fduthesis}模板的代码}。
+%
+% \begin{macro}{\hypersetup,\nwafu_hyperref_setup:n}
+% \pkg{hyperref} 宏包是在导言区之后才引入的。若要在导言区中使用
+% \tn{hypersetup} 命令,必须另行定义。
+% \begin{macrocode}
+\NewDocumentCommand \hypersetup { m }
+ { \nwafu_hyperref_setup:n {#1} }
+\cs_new_protected:Npn \nwafu_hyperref_setup:n #1
+ { \clist_gput_right:Nn \g_@@_to_hyperref_clist {#1} }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_set_hyperlink_color_key:n}
+% 设置超链接颜色选项。最后的逗号用于确保 \pkg{l3keys} 可以正确解析,不能省去。
+% \begin{macrocode}
+\cs_new:Npn \@@_set_hyperlink_color_key:n #1
+ {
+ hyperlink-color / \clist_item:nn {#1} {1} .code:n =
+ {
+ \@@_define_hyperlink_color:nnn
+ { \clist_item:nn {#1} {2} }
+ { \clist_item:nn {#1} {3} }
+ { \clist_item:nn {#1} {4} }
+ \nwafu_hyperref_setup:n
+ {
+ linkcolor = nwafu@link, linkbordercolor = nwafu@link,
+ urlcolor = nwafu@url, urlbordercolor = nwafu@url,
+ citecolor = nwafu@cite, citebordercolor = nwafu@cite
+ }
+ },
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_define_hyperlink_color:nnn}
+% 定义超链接颜色。
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_define_hyperlink_color:nnn #1#2#3
+ {
+ \definecolorset { HTML } { nwafu@ } { }
+ { link, #1; url, #2; cite, #3 }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\keys_define:nx { nwafu / style }
+ {
+% \end{macrocode}
+%
+% \begin{macro}{style/hyperlink}
+% 超链接样式。
+% \begin{macrocode}
+ hyperlink .choice:,
+ hyperlink .value_required:n = true,
+ hyperlink / border .code:n = { },
+ hyperlink / color .code:n =
+ { \nwafu_hyperref_setup:n { colorlinks = true } },
+ hyperlink / none .code:n =
+ { \nwafu_hyperref_setup:n { hidelinks = true } },
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{style/hyperlink-color}
+% 超链接颜色。
+% \begin{macrocode}
+ hyperlink-color .choice:,
+ hyperlink-color .value_required:n = true,
+ \clist_map_function:nN
+ {
+ { autumn, D70000, D75F00, AF8700 },
+ { business, D14542, 295497, 1F6E43 },
+ { classic, FF0000, 0000FF, 00FF00 },
+ { default, 990000, 0000B2, 007F00 },
+ { elegant, 961212, C31818, 9B764F },
+ { fantasy, FF4A19, FF3F94, 934BA1 },
+ { material, E91E63, 009688, 4CAF50 },
+ { science, CA0619, 389F9D, FF8920 },
+ { summer, 00AFAF, 5F5FAF, 5F8700 },
+ { graylevel, 616161, 616161, 616161 },
+ { prl, 2D3092, 2D3092, 2D3092 }
+ }
+ \@@_set_hyperlink_color_key:n
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\nwafu_allow_url_break:,\@@_add_url_break_points:}
+% 允许 URL 在字母、数字和一些特殊符号处断行。见
+% \url{https://bit.ly/2hhIjLW}。
+% \begin{macrocode}
+\cs_new:Npn \nwafu_allow_url_break:
+ {
+ \cs_new:Npn \@@_add_url_break_points:
+ { \tl_map_function:NN \c_@@_url_break_points_tl \do }
+ \@@_appto_cmd:Nn \UrlBreaks
+ { \UrlOrds \@@_add_url_break_points: }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{variable}{\c_@@_url_break_points_tl}
+% 额外的断行位置是 26 个英文字母(大小写)以及 10 个阿拉伯数字。
+% \pkg{url} 提供的宏 \tn{UrlBreaks} 还包含了特殊符号 |*|、|-|、
+% |~|、|'|、|"|、|-|,也被设置为允许断行。
+% \begin{macrocode}
+\tl_const:Nn \c_@@_url_break_points_tl
+ {
+ abcdefghijklmnopqrstuvwxyz
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ
+ 0123456789
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% 在导言区末尾引入 \pkg{hyperref} 宏包。
+% \begin{macrocode}
+\ctex_at_end_preamble:n
+ {
+ \RequirePackage { hyperref }
+% \end{macrocode}
+% 此后 \tn{hypersetup} 命令由 \pkg{hyperref} 宏包接管。
+% \begin{macrocode}
+ \hypersetup
+ {
+ bookmarksnumbered = true,
+ psdextra = true,
+ unicode = true,
+% \end{macrocode}
+% 填写 PDF 元信息。
+% \begin{macrocode}
+%<*class>
+ pdftitle = \l_@@_info_title_tl,
+ pdfauthor = \l_@@_info_author_tl,
+ pdfkeywords = \l_@@_abstract_keywords_clist,
+%</class>
+% pdfsubject = ,
+ pdfcreator = \c_@@_name_pdf_creator_tl
+ }
+% \end{macrocode}
+% 将导言区中通过 \cs{nwafu_hyperref_setup:n} 进行的设置传入
+% \tn{hypersetup}。
+% \begin{macrocode}
+ \exp_args:NV \hypersetup \g_@@_to_hyperref_clist
+% \end{macrocode}
+% URL 断行处理。
+% \begin{macrocode}
+ \nwafu_allow_url_break:
+% \end{macrocode}
+% 手动开启 \pkg{biblatex} 的 \pkg{hyperref} 支持。
+% \begin{macrocode}
+ \BiblatexManualHyperrefOn
+ }
+% \end{macrocode}
+%
+% 在 PDF 字符串中设置 \tn{nwafu@kai} 命令为空,以抑制 \pkg{hyperref}
+% 的警告信息。
+% \begin{macrocode}
+\ctex_at_end_package:nn { hyperref }
+ {
+ \pdfstringdefDisableCommands
+ {
+ \cs_set_eq:NN \nwafu@kai \prg_do_nothing:
+ \cs_set_eq:NN \quad \c_space_tl
+ \cs_set_eq:NN \qquad \c_space_tl
+ }
+ }
+% \end{macrocode}
+%
+% 引用标题配置。
+% \begin{macrocode}
+\labelformat{part}{\CTEXthepart}
+\labelformat{chapter}{\CTEXthechapter}
+\labelformat{figure}{\figurename~#1}
+\labelformat{table}{\tablename~#1}
+\def\figureautorefname{图}
+\def\tableautorefname{表}
+\keys_set_known:nn { ctex }
+ {
+ figurename = 图,
+ tablename = 表,
+ }
+\labelformat{equation}{式(#1)}
+\labelformat{section}{节 #1}
+\labelformat{subsection}{小节 #1}
+% \end{macrocode}
+%
+% \subsection{用户接口}
+%
+% \begin{macro}{abstract,info,style}
+% 定义元(meta)键值对。
+% \begin{macrocode}
+\keys_define:nn { nwafu }
+ {
+ abstract .meta:nn = { nwafu / abstract } {#1},
+ info .meta:nn = { nwafu / info } {#1},
+ style .meta:nn = { nwafu / style } {#1}
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% 文档类初始设置。
+% \begin{macrocode}
+\keys_set:nn { nwafu }
+ {
+ style / font-size = -4,
+ style / fullwidth-stop = false,
+ style / auto-make-cover = true,
+ style / logo = { logo/nwafu-bar.pdf },
+ style / logo-size = { 0.65 \textwidth },
+ style / hyperlink = none,
+ style / hyperlink-color = default,
+ info / degree = academic,
+ info / secret-level = none,
+ info / school-id = { 10712 },
+ info / date = { \zhtoday },
+ theorem / header-font = { \sffamily },
+ theorem / body-font = { \nwafu@kai },
+ theorem / counter = { chapter }
+ }
+% \end{macrocode}
+%
+% \begin{macro}{\nwafuset}
+% 用户设置接口。
+% \begin{macrocode}
+\NewDocumentCommand \nwafuset { m }
+ { \keys_set:nn { nwafu } {#1} }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{environment}{proof}
+% \begin{environment}{axiom}
+% \begin{environment}{corollary}
+% \begin{environment}{definition}
+% \begin{environment}{example}
+% \begin{environment}{lemma}
+% \begin{environment}{theorem}
+% 模板预定义的常用数学环境。
+% 其中的“证明”比较特殊,它不编号,但会添加证毕符号。
+% \begin{macrocode}
+%<*class>
+\newtheorem* { proof } { \c_@@_name_proof_tl }
+\newtheorem { axiom } { \c_@@_name_axiom_tl }
+\newtheorem { corollary } { \c_@@_name_corollary_tl }
+\newtheorem { definition } { \c_@@_name_definition_tl }
+\newtheorem { example } { \c_@@_name_example_tl }
+\newtheorem { lemma } { \c_@@_name_lemma_tl }
+\newtheorem { theorem } { \c_@@_name_theorem_tl }
+%</class>
+%</class>
+% \end{macrocode}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+% \end{environment}
+%
+% \begin{macrocode}
+%<@@=>
+% \end{macrocode}
+%
+% \clearpage
+%
+% \end{implementation}
+%
diff --git a/macros/unicodetex/latex/nwafuthesis/nwafuthesis.pdf b/macros/unicodetex/latex/nwafuthesis/nwafuthesis.pdf
new file mode 100644
index 0000000000..625302daac
--- /dev/null
+++ b/macros/unicodetex/latex/nwafuthesis/nwafuthesis.pdf
Binary files differ