From fb07ccd098248248795fb851a3a6479ecafaaa47 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 18 Sep 2021 03:00:49 +0000 Subject: CTAN sync 202109180300 --- macros/latex/contrib/zref-check/CHANGELOG.md | 15 +- .../latex/contrib/zref-check/zref-check-code.pdf | Bin 710511 -> 739197 bytes macros/latex/contrib/zref-check/zref-check.dtx | 500 +++-- macros/latex/contrib/zref-check/zref-check.pdf | Bin 455030 -> 457730 bytes macros/unicodetex/latex/njuthesis/README.md | 9 +- macros/unicodetex/latex/njuthesis/README_ZH_CN.md | 77 + .../latex/njuthesis/figure/njuname-large.jpg | Bin 817068 -> 0 bytes .../latex/njuthesis/figure/njuname-large.pdf | Bin 0 -> 84739 bytes macros/unicodetex/latex/njuthesis/njuthesis.cls | 96 - macros/unicodetex/latex/njuthesis/njuthesis.dtx | 2266 ++++++++++++++++++++ macros/unicodetex/latex/njuthesis/njuthesis.pdf | Bin 1468177 -> 638180 bytes .../latex/njuthesis/profile/abstract.sty | 136 -- .../latex/njuthesis/profile/components.sty | 173 -- .../unicodetex/latex/njuthesis/profile/cover.sty | 251 --- macros/unicodetex/latex/njuthesis/profile/font.sty | 219 -- .../latex/njuthesis/profile/packages.sty | 71 - macros/unicodetex/latex/njuthesis/profile/page.sty | 54 - .../latex/njuthesis/profile/reference.sty | 68 - 18 files changed, 2643 insertions(+), 1292 deletions(-) create mode 100644 macros/unicodetex/latex/njuthesis/README_ZH_CN.md delete mode 100644 macros/unicodetex/latex/njuthesis/figure/njuname-large.jpg create mode 100644 macros/unicodetex/latex/njuthesis/figure/njuname-large.pdf delete mode 100644 macros/unicodetex/latex/njuthesis/njuthesis.cls create mode 100644 macros/unicodetex/latex/njuthesis/njuthesis.dtx delete mode 100644 macros/unicodetex/latex/njuthesis/profile/abstract.sty delete mode 100644 macros/unicodetex/latex/njuthesis/profile/components.sty delete mode 100644 macros/unicodetex/latex/njuthesis/profile/cover.sty delete mode 100644 macros/unicodetex/latex/njuthesis/profile/font.sty delete mode 100644 macros/unicodetex/latex/njuthesis/profile/packages.sty delete mode 100644 macros/unicodetex/latex/njuthesis/profile/page.sty delete mode 100644 macros/unicodetex/latex/njuthesis/profile/reference.sty (limited to 'macros') diff --git a/macros/latex/contrib/zref-check/CHANGELOG.md b/macros/latex/contrib/zref-check/CHANGELOG.md index 130aaf8ad7..7ce9594a63 100644 --- a/macros/latex/contrib/zref-check/CHANGELOG.md +++ b/macros/latex/contrib/zref-check/CHANGELOG.md @@ -1,6 +1,19 @@ # Changelog -## [Unreleased](https://github.com/gusbrs/zref-check/compare/v0.2.0...HEAD) +## [Unreleased](https://github.com/gusbrs/zref-check/compare/v0.2.1...HEAD) + +## [v0.2.1](https://github.com/gusbrs/zref-check/compare/v0.2.0...v0.2.1) (2021-09-16) + +### Changed +- Use `\msg_line_context:` instead of `\msg_line_number:` for messages. +- Use more efficient way to set checks as option keys in `\zcheck`. +- Spare setting end label in `\zcheck` for checks which don't need it. +- Separate `zref` property lists for checks and targets, so that only the + minimum set of required properties for each are used. + +### Added +- New `pagegap` check. +- Provide infrastructure for integration with `zref-clever`. ## [v0.2.0](https://github.com/gusbrs/zref-check/compare/v0.1.0...v0.2.0) (2021-08-17) diff --git a/macros/latex/contrib/zref-check/zref-check-code.pdf b/macros/latex/contrib/zref-check/zref-check-code.pdf index b412a1c5be..f2af1c0794 100644 Binary files a/macros/latex/contrib/zref-check/zref-check-code.pdf and b/macros/latex/contrib/zref-check/zref-check-code.pdf differ diff --git a/macros/latex/contrib/zref-check/zref-check.dtx b/macros/latex/contrib/zref-check/zref-check.dtx index 29c48befbd..584cf1b316 100644 --- a/macros/latex/contrib/zref-check/zref-check.dtx +++ b/macros/latex/contrib/zref-check/zref-check.dtx @@ -231,6 +231,10 @@ % \item[nextpage] \meta{label} occurs on the next page relative to % \cs{zcheck}. % +% \item[pagegap] There is a page gap between \meta{label} and \cs{zcheck}, in +% other words, \meta{label} does \emph{not} occur on \opt{thispage}, +% \opt{prevpage} or \opt{nextpage}. +% % \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. @@ -512,6 +516,16 @@ % may be needed for these checks to work as expected. % % +% +% \section{Change history} +% +% A change log with relevant changes for each version, eventual upgrade +% instructions, and upcoming changes, is maintained in the package's +% repository, at +% \url{https://github.com/gusbrs/zref-check/blob/main/CHANGELOG.md}. +% +% +% % \end{documentation} % % @@ -549,7 +563,7 @@ % % Identify the package. % \begin{macrocode} -\ProvidesExplPackage {zref-check} {2021-08-17} {0.2.0} +\ProvidesExplPackage {zref-check} {2021-09-16} {0.2.1} {Flexible cross-references with contextual checks based on zref} % \end{macrocode} % @@ -600,14 +614,29 @@ % \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. +% These are the lists 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 } +\zref@newlist { zrefcheck-check } +\zref@addprops { zrefcheck-check } + { + page , % for messages + abspage , + zc@abschap , + zc@abssec + } +\zref@newlist { zrefcheck-target } +\zref@addprops { zrefcheck-target } + { + page , % so that \zpageref can refer to it + abspage , + zc@abschap , + zc@abssec + } +\zref@newlist { zrefcheck-end } +\zref@addprops { zrefcheck-end } { - page , abspage , zc@abschap , zc@abssec @@ -621,7 +650,7 @@ % % \begin{macro}{\@@_message:nnnn, \@@_message:nnnx} % \begin{macrocode} -\cs_new:Npn \@@_message:nnnn #1#2#3#4 +\cs_new_protected:Npn \@@_message:nnnn #1#2#3#4 { \use:c { msg_ \l_@@_msglevel_tl :nnnnn } { zref-check } {#1} {#2} {#3} {#4} @@ -632,29 +661,20 @@ % % \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:. - } + { Failed~check~'#1'~for~label~'#2'~on~page~#3~\msg_line_context:. } \msg_new:nnn { zref-check } { double-check } - { - Double-check~'#1'~for~label~'#2' \iow_newline: - on~page~#3~on~input~line~\msg_line_number:. - } + { Double-check~'#1'~for~label~'#2'~on~page~#3~\msg_line_context:. } % \end{macrocode} % % \begin{macrocode} \msg_new:nnn { zref-check } { check-missing } - { Check~'#1'~not~defined~on~input~line~\msg_line_number:. } + { Check~'#1'~not~defined~\msg_line_context:. } \msg_new:nnn { zref-check } { property-undefined } - { Property~'#1'~not~defined~on~input~line~\msg_line_number:. } + { Property~'#1'~not~defined~\msg_line_context:. } \msg_new:nnn { zref-check } { property-not-in-label } - { Label~'#1'~has~no~property~'#2'~on~input~line~\msg_line_number:. } + { Label~'#1'~has~no~property~'#2'~\msg_line_context:. } \msg_new:nnn { zref-check } { property-not-integer } - { - Property~'#1'~for~label~'#2'~not~an~integer \iow_newline: - on~input~line~\msg_line_number:. - } + { Property~'#1'~for~label~'#2'~not~an~integer~\msg_line_context:. } % \end{macrocode} % % \begin{macrocode} @@ -671,14 +691,11 @@ 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:. - } + { Option~'#1'~only~available~in~the~preamble~\msg_line_context:. } \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. + Option~'closerange'~not~a~positive~integer~\msg_line_context:.~ + Using~default~value. } \msg_new:nnn { zref-check } { labelcmd-undefined } { @@ -781,7 +798,7 @@ \bool_if:NT \l_@@_use_hyperref_bool { \RequirePackage { zref-hyperref } - \zref@addprop { zrefcheck } { anchor } + \zref@addprop { zrefcheck-target } { anchor } } } { @@ -930,8 +947,8 @@ % 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 } } +\cs_new_protected:Npn \@@_target_label:n #1 + { \zref@labelbylist {#1} { zrefcheck-target } } % \end{macrocode} % \end{macro} % @@ -944,7 +961,7 @@ { \tl_clear:N \l_@@_target_label_tl } \cs_if_exist:cTF { \l_@@_target_label_tl } { - \cs_set:Npx \@@_target_label:n #1 + \cs_set_protected:Npx \@@_target_label:n #1 { \exp_not:o { \cs:w \l_@@_target_label_tl \cs_end: } @@ -952,7 +969,7 @@ } } { - \exp_args:NnnV \msg_warning:nnn { zref-check } + \exp_args:Nnno \msg_warning:nnn { zref-check } { labelcmd-undefined } { \l_@@_target_label_tl } } } @@ -1214,9 +1231,11 @@ % 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. +% expandable) at the place of use, and also make these functions `protected' +% (see egreg's \url{https://tex.stackexchange.com/a/572903}: ``a function +% that performs assignments should be \texttt{protected}''). 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 @@ -1226,7 +1245,7 @@ % \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 +\cs_new_protected:Npn \zrefcheck_get_astl:nnn #1#2#3 { \tl_clear:N #3 \tl_if_eq:nnTF {#2} { lblseq } @@ -1308,7 +1327,7 @@ % \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 +\cs_new_protected:Npn \zrefcheck_get_asint:nnn #1#2#3 { \zrefcheck_get_astl:nnn {#1} {#2} { \l_@@_propval_tl } \@@_is_integer:nTF { \l_@@_propval_tl } @@ -1357,8 +1376,7 @@ % \end{syntax} % % \begin{macrocode} -\NewDocumentCommand \zcheck - { s O { } > { \SplitList { , } } m m } +\NewDocumentCommand \zcheck { s O { } m m } { \zref@wrapper@babel \@@_zcheck:nnnn {#3} {#1} {#2} {#4} } % \end{macrocode} % \end{macro} @@ -1366,17 +1384,17 @@ % % \begin{variable} % { +% \l_@@_zcheck_labels_seq , % \g_@@_id_int , % \l_@@_checkbeg_tl , -% \l_@@_checkend_tl , % \l_@@_link_label_tl , % \l_@@_link_anchor_tl , % \l_@@_link_star_bool % } % \begin{macrocode} +\seq_new:N \l_@@_zcheck_labels_seq \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_bool @@ -1395,36 +1413,31 @@ % \end{syntax} % % \begin{macrocode} -\cs_new:Npn \@@_zcheck:nnnn #1#2#3#4 +\cs_new_protected:Npn \@@_zcheck:nnnn #1#2#3#4 { \group_begin: % \end{macrocode} -% Set checks keys. -% \begin{macrocode} - \@@_set_checks_keys: -% \end{macrocode} % Process local options and checks. % \begin{macrocode} - \keys_set:nn { zref-check } {#3} + \keys_set:nn { zref-check / zcheck } {#3} + \seq_set_from_clist:Nn \l_@@_zcheck_labels_seq {#1} % \end{macrocode} -% Names of the labels for this zrefcheck call. +% Names of the labels for this zcheck 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 } + \zref@labelbylist { \l_@@_checkbeg_tl } { zrefcheck-check } % \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} } + \seq_get:NN \l_@@_zcheck_labels_seq \l_@@_link_label_tl \bool_set:Nn \l_@@_link_star_bool {#2} \zref@ifrefundefined { \l_@@_link_label_tl } % \end{macrocode} @@ -1448,16 +1461,21 @@ % \end{macrocode} % Set checkend label. % \begin{macrocode} - \zref@labelbylist { \l_@@_checkend_tl } { zrefcheck } + \bool_if:NT \l_@@_zcheck_end_label_bool + { + \zref@labelbylist + { \@@_end_lblfmt:n { \l_@@_checkbeg_tl } } + { zrefcheck-end } + } % \end{macrocode} % Check if \meta{labels} are defined. % \begin{macrocode} - \tl_map_function:nN {#1} \zref@refused + \seq_map_function:NN \l_@@_zcheck_labels_seq \zref@refused % \end{macrocode} % Run the checks. % \begin{macrocode} - \@@_run_checks:nnv - { \l_@@_zcheck_checks_seq } {#1} { l_@@_checkbeg_tl } + \@@_run_checks:nnx { \l_@@_zcheck_checks_seq } + { \l_@@_zcheck_labels_seq } { \l_@@_checkbeg_tl } \group_end: } % \end{macrocode} @@ -1483,7 +1501,7 @@ \zref@wrapper@babel \@@_target_label:n {#1} #2 \zref@wrapper@babel - \zref@labelbylist { \@@_end_lblfmt:n {#1} } { zrefcheck } + \zref@labelbylist { \@@_end_lblfmt:n {#1} } { zrefcheck-end } \group_end: } % \end{macrocode} @@ -1503,7 +1521,7 @@ } { \zref@wrapper@babel - \zref@labelbylist { \@@_end_lblfmt:n {#1} } { zrefcheck } + \zref@labelbylist { \@@_end_lblfmt:n {#1} } { zrefcheck-end } } % \end{macrocode} % \end{macro} @@ -1516,7 +1534,7 @@ % % First, a conditional function defined with: % -% \cs{prg_new_conditional:Npnn} \cs{@@_check_\meta{check}:nn} |#1#2 { F }| +% \cs{prg_new_protected_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 @@ -1545,145 +1563,122 @@ % \cs{zref@addprop} and friends, as usual. % % Third, the check must be registered as a key which gets setup in -% \cs{zcheck} by \cs{@@_set_checks_keys:}. +% \cs{zcheck} by the \texttt{ zref-check / zcheck } key set. +% +% Fourth, if the check requires only a single label to work, it should be +% registered in \cs{c_@@_single_label_checks_seq}. +% +% +% \subsection{Single label checks} +% +% +% Some checks do not require an ``end label'' in \cs{zcheck}, notably the +% sectioning ones, which don't rely on page boundaries. Hence, in case +% \cs{zcheck} only calls checks in this set, we can spare the setting of the +% end label. +% +% \begin{variable}{\c_@@_single_label_checks_seq} +% \begin{macrocode} +\seq_new:N \c_@@_single_label_checks_seq +\seq_set_from_clist:Nn \c_@@_single_label_checks_seq + { + thischap , + prevchap , + nextchap , + chapsbefore , + chapsafter , + thissec , + prevsec , + nextsec , + secsbefore , + secsafter , + } +% \end{macrocode} +% \end{variable} +% % % % \subsection{Setup} % -% \begin{variable}{\l_@@_zcheck_checks_seq} +% \begin{variable}{\l_@@_zcheck_checks_seq,\l_@@_end_label_required_bool} % \begin{macrocode} \seq_new:N \l_@@_zcheck_checks_seq +\bool_new:N \l_@@_zcheck_end_label_bool % \end{macrocode} % \end{variable} % -% \begin{macro}{\@@_set_checks_keys:} +% +% First, we inherit all the main options into the keys of \texttt{zref-check / +% zcheck}. % \begin{macrocode} -\cs_new:Npn \@@_set_checks_keys: +\keys_define:nn { } { zref-check / zcheck .inherit:n = zref-check } +% \end{macrocode} +% +% Then we add the checks to it. +% \begin{macrocode} +\clist_map_inline:nn + { + thispage , + prevpage , + nextpage , + facing , + pagegap , + above , + below , + pagesbefore , + ppbefore , + pagesafter , + ppafter , + before , + after , + thischap , + prevchap , + nextchap , + chapsbefore , + chapsafter , + thissec , + prevsec , + nextsec , + secsbefore , + secsafter , + close , + far , + } { - \keys_define:nn { zref-check } + \keys_define:nn { zref-check / zcheck } { - thispage .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { thispage } } , - thispage .value_forbidden:n = true , - - prevpage .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { prevpage } } , - prevpage .value_forbidden:n = true , - - nextpage .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { nextpage } } , - nextpage .value_forbidden:n = true , - - facing .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { facing } } , - facing .value_forbidden:n = true , - - above .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { above } } , - above .value_forbidden:n = true , - - below .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { below } } , - below .value_forbidden:n = true , - - pagesbefore .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { pagesbefore } } , - pagesbefore .value_forbidden:n = true , - - ppbefore .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { ppbefore } } , - ppbefore .value_forbidden:n = true , - - pagesafter .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { pagesafter } } , - pagesafter .value_forbidden:n = true , - - ppafter .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { ppafter } } , - ppafter .value_forbidden:n = true , - - before .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { before } } , - before .value_forbidden:n = true , - - after .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { after } } , - after .value_forbidden:n = true , - - thischap .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { thischap } } , - thischap .value_forbidden:n = true , - - prevchap .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { prevchap } } , - prevchap .value_forbidden:n = true , - - nextchap .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { nextchap } } , - nextchap .value_forbidden:n = true , - - chapsbefore .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { chapsbefore } } , - chapsbefore .value_forbidden:n = true , - - chapsafter .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { chapsafter } } , - chapsafter .value_forbidden:n = true , - - thissec .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { thissec } } , - thissec .value_forbidden:n = true , - - prevsec .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { prevsec } } , - prevsec .value_forbidden:n = true , - - nextsec .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { nextsec } } , - nextsec .value_forbidden:n = true , - - secsbefore .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { secsbefore } } , - secsbefore .value_forbidden:n = true , - - secsafter .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { secsafter } } , - secsafter .value_forbidden:n = true , - - close .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { close } } , - close .value_forbidden:n = true , - - far .code:n = - { \seq_put_right:Nn \l_@@_zcheck_checks_seq { far } } , - far .value_forbidden:n = true , - } + #1 .code:n = + { + \seq_put_right:Nn \l_@@_zcheck_checks_seq {#1} + \seq_if_in:NnF \c_@@_single_label_checks_seq {#1} + { \bool_set_true:N \l_@@_zcheck_end_label_bool } + } , + #1 .value_forbidden:n = true , + } } % \end{macrocode} -% \end{macro} -% % % % % \subsection{Running} % -% \begin{macro}{\@@_run_checks:nnn, \@@_run_checks:nnv} +% \begin{macro}{\@@_run_checks:nnn} % \begin{syntax} % \cs{@@_run_checks:nnn} \Arg{checks} \Arg{labels} \Arg{reference} % \end{syntax} % \meta{checks} are expected to be received as a sequence variable. % \begin{macrocode} -\cs_new:Npn \@@_run_checks:nnn #1#2#3 +\cs_new_protected:Npn \@@_run_checks:nnn #1#2#3 { \group_begin: - \tl_map_inline:nn {#2} + \seq_map_inline:Nn #2 { \seq_map_inline:Nn #1 { \@@_do_check:nnn {####1} {##1} {#3} } } \group_end: } -\cs_generate_variant:Nn \@@_run_checks:nnn { nnv } +\cs_generate_variant:Nn \@@_run_checks:nnn { nnx } % \end{macrocode} % \end{macro} % @@ -1714,7 +1709,7 @@ % \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 +\cs_new_protected:Npn \@@_do_check:nnn #1#2#3 { \group_begin: % \end{macrocode} @@ -1732,37 +1727,45 @@ \bool_set_false:N \l_@@_onpage_bool \cs_if_exist:cTF { @@_check_ #1 :nnF } { -% \end{macrocode} -% ``label beg'' vs ``reference beg''. -% \begin{macrocode} + % ``label beg'' vs ``reference beg''. \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} } - {} + % ``reference end'' \emph{may} exist or not depending on the + % checks. + \zref@ifrefundefined { \@@_end_lblfmt:n {#3} } { -% \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} } + % ``label end'' \emph{may} have been created by the + % target commands. + \zref@ifrefundefined { \@@_end_lblfmt:n {#2} } + {} + { + % ``label end'' vs ``reference beg''. + \exp_args:Nno \use:c { @@_check_ #1 :nnF } + { \@@_end_lblfmt:n {#2} } {#3} + { \bool_set_false:N \l_@@_passedcheck_bool } + } + } + { + % ``label beg'' vs ``reference end''. + \exp_args:Nnno \use:c { @@_check_ #1 :nnF } + {#2} { \@@_end_lblfmt:n {#3} } { \bool_set_false:N \l_@@_passedcheck_bool } + % ``label end'' \emph{may} have been created by the + % target commands. + \zref@ifrefundefined { \@@_end_lblfmt:n {#2} } + {} + { + % ``label end'' vs ``reference beg''. + \exp_args:Nno \use:c { @@_check_ #1 :nnF } + { \@@_end_lblfmt:n {#2} } {#3} + { \bool_set_false:N \l_@@_passedcheck_bool } + % ``label end'' vs ``reference end''. + \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 @@ -1839,7 +1842,7 @@ % % \begin{macro}{\@@_check_thispage:nn} % \begin{macrocode} -\prg_new_conditional:Npnn \@@_check_thispage:nn #1#2 { T , F , TF } +\prg_new_protected_conditional:Npnn \@@_check_thispage:nn #1#2 { T , F , TF } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -1871,7 +1874,7 @@ % % \begin{macro}{\@@_check_above:nn, \@@_check_below:nn} % \begin{macrocode} -\prg_new_conditional:Npnn \@@_check_above:nn #1#2 { F , TF } +\prg_new_protected_conditional:Npnn \@@_check_above:nn #1#2 { F , TF } { \group_begin: \@@_check_thispage:nnTF {#1} {#2} @@ -1893,7 +1896,7 @@ { \group_insert_after:N \prg_return_false: } \group_end: } -\prg_new_conditional:Npnn \@@_check_below:nn #1#2 { F , TF } +\prg_new_protected_conditional:Npnn \@@_check_below:nn #1#2 { F , TF } { \@@_check_thispage:nnTF {#1} {#2} { @@ -1911,7 +1914,7 @@ % % \begin{macro}{\@@_check_before:nn, \@@_check_after:nn} % \begin{macrocode} -\prg_new_conditional:Npnn \@@_check_before:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_before:nn #1#2 { F } { \@@_check_pagesbefore:nnTF {#1} {#2} { \prg_return_true: } @@ -1921,7 +1924,7 @@ { \prg_return_false: } } } -\prg_new_conditional:Npnn \@@_check_after:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_after:nn #1#2 { F } { \@@_check_pagesafter:nnTF {#1} {#2} { \prg_return_true: } @@ -1945,10 +1948,11 @@ % \@@_check_ppbefore:nn , % \@@_check_pagesafter:nn , % \@@_check_ppafter:nn , +% \@@_check_pagegap:nn , % \@@_check_facing:nn % } % \begin{macrocode} -\prg_new_conditional:Npnn \@@_check_nextpage:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_nextpage:nn #1#2 { F } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -1966,7 +1970,7 @@ { \group_insert_after:N \prg_return_false: } \group_end: } -\prg_new_conditional:Npnn \@@_check_prevpage:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_prevpage:nn #1#2 { F } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -1984,7 +1988,7 @@ { \group_insert_after:N \prg_return_false: } \group_end: } -\prg_new_conditional:Npnn \@@_check_pagesbefore:nn #1#2 { F , TF } +\prg_new_protected_conditional:Npnn \@@_check_pagesbefore:nn #1#2 { F , TF } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2003,7 +2007,7 @@ \group_end: } \cs_new_eq:NN \@@_check_ppbefore:nnF \@@_check_pagesbefore:nnF -\prg_new_conditional:Npnn \@@_check_pagesafter:nn #1#2 { F , TF } +\prg_new_protected_conditional:Npnn \@@_check_pagesafter:nn #1#2 { F , TF } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2022,7 +2026,25 @@ \group_end: } \cs_new_eq:NN \@@_check_ppafter:nnF \@@_check_pagesafter:nnF -\prg_new_conditional:Npnn \@@_check_facing:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_pagegap: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 + { \int_abs:n { \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_protected_conditional:Npnn \@@_check_facing:nn #1#2 { F } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2065,7 +2087,7 @@ % % \begin{macro}{\@@_check_close:nn, \@@_check_far:nn} % \begin{macrocode} -\prg_new_conditional:Npnn \@@_check_close:nn #1#2 { F , TF } +\prg_new_protected_conditional:Npnn \@@_check_close:nn #1#2 { F , TF } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2085,7 +2107,7 @@ { \group_insert_after:N \prg_return_false: } \group_end: } -\prg_new_conditional:Npnn \@@_check_far:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_far:nn #1#2 { F } { \@@_check_close:nnTF {#1} {#2} { \prg_return_false: } @@ -2106,7 +2128,7 @@ % \@@_check_chapsbefore:nn % } % \begin{macrocode} -\prg_new_conditional:Npnn \@@_check_thischap:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_thischap:nn #1#2 { F } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2132,7 +2154,7 @@ { \group_insert_after:N \prg_return_false: } \group_end: } -\prg_new_conditional:Npnn \@@_check_nextchap:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_nextchap:nn #1#2 { F } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2149,7 +2171,7 @@ { \group_insert_after:N \prg_return_false: } \group_end: } -\prg_new_conditional:Npnn \@@_check_prevchap:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_prevchap:nn #1#2 { F } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2167,7 +2189,7 @@ { \group_insert_after:N \prg_return_false: } \group_end: } -\prg_new_conditional:Npnn \@@_check_chapsafter:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_chapsafter:nn #1#2 { F } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2184,7 +2206,7 @@ { \group_insert_after:N \prg_return_false: } \group_end: } -\prg_new_conditional:Npnn \@@_check_chapsbefore:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_chapsbefore:nn #1#2 { F } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2217,7 +2239,7 @@ % \@@_check_secsbefore:nn % } % \begin{macrocode} -\prg_new_conditional:Npnn \@@_check_thissec:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_thissec:nn #1#2 { F } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2247,7 +2269,7 @@ { \group_insert_after:N \prg_return_false: } \group_end: } -\prg_new_conditional:Npnn \@@_check_nextsec:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_nextsec:nn #1#2 { F } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2268,7 +2290,7 @@ { \group_insert_after:N \prg_return_false: } \group_end: } -\prg_new_conditional:Npnn \@@_check_prevsec:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_prevsec:nn #1#2 { F } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2290,7 +2312,7 @@ { \group_insert_after:N \prg_return_false: } \group_end: } -\prg_new_conditional:Npnn \@@_check_secsafter:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_secsafter:nn #1#2 { F } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2311,7 +2333,7 @@ { \group_insert_after:N \prg_return_false: } \group_end: } -\prg_new_conditional:Npnn \@@_check_secsbefore:nn #1#2 { F } +\prg_new_protected_conditional:Npnn \@@_check_secsbefore:nn #1#2 { F } { \group_begin: \bool_set_true:N \l_@@_integer_bool @@ -2337,6 +2359,50 @@ % \end{macro} % % +% +% \section{\pkg{zref-clever} integration} +% +% +% There are four tasks \pkg{zref-clever} needs to do, in order to offer +% integration with \pkg{zref-check} from the options of \cs{zcref}: i) set the +% ``beg label''; ii) set the checks options; iii) run the checks; iv) +% (possibly) set the ``end label''. Since `ii)' can be done directly by +% running |\keys_set:nn { zref-check / zcheck }| on the options received, we +% provide convenience functions for the other three tasks. +% +% +% \begin{macro} +% { +% \zrefcheck_zcref_beg_label: , +% \zrefcheck_zcref_end_label_maybe: , +% \zrefcheck_zcref_run_checks_on_labels:n +% } +% \begin{macrocode} +\cs_new_protected:Npn \zrefcheck_zcref_beg_label: + { + \int_gincr:N \g_@@_id_int + \tl_set:Nx \l_@@_checkbeg_tl + { \@@_check_lblfmt:n { \g_@@_id_int } } + \zref@labelbylist { \l_@@_checkbeg_tl } { zrefcheck-check } + } +\cs_new_protected:Npn \zrefcheck_zcref_end_label_maybe: + { + \bool_if:NT \l_@@_zcheck_end_label_bool + { + \zref@labelbylist + { \@@_end_lblfmt:n { \l_@@_checkbeg_tl } } + { zrefcheck-end } + } + } +\cs_new_protected:Npn \zrefcheck_zcref_run_checks_on_labels:n #1 + { + \@@_run_checks:nnx + { \l_@@_zcheck_checks_seq } {#1} { \l_@@_checkbeg_tl } + } +% \end{macrocode} +% \end{macro} +% +% % \begin{macrocode} % % \end{macrocode} diff --git a/macros/latex/contrib/zref-check/zref-check.pdf b/macros/latex/contrib/zref-check/zref-check.pdf index f7b1110802..2197eda816 100644 Binary files a/macros/latex/contrib/zref-check/zref-check.pdf and b/macros/latex/contrib/zref-check/zref-check.pdf differ diff --git a/macros/unicodetex/latex/njuthesis/README.md b/macros/unicodetex/latex/njuthesis/README.md index d7c4cb33aa..e8e9c42190 100644 --- a/macros/unicodetex/latex/njuthesis/README.md +++ b/macros/unicodetex/latex/njuthesis/README.md @@ -1,11 +1,8 @@ -# NJU Thesis - -[![njuthesis](https://img.shields.io/badge/njuthesis-latex-blue)](https://git.nju.edu.cn/nju-lug/nju-latex-templates) -[![overleaf](https://img.shields.io/badge/overleaf-supported-brightgreen)](https://tex.nju.edu.cn) +# The njuthesis class ## Overview -This is A LaTex Template for Nanjing University Bachelor Thesis. The Template needs `xelatex` or `lualatex`. +This package is intended for typesetting Nanjing University thesis with LaTeX, providing support for bachelor, master, and doctoral thesis. Compilation of this class requires either `xelatex` or `lualatex` engine. ## License @@ -18,7 +15,7 @@ This is A LaTex Template for Nanjing University Bachelor Thesis. The Template ne ## Contributing -If you find a problem with the template, please submit an issue or PR in Github +If you run into any problem with the template, please contact us via Github issue or submit Pull Request. ## Wiki diff --git a/macros/unicodetex/latex/njuthesis/README_ZH_CN.md b/macros/unicodetex/latex/njuthesis/README_ZH_CN.md new file mode 100644 index 0000000000..a3e0d04645 --- /dev/null +++ b/macros/unicodetex/latex/njuthesis/README_ZH_CN.md @@ -0,0 +1,77 @@ +# NJU Thesis + +[![njuthesis](https://img.shields.io/badge/njuthesis-latex-blue)](https://git.nju.edu.cn/nju-lug/nju-latex-templates) +[![overleaf](https://img.shields.io/badge/overleaf-supported-brightgreen)](https://tex.nju.edu.cn) +![build status](https://github.com/nju-lug/NJUThesis/actions/workflows/build.yml/badge.svg) + +> 此项目是基于[NJU thesis 2021](https://github.com/FengChendian/NJUThesis2021)的重构版本,目前本科生版本**已经基本重构完成**,硕博论文**正在**根据研究生院的文件重构,但研究生院的规定并不完善,因此部分格式可能会参考本科的,**如果院系另有要求,请自行修改或者提交issue**。 + +原来的[NJU thesis 2021](https://github.com/FengChendian/NJUThesis2021)模板太过古老并且不支持硕士、博士论文,目前难以维护,因此为了模板的可持续发展,现在将对该项目进行重构,项目挂载于[NJU-LUG](https://github.com/nju-lug)组织仓库下,目前已[发布在CTAN](https://ctan.org/pkg/njuthesis)。 + +相关文档请参见[本项目wiki](https://github.com/nju-lug/NJUThesis/wiki)。 + +## 快速开始 + +从0.9.0版以后,本模板以DocStrip(`.dtx`)格式进行维护。常规的`.cls`格式文件可从Releases页面下载或使用以下方法提取。 + +### 关于DocStrip文件 + +DocStrip格式合并了LaTeX源代码和说明文档,更有利于宏包的发布。要使用该文件,请在当前工作目录下打开终端: + +- 输入`xetex njuthesis.dtx`以提取宏包内容 +- 输入`latexmk njuthesis.dtx`以生成并查看内置的文档 + +请注意,由于文件重名原因,项目中的示例论文模板已被重命名为`njuthesis-sample.tex`。 + +### 本地编译 + +1. [从南大镜像站下载](https://mirror.nju.edu.cn/download/app/TeX%20%E6%8E%92%E7%89%88%E7%B3%BB%E7%BB%9F)并安装TeXLive或者MiKTeX最新版 +2. 下载包含[模板全部文件](https://github.com/nju-lug/NJUThesis/releases/latest)的压缩包`njuthesis.zip` +3. 根据需要更改`njuthesis-sample.tex`文件中的内容 +4. 在模板根目录下运行`latexmk`编译文件,得到对应的PDF + +#### **关于本地编译** + +- 模板支持`latexmk`、`xelatex`、`lualatex`三种编译方式 +- 如果使用`latexmk`,请务必使用完整的命令`latexmk -xelatex`以免产生不必要的问题 +- 如果使用`xelatex`或`lualatex`,需要按照`xelatex/lualatex` -> `biber` -> `xelatex/lualatex` -> `xelatex/lualatex`的顺序编译四次 +- 仓库中`.vscode`附带一份VScode的LaTeX WorkShop的配置文件,可根据需要使用 + +### [南大TeX](https://tex.nju.edu.cn)编译 + +1. 下载包含[模板全部文件](https://github.com/nju-lug/NJUThesis/releases/latest)的压缩包`njuthesis.zip` +2. 登录[南大TeX](https://tex.nju.edu.cn),点击New Project -> Upload Project上传刚刚得到的压缩包,上传后`njuthesis-sample.tex`、`njuthesis.cls`等文件应在根目录,0.9.0以后的目录结构如下所示: + + ```shell + NJUThesis-master/ + │ + ├─figure/ + │ njulogo.pdf + │ njuname.pdf + │ + │ njuthesis.bib + │ njuthesis.cls + │ njuthesis-sample.tex + ``` + +3. 在南大TeX项目内页面左上角的`Menu`中,将编译器改为`XeLaTeX` +4. 编写TeX文档 + +### 其他 + +更多内容请参见项目Wiki中的[使用说明](https://github.com/nju-lug/NJUThesis/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E)。 + +你也可以下载[Release](https://github.com/nju-lug/NJUThesis/releases/latest)中附带的`njuthesis.pdf`,里面详尽阐述了模板的特性和使用方法。 + +## 常见问题 + +请参见[常见问题](https://github.com/nju-lug/NJUThesis/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)。 + +## 贡献 + +如果你发现了模板的问题,欢迎在Github中[提交issue](https://github.com/nju-lug/NJUThesis/issues)或者PR。 + +## 许可 + +本模板的发布遵守 LaTeX Project Public License(版本 1.3c 或更高)。 + diff --git a/macros/unicodetex/latex/njuthesis/figure/njuname-large.jpg b/macros/unicodetex/latex/njuthesis/figure/njuname-large.jpg deleted file mode 100644 index b69db06921..0000000000 Binary files a/macros/unicodetex/latex/njuthesis/figure/njuname-large.jpg and /dev/null differ diff --git a/macros/unicodetex/latex/njuthesis/figure/njuname-large.pdf b/macros/unicodetex/latex/njuthesis/figure/njuname-large.pdf new file mode 100644 index 0000000000..f7e71662e5 Binary files /dev/null and b/macros/unicodetex/latex/njuthesis/figure/njuname-large.pdf differ diff --git a/macros/unicodetex/latex/njuthesis/njuthesis.cls b/macros/unicodetex/latex/njuthesis/njuthesis.cls deleted file mode 100644 index d8d8f57f3a..0000000000 --- a/macros/unicodetex/latex/njuthesis/njuthesis.cls +++ /dev/null @@ -1,96 +0,0 @@ -\NeedsTeXFormat{LaTeX2e} -\ProvidesExplClass{njuthesis}{2021-09-11}{0.7.3}{NJU Thesis LaTeX Template} - -% 通过类传递参数 -\RequirePackage{l3keys2e} - -\LoadClass[ - a4paper, - twoside, - UTF8, - scheme=chinese, - linespread=1.625,% laTex默认1.2行距,word默认行距是1.3,要求1.5倍word行距,故1.5/1.2*1.3 = 1.625 - fontset=none, - zihao=-4 - ]{ctexbook}[2018/04/01] - -% 定义模板键值 -% 用于格式控制的键值 -\keys_define:nn { nju } -{ - titlelength .int_set:N = \nju_titlelength, - titlelength .initial:n = 1, - - secondmentor .bool_set:N = \nju_second_mentor, - secondmentor .initial:n = false, - - degree .tl_set:N = \nju_degree, - degree .initial:n = UG, - - type .tl_set:N = \nju_type, - type .initial:n = thesis, - - systemfont .bool_set:N = \nju_systemfont, - systemfont .initial:n = true, - - customlatinfont .tl_set:N = \nju_customlatinfont, - customlatinfont .initial:n = windows, - - customchinesefont .tl_set:N = \nju_customchinesefont, - customchinesefont .initial:n = windows, - - info .meta:nn = { nju / info } { #1 } -} - -\keys_define:nn { nju / info } -{ - % 题目 - TitleA .tl_set:N = \nju_title_a, - TitleB .tl_set:N = \nju_title_b, - TitleC .tl_set:N = \nju_title_c, - TitleEN .tl_set:N = \nju_title_en, - - % 年级学号姓名 - Grade .tl_set:N = \nju_grade, - StudentID .tl_set:N = \nju_student_id, - StudentName .tl_set:N = \nju_student_name, - StudentNameEN .tl_set:N = \nju_student_name_en, - - % 院系专业方向 - Department .tl_set:N = \nju_department, - DepartmentEN .tl_set:N = \nju_department_en, - Major .tl_set:N = \nju_major, - MajorEN .tl_set:N = \nju_major_en, - Field .tl_set:N = \nju_field, - FieldEN .tl_set:N = \nju_field_en, - - % 导师 - MentorA .tl_set:N = \nju_mentor_a, - MentorAEN .tl_set:N = \nju_mentor_a_en, - MentorATitle .tl_set:N = \nju_mentor_a_title, - MentorATitleEN .tl_set:N = \nju_mentor_a_title_en, - - % 第二导师 - MentorB .tl_set:N = \nju_mentor_b, - MentorBEN .tl_set:N = \nju_mentor_b_en, - MentorBTitle .tl_set:N = \nju_mentor_b_title, - MentorBTitleEN .tl_set:N = \nju_mentor_b_title_en, - - % 日期 - SubmitDate .tl_set:N = \nju_submit_date, - DefenseDate .tl_set:N = \nju_defense_date, -} - -\NewDocumentCommand \njusetup { m } -{ \keys_set:nn { nju } { #1 } } - -\ProcessKeysOptions { nju } - -% 输入配置文件 -\RequirePackage{profile/packages} -\RequirePackage{profile/font} -\RequirePackage{profile/page} -\RequirePackage{profile/reference} -\RequirePackage{profile/components} -\RequirePackage{profile/cover} -\RequirePackage{profile/abstract} diff --git a/macros/unicodetex/latex/njuthesis/njuthesis.dtx b/macros/unicodetex/latex/njuthesis/njuthesis.dtx new file mode 100644 index 0000000000..008b7173f7 --- /dev/null +++ b/macros/unicodetex/latex/njuthesis/njuthesis.dtx @@ -0,0 +1,2266 @@ +% \iffalse meta-comment +% !TeX program = XeLaTeX +% !TeX encoding = UTF-8 +% +% Copyright (C) 2021 +% by Nanjing University Linux User Group +% +% 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 +% +% ----------------------------------------------------------------------- +% +% The development version of the template can be found at +% +% https://github.com/nju-lug/NJUThesis +% +% for those people who are interested. +% +%<*internal> +\iffalse +% +% +%<*readme-zh> +# NJU Thesis + +[![njuthesis](https://img.shields.io/badge/njuthesis-latex-blue)](https://git.nju.edu.cn/nju-lug/nju-latex-templates) +[![overleaf](https://img.shields.io/badge/overleaf-supported-brightgreen)](https://tex.nju.edu.cn) +![build status](https://github.com/nju-lug/NJUThesis/actions/workflows/build.yml/badge.svg) + +> 此项目是基于[NJU thesis 2021](https://github.com/FengChendian/NJUThesis2021)的重构版本,目前本科生版本**已经基本重构完成**,硕博论文**正在**根据研究生院的文件重构,但研究生院的规定并不完善,因此部分格式可能会参考本科的,**如果院系另有要求,请自行修改或者提交issue**。 + +原来的[NJU thesis 2021](https://github.com/FengChendian/NJUThesis2021)模板太过古老并且不支持硕士、博士论文,目前难以维护,因此为了模板的可持续发展,现在将对该项目进行重构,项目挂载于[NJU-LUG](https://github.com/nju-lug)组织仓库下,目前已[发布在CTAN](https://ctan.org/pkg/njuthesis)。 + +相关文档请参见[本项目wiki](https://github.com/nju-lug/NJUThesis/wiki)。 + +## 快速开始 + +从0.9.0版以后,本模板以DocStrip(`.dtx`)格式进行维护。常规的`.cls`格式文件可从Releases页面下载或使用以下方法提取。 + +### 关于DocStrip文件 + +DocStrip格式合并了LaTeX源代码和说明文档,更有利于宏包的发布。要使用该文件,请在当前工作目录下打开终端: + +- 输入`xetex njuthesis.dtx`以提取宏包内容 +- 输入`latexmk njuthesis.dtx`以生成并查看内置的文档 + +请注意,由于文件重名原因,项目中的示例论文模板已被重命名为`njuthesis-sample.tex`。 + +### 本地编译 + +1. [从南大镜像站下载](https://mirror.nju.edu.cn/download/app/TeX%20%E6%8E%92%E7%89%88%E7%B3%BB%E7%BB%9F)并安装TeXLive或者MiKTeX最新版 +2. 下载包含[模板全部文件](https://github.com/nju-lug/NJUThesis/releases/latest)的压缩包`njuthesis.zip` +3. 根据需要更改`njuthesis-sample.tex`文件中的内容 +4. 在模板根目录下运行`latexmk`编译文件,得到对应的PDF + +#### **关于本地编译** + +- 模板支持`latexmk`、`xelatex`、`lualatex`三种编译方式 +- 如果使用`latexmk`,请务必使用完整的命令`latexmk -xelatex`以免产生不必要的问题 +- 如果使用`xelatex`或`lualatex`,需要按照`xelatex/lualatex` -> `biber` -> `xelatex/lualatex` -> `xelatex/lualatex`的顺序编译四次 +- 仓库中`.vscode`附带一份VScode的LaTeX WorkShop的配置文件,可根据需要使用 + +### [南大TeX](https://tex.nju.edu.cn)编译 + +1. 下载包含[模板全部文件](https://github.com/nju-lug/NJUThesis/releases/latest)的压缩包`njuthesis.zip` +2. 登录[南大TeX](https://tex.nju.edu.cn),点击New Project -> Upload Project上传刚刚得到的压缩包,上传后`njuthesis-sample.tex`、`njuthesis.cls`等文件应在根目录,0.9.0以后的目录结构如下所示: + + ```shell + NJUThesis-master/ + │ + ├─figure/ + │ njulogo.pdf + │ njuname.pdf + │ + │ njuthesis.bib + │ njuthesis.cls + │ njuthesis-sample.tex + ``` + +3. 在南大TeX项目内页面左上角的`Menu`中,将编译器改为`XeLaTeX` +4. 编写TeX文档 + +### 其他 + +更多内容请参见项目Wiki中的[使用说明](https://github.com/nju-lug/NJUThesis/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E)。 + +你也可以下载[Release](https://github.com/nju-lug/NJUThesis/releases/latest)中附带的`njuthesis.pdf`,里面详尽阐述了模板的特性和使用方法。 + +## 常见问题 + +请参见[常见问题](https://github.com/nju-lug/NJUThesis/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)。 + +## 贡献 + +如果你发现了模板的问题,欢迎在Github中[提交issue](https://github.com/nju-lug/NJUThesis/issues)或者PR。 + +## 许可 + +本模板的发布遵守 LaTeX Project Public License(版本 1.3c 或更高)。 + +% +% +%<*readme-en> +# The njuthesis class + +## Overview + +This package is intended for typesetting Nanjing University thesis with LaTeX, providing support for bachelor, master, and doctoral thesis. Compilation of this class requires either `xelatex` or `lualatex` engine. + +## License + +----- + This work may be distributed and/or modified under the conditions of + the [LaTeX Project Public License](http://www.latex-project.org/lppl.txt), + either version 1.3c of this license or (at your option) any later + version. +----- + +## Contributing + +If you run into any problem with the template, please contact us via Github issue or submit Pull Request. + +## Wiki + +Please see [Chinese wiki](https://github.com/nju-lug/NJUThesis/wiki)。 + +----- + +Copyright © NJU-LUG +% +% +%<*internal> +\fi +\begingroup + \def\NameOfLaTeXe{LaTeX2e} +\expandafter\endgroup\ifx\NameOfLaTeXe\fmtname\else +\csname fi\endcsname +% +% +%<*install> +\input l3docstrip.tex +\keepsilent +\askforoverwritefalse + +\preamble + +Copyright (C) 2021 +by Nanjing University Linux User Group + +This file may be distributed and/or modified under the conditions of +the LaTeX Project Public License, either version 1.3 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. + +To produce the documentation run the original source files ending with `.dtx' +through XeTeX. + +\endpreamble + +\generate{ + \usedir{tex/latex/njuthesis} + \file{\jobname.cls} {\from{\jobname.dtx}{class}} +% +%<*internal> + \usedir{source/latex/njuthesis} + \file{\jobname.ins} {\from{\jobname.dtx}{install}} +% +%<*install> + \usedir{doc/latex/njuthesis} + \nopreamble\nopostamble + \file{README_EN.md} {\from{\jobname.dtx}{readme-en}} + \file{README.md} {\from{\jobname.dtx}{readme-zh}} +} + +\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/njuthesis *} +\Msg{* *} +\Msg{* njuthesis.cls *} +\Msg{* njuthesis.ins *} +\Msg{* README.md *} +\Msg{* README_EN.md *} +\Msg{* *} +\Msg{* To produce the documentation, run the file njuthesis.dtx *} +\Msg{* through XeLaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile +% +% +%<*internal> +\fi +% +% +%\NeedsTeXFormat{LaTeX2e} +%\RequirePackage{expl3} +% \GetIdInfo $Id: njuthesis.dtx 0.9.2 2021-09-17 22:00:00 +0800 NJU LUG $ +% {Thesis template for Nanjing University} +%\ProvidesExplClass{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +% +%<*driver> +\ProvidesFile{njuthesis.dtx} +\documentclass{ctxdoc} +\usepackage{listings,xcolor} +\definecolor{njuviolet}{cmyk}{0.5,1,0,0.4} +\definecolor{njumagenta}{cmyk}{0.05,1,0.55,0} +\definecolor{njublue}{cmyk}{0.8,0.5,0,0} +\definecolor{njuyellow}{cmyk}{0,0.3,1,0} +\begin{document} + \DocInput{njuthesis.dtx} +\end{document} +% +% \fi +% +% \title{\color{njuviolet}{The \textsc{NJuThesis} class\\ 南京大学学位论文模板}} +% +% \author{^^A +% Nanjing University Linux User Group +% \thanks{E-mail: \href{mailto:nju.lug@yaoge123.cn}{nju.lug@yaoge123.cn}}} +% +% \date{v0.9.2 \\ Released 2021-09-17} +% +% \maketitle +% +% \begin{abstract} +% 南京大学学位论文\hologo{LaTeX}模板基于本科生院的论文撰写规范制作,同时参考研究生院提供的硕士、博士学位材料包,用于生成符合南京大学学位论文排版要求和相应的国家规范、行业标准的学位论文,旨在为同学提供毕业论文书写的方便。 +% \end{abstract} +% +% \def\abstractname{Abstract} +% \begin{abstract} +% The \textsc{NJuThesis} class is intended for typesetting Nanjing University thesis with LaTeX, providing support for bachelor, master, and doctoral thesis. +% \end{abstract} +% +% \def\abstractname{特别声明} +% \begin{abstract} +% 请注意,本模板仍未完成开发,出现bug或者文档不完善属于正常情况,提issue或Pull Request即可。 +% +% \href{https://git.nju.edu.cn/nju-lug/lug-introduction}{NJU LUG}始终欢迎您的加入与贡献! +% \end{abstract} +% +% \clearpage +% +% \setcounter{tocdepth}{4} +% \tableofcontents +% \clearpage +% +% \EnableDocumentation +%^^A \DisableDocumentation +% +% \begin{documentation} +% +% +% \section{模板介绍} +% \textsc{NJuThesis},即南京大学学位论文模板,是一个由南京大学LUG组织维护的,用于处理本校学生毕业论文排版需求的\hologo{LaTeX}模板。 +% +% \subsection{历史沿革} +% +% 十几年来,多位热心校友发布过自己编写的模板,在GitHub上可考的包括 +% \begin{enumerate} +% \item 杨文博(\href{http://yangwenbo.com/}{@solrex})的\href{https://github.com/solrex/njuthesis}{南京大学学位论文\hologo{LaTeX}模板}(2010) +% \item \href{https://github.com/fireblue}{@fireblue}基于solrex模板的的\href{https://github.com/fireblue/NJUThesis}{南京大学学位论文\hologo{LaTeX}模板}(2013) +% \item \href{https://github.com/wenhai-zheng}{@wenhai-zheng}的\href{https://github.com/wenhai-zheng/NJUThesis}{NJUThesis}(2013) +% \item 胡海星(\href{http://haixing-hu.github.io/}{@Haixing-Hu})的\href{https://github.com/Haixing-Hu/nju-thesis}{NJU-Thesis}(2013 - 2018) +% \item 张楚珩(\href{https://github.com/zhangchuheng123}{@zhangchuheng123})基于胡海星模板的\href{https://github.com/zhangchuheng123/NJUThesis}{NJUThesis}(2016) +% \item 蒋炎岩(\href{http://ics.nju.edu.cn/~jyy/}{@jiangyy})的\href{https://github.com/jiangyy/njuthesis}{南京大学山寨\hologo{LyX}研究生毕业论文模板}(2017) +% \item 饶安逸(\href{https://anyirao.com/}{@AnyiRao})基于胡海星模板的\href{https://github.com/jiangyy/njuthesis}{NJU-Thesis}(2018) +% \item \href{https://github.com/njuHan}{@njuHan}基于胡海星模板的\href{https://github.com/njuHan/njuthesis-nju-thesis-template/}{NJU-Thesis}(2018 - 2021) +% \item 赵懿晨(\href{https://fengchendian.github.io/about.html}{@FengChendian})基于AnyiRao模板的\href{https://github.com/FengChendian/NJUThesis2021}{NJU Thesis 2021}(2021) +% \end{enumerate} +% 至于不幸而未进行代码版本管理的,甚至于说以压缩包形式流传于各人硬盘中的,就更不可计数了。 +% +% 与其让一千个学生做一千种不同的模板,不如有人牵起头来,集中力量办大事。因此,南京大学 Linux User Group 的有志之士在2021年暑期联合起来,参考以上的现成模板,兼顾友校thuthesis、fduthesis等优秀项目,构建了这一全新模板,力求通过\hologo{LaTeX3}语法和清淅的接口实现良好的易用性和可维护性。 +% +% 目前,本模板的主要维护者包括: +% +% \begin{itemize} +% \item 赵懿晨 +% \item 熊煜 +% \end{itemize} +% +% \subsection{君\hologo{LaTeX}本当上手} +% \hologo{LaTeX}并不是一种零门槛的语言,亦不是南京大学学生的必备技能。有同学听到“\emph{给毕业论文交差也得写代码}”这种事情就头疼,实在是我们不愿意见到而必须要面对的情况。目前,中文互联网上的\hologo{LaTeX}写作教程不能说屈指可数,起码也是汗牛充栋,比较著名的包括刘海洋的《\hologo{LaTeX}入门》等等都是不错的参考资料。然而如何快速准确找到所需要的用法,尤其是\hologo{LaTeX3}的新接口,需要一定的时间或者良好的英文阅读能力。在本文档的写作中,我们无力从盘古开天辟地开始从头构建您的相关知识体系,只能\textbf{尽力做到有求必应},在需要的地方顺带提一嘴,保证您少走点弯路。 +% +% \subsection{关于本说明手册} +% +% 本模板通过\textsc{DocStrip}进行维护,实际上是一种\emph{文学编程}。文学编程的本体是那些用来说明的文字,按写书写文章的方式组织。 +% \file{njuthesis.dtx}包含njuthesis模板的所有信息。前半部分为模板说明,即各种常用命令与必要的使用方法;后半部分为代码实现,为带有详细注释的\hologo{TeX}源代码。后者配合附录,为有意了解本模板细节的同学提供简明的指引。 +% +% 下文中将出现若干特殊格式,包括\file{file-example.xxx}等。 +% +% 如果您在使用最新版模板时发现了任何问题,抑或有意向参与本模板的维护,请通过GitHub issue或者QQ群聊联系LUG。 +% +% \section{安装} +% \label{sec:setup} +% +% 本节主要介绍本宏包的获取、安装以及编译方式 +% \subsection{下载模板} +% +% 本宏包已经发布在CTAN,将在明年进入\hologo{TeX}\,Live 2022 发行版。然而CTAN版更新不及时,更推荐使用以下方式下载。 +% +% 从本模板的Github Releases页面下载最新的发布版 +% +% 从本模板的Github仓库下载最新的dtx文件自行安装 +% +% \subsection{本地编译} +% +% \subsubsection{安装\hologo{TeX}发行版} +% +% 首先需要下载\hologo{TeX}软件发行版,校园网环境中使用\href{https://mirror.nju.edu.cn/download/app/TeX%20%E6%8E%92%E7%89%88%E7%B3%BB%E7%BB%9F}{南大镜像站}可以获得最好的体验。\textbf{推荐使用最新的\hologo{TeX}\,Live 2021或者\hologo{MiKTeX} 21以避免潜在的兼容性问题。} +% +% \begin{itemize} +% \item 为了避免不必要的麻烦,请尽可能下载 full 版本,如 texlive-full。简而言之,下载大的那个。 +% \item 并且,尽可能使用最新版(截至目前是 2021)。2020 及之前版本使用 PDF 格式的图片可能会出现加粗问题。 +% \end{itemize} +% +% 下表是目前经过测试的环境。如果有其他可用不可用的环境,欢迎补充。 +% \begin{table}[ht] +% \centering +% \caption{经过测试的环境} +% % \label{tab:1} +% \begin{tabular}{ccc} +% \toprule +% OS & TeX & 测试情况 \\ +% \midrule +% Windows 10 & \hologo{TeX}\,Live 2020 & cref存在格式问题 \\ +% Windows 10 & \hologo{TeX}\,Live 2021 & 通过 \\ +% Windows 10 & \hologo{MiKTeX} & 通过 \\ +% macOS 10.15 & mac\hologo{TeX} 2021 & 通过 \\ +% Ubuntu 20.04 & \hologo{TeX}\,Live 2021 & 通过 \\ +% Arch Linux & \hologo{TeX}\,Live 2021 & 通过 \\ +% \bottomrule +% \end{tabular} +% \end{table} +% +% \subsubsection{选择编辑器} +% +% 配置完编译器后,还需要一个\textbf{文本编辑器}作为前端来完成\texttt{.tex}文件内容的写作。 +% +% 至今仍有相当一部分人认为Windows自带的\textit{记事本}是最好的文本编辑器,但对于本项目而言,在此诚心诚意地推荐你使用\textbf{更现代更美观更多功能}的编辑器,譬如\emph{安装了 LaTeX Workshop 插件 的 \href{https://code.visualstudio.com/}{Visual Studio Code}},来完成论文编写。你也可以根据个人的喜好随便使用其他编辑器,如 TeXworks、TeX Studio 等,顺手就行。 +% +% 若使用 LaTeX Workshop 插件,本项目在|.vscode/|中提供一份简易配置,可以省略初始配置步骤直接使用。 +% +% \subsubsection{编译顺序} +% 假设即将使用的文件名为\file{mynjuthesis.tex} +% 应采用以下命令顺序进行编译,以生成正确的目录、编号和参考文献条目。 +% \begin{ctexexam} +% xelatex mynjuthesis +% biber mynjuthesis +% xelatex mynjuthesis +% xelatex mynjuthesis +% \end{ctexexam} +% 使用 \pkg{latexmk} +% \begin{ctexexam} +% latexmk -xelatex mynjuthesis +% \end{ctexexam} +% +% \begin{ctexexam} +% lualatex mynjuthesis +% biber mynjuthesis +% lualatex mynjuthesis +% lualatex mynjuthesis +% \end{ctexexam} +% 使用 \pkg{latexmk} +% \begin{ctexexam} +% latexmk -lualatex mynjuthesis +% \end{ctexexam} +% +% 编译产物为\file{njuthesis.pdf},位于主目录下。此外还会生成一系列中间文件,可以选择使用以下命令进行清理。 +% +% \begin{ctexexam} +% latexmk -c +% \end{ctexexam} +% +% \subsection{在线编译} +% +% 相信你在接触了本地编译以后,很快就会意识到一些十分显然的事实,譬如\hologo{TeX}编译器安装过程较为漫长,占用空间过大,而且在一部分处理器性能不佳的电脑上需要较长编译时间\footnote{其实这三点都是对广大的Windows用户说的,同一个模板在Linux编译可以节省一半耗时}。拒绝接受这些麻烦的同学不妨尝试本节介绍的在线编译方法。 +% +% \subsubsection{南大\hologo{TeX}平台简介} +% +% \href{https://tex.nju.edu.cn}{南大\hologo{TeX}}基于开源的ShareLaTeX平台\footnote{理论上在\href{https://doc.nju.edu.cn/books/latex}{这个网站}能找到一段平台简介,实际上大家都有意无意地鸽了,下次一定补上。},于2021年3月4日正式上线,面向南京大学全体师生开放,首次使用需凭学校邮箱自助注册账号。 +% +% \subsubsection{操作步骤} +% +% \begin{enumerate} +% \item 下载\href{https://github.com/nju-lug/NJUThesisUndergraduate/archive/refs/heads/master.zip}{模板全部文件} +% \item 访问\href{https://tex.nju.edu.cn}{南大\hologo{TeX}},点击界面右上方Register,使用\emph{南京大学邮箱}注册账号并登录 +% \item 点击New Project -> Upload Project上传刚刚得到的zip文件,上传后njuthesis.tex、njuthesis.cls等文件应在根目录,目录结构如{{sec:directory}}所示 +% \item 在项目页面左上角的Menu中,将编译器改为\hologo{XeLaTeX}或者\hologo{LuaLaTeX} +% \item 编写论文 +% \item 点击Compile按钮进行编译和预览 +% \item 点击编译按钮右侧第三个按钮下载产物 +% \end{enumerate} +% +% \subsubsection{关于Overleaf平台} +% +% 由于\href{https://www.overleaf.com/}{Overleaf平台}的\hologo{TeX}\,Live版本停留在2020,\texttt{cleveref}包在引用章节时会生成错误的标签,引发格式错误;而南大\hologo{TeX}通过及时更新规避了这一问题。因此\emph{请务必不要使用Overleaf官网进行编译}。 +% +% +% +% \section{使用方法} +% +% \subsection{自定义选项} +% +% 尖括号内列出了若干个允许的选项,其中加粗的为默认选项。 +% +% 封面标题留空即可自动化换行 +% +% 第二导师不填则留空,目前来说拥有两位指导老师并不是一种普遍状况。 +% +% \begin{function}[added=2021-09-07]{nlcover} +% \begin{syntax} +% nlcover = <\TTF> +% \end{syntax} +% +% 通过此项可选择是否添加国家图书馆封面,本选项仅对于研究生有效 +% \end{function} +% +% +% \subsubsection{学位信息} +% \begin{function}[added=2021-09-07]{degree} +% \begin{syntax} +% degree = <(ug)|mg|mf|phd> +% \end{syntax} +% +% 选择学位,可选: +% \opt{ug}(默认本科),\opt{mg}即学术硕士,\opt{mf},\opt{phd}。 +% \end{function} +% +% +% \begin{function}[added=2021-09-07]{type} +% \begin{syntax} +% type = <(thesis)|design> +% \end{syntax} +% +% 用于选择文档类型并将相关字段输出在封面和摘要页。可选值包括thesis(表示毕业论文)和design(表示毕业设计),缺省值为thesis。 +% \opt{thesis}(默认),\opt{design}。 +% \end{function} +% +% +% +% \subsubsection{指定字体} +% +% +% 学校论文格式要求使用的字体一般已经预装在各个操作系统,本模板针对不同平台进行了自动检测适配,可以开箱即用。 +% +% 如果希望更改本模板使用的字体,请填写以下两个选项覆盖检测操作系统得到的设置 +% +% +% \begin{function}[added=2021-09-07]{customlatinfont} +% \begin{syntax} +% customlatinfont = <(windows)|macos|gyre|null> +% \end{syntax} +% +% 手动指定英文字体,可选: +% \opt{windows}(默认), \opt{macos}, \opt{gyre}, \opt{null}。 +% \end{function} +% +% +% \begin{function}[added=2021-09-07]{customchinesefont} +% \begin{syntax} +% customchinesefont = <(windows)|macos|fandol|founder|noto|null> +% \end{syntax} +% +% 手动指定中文字体,可选: +% \opt{windows}(默认), \opt{macos}, \opt{fandol}, \opt{founder},\opt{noto},\opt{null}。 +% +% 方正字体(简繁扩展)系列 +% FZSSK \href{http://www.foundertype.com/index.php/FontInfo/index/id/151}{方正书宋} 免费商用 +% +% FZXBSK \href{http://www.foundertype.com/index.php/FontInfo/index/id/164}{方正小标宋} 设计师非商免费 +% +% FZKTK \href{http://www.foundertype.com/index.php/FontInfo/index/id/137}{方正楷体} 免费商用 +% +% FZXH1K \href{http://www.foundertype.com/index.php/FontInfo/index/id/161}{方正细黑一} 设计师非商免费 +% +% FZHTK \href{http://www.foundertype.com/index.php/FontInfo/index/id/131}{方正黑体} 免费商用 +% +% FZFSK \href{http://www.foundertype.com/index.php/FontInfo/index/id/128}{方正仿宋} +% +% FZYouHK_508R \href{http://www.foundertype.com/index.php/FontInfo/index/id/244}{方正悠黑508R} 设计师非商免费 +% +% FZYouHK_511M \href{http://www.foundertype.com/index.php/FontInfo/index/id/244}{方正悠黑511M} 设计师非商免费 +% +% 思源字体\footnote{思源宋体和思源黑体有两种英文命名,本模板采用Google的noto系列}: +% \href{https://www.google.com/get/noto/#serif-hans}{思源宋体}、 +% \href{https://www.google.com/get/noto/#sans-hans}{思源黑体} +% +% +% +% 方正楷体、方正仿宋为免费商用字体,且支持CJK字符集 +% \href{http://www.foundertype.com/index.php/FontInfo/index/id/128.html}{方正仿宋} +% \href{http://www.foundertype.com/index.php/FontInfo/index/id/137.html}{方正楷体} +% +% 各个系统的默认字体请参考。可以看到,不同系统上使用的字体有所差别,实际输出结果可能存在细微不同, 使用时请注意。例如,在Linux平台或者使用了Ubuntu后端的南大\hologo{TeX}上,宋体加粗效果更明显;另一方面,在Windows平台进行编译的效果更接近Word加粗\footnote{因为SimSun没有原生粗体,通过AutoFakeBold=2.17进行模仿},符合视觉习惯。 +% +% \end{function} +% +% +% \subsection{封面信息} +% +% \subsection{输入个人信息} +% +% \begin{function}{\njusetup} +% +% 定义了用于文档封面的诸多属性参数, +% 写作时修改相应字符串即可。注意不要有空行,否则可能报错 +% +% \end{function} +% +% 本科生可以参考如下列表输入个人信息。注意不能有空行,有空格的内容需要将空格替换为波浪线或者两端加上大括号 +% +% \begin{ctexexam} +% \njusetup { +% info = { +% TitleA = 一种使用南京大学\hologo{LaTeX}模版, +% TitleB = 编写毕业论文的经验性方法, +% Title* = {An Empirical Way of Composing Thesis with NJU \hologo{LaTeX} Template}, +% Grade = 2018, +% StudentID = 189114514, +% StudentName = 周煜华, +% StudentName* = Zhou~Yuhua, +% Department = 拉太赫科学与技术学院, +% Department* = School~of~\hologo{LaTeX}, +% Major = 拉太赫语言学, +% Major* = \hologo{LaTeX}~Linguistics, +% SupervisorA = 李成殿, +% SupervisorA*= Li~Chengdian, +% SupervisorATitle = 教授, +% SupervisorATitle* = Professor, +% SupervisorB = 孙赫弥, +% SupervisorB* = Sun~Hemi, +% SupervisorBTitle = 副教授, +% SupervisorBTitle* = Associate professor, +% SubmitDate = 2021年8月10日, +% } +% } +% \end{ctexexam} +% +% 研究生可以参考如下列表输入个人信息 +% +% \begin{ctexexam} +% \njusetup { +% info = { +% TitleA = 一种使用南京大学\hologo{LaTeX}模版, +% TitleB = 编写毕业论文的经验性方法, +% TitleC = (内容已经过时,详见说明手册), +% Title* = {An Empirical Way of Composing Thesis with NJU \hologo{LaTeX} Template}, +% Grade = 2018, +% StudentID = dz18114514, +% StudentName = 周煜华, +% StudentName* = Zhou~Yuhua, +% Department = 拉太赫科学与技术学院, +% Department* = School~of~\hologo{LaTeX}, +% Major = 拉太赫语言学, +% Major* = \hologo{LaTeX}~Linguistics, +% Field = 拉太赫语言在现当代的使用, +% Field* = Contemporary~Usage~of~the~\hologo{LaTeX}~Language, +% SupervisorA = 李成殿, +% SupervisorA*= Li~Chengdian, +% SupervisorATitle = 教授, +% SupervisorATitle* = Professor, +% SubmitDate = 2021年8月10日, +% SubmitDate* = {Aug 10, 2021}, +% DefendDate = 2021年9月19日, +% ReviewerChairman = 张晓山~教授, +% ReviewerA = 王瑞希~教授, +% ReviewerB = 郭德纲~副教授, +% ReviewerC = 华芈库~教授, +% ReviewerD = 戴菲菲~教授, +% Classification = 0175.2, +% SecurityLevel = 限制, +% UDC = 004.72, +% SupervisorContact = {拉太赫科学与技术学院 枝江市结丘路 19 号 114514}, +% } +% } +% \end{ctexexam} +% +% \subsection{摘要页} +% +% 摘要页一般不插入目录,默认只添加pdf书签。如确实有插入目录的需求,请在\texttt{abstract.sty}文件中定位到如下语句 +% +% 在使用\hologo{LuaLaTeX}编译时,研究生中文摘要页的标题会出现空格无下划线的问题,目前正在积极寻求解决方法。 +% +% {前言页} +% 使用\env{preface}环境定义 +% +% +% \subsection{正文格式} +% +% 本科生无页眉,页面编号居中位于页脚;研究生无页脚,页眉包括章节名和页面编号。 +% +% +% 对中文加下划线请使用xeCJKfntef包的CJKunderline命令代替uline,以解决中文的换行问题 +% +% {参考文献页} +% +% 需要使用biber手动编译才会显示,具体内容参考 +% +% {致谢页} +% 同前言,使用\env{acknowledgement}环境 +% +% {附录页} +% +% 附录放在|\appendix|命令后,以英文字母进行编号 +% +% \end{documentation} +% +% \begin{implementation} +% +% \section{代码实现} +% @@在l3docstrip中表示名空间,在生成cls时会被相应字段替换,譬如在njuthesis中@@=nju。 +% 尖括号包裹的|<*class>|||用来指定某段代码属于哪个文件。 +% +% \begin{macrocode} +%<@@=nju> +%<*class> +\LoadClass[ + a4paper, + twoside, + UTF8, + scheme=chinese, +% \end{macrocode} +% +% 关于行距,\hologo{LaTeX}默认1.2行距,word默认行距是1.3,要求1.5倍word行距,故 +% \[ 1.5\times\frac{1.3}{1.2} = 1.625\] +% \begin{macrocode} + linespread=1.625, + fontset=none, + zihao=-4 + ]{ctexbook}[2018/04/01] +% \end{macrocode} +% +% 宏包\pkg{l3keys2e}用于配置模板选项。 +% \begin{macrocode} +\RequirePackage{l3keys2e} +% \end{macrocode} +% 用于存储学位名称的全局变量,注意宏的命名,l代表局部变量,g代表全局变量 +% \begin{macrocode} +\tl_new:N \l_@@_info_degree_tl +\tl_new:N \l_@@_info_type_tl +% \end{macrocode} +% +% 是否需要国家图书馆封面的设置 +% \begin{macrocode} +\keys_define:nn { nju } +{ + nlcover .bool_set:N = \g_@@_nlcover_bool, + nlcover .initial:n = false, +} +% \end{macrocode} +% +% 学位信息的设置 +% \begin{macrocode} +\keys_define:nn { nju } +{ + degree .choices:nn = + { ug, mg, mg, phd } + { \tl_set_eq:NN \l_@@_info_degree_tl \l_keys_choice_tl }, + degree .initial:n = ug, + type .choices:nn = + { thesis, design } + { \tl_set_eq:NN \l_@@_info_type_tl \l_keys_choice_tl }, + type .initial:n = thesis, +} +% \end{macrocode} +% +% \subsection{个人信息} +% 输入个人信息的区域。 +% \begin{macrocode} +\keys_define:nn { nju } +{ + info.meta:nn = { nju / info } { #1 } +} +% \end{macrocode} +% +% 题目 +% \begin{macrocode} +\keys_define:nn { nju / info } +{ + TitleA .tl_set:N = \l_@@_info_title_a_tl, + TitleB .tl_set:N = \l_@@_info_title_b_tl, + TitleC .tl_set:N = \l_@@_info_title_c_tl, + Title* .tl_set:N = \l_@@_info_title_en_tl, +} +% \end{macrocode} +% +% 年级、学号、姓名 +% \begin{macrocode} +\keys_define:nn { nju / info } +{ + Grade .tl_set:N = \l_@@_info_grade_tl, + StudentID .tl_set:N = \l_@@_info_id_tl, + StudentName .tl_set:N = \l_@@_info_author_tl, + StudentName* .tl_set:N = \l_@@_info_author_en_tl, +} +% \end{macrocode} +% +% 院系、专业、方向 +% \begin{macrocode} +\keys_define:nn { nju / info } +{ + Department .tl_set:N = \l_@@_info_dept_tl, + Department* .tl_set:N = \l_@@_info_dept_en_tl, + Major .tl_set:N = \l_@@_major_tl, + Major* .tl_set:N = \l_@@_major_en_tl, + Field .tl_set:N = \l_@@_field_tl, + Field* .tl_set:N = \l_@@_field_en_tl, +} +% \end{macrocode} +% +% 导师 +% +% \begin{macrocode} +\keys_define:nn { nju / info } +{ + SupervisorA .tl_set:N = \l_@@_info_supv_a_tl, + SupervisorA* .tl_set:N = \l_@@_info_supv_a_en_tl, + SupervisorATitle .tl_set:N = \l_@@_info_supv_a_title_tl, + SupervisorATitle* .tl_set:N = \l_@@_info_supv_a_title_en_tl, +} +% \end{macrocode} +% +% 第二导师 +% +% \begin{macrocode} +\keys_define:nn { nju / info } +{ + SupervisorB .tl_set:N = \l_@@_info_supv_b_tl, + SupervisorB* .tl_set:N = \l_@@_info_supv_b_en_tl, + SupervisorBTitle .tl_set:N = \l_@@_info_supv_b_title_tl, + SupervisorBTitle* .tl_set:N = \l_@@_info_supv_b_title_en_tl, +} +% \end{macrocode} +% +% 提交日期 +% \begin{macrocode} +\keys_define:nn { nju / info } +{ + SubmitDate .tl_set:N = \l_@@_submit_date_tl, + SubmitDate* .tl_set:N = \l_@@_submit_date_en_tl, +} +% \end{macrocode} +% +% 答辩 +% \begin{macrocode} +\keys_define:nn { nju / info } +{ + DefendDate .tl_set:N = \l_@@_defend_date_tl, + ReviewerChairman .tl_set:N = \l_@@_info_chairman_tl, + ReviewerA .tl_set:N = \l_@@_info_reviewer_a_tl, + ReviewerB .tl_set:N = \l_@@_info_reviewer_b_tl, + ReviewerC .tl_set:N = \l_@@_info_reviewer_c_tl, + ReviewerD .tl_set:N = \l_@@_info_reviewer_d_tl, +} +% \end{macrocode} +% +% 国家图书馆封面相关 +% \begin{macrocode} +\keys_define:nn { nju / info } +{ + Classification .tl_set:N = \l_@@_info_classif_tl, + SecurityLevel .tl_set:N = \l_@@_info_seclv_tl, + UDC .tl_set:N = \l_@@_info_udc_tl, + SupervisorContact .tl_set:N = \l_@@_info_supv_cont_tl, +} +% \end{macrocode} +% 定义用于设置个人信息的命令 +% \begin{macrocode} +\NewDocumentCommand \njusetup { m } +{ \keys_set:nn { nju } { #1 } } +% \end{macrocode} +% +% 使用\pkg{geometry}设置页边距。 +% \begin{macrocode} +\RequirePackage[ + top=2.5cm, + bottom=2.5cm, + left=3.2cm, + right=3.2cm +]{geometry} +% \end{macrocode} +% +% +% \begin{macrocode} +\RequirePackage{xparse} +\RequirePackage{titletoc} % 修改目录内标题格式 +\RequirePackage[hyphens]{url} % generate better linebreaks in the url +% \RequirePackage[normalem]{ulem} % 绘制下划线 +\RequirePackage{dashundergaps} +\RequirePackage{setspace} +\RequirePackage{lastpage} +\RequirePackage{emptypage} % 清除空白页的页码 +% \end{macrocode} +% +% +% \begin{macrocode} +\RequirePackage{listings} % 代码环境 +\RequirePackage{enumitem} % 用于修改列表环境 +\RequirePackage{caption} +\RequirePackage{floatrow} % 用于图表等页面元素的定位 +\RequirePackage{booktabs} % 用于绘制三线表 +\RequirePackage{multirow} % Cells occupying multiple rows in tables +\RequirePackage{multicol} % Multiple columns in dictionary +\RequirePackage{siunitx} % 用于书写单位符号 +% \end{macrocode} +% +% 用于化学 +% \begin{macrocode} +\RequirePackage[version=4]{mhchem} % 用于绘制分子式 +% \end{macrocode} +% +% 用于生成可以被插入书签的LaTeX logo,TODO: 使用hologo创建|latex{}|命令 +% \begin{macrocode} +\RequirePackage{hologo} +% \end{macrocode} +% +% +% \begin{macrocode} +% Required to prevent page break right after a sectioning command +% \RequirePackage{needspace} + +% \RequirePackage{xspace} % Better print trailing whitespace +% \end{macrocode} +% +% 针对编译引擎,使用不同的宏包重构下划线命令 +% \begin{macrocode} +\sys_if_engine_xetex:T +{ + \RequirePackage{microtype} + + % 加中文下划线,不能用于lualatex + \RequirePackage{xeCJKfntef} + \cs_new:Npn \nju_underline:n #1 {\CJKunderline{#1}} +} +\sys_if_engine_luatex:T{ + % 加中文下划线 + \RequirePackage{lua-ul} + \cs_new:Npn \nju_underline:n #1 {\underLine{#1}} + + % emoji支持 + % \RequirePackage{emoji} + % \setemojifont{Segoe~UI~Emoji} % windows + % \setemojifont{Apple~Color~Emoji} % macos + % \setemojifont{Noto~Color~Emoji} + % For windows. + % Shipped with the best `grinning-face-with-sweat' support. +} +% \end{macrocode} +% +% 生成用于测试的大段无意义英文文字 +% \begin{macrocode} +\RequirePackage{blindtext} +\RequirePackage{zhlipsum} +% \end{macrocode} +% +% 加载以后展示内容边界 +% \begin{macrocode} +% \RequirePackage{showframe} +% \end{macrocode} +% +% 数学 +% \begin{macrocode} +\RequirePackage{amsmath} % Must be loaded before unicode-math +\RequirePackage{amsthm} % Mathematical environments +\RequirePackage{mathtools} % Mathematical tools to use with amsmath +\RequirePackage{thmtools} % Theorem styles +\RequirePackage[ + warnings-off={% 消除与mathtools合用产生的警告 + mathtools-colon, + mathtools-overbracket} + ]{unicode-math} % Math fonts in xetex or luatex +% \end{macrocode} +% +% +% \begin{macrocode} +\RequirePackage{graphicx} +\DeclareGraphicsExtensions{.pdf,.eps,.jpg,.png} +\graphicspath{{figure/}} % 图片路径 +\RequirePackage{wrapfig} % Wrap text around figures +% \end{macrocode} +% +% 必须以该顺序加载以下三个包 +% \begin{macrocode} +% \RequirePackage{varioref} +\RequirePackage[hidelinks,bookmarksnumbered=true]{hyperref} +\RequirePackage[capitalise,nameinlink,noabbrev]{cleveref} +% \end{macrocode} +% +% \subsection{字体设置} +% +% 加载设置字体所需的包\pkg{fontspec} +% \begin{macrocode} +\RequirePackage{fontspec} +% \end{macrocode} +% +% +% +% \begin{variable}{\g_@@_latin_fontset_tl,\g_@@_cjk_fontset_tl} +% 用于存储所使用字体名称的全局变量 +% \begin{macrocode} +\tl_new:N \g_@@_latin_fontset_tl +\tl_new:N \g_@@_cjk_fontset_tl +% \end{macrocode} +% \end{variable} +% +% 定义字体选项 +% \begin{macrocode} +\keys_define:nn { nju } +{ + customlatinfont .choices:nn = + { gyre, macos, windows, null } + { \tl_set_eq:NN \g_@@_latin_fontset_tl \l_keys_choice_tl }, + customchinesefont .choices:nn = + { fandol, founder, macos, noto, windows, null } + { \tl_set_eq:NN \g_@@_cjk_fontset_tl \l_keys_choice_tl }, +} +% \end{macrocode} +% +% \begin{macro}{\ProcessKeysOptions} +% 在定义完全部设置以后从tex文件导言区输入参数 +% \begin{macrocode} +\ProcessKeysOptions { nju } +% \end{macrocode} +% \end{macro} +% +% 如果未进行设置则使用系统默认字体覆盖输入参数 +% +% \begin{variable}{\g_@@_load_system_fontset_bool} +% 用于判断是否需要载入系统预装字体的全局变量 +% \begin{macrocode} +\bool_new:N \g_@@_load_system_fontset_bool +% \end{macrocode} +% \end{variable} +% +% 判断用户是否自定义了中英文字体,如果其中任意一种未被定义, +% 则使用系统预装字体覆盖字体选项 +% \begin{macrocode} +\tl_if_empty:NTF \g_@@_latin_fontset_tl + { \bool_gset_true:N \g_@@_load_system_fontset_bool } +{ + \tl_if_empty:NT \g_@@_cjk_fontset_tl + { \bool_gset_true:N \g_@@_load_system_fontset_bool } +} +\bool_if:NT \g_@@_load_system_fontset_bool +{ + % 检测是否是 Windows + \sys_if_platform_windows:TF + { + \tl_set:Nn \g_@@_latin_fontset_tl { windows } + \tl_set:Nn \g_@@_cjk_fontset_tl { windows } + } + { + % 检测是否是 macOS + \ctex_if_platform_macos:TF + { + \tl_set:Nn \g_@@_latin_fontset_tl { macos } + \tl_set:Nn \g_@@_cjk_fontset_tl { macos } + } + % 其余系统一律使用自由字体 + { + \tl_set:Nn \g_@@_latin_fontset_tl { gyre } + \tl_set:Nn \g_@@_cjk_fontset_tl { fandol } + } + } +} +% \end{macrocode} +% +% 接下来逐个定义所需要使用的字符集 +% +% \begin{macro}{\@@_load_latin_font_windows:} +% Windows 西文字体 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_latin_font_windows: +{ + \setmainfont{Times~New~Roman} + \setsansfont{Arial} + \setmonofont{Courier~New}[Scale=MatchLowercase] +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@_load_latin_font_macos:} +% macOS 西文字体 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_latin_font_macos: +{ +\setmainfont{Times~New~Roman} +\setsansfont{Arial} +\setmonofont{Menlo}[Scale=MatchLowercase] +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@_load_latin_font_gyre:} +% 开源的 gyre 西文字体 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_latin_font_gyre: +{ +\setmainfont{texgyretermes}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic] +\setsansfont{texgyreheros}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic] +\setmonofont{texgyrecursor}[ + Extension=.otf, + UprightFont=*-regular, + BoldFont=*-bold, + ItalicFont=*-italic, + BoldItalicFont=*-bolditalic, + Scale=MatchLowercase, + Ligatures=CommonOff] +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_load_cjk_font_windows:} +% Windows 中文字体 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_windows: +{ + \setCJKmainfont{SimSun}[ + AutoFakeBold=2.17, + ItalicFont=KaiTi] + \setCJKsansfont{SimHei} + \setCJKmonofont{FangSong} + \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold=2.17] + \setCJKfamilyfont{zhhei}{SimHei} + \setCJKfamilyfont{zhfs}{FangSong} + \setCJKfamilyfont{zhkai}{KaiTi}[AutoFakeBold=2.17] + \setCJKfamilyfont{zhnewhei}{Microsoft~YaHei}[ + BoldFont=Microsoft~YaHei~Bold] +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@_load_cjk_font_macos:} +% macOS 字体 +% 参考CTeX手册第9节 LuaLATEX 下的中文支持方式解决issue问题 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_macos: +{ + % 移除 does not contain script "CJK" 警告 + \msg_redirect_name:nnn {fontspec} {no-script} {info} + \setCJKmainfont{Songti~SC~Light}[ + BoldFont=Songti~SC~Bold, + ItalicFont=Kaiti~SC, + BoldItalicFont=Kaiti~SC~Bold] + \setCJKsansfont{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] + \setCJKmonofont{STFangsong} + \setCJKfamilyfont{zhsong}{Songti~SC~Light}[BoldFont=Songti~SC~Bold] + \setCJKfamilyfont{zhhei}{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] + \setCJKfamilyfont{zhfs}{STFangsong} + \setCJKfamilyfont{zhkai}{Kaiti~SC} + [ + BoldFont=Kaiti~SC~Bold, + % AlternateFont = + % { + % {character range1} {alternate font name1} + % {alternate font features2} , + % ...... + % } + ] + \setCJKfamilyfont{zhnewhei}{PingFang~SC} +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@_load_cjk_font_fandol:} +% Fandol 字体 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_fandol: +{ + % 移除 does not contain script "CJK" 警告 + \msg_redirect_name:nnn {fontspec} {no-script} {info} + \setCJKmainfont{FandolSong-Regular}[ + Extension=.otf, + BoldFont=FandolSong-Bold, + ItalicFont=FandolKai-Regular] + \setCJKsansfont{FandolHei-Regular}[ + Extension=.otf, + BoldFont=FandolHei-Bold] + \setCJKmonofont{FandolFang-Regular}[Extension=.otf] + \setCJKfamilyfont{zhsong}{FandolSong-Regular}[ + Extension=.otf, + BoldFont=FandolSong-Bold] + \setCJKfamilyfont{zhhei}{FandolHei-Regular}[ + Extension=.otf, + BoldFont=FandolHei-Bold] + \setCJKfamilyfont{zhfs}{FandolFang-Regular}[Extension=.otf] + \setCJKfamilyfont{zhkai}{FandolKai-Regular}[ + Extension=.otf, + AutoFakeBold=2.17] +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@_load_cjk_font_founder:} +% 方正字符集(简繁扩展) +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_founder: +{ + \setCJKmainfont{FZSSK}[% 方正书宋 + Extension=.ttf, + BoldFont=FZXBSK,% 方正小标宋 + ItalicFont=FZKTK]% 方正楷体 + \setCJKsansfont{FZXH1K}[% 方正细黑一 + Extension=.ttf, + BoldFont=FZHTK]% FZHTK 方正黑体 + \setCJKmonofont{FZFSK}[Extension=.ttf]% 方正仿宋 + \setCJKfamilyfont{zhsong} + {FZSSK}[ + Extension=.ttf, + BoldFont=FZXBSK] + \setCJKfamilyfont{zhhei} + {FZHTK}[ + Extension=.ttf, + AutoFakeBold=2.17] + \setCJKfamilyfont{zhfs} + {FZFSK}[Extension=.ttf] + \setCJKfamilyfont{zhkai} + {FZKTK}[Extension=.ttf] + \setCJKfamilyfont{zhnewhei} + {FZYouHK_508R}[% 方正悠黑508R + Extension=.ttf, + BoldFont=FZYouHK_511M]% 方正悠黑511M +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@_load_cjk_font_noto:} +% 思源字体 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_cjk_font_noto: +{ + % 思源宋体 + \setCJKmainfont[ + UprightFont=NotoSerifCJKsc-Regular, + BoldFont=NotoSerifCJKsc-Bold, + ItalicFont=NotoSerifCJKsc-Regular, + BoldItalicFont=NotoSerifCJKsc-Bold, + ItalicFeatures=FakeSlant, + BoldItalicFeatures=FakeSlant]{Noto~Serif~CJK~SC} + + % 思源黑体 + \setCJKsansfont[ + UprightFont=NotoSansCJKsc-Regular, + BoldFont=NotoSansCJKsc-Bold, + ItalicFont=NotoSansCJKsc-Regular, + BoldItalicFont=NotoSansCJKsc-Bold, + ItalicFeatures=FakeSlant, + BoldItalicFeatures=FakeSlant]{Noto~Sans~CJK~SC} + + % 包含于思源黑体 + \setCJKmonofont[ + UprightFont=NotoSansMonoCJKsc-Regular, + BoldFont=NotoSansMonoCJKsc-Bold, + ItalicFont=NotoSansMonoCJKsc-Regular, + BoldItalicFont=NotoSansMonoCJKsc-Bold, + ItalicFeatures=FakeSlant, + BoldItalicFeatures=FakeSlant]{Noto~Sans~Mono~SC} + + \setCJKfamilyfont{zhsong}{Noto~Serif~CJK~SC} + \setCJKfamilyfont{zhhei}{Noto~Sans~CJK~SC} + \setCJKfamilyfont{zhfs}{方正仿宋简体}[AutoFakeBold=2.17] + \setCJKfamilyfont{zhkai}{方正楷体简体}[AutoFakeBold=2.17] +} +% \end{macrocode} +% \end{macro} +% +% 载入设置的字体 +% \begin{macrocode} +\cs_new_protected:Npn \@@_load_font: +{ + \use:c { @@_load_latin_font_ \g_@@_latin_fontset_tl : } + \use:c { @@_load_cjk_font_ \g_@@_cjk_fontset_tl : } + + \NewDocumentCommand\songti{}{\CJKfamily{zhsong}} + \NewDocumentCommand\heiti{}{\CJKfamily{zhhei}} + \NewDocumentCommand\fangsong{}{\CJKfamily{zhfs}} + \NewDocumentCommand\kaishu{}{\CJKfamily{zhkai}} +} +\@@_load_font: +% \end{macrocode} +% +% 设置数学字体 (XITS, 或者 STIX, 与 Times New Roman 最为相近) +% \begin{macrocode} +% \setmathfont{STIXTwoMath-Regular}[Extension = .otf] +\setmathfont{XITSMath-Regular}[ + BoldFont = XITSMath-Bold, + Extension = .otf] +% \end{macrocode} +% +% +% \subsection{页面样式} +% +% \subsubsection{页眉页脚} +% +% +% \begin{macrocode} +\RequirePackage{fancyhdr} % 调整页眉页脚 +% 本科生页眉页脚 +\fancypagestyle{njuplain}{% + \fancyhead{} + \fancyfoot[C]{\zihao{5}\thepage} % 页脚居中 五号新罗马体数字 +} +% \end{macrocode} +% +% +% \begin{macrocode} +% TODO: 研究生页眉页脚 +\fancypagestyle{njuheadings}{% + \fancyhead{} + \fancyfoot[C]{\zihao{5}\thepage} +} +% \end{macrocode} +% +% +% \begin{macrocode} +\str_if_eq:NNTF {\l_@@_info_degree_tl} { ug } +{ + % the header line + \tl_set:Nn \headrulewidth {0pt} + % the footer line + \tl_set:Nn \footrulewidth {0pt} + + \AtBeginDocument{\pagestyle{njuplain}} % 本科无页眉页脚 +} +{ + % the header line + \tl_set:Nn \headrulewidth {1pt} + % the footer line + \tl_set:Nn \footrulewidth {0pt} + + % \AtBeginDocument{\pagestyle{njuplain}} % 无页眉页脚 + \AtBeginDocument{\pagestyle{headings}} % 研究生有页眉页脚 +} +% \end{macrocode} +% +% +% \begin{macrocode} +% ctex格式设置 +% 目录标题 三号宋体加粗 +% 各部分标题 四号黑体 +\ctexset{ + contentsname = 目录, + listfigurename = 插图清单, + listtablename = 表格清单, + chapter/format = \zihao{4}\heiti\centering, + chapter/beforeskip = 10pt, + chapter/afterskip = 60pt, + section/format = \zihao{4}\heiti\raggedright, + subsection/format = \zihao{4}\heiti\raggedright, + subsubsection/format = \zihao{4}\heiti\raggedright +} + +% 重定义目录中章节标题样式 +% 目录内容中章的标题 四号黑体 +% 目录中其他内容 小四号宋体 +\titlecontents{chapter}% 标题级别 + [5em]% 标题左间距 + {\heiti\zihao{4}\vspace{10pt}}% 标题格式 + {\contentslabel{4em}}% 标题标志 + {\hspace*{-4em}}% 无序号标题 + {~\titlerule*[0.6pc]{$.$}~\contentspage}% 指引线与页码 + + \titlecontents{section} + [5em] + {\zihao{-4}\vspace{0pt}} + {\contentslabel{2.5em}} + {\hspace*{-4em}} + {~\titlerule*[0.6pc]{$.$}~\contentspage} + +\titlecontents{subsection} + [8em] + {\zihao{-4}\vspace{0pt}} + {\contentslabel{3em}} + {\hspace*{-4em}} + {~\titlerule*[0.6pc]{$.$}~\contentspage} +% \end{macrocode} +% +% +% \begin{macrocode} +\cs_set:Npn \CTEX@addtocline #1#2 +{ + \addcontentsline { toc } {#1} + { \use:c { CTEX@#1@tocline } {#1} {#2} } +} +% \end{macrocode} +% +% +% \begin{macrocode} +% 目录页面格式修改 +\cs_new:Npn \nju_tocpagestyle:nnn #1 #2 #3 +{ + \newpage + \hspace{0pt} + \vskip 10pt + \begin{center} + \mbox{\songti\bf\zihao{3}{#1}} % 目录页面标题 + \phantomsection + \addcontentsline{toc}{chapter}{#2} % 插入目录 + \end{center} + \vskip 40pt + \@starttoc{#3}% + \cleardoublepage +} +% \end{macrocode} +% +% +% \begin{macrocode} +\tl_set:Nn \tableofcontents +{ + \nju_tocpagestyle:nnn {目\hspace{2em}录}{\contentsname}{toc} +} +\tl_set:Nn \listoffigures +{ + \nju_tocpagestyle:nnn {\listfigurename}{\listfigurename}{lof} +} +\tl_set:Nn \listoftables +{ + \nju_tocpagestyle:nnn {\listtablename}{\listtablename}{lot} +} +% \end{macrocode} +% +% \begin{environment}{preface} +% +% \begin{macrocode} +% 定制前言、致谢环境 +\NewDocumentEnvironment{preface}{} +{% + \chapter*{前言} + \addcontentsline{toc}{chapter}{前言} +}{} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{acknowledgement} +% 单独制作的致谢页。 +% \begin{macrocode} +\NewDocumentEnvironment{acknowledgement}{} +{% + \chapter*{致谢} + \addcontentsline{toc}{chapter}{致谢} +}{} +% \end{macrocode} +% \end{environment} +% +% +% \begin{macrocode} +% biblatex设置 +\RequirePackage[ + style=gb7714-2015, + %style=numeric-comp, + %citestyle=authortitle-icomp, + % citestyle=numeric-comp, + %bibstyle=authoryear, + % bibstyle=numeric, + sorting=none, + %sorting=nyt, + %sortcites=true, + %autocite=footnote, + backend=biber, % Compile the bibliography with biber + hyperref=true, + backref=false, + citecounter=true, + pagetracker=true, + citetracker=true, + ibidtracker=context, + autopunct=true, + autocite=plain, + % gbpub=false, % Uncomment if you do NOT want '[S.l. : s.n.]' + % in reference entries, GitHub Issue (#47) + % gbnamefmt=lowercase, % Uncomment if you do NOT want uppercase author + % names in reference entries, GitHub Issue (#23) +]{biblatex} +% \end{macrocode} +% +% +% \begin{macrocode} +% Remove some unwanted entries from the bibliography +\AtEveryBibitem{ + \clearfield{abstract} + \clearfield{issn} + \clearfield{isbn} + \clearfield{archivePrefix} + \clearfield{arxivId} + \clearfield{pmid} + \clearfield{eprint} + \ifentrytype{online}{}{\ifentrytype{misc}{}{\clearfield{url}}} + % \ifentrytype{book}{\clearfield{doi}}{} +} +% \end{macrocode} +% +% +% \begin{macrocode} +% 修改标签名称 +\crefdefaultlabelformat{#2#1#3\,} % 默认在名称后面添加空格 + +\crefname{figure}{图}{图} +\crefname{table}{表}{表} +% \crefname{equation}{公式}{公式} +\crefformat{equation}{公式~#2#1#3~} % 删除公式编号的括号 + +\crefformat{chapter}{第#2#1#3章} +\crefformat{section}{第~#2#1#3~节} +\crefformat{subsection}{第~#2#1#3~小节} +\crefformat{subsubsection}{第~#2#1#3~小节} +% \crefname{chapter}{§}{§} +% \crefname{section}{§}{§} +% \crefname{subsection}{§}{§} +% \crefname{subsubsection}{§}{§} +\crefname{appendix}{附录}{附录} + +% \crefname{definition}{定义}{定义} +% \crefname{axiom}{公理}{公理} +% \crefname{property}{性质}{性质} +% \crefname{proposition}{命题}{命题} +% \crefname{lemma}{引理}{引理} +% \crefname{corollary}{推论}{推论} +% \crefname{remark}{注解}{注解} +% \crefname{condition}{条件}{条件} +% \crefname{conclusion}{结论}{结论} +% \crefname{assumption}{假设}{假设} +% \end{macrocode} +% +% soifjsojfosjfos +% \begin{macrocode} +% 图表位置调整 +\floatsetup[lstlisting]{ % Captions for lstlistings + capposition=above,% + margins=centering,% + floatwidth=\textwidth% +} +\floatsetup[figure]{ % Captions for figures + capposition=bottom,% + margins=centering,% + floatwidth=\textwidth% +} +\floatsetup[table]{ % Captions for tables + capposition=above,% + margins=centering,% + floatwidth=\textwidth% +} +% \end{macrocode} +% +% +% \begin{macrocode} +% 代码样式 +\lstset{ + basicstyle=\ttfamily\linespread{1}\small\selectfont, + keywordstyle=\bfseries,% use bold style for keywords + commentstyle=\rmfamily\itshape,% use italic style for comments + stringstyle=\ttfamily,% 字符串风格 + flexiblecolumns,% ? + numbers=left,% left-aligned numbering + showspaces=false,% hide markers for spaces + showstringspaces=false, + captionpos=t,% place the caption at the top + % frame=lrtb,% show all four sides of the frame + % linewidth=.8\textwidth, + % breakatwhitespace=true, + breaklines=true, + xleftmargin=2em,xrightmargin=2em,% set the width of the code environment +} +% \end{macrocode} +% +% +% \begin{macrocode} +\lstdefinestyle{LaTeX}{ + language=TeX, + morekeywords={ + begin, caption, label, mathrm, frac, + toprule, midrule, bottomrule, includegraphics} +} +% \end{macrocode} +% +% +% \begin{macrocode} +% 图表标题样式 +\DeclareCaptionFont{songticap}{\zihao{5}\bf\songti} +\captionsetup{ + font=small,% + labelfont=songticap, + textfont=songticap, + strut=no,% + hypcap=true, % Links point to the top of the figure + % indention=0pt, % Suppress indentation + % % parindent=0pt, % Suppress space between paragraphs + aboveskip=6pt, % Increase the space between the figure and the caption + belowskip=6pt, % Increase the space between the caption and the table +} +% \end{macrocode} +% +% +% \begin{macrocode} +% list configuration +\renewcommand{\labelitemi}{\tiny$\blacktriangleright$} +\renewcommand{\labelitemii}{\textbullet} + +\setlist[itemize]{noitemsep} +\setlist[enumerate]{noitemsep} +\setlist[description]{noitemsep} +% \end{macrocode} +% +% +% \begin{macrocode} +% 数学环境 +\declaretheoremstyle[ + %spaceabove=.5\thm@preskip, + %spacebelow=.5\thm@postskip, + headfont=\bf\songti,%\scshape, + notefont=\songti,% notebraces={ (}{)}, + bodyfont=\songti, + %headformat={\NAME\space\NUMBER\space\NOTE}, + headpunct={}, + %postheadspace={.5em plus .1em minus .1em}, + %prefoothook={\hfill\qedsymbol} + ]{njuthm} + +\theoremstyle{njuthm} +% \end{macrocode} +% +% +% \begin{macrocode} +\let\oldproofname=\proofname +\renewcommand*{\proofname}{\rm\bf\songti{\oldproofname}} % 修改证明环境标题 +% \end{macrocode} +% +% +% \begin{macrocode} +\declaretheorem[ + name=算法, + style=njuthm, + refname={算法,算法}, + Refname={算法,算法}, + % numberwithin=section, +]{algorithm} +\declaretheorem[ + name=假设, + style=njuthm, + refname={假设,假设}, + Refname={假设,假设}, + % numberwithin=section, +]{assumption} +\declaretheorem[ + name=公理, + style=njuthm, + refname={公理,公理}, + Refname={公理,公理}, + % numberwithin=section, +]{axiom} +\declaretheorem[ + name=结论, + style=njuthm, + refname={结论,结论}, + Refname={结论,结论}, + % numberwithin=section, +]{conclusion} +\declaretheorem[ + name=条件, + style=njuthm, + refname={条件,条件}, + Refname={条件,条件}, + % numberwithin=section, +]{condition} +\declaretheorem[ + name=推论, + style=njuthm, + refname={推论,推论}, + Refname={推论,推论}, + % numberwithin=section, +]{corollary} +\declaretheorem[ + name=定义, + style=njuthm, + refname={定义,定义}, + Refname={定义,定义}, + % numberwithin=section, +]{definition} +\declaretheorem[ + name=例, + style=njuthm, + refname={例,例}, + Refname={例,例}, + % numberwithin=section, +]{example} +\declaretheorem[ + name=引理, + style=njuthm, + refname={引理,引理}, + Refname={引理,引理}, + % numberwithin=section, +]{lemma} +\declaretheorem[ + name=性质, + style=njuthm, + refname={性质,性质}, + Refname={性质,性质}, + % numberwithin=section, +]{property} +\declaretheorem[ + name=命题, + style=njuthm, + refname={命题,命题}, + Refname={命题,命题}, + % numberwithin=section, +]{proposition} +\declaretheorem[ + name=注解, + style=njuthm, + refname={注解,注解}, + Refname={注解,注解}, + % numberwithin=section, +]{remark} +\declaretheorem[ + name=定理, + style=njuthm, + refname={定理,定理}, + Refname={定理,定理}, + numberwithin=section, +]{theorem} +% \end{macrocode} +% +% \subsection{封面绘制} +% \begin{macrocode} +% 拼合标题 +\tl_const:Nn \l_@@_info_title_tl +{ + \l_@@_info_title_a_tl + \l_@@_info_title_b_tl + \l_@@_info_title_c_tl +} +% \end{macrocode} +% 双导师的处理 +%% \begin{variable}{\l_@@_info_supv_full_tl,\l_@@_info_supv_full_en_tl} +% 用于存储导师姓名加职称的变量,旧版编译器不支持字符串中含有|\hspace{.5em}|这样的空白空间命令 +% \begin{macrocode} +\tl_new:N \l_@@_info_supv_full_tl +\tl_new:N \l_@@_info_supv_full_en_tl +% \end{macrocode} +% \end{variable} +% +% 拼合导师 +% \begin{macrocode} +\tl_set:Nn \l_@@_info_supv_full_tl +{ + \l_@@_info_supv_a_tl\ + \l_@@_info_supv_a_title_tl\ \ + \l_@@_info_supv_b_tl\ + \l_@@_info_supv_b_title_tl +} +\tl_set:Nn \l_@@_info_supv_full_en_tl +{ + \l_@@_info_supv_a_en_tl\ + \l_@@_info_supv_a_title_en_tl\ \ + \l_@@_info_supv_b_en_tl\ + \l_@@_info_supv_b_title_en_tl +} +% \end{macrocode} +% \begin{variable}{\c_@@_name_degree_tl,\c_@@_name_degree_en_tl} +% 用于存储学位名称的变量 +% \begin{macrocode} +\tl_new:N \c_@@_name_degree_tl +\tl_new:N \c_@@_name_degree_en_tl +% \end{macrocode} +% \end{variable} +% +% 判断学位进行命令定义 +% \begin{macrocode} +\str_if_eq:NNTF {\l_@@_info_degree_tl} { ug } +{ + % 本科 + \tl_const:Nn \l_@@_name_diploma_tl { 本\hfill 科\hfill } + \tl_const:Nn \c_@@_name_title_tl { 题\hfill 目 } + + \tl_const:Nn \c_@@_cover_uline_len_a_tl { 250pt } + \tl_const:Nn \c_@@_cover_uline_len_b_tl { 90pt } + \tl_const:Nn \c_@@_cover_uline_font_tl { \songti } + \tl_const:Nn \c_@@_cover_uline_style_tl { \bf } + \tl_const:Nn \c_@@_cover_uline_bskip_tl {} + + \tl_const:Nn \c_@@_cover_box_len_tl { 4.2em } + + % 本科强制不打印国家图书馆封面 + \bool_set_false:N \g_@@_nlcover_bool +} +{ + % 本科以外都是研究生 + \tl_const:Nn \l_@@_name_diploma_tl { 研\hfill 究\hfill 生\hfill } + \tl_const:Nn \c_@@_name_title_tl { 论\hfill 文\hfill 题\hfill 目 } + + \tl_const:Nn \c_@@_cover_uline_len_a_tl { 250pt } + \tl_const:Nn \c_@@_cover_uline_len_b_tl { 14em } + \tl_const:Nn \c_@@_cover_uline_font_tl { \kaishu } + \tl_const:Nn \c_@@_cover_uline_style_tl {} + \tl_const:Nn \c_@@_cover_uline_bskip_tl { \hspace{1em} } + + \tl_const:Nn \c_@@_cover_box_len_tl { 6em } + + % 研究生学位名称 + \str_if_eq:NNTF { \l_@@_info_degree_tl } { phd } + { + \tl_set:Nn \c_@@_name_degree_tl { 博士 } + \tl_set:Nn \c_@@_name_degree_en_tl { Doctor~of~Philosophy } + } + { + \tl_set:Nn \c_@@_name_degree_en_tl { Master } + \str_if_eq:NNTF { \l_@@_info_degree_tl } { mg } + { \tl_set:Nn \c_@@_name_degree_tl { 硕士 } } + { \tl_set:Nn \c_@@_name_degree_tl { 硕士专业 } } + } +} +% \end{macrocode} +% +% \begin{macro}{\@@_cover_uline_a:n} +% 在封面绘制下划线 +% \begin{macrocode} +\cs_new:Npn \@@_cover_uline_a:n #1 +{ + \uline{\makebox[\c_@@_cover_uline_len_a_tl] + {\rm\c_@@_cover_uline_font_tl #1 }} +} +\cs_new:Npn \@@_cover_uline_b:n #1 +{ + \uline{\makebox[\c_@@_cover_uline_len_b_tl] + {\rm\c_@@_cover_uline_font_tl #1 }} +} +\cs_new:Npn \@@_cover_uline_nl:nn #1 #2 +{ + \uline{\makebox[#1] + {\rm\c_@@_cover_uline_font_tl #2 }} +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@_cover_box:n} +% 封面表格边框 +% \begin{macrocode} +\cs_new:Npn \@@_cover_box:n #1 +{ + \makebox[\c_@@_cover_box_len_tl][s]{ + #1\c_@@_cover_uline_bskip_tl} +} +% \end{macrocode} +% \end{macro} +% +% 判断类型 +% +% \begin{macrocode} +\str_if_eq:NNTF { \l_@@_info_type_tl } { thesis } +{ + \tl_const:Nn \l_@@_info_type_tl_name + { \l_@@_name_diploma_tl 毕\hfill 业\hfill 论\hfill 文 } +} +{ + \tl_const:Nn \l_@@_info_type_tl_name + { \l_@@_name_diploma_tl 毕\hfill 业\hfill 设\hfill 计 } +} +% \end{macrocode} +% +% \begin{macro}{\@@_cover_title_breakline:} +% 对多行标题进行自动判断,并输出换行后的结果 +% \begin{macrocode} +\cs_new_protected:Npn \@@_cover_title_breakline: +{ + \@@_cover_box:n {\c_@@_name_title_tl} + & \@@_cover_uline_a:n + { \c_@@_cover_uline_style_tl \l_@@_info_title_a_tl } \\ + % 如果某行标题空则不输出接下来的若干行 + \tl_if_empty:NF \l_@@_info_title_b_tl + { + \tl_if_empty:NTF \l_@@_info_title_c_tl + { + & \@@_cover_uline_a:n + {\c_@@_cover_uline_style_tl \l_@@_info_title_b_tl } \\ + } + { + & \@@_cover_uline_a:n + { \c_@@_cover_uline_style_tl \l_@@_info_title_b_tl } \\ + & \@@_cover_uline_a:n + { \c_@@_cover_uline_style_tl \l_@@_info_title_c_tl } \\ + } + } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_print_covertab:} +% 封面信息栏 +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_covertab: +{% + \str_if_eq:NNTF { \l_@@_info_degree_tl } { ug } + { + \begin{tabular}{p{4.2em}c} + \@@_cover_box:n {院\hfill 系} + & \@@_cover_uline_a:n {\l_@@_info_dept_tl} \\ + \@@_cover_box:n {专\hfill 业} + & \@@_cover_uline_a:n {\l_@@_major_tl} \\ + \@@_cover_title_breakline: + \end{tabular}\\ + + \begin{tabular}{p{4.2em}cp{4.2em}c} + \@@_cover_box:n {年\hfill 级} + & \@@_cover_uline_b:n {\l_@@_info_grade_tl} + & \@@_cover_box:n {学\hfill 号} + & \@@_cover_uline_b:n {\l_@@_info_id_tl}\\ + \end{tabular}\\ + + \begin{tabular}{p{4.2em}c} + \@@_cover_box:n {学\hfill 生\hfill 姓\hfill 名} + & \@@_cover_uline_a:n {\l_@@_info_author_tl} + \end{tabular}\\ + \begin{tabular}{p{4.2em}cp{4.2em}c} + \@@_cover_box:n {导\hfill 师} + & \@@_cover_uline_b:n {\l_@@_info_supv_a_tl} + & \@@_cover_box:n {职\hfill 称} + & \@@_cover_uline_b:n {\l_@@_info_supv_a_title_tl}\\ + + % 第二导师 + \tl_if_empty:NF \l_@@_info_supv_b_tl + { + \@@_cover_box:n {第\hfill 二\hfill 导\hfill 师} + & \@@_cover_uline_b:n {\l_@@_info_supv_b_tl} + & \@@_cover_box:n {职\hfill 称} + & \@@_cover_uline_b:n {\l_@@_info_supv_b_title_tl}\\ + } + \end{tabular}\\ + + \begin{tabular}{p{4.2em}c} + \@@_cover_box:n {提\hfill 交\hfill 日\hfill 期} + & \@@_cover_uline_a:n {\l_@@_submit_date_tl}\\ + \end{tabular} + } + { + \begin{tabular}{p{6em}c} + \@@_cover_title_breakline: + \@@_cover_box:n {作\hfill 者\hfill 姓\hfill 名} + & \@@_cover_uline_a:n {\l_@@_info_author_tl}\\ + \@@_cover_box:n {专\hfill 业\hfill 名\hfill 称} + & \@@_cover_uline_a:n {\l_@@_major_tl}\\ + \@@_cover_box:n {研\hfill 究\hfill 方\hfill 向} + & \@@_cover_uline_a:n {\l_@@_field_tl}\\ + \@@_cover_box:n {指\hfill 导\hfill 教\hfill 师} + & \@@_cover_uline_a:n {\l_@@_info_supv_full_tl}\\ + \end{tabular} + } +} +% \end{macrocode} +% \end{macro} +% +% +% +% +% \begin{macro}{\@@_print_cover_nl:} +% 按需绘制国家图书馆封面,修改自胡海星模板 +% +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_cover_nl: +{ + \thispagestyle{empty} + \pdfbookmark[0]{国家图书馆封面}{nl} + { + % 顶端 + \hspace{0mm} + \vskip -20mm \hskip -15mm + \songti\zihao{-4} + \makebox[40pt][l]{分类号} + \@@_cover_uline_b:n {\l_@@_info_classif_tl} + \hfill + \makebox[40pt][l]{密级} + \@@_cover_uline_b:n {\l_@@_info_seclv_tl} + \vskip 10pt \hskip -15mm + \makebox[40pt][l]{UDC} + \@@_cover_uline_b:n {\l_@@_info_udc_tl} + } + + % 中部 + \vskip\stretch{2} + \begin{center} + \def\ULthickness{1pt} + {\kaishu\zihao{-0} 学\hspace{0.5em}位\hspace{0.5em}论\hspace{0.5em}文} + { + \kaishu\zihao{1} + \vskip \stretch{1} + \@@_cover_uline_b:n {\l_@@_info_title_a_tl}\\ + \@@_cover_uline_b:n {\l_@@_info_title_b_tl}\\ + \@@_cover_uline_b:n {\l_@@_info_title_c_tl}\\ + } + \vskip \stretch{1} + {\kaishu\zihao{4}(题名和副题名)} + \vskip \stretch{1} \vskip 5mm + {\kaishu\zihao{1}\uline{\makebox{\l_@@_info_author_tl}}} + \vskip \stretch{1} + {\kaishu\zihao{4}(作者姓名)} + \end{center} + + % 底部 + \vskip\stretch{1} + { + \kaishu\zihao{4} + \noindent 指导教师姓名、职务、职称、学位、单位名称及地址% + \@@_cover_uline_nl:nn {94pt}{\l_@@_info_supv_a_tl}\par + \noindent\@@_cover_uline_nl:nn {\textwidth}{% + \l_@@_info_supv_cont_tl}\par + \noindent 申请学位级别% + \@@_cover_uline_nl:nn {9em}{\c_@@_name_degree_tl}% + \noindent 专业名称% + \uline{\hfill\l_@@_major_tl\hfill}\par% 需要调整下划线长度 + \noindent 论文提交日期% + \@@_cover_uline_nl:nn {9em}{\l_@@_submit_date_tl}% + 论文答辩日期% + \uline{\hfill\l_@@_defend_date_tl\hfill}\par% 需要调整下划线长度 + \noindent 学位授予单位和日期\uline{\hfill}\par + \noindent\hfill 答辩委员会主席:% + \@@_cover_uline_nl:nn {9em}{\l_@@_info_chairman_tl}\par + \noindent\hfill 评阅人:% + \@@_cover_uline_nl:nn {9em}{\l_@@_info_reviewer_a_tl}\par + \noindent\hfill\@@_cover_uline_nl:nn {9em}{\l_@@_info_reviewer_b_tl}\par + \noindent\hfill\@@_cover_uline_nl:nn {9em}{\l_@@_info_reviewer_c_tl}\par + \noindent\hfill\@@_cover_uline_nl:nn {9em}{\l_@@_info_reviewer_d_tl}\par + + \begin{center} + \kaishu\zihao{3}\hspace{2em} 年\hspace{1em} 月\hspace{1em} 日 + \end{center} + \vskip -10mm + } + \cleardoublepage +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@_print_cover_ug:} +% 本科封面 +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_cover_ug: +{ + \thispagestyle{empty} + \pagenumbering{Roman} + % Start + \pdfbookmark{封面}{封面} % 将封面插入pdf书签 + \begin{spacing}{1.25} + \vskip 0mm + \hspace{-10mm} + \includegraphics[height=3cm]{njulogo}\smallskip + \begin{center} + \includegraphics[height=3.35cm]{njuname} + \vskip 10mm + {\zihao{1}\makebox[9em][s]{\bf{\songti\l_@@_info_type_tl_name}}} + \vfill + \vskip\stretch{0} + {\bgroup + \kaishu\zihao{3} + \def\tabcolsep{1pt} + \def\arraystretch{1.5} + % 绘制信息框 + \@@_print_covertab: + \egroup} + \vfill + \end{center} + \end{spacing} + \cleardoublepage + % \vfill + % \newpage +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@@_print_cover_g:} +% 研究生封面 +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_cover_g: +{ + \thispagestyle{empty} + \pagenumbering{Roman} + % Start + \pdfbookmark{封面}{封面} % 将封面插入pdf书签 + \begin{spacing}{1.25} + \begin{center} + \hspace{0pt} \vskip 5mm + \includegraphics[height=1.9cm]{njulogo} + \vskip 10mm + \includegraphics[height=2cm]{njuname-large} + \vskip 15mm + {\zihao{1}\makebox[10em][s]{\bf{\kaishu\l_@@_info_type_tl_name}}} + \vskip 5mm + {\zihao{1}\bf{\kaishu{(申请\c_@@_name_degree_tl 学位)}}} + \par\vfill + \vskip\stretch{0} + {\bgroup + \bf\kaishu\zihao{3} + \def\tabcolsep{1pt} + \def\arraystretch{1.5} + \vskip 10mm + % 绘制信息框 + \@@_print_covertab: + \egroup} + \vfill + \vskip 10mm + \bf\kaishu\zihao{4}\l_@@_submit_date_tl + \vskip 15mm + \end{center} + \end{spacing} + + \newpage % 封面背面 + \thispagestyle{empty} + \begin{spacing}{1.625} + % TODO: 等待调整格式 + \hspace{0pt} \vfill + {\bgroup + \kaishu\zihao{3} + \makebox[6em][s]{\bf\kaishu 学\hfill 号}:\MakeUppercase{\l_@@_info_id_tl} + \par + \makebox[6em][s]{\bf\kaishu 论文答辩日期}:\l_@@_defend_date_tl + \par + \makebox[6em][s]{\bf\kaishu 指\hfill 导\hfill 教\hfill 师}:\hspace{50mm}(签字) + \par + \egroup} + \vskip 15mm + \end{spacing} + \cleardoublepage +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_print_cover_en:} +% 研究生英文封面 +% \begin{macrocode} +\cs_new_protected:Npn \@@_print_cover_en: +{ + \thispagestyle{empty} + \pdfbookmark{英文封面}{English~cover} % 将封面插入pdf书签 + \begin{center} + \vspace*{20pt} + \bf\sffamily\zihao{2}\l_@@_info_title_en_tl + \vskip \stretch{1} + \normalfont\rmfamily\zihao{4}{by} + \vskip 3pt + \bf\sffamily\zihao{4}\l_@@_info_author_en_tl + \vskip\stretch{1} + \normalfont\rmfamily\zihao{4}{Supervised~by} + \vskip 3pt + \normalfont\sffamily\zihao{4}\l_@@_info_supv_a_title_en_tl + \hspace{.5em}\l_@@_info_supv_a_en_tl + \vskip\stretch{1} + \normalsize\rmfamily{% + A~dissertation~submitted~to\\ + the~graduate~school~of~Nanjing~University\\ + in~partial~fulfilment~of~the~requirements~for~the~degree~of\\ + {\textsc{\c_@@_name_degree_en_tl}}\\ + in\\ + {\l_@@_major_en_tl} + } + \vskip\stretch{2} + \includegraphics[width=2.5cm]{njulogo} \\ + \vskip 3mm + \normalfont\l_@@_info_dept_en_tl\\ + {Nanjing~University} + \vskip 30pt + \normalfont\normalsize\l_@@_submit_date_en_tl + \end{center} + \normalfont + \cleardoublepage +} +% \end{macrocode} +% \end{macro} +% +% +% 重定义maketitle生成封面 +% \begin{macrocode} +\tl_set:Nn \maketitle +{% + \str_if_eq:NNTF { \l_@@_info_degree_tl } { ug } + { + \@@_print_cover_ug: % 本科封面 + } + { + \bool_if:NT \g_@@_nlcover_bool { \@@_print_cover_nl: } % 国家图书馆封面 + \@@_print_cover_g: % 研究生封面 + \@@_print_cover_en: % 英文封面 + } +} +% \end{macrocode} +% +% \subsection{摘要绘制} +% +% 中文关键词 +% \begin{macrocode} +\NewDocumentCommand \keywords {m} {% + \par\vspace{2ex}\noindent% + {\kaishu\zihao{-4}\makebox[4em][s]{关键词{:}}}~{#1}% +} +% \end{macrocode} +% +% +% 英文关键词 +% +% \begin{macrocode} +\NewDocumentCommand \englishkeywords {m} {% + \par\vspace{2ex}\noindent% + {KEYWORDS{:}}~~{#1}% +} +% \end{macrocode} +% +% +% +% \begin{macrocode} +% 判断学位 +\str_if_eq:NNTF {\l_@@_info_degree_tl} { ug } +{ + % 本科摘要环境 + \NewDocumentEnvironment{abstract} {} + {% + % \pagestyle{plain} + % \pagenumbering{Roman} + % \phantomsection\addcontentsline{toc}{chapter}{中文摘要} % 将摘要插入目录和pdf书签 + \pdfbookmark[0]{中文摘要}{中文摘要} % 将摘要插入pdf书签,与上一行不可共存 + \begin{center} + \kaishu\zihao{-2}{\textbf{ + \uuline{南京大学本科生毕业论文(设计、作品)中文摘要}}} + \end{center} + {\bgroup + \kaishu\zihao{-4} + \tl_set:Nn \tabcolsep {0pt} + \tl_set:Nn \arraystretch {0.8} + \noindent + 题目: \l_@@_info_title_tl \\ + 院系: \l_@@_info_dept_tl \\ + 专业: \l_@@_major_tl \\ + 本科生姓名: \l_@@_info_author_tl \\ + 指导教师(姓名、职称):\l_@@_info_supv_full_tl \\ + 摘要: + \egroup + } + \kaishu\zihao{-4}\par% + }{% + \newpage + } + + % 英文摘要 + \NewDocumentEnvironment{englishabstract} {} + {% + \pagestyle{plain} + % \phantomsection\addcontentsline{toc}{chapter}{英文摘要} % 将摘要插入目录和pdf书签 + \pdfbookmark[0]{英文摘要}{英文摘要} % 将摘要插入pdf书签,与上一行不可共存 + \begin{center} + \kaishu\zihao{-2}{\textbf{\uuline{ + 南京大学本科生毕业论文(设计、作品)英文摘要}}} + \end{center} + { + \bgroup + THESIS: ~~\l_@@_info_title_en_tl \\ + DEPARTMENT: ~~\l_@@_info_dept_en_tl \\ + SPECIALIZATION: ~~\l_@@_major_en_tl \\ + UNDERGRADUATE:~~\l_@@_info_author_en_tl \\ + MENTOR:~~\l_@@_info_supv_full_en_tl \\ + ABSTRACT: + \egroup + } + \zihao{-4}\par% + }{% + \cleardoublepage + \newpage + } +} +% \end{macrocode} +% +% +% \begin{macrocode} +{ + % 研究生摘要环境 + \NewDocumentEnvironment{abstract} {} + {% + \pagestyle{plain} + \pagenumbering{Roman} + % \phantomsection\addcontentsline{toc}{chapter}{中文摘要} % 将摘要插入目录和pdf书签 + \pdfbookmark[0]{中文摘要}{中文摘要} % 将摘要插入pdf书签,与上一行不可共存 + \begin{center} + \kaishu\zihao{-2}{\textbf{\uuline{ + 南京大学研究生毕业论文中文摘要首页用纸}}} + \end{center} + + \bgroup + \kaishu\zihao{4} + \tl_set:Nn \tabcolsep {0pt} + \tl_set:Nn \arraystretch {0.8} + \noindent + 毕业论文题目:\hspace{0.5em}\nju_underline:n {\l_@@_info_title_tl\hfill}\\ + \uline{\makebox[9em]{\l_@@_major_tl}}专业 + \uline{\makebox[4em]{\l_@@_info_grade_tl}}级 + \str_if_eq:NNTF {\l_@@_info_degree_tl} { phd } {博}{硕} + 士生姓名:\uline{\hfill\l_@@_info_author_tl\hfill} \\ + 指导教师(姓名、职称):\uline{\hfill\l_@@_info_supv_full_tl\hfill}\par + \egroup + + \kaishu\zihao{4}\par% + }{% + \newpage + } + + % 英文摘要 + \NewDocumentEnvironment{englishabstract} {} + {% + \pagestyle{plain} + % \phantomsection\addcontentsline{toc}{chapter}{英文摘要} % 将摘要插入目录和pdf书签 + \pdfbookmark[0]{英文摘要}{英文摘要} % 将摘要插入pdf书签,与上一行不可共存 + \begin{center} + \kaishu\zihao{-2}{\textbf{\uuline{ + 南京大学研究生毕业论文英文摘要首页用纸}}} + \end{center} + { + \bgroup + \zihao{4} + THESIS: ~~\l_@@_info_title_en_tl \\ + SPECIALIZATION: ~~\l_@@_major_en_tl \\ + POSTGRADUATE:~~\l_@@_info_author_en_tl \\ + MENTOR:~~\l_@@_info_supv_full_en_tl\par + \egroup + } + \zihao{4}\par% + }{% + \cleardoublepage + \newpage + } +} +% +% \end{macrocode} +% +% +% +% +% \end{implementation} +% +% \PrintIndex diff --git a/macros/unicodetex/latex/njuthesis/njuthesis.pdf b/macros/unicodetex/latex/njuthesis/njuthesis.pdf index 11b1922dea..a254258dd5 100644 Binary files a/macros/unicodetex/latex/njuthesis/njuthesis.pdf and b/macros/unicodetex/latex/njuthesis/njuthesis.pdf differ diff --git a/macros/unicodetex/latex/njuthesis/profile/abstract.sty b/macros/unicodetex/latex/njuthesis/profile/abstract.sty deleted file mode 100644 index 37814cef13..0000000000 --- a/macros/unicodetex/latex/njuthesis/profile/abstract.sty +++ /dev/null @@ -1,136 +0,0 @@ -\ProvidesExplPackage{profile/abstract}{2021-09-11}{0.7.0}{NJU Thesis abstract design} - -% 判断学位 -\str_if_eq:eeTF {\nju_degree} { ug } -{ - % 本科摘要环境 - \NewDocumentEnvironment{abstract} {} - {% - \pagestyle{plain} - \pagenumbering{Roman} - % \phantomsection\addcontentsline{toc}{chapter}{中文摘要} % 将摘要插入目录和pdf书签 - \pdfbookmark[0]{中文摘要}{中文摘要} % 将摘要插入pdf书签,与上一行不可共存 - \begin{center} - \kaishu\zihao{-2}{\textbf{\uuline{南京大学本科生毕业论文(设计、作品)中文摘要}}} - \end{center} - {\bgroup - \kaishu\zihao{-4} - \tl_set:Nn \tabcolsep {0pt} - \tl_set:Nn \arraystretch {0.8} - \noindent - 题目: \nju_title \\ - 院系: \nju_department \\ - 专业: \nju_major \\ - 本科生姓名: \nju_student_name \\ - 指导教师(姓名、职称):\nju_mentor_full \\ - 摘要: - \egroup - } - \kaishu\zihao{-4}\par% - }{% - \newpage - } - - % 中文关键词 - \NewDocumentCommand \keywords {m} {% - \par\vspace{2ex}\noindent% - {\kaishu\zihao{-4}\makebox[4em][s]{关键词{:}}}~{#1}% - } - - % 英文摘要 - \NewDocumentEnvironment{englishabstract} {} - {% - \pagestyle{plain} - % \phantomsection\addcontentsline{toc}{chapter}{英文摘要} % 将摘要插入目录和pdf书签 - \pdfbookmark[0]{英文摘要}{英文摘要} % 将摘要插入pdf书签,与上一行不可共存 - \begin{center} - \kaishu\zihao{-2}{\textbf{\uuline{南京大学本科生毕业论文(设计、作品)英文摘要}}} - \end{center} - { - \bgroup - THESIS: ~~\nju_title_en \\ - DEPARTMENT: ~~\nju_department_en \\ - SPECIALIZATION: ~~\nju_major_en \\ - UNDERGRADUATE:~~\nju_student_name_en \\ - MENTOR:~~\nju_mentor_full_en \\ - ABSTRACT: - \egroup - } - \zihao{-4}\par% - }{% - \cleardoublepage - \newpage - } - - % 英文关键词 - \NewDocumentCommand \englishkeywords {m} {% - \par\vspace{2ex}\noindent% - {KEYWORDS{:}}~~{#1}% - } -} -{ - % 摘要环境 - \NewDocumentEnvironment{abstract} {} - {% - \pagestyle{plain} - \pagenumbering{Roman} - % \phantomsection\addcontentsline{toc}{chapter}{中文摘要} % 将摘要插入目录和pdf书签 - \pdfbookmark[0]{中文摘要}{中文摘要} % 将摘要插入pdf书签,与上一行不可共存 - \begin{center} - \kaishu\zihao{-2}{\textbf{\uuline{南京大学研究生毕业论文中文摘要首页用纸}}} - \end{center} - - \bgroup - \kaishu\zihao{4} - \tl_set:Nn \tabcolsep {0pt} - \tl_set:Nn \arraystretch {0.8} - \noindent - % 毕业论文题目:\ \uline{\nju_title} \\ % 下划线有问题 - 毕业论文题目:\ \nju_title \\ - \uline{\makebox[9em]{\nju_major}}专业\uline{\makebox[3em]{\nju_grade}}级 - \str_if_eq:eeTF {\nju_degree} { d } {博}{硕} - 士生姓名:\uline{\hfill\nju_student_name\hfill} \\ - 指导教师(姓名、职称):\uline{\hfill\nju_mentor_full\hfill}\par - \egroup - - \kaishu\zihao{4}\par% - }{% - \newpage - } - - % 中文关键词 - \NewDocumentCommand \keywords {m} {% - \par\vspace{2ex}\noindent% - {\kaishu\zihao{4}\makebox[4em][s]{关键词{:}}}~{#1}% - } - - % 英文摘要 - \NewDocumentEnvironment{englishabstract} {} - {% - \pagestyle{plain} - % \phantomsection\addcontentsline{toc}{chapter}{英文摘要} % 将摘要插入目录和pdf书签 - \pdfbookmark[0]{英文摘要}{英文摘要} % 将摘要插入pdf书签,与上一行不可共存 - \begin{center} - \kaishu\zihao{-2}{\textbf{\uuline{南京大学研究生毕业论文英文摘要首页用纸}}} - \end{center} - { - \bgroup - \zihao{4} - THESIS: ~~\nju_title_en \\ - SPECIALIZATION: ~~\nju_major_en \\ - POSTGRADUATE:~~\nju_student_name_en \\ - MENTOR:~~\nju_mentor_full_en\par - \egroup - } - \zihao{4}\par% - }{% - \cleardoublepage - \newpage - } - - % 英文关键词 - \NewDocumentCommand \englishkeywords {m} {% - \par\vspace{2ex}\noindent% - {KEYWORDS{:}}~~{#1}% - } -} diff --git a/macros/unicodetex/latex/njuthesis/profile/components.sty b/macros/unicodetex/latex/njuthesis/profile/components.sty deleted file mode 100644 index 4a24fe4f59..0000000000 --- a/macros/unicodetex/latex/njuthesis/profile/components.sty +++ /dev/null @@ -1,173 +0,0 @@ -\ProvidesExplPackage{profile/components}{2021-09-11}{0.6.0}{NJU Thesis components configuration} - -% 图表位置调整 -\floatsetup[lstlisting]{ % Captions for lstlistings - capposition=above,% - margins=centering,% - floatwidth=\textwidth% -} -\floatsetup[figure]{ % Captions for figures - capposition=bottom,% - margins=centering,% - floatwidth=\textwidth% -} -\floatsetup[table]{ % Captions for tables - capposition=above,% - margins=centering,% - floatwidth=\textwidth% -} - -% 代码样式 -\lstset{ - basicstyle=\ttfamily\linespread{1}\small\selectfont, - keywordstyle=\bfseries,% use bold style for keywords - commentstyle=\rmfamily\itshape,% use italic style for comments - stringstyle=\ttfamily,% 字符串风格 - flexiblecolumns,% ? - numbers=left,% left-aligned numbering - showspaces=false,% hide markers for spaces - showstringspaces=false, - captionpos=t,% place the caption at the top - % frame=lrtb,% show all four sides of the frame - % linewidth=.8\textwidth, - % breakatwhitespace=true, - breaklines=true, - xleftmargin=2em,xrightmargin=2em,% set the width of the code environment -} - -\lstdefinestyle{LaTeX}{ - language=TeX, - morekeywords={begin, caption, label, mathrm, frac, toprule, midrule, bottomrule, includegraphics} -} - -% 图表标题样式 -\DeclareCaptionFont{songticap}{\zihao{5}\bf\songti} -\captionsetup{ - font=small,% - labelfont=songticap, - textfont=songticap, - strut=no,% - hypcap=true, % Links point to the top of the figure - % indention=0pt, % Suppress indentation - % % parindent=0pt, % Suppress space between paragraphs - aboveskip=6pt, % Increase the space between the figure and the caption - belowskip=6pt, % Increase the space between the caption and the table -} - -% list configuration -\renewcommand{\labelitemi}{\tiny$\blacktriangleright$} -\renewcommand{\labelitemii}{\textbullet} - -\setlist[itemize]{noitemsep} -\setlist[enumerate]{noitemsep} -\setlist[description]{noitemsep} - -% 数学环境 -\declaretheoremstyle[ - %spaceabove=.5\thm@preskip, - %spacebelow=.5\thm@postskip, - headfont=\bf\songti,%\scshape, - notefont=\songti,% notebraces={ (}{)}, - bodyfont=\songti, - %headformat={\NAME\space\NUMBER\space\NOTE}, - headpunct={}, - %postheadspace={.5em plus .1em minus .1em}, - %prefoothook={\hfill\qedsymbol} - ]{njuthm} - -\theoremstyle{njuthm} - -\let\oldproofname=\proofname -\renewcommand*{\proofname}{\rm\bf\songti{\oldproofname}} % 修改证明环境标题 - -\declaretheorem[ - name=算法, - style=njuthm, - refname={算法,算法}, - Refname={算法,算法}, - % numberwithin=section, -]{algorithm} -\declaretheorem[ - name=假设, - style=njuthm, - refname={假设,假设}, - Refname={假设,假设}, - % numberwithin=section, -]{assumption} -\declaretheorem[ - name=公理, - style=njuthm, - refname={公理,公理}, - Refname={公理,公理}, - % numberwithin=section, -]{axiom} -\declaretheorem[ - name=结论, - style=njuthm, - refname={结论,结论}, - Refname={结论,结论}, - % numberwithin=section, -]{conclusion} -\declaretheorem[ - name=条件, - style=njuthm, - refname={条件,条件}, - Refname={条件,条件}, - % numberwithin=section, -]{condition} -\declaretheorem[ - name=推论, - style=njuthm, - refname={推论,推论}, - Refname={推论,推论}, - % numberwithin=section, -]{corollary} -\declaretheorem[ - name=定义, - style=njuthm, - refname={定义,定义}, - Refname={定义,定义}, - % numberwithin=section, -]{definition} -\declaretheorem[ - name=例, - style=njuthm, - refname={例,例}, - Refname={例,例}, - % numberwithin=section, -]{example} -\declaretheorem[ - name=引理, - style=njuthm, - refname={引理,引理}, - Refname={引理,引理}, - % numberwithin=section, -]{lemma} -\declaretheorem[ - name=性质, - style=njuthm, - refname={性质,性质}, - Refname={性质,性质}, - % numberwithin=section, -]{property} -\declaretheorem[ - name=命题, - style=njuthm, - refname={命题,命题}, - Refname={命题,命题}, - % numberwithin=section, -]{proposition} -\declaretheorem[ - name=注解, - style=njuthm, - refname={注解,注解}, - Refname={注解,注解}, - % numberwithin=section, -]{remark} -\declaretheorem[ - name=定理, - style=njuthm, - refname={定理,定理}, - Refname={定理,定理}, - numberwithin=section, -]{theorem} diff --git a/macros/unicodetex/latex/njuthesis/profile/cover.sty b/macros/unicodetex/latex/njuthesis/profile/cover.sty deleted file mode 100644 index 8293e64780..0000000000 --- a/macros/unicodetex/latex/njuthesis/profile/cover.sty +++ /dev/null @@ -1,251 +0,0 @@ -\ProvidesExplPackage{profile/cover}{2021-09-11}{0.7.0}{NJU Thesis cover design} - -% 拼合标题 -\tl_const:Nn \nju_title {\nju_title_a \nju_title_b \nju_title_c} - -% 拼合导师 -\bool_if:NTF \nju_second_mentor -{ - \tl_const:Nn \nju_mentor_full - { - \nju_mentor_a\ \nju_mentor_a_title - \ \ \nju_mentor_b\ \nju_mentor_b_title - } - \tl_const:Nn \nju_mentor_full_en - { - \nju_mentor_a_en\ \nju_mentor_a_title_en - \ \ \nju_mentor_b_en\ \nju_mentor_b_title_en - } -} -{ - \tl_const:Nn \nju_mentor_full - { - \nju_mentor_a\ \nju_mentor_a_title - } - \tl_const:Nn \nju_mentor_full_en - { - \nju_mentor_a_en\ \nju_mentor_a_title_en - } -} - -% 封面下划线 -\cs_new:Npn \nju_cover_underline_ug:nn #1 #2 { - \uline{\makebox[#1]{\rm\songti#2}} -} -\cs_new:Npn \nju_cover_underline_g:n #1 { - \uline{\makebox[215pt]{\rm\kaishu#1}} -} - -% 封面表格边框 -\cs_new:Npn \nju_coverbox_ug:n #1 { - \makebox[4.2em][s]{#1} -} -\cs_new:Npn \nju_coverbox_g:n #1 { - \makebox[6em][s]{#1\hspace{1em}} -} - -% 判断学位 -\str_if_eq:eeTF {\nju_degree} { ug } -{ \tl_const:Nn \nju_degree_name {本\hfill 科\hfill } } % 本科 -{ - % 本科以外都是研究生 - \tl_const:Nn \nju_degree_name {研\hfill 究\hfill 生\hfill } - - % 研究生类别 - \str_case_e:nn { \nju_degree } - { - { mg } { \tl_const:Nn \nju_degree_title {硕士} } - { mf } { \tl_const:Nn \nju_degree_title {硕士专业} } - { d } { \tl_const:Nn \nju_degree_title {博士} } - } -} - -% 判断类型 -\str_if_eq:eeTF {\nju_type} {thesis} -{\tl_const:Nn \nju_type_name {\nju_degree_name 毕\hfill 业\hfill 论\hfill 文}} -{\tl_const:Nn \nju_type_name {\nju_degree_name 毕\hfill 业\hfill 设\hfill 计}} - -% 封面信息栏 本科 -\tl_new:N \nju_printcoverinfo_ug -\tl_set:Nn \nju_printcoverinfo_ug { - \begin{tabular}{p{4.2em}c} - \nju_coverbox_ug:n {院\hfill 系} - & \nju_cover_underline_ug:nn {250pt}{\nju_department}\\ - \nju_coverbox_ug:n {专\hfill 业} - & \nju_cover_underline_ug:nn {250pt}{\nju_major}\\ - - % 标题换行 - \int_case:nn {\nju_titlelength} - { - { 1 } { - \nju_coverbox_ug:n {题\hfill 目} - & \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_a}} \\ } - { 2 } { - \nju_coverbox_ug:n {题\hfill 目} - & \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_a}} \\ - & \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_b}} \\ } - { 3 } { - \nju_coverbox_ug:n {题\hfill 目} - & \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_a}} \\ - & \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_b}} \\ - & \nju_cover_underline_ug:nn {250pt}{\bf{\nju_title_c}} \\} - } - \end{tabular}\\ - - \begin{tabular}{p{4.2em}cp{4.2em}c} - \nju_coverbox_ug:n {年\hfill 级} - & \nju_cover_underline_ug:nn {90pt}{\nju_grade} - & \nju_coverbox_ug:n {学\hfill 号} - & \nju_cover_underline_ug:nn {90pt}{\nju_student_id}\\ - \end{tabular}\\ - - \begin{tabular}{p{4.2em}c} - \nju_coverbox_ug:n {学\hfill 生\hfill 姓\hfill 名} - & \nju_cover_underline_ug:nn {250pt}{\nju_student_name} - \end{tabular}\\ - \begin{tabular}{p{4.2em}cp{4.2em}c} - \nju_coverbox_ug:n {导\hfill 师} - & \nju_cover_underline_ug:nn {90pt}{\nju_mentor_a} - & \nju_coverbox_ug:n {职\hfill 称} - & \nju_cover_underline_ug:nn {90pt}{\nju_mentor_a_title}\\ - - % 第二导师 - \bool_if:NTF \nju_second_mentor - { - \nju_coverbox_ug:n {第\hfill 二\hfill 导\hfill 师} - & \nju_cover_underline_ug:nn {90pt}{\nju_mentor_b} - & \nju_coverbox_ug:n {职\hfill 称} - & \nju_cover_underline_ug:nn {90pt}{\nju_mentor_b_title}\\ - } - {} - \end{tabular}\\ - - \begin{tabular}{p{4.2em}c} - \nju_coverbox_ug:n {提\hfill 交\hfill 日\hfill 期} - & \nju_cover_underline_ug:nn {250pt}{\nju_submit_date}\\ - \end{tabular} -} - -% 封面信息栏 研究生 -\tl_new:N \nju_printcoverinfo_g -\tl_set:Nn \nju_printcoverinfo_g { - \begin{tabular}{p{6em}c} - % 标题换行 - \int_case:nn {\nju_titlelength} - { - { 1 } { - \nju_coverbox_g:n {论\hfill 文\hfill 题\hfill 目} - & \nju_cover_underline_g:n {\nju_title_a} \\ } - { 2 } { - \nju_coverbox_g:n {论\hfill 文\hfill 题\hfill 目} - & \nju_cover_underline_g:n {\nju_title_a} \\ - & \nju_cover_underline_g:n {\nju_title_b} \\ } - { 3 } { - \nju_coverbox_g:n {论\hfill 文\hfill 题\hfill 目} - & \nju_cover_underline_g:n {\nju_title_a} \\ - & \nju_cover_underline_g:n {\nju_title_b} \\ - & \nju_cover_underline_g:n {\nju_title_c} \\} - } - - \nju_coverbox_g:n {作\hfill 者\hfill 姓\hfill 名} - & \nju_cover_underline_g:n {\nju_student_name}\\ - \nju_coverbox_g:n {专\hfill 业\hfill 名\hfill 称} - & \nju_cover_underline_g:n {\nju_major}\\ - \nju_coverbox_g:n {研\hfill 究\hfill 方\hfill 向} - & \nju_cover_underline_g:n {\nju_field}\\ - \nju_coverbox_g:n {指\hfill 导\hfill 教\hfill 师} - & \nju_cover_underline_g:n {\nju_mentor_full}\\ - \end{tabular} -} - -% 绘制封面命令 -\tl_new:N \nju_printcover_ug % 本科封面 -\tl_new:N \nju_printcover_g % 研究生封面 - -% 本科封面 -\tl_set:Nn \nju_printcover_ug { - \thispagestyle{empty} - \pagenumbering{Roman} - % Start - \pdfbookmark{封面}{封面} % 将封面插入pdf书签 - \begin{spacing}{1.25} - \vskip 0mm - \hspace{-10mm} - \includegraphics[height=3cm]{njulogo}\smallskip - \begin{center} - \includegraphics[height=3.35cm]{njuname} - \vskip 10mm - {\zihao{1}\makebox[9em][s]{\bf{\songti\nju_type_name}}} - \vfill - \vskip\stretch{0} - {\bgroup - \kaishu\zihao{3} - \def\tabcolsep{1pt} - \def\arraystretch{1.5} - \nju_printcoverinfo_ug % 绘制信息框 - \egroup} - \vfill - \end{center} - \end{spacing} - \cleardoublepage - \vfill - % \newpage -} - -% 研究生封面 -\tl_set:Nn \nju_printcover_g { - \thispagestyle{empty} - \pagenumbering{Roman} - % Start - \pdfbookmark{封面}{封面} % 将封面插入pdf书签 - \begin{spacing}{1.25} - \begin{center} - \hspace{0pt} \vskip 5mm - \includegraphics[height=1.9cm]{njulogo} - \vskip 10mm - \includegraphics[height=1.9cm]{njuname-large} - \vskip 15mm - {\zihao{1}\makebox[10em][s]{\bf{\kaishu\nju_type_name}}} - \vskip 5mm - {\zihao{1}\bf{\kaishu{(申请\nju_degree_title 学位)}}} - \par\vfill - \vskip\stretch{0} - {\bgroup - \bf\kaishu\zihao{3} - \def\tabcolsep{1pt} - \def\arraystretch{1.5} - \vskip 10mm - \nju_printcoverinfo_g % 绘制信息框 - \egroup} - \vfill - \vskip 10mm - \bf\kaishu\zihao{4}\nju_submit_date - \vskip 15mm - \end{center} - \end{spacing} - - \newpage % 封面背面 - \thispagestyle{empty} - \begin{spacing}{1.625} - % TODO: 等待调整格式 - \hspace{0pt} \vfill - {\bgroup - \bf\kaishu\zihao{3} - \makebox[6em][s]{学\hfill 号}:\nju_student_id - \par - \makebox[6em][s]{论文答辩日期}:\nju_defense_date - \par - \makebox[6em][s]{指\hfill 导\hfill 教\hfill 师}:\hspace{50mm}(签字) - \par - \egroup} - \vskip 15mm - \end{spacing} - \cleardoublepage -} - -% 重定义maketitle生成封面 -\RenewDocumentCommand \maketitle {} {% - \str_if_eq:eeTF {\nju_degree} { ug } - { \nju_printcover_ug } % 本科封面 - { \nju_printcover_g } % 研究生封面 -} diff --git a/macros/unicodetex/latex/njuthesis/profile/font.sty b/macros/unicodetex/latex/njuthesis/profile/font.sty deleted file mode 100644 index d939fb4842..0000000000 --- a/macros/unicodetex/latex/njuthesis/profile/font.sty +++ /dev/null @@ -1,219 +0,0 @@ -\ProvidesExplPackage{profile/font}{2021-09-11}{0.7.0}{NJU Thesis font configuration} - -% \RequireXeTeX -% \RequireLuaTeX - -% 设置西文字体 -\NewDocumentCommand\set_latin_fontset_windows{}{ - \setmainfont{Times~New~Roman} - \setsansfont{Arial} - \setmonofont{Courier~New}[Scale=MatchLowercase] -} - -\NewDocumentCommand\set_latin_fontset_macos{}{ - \setmainfont{Times~New~Roman} - \setsansfont{Arial} - \setmonofont{Menlo}[Scale=MatchLowercase] -} - -\NewDocumentCommand\set_latin_fontset_gyre{}{ - \setmainfont{texgyretermes}[ - Extension=.otf, - UprightFont=*-regular, - BoldFont=*-bold, - ItalicFont=*-italic, - BoldItalicFont=*-bolditalic] - \setsansfont{texgyreheros}[ - Extension=.otf, - UprightFont=*-regular, - BoldFont=*-bold, - ItalicFont=*-italic, - BoldItalicFont=*-bolditalic] - \setmonofont{texgyrecursor}[ - Extension=.otf, - UprightFont=*-regular, - BoldFont=*-bold, - ItalicFont=*-italic, - BoldItalicFont=*-bolditalic, - Scale=MatchLowercase, - Ligatures=CommonOff] -} - -% 设置中文字体 -\NewDocumentCommand\set_chinese_fontset_windows{}{ - \setCJKmainfont{SimSun}[ - AutoFakeBold=2.17, - ItalicFont=KaiTi] - \setCJKsansfont{SimHei} - \setCJKmonofont{FangSong} - \setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold=2.17] - \setCJKfamilyfont{zhhei}{SimHei} - \setCJKfamilyfont{zhfs}{FangSong} - \setCJKfamilyfont{zhkai}{KaiTi}[AutoFakeBold=2.17] - \setCJKfamilyfont{zhnewhei}{Microsoft~YaHei}[BoldFont=Microsoft~YaHei~Bold] -} - -\NewDocumentCommand\set_chinese_fontset_macos{}{ - \msg_redirect_name:nnn {fontspec} {no-script} {info} % 移除 does not contain script "CJK" 警告 - \setCJKmainfont{Songti~SC~Light}[ - BoldFont=Songti~SC~Bold, - ItalicFont=Kaiti~SC, - BoldItalicFont=Kaiti~SC~Bold] - \setCJKsansfont{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] - \setCJKmonofont{STFangsong} - \setCJKfamilyfont{zhsong}{Songti~SC~Light}[BoldFont=Songti~SC~Bold] - \setCJKfamilyfont{zhhei}{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium] - \setCJKfamilyfont{zhfs}{STFangsong} - \setCJKfamilyfont{zhkai}{Kaiti~SC}[BoldFont=Kaiti~SC~Bold] - \setCJKfamilyfont{zhnewhei}{PingFang~SC} -} - -\NewDocumentCommand\set_chinese_fontset_fandol{}{ - \msg_redirect_name:nnn {fontspec} {no-script} {info} % 移除 does not contain script "CJK" 警告 - \setCJKmainfont{FandolSong-Regular}[ - Extension=.otf, - BoldFont=FandolSong-Bold, - ItalicFont=FandolKai-Regular] - \setCJKsansfont{FandolHei-Regular}[ - Extension=.otf, - BoldFont=FandolHei-Bold] - \setCJKmonofont{FandolFang-Regular}[Extension=.otf] - \setCJKfamilyfont{zhsong}{FandolSong-Regular}[ - Extension=.otf, - BoldFont=FandolSong-Bold] - \setCJKfamilyfont{zhhei}{FandolHei-Regular}[ - Extension=.otf, - BoldFont=FandolHei-Bold] - \setCJKfamilyfont{zhfs}{FandolFang-Regular}[Extension=.otf] - \setCJKfamilyfont{zhkai}{FandolKai-Regular}[ - Extension=.otf, - AutoFakeBold=2.17] -} - -% 方正字符集 -\NewDocumentCommand\set_chinese_fontset_founder{}{ - % FZSSK 方正书宋(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/151 免费商用 - % FZXBSK 方正小标宋(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/164 设计师非商免费 - % FZKTK 方正楷体(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/137 免费商用 - \setCJKmainfont{FZSSK}[ - Extension=.ttf, - BoldFont=FZXBSK, - ItalicFont=FZKTK] - % FZXH1K 方正细黑一(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/161 设计师非商免费 - % FZHTK 方正黑体(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/131 免费商用 - \setCJKsansfont{FZXH1K}[ - Extension=.ttf, - BoldFont=FZHTK] - % FZFSK 方正仿宋(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/128 - \setCJKmonofont{FZFSK}[Extension=.ttf] - - \setCJKfamilyfont{zhsong}{FZSSK}[ - Extension=.ttf, - BoldFont=FZXBSK] - \setCJKfamilyfont{zhhei}{FZHTK}[ - Extension=.ttf, - AutoFakeBold=2.17] - \setCJKfamilyfont{zhfs}{FZFSK}[Extension=.ttf] - \setCJKfamilyfont{zhkai}{FZKTK}[Extension=.ttf] - % FZYouHK_508R 方正悠黑508R(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/244 设计师非商免费 - % FZYouHK_511M 方正悠黑511M(简繁扩展) http://www.foundertype.com/index.php/FontInfo/index/id/244 设计师非商免费 - \setCJKfamilyfont{zhnewhei}{FZYouHK_508R}[ - Extension=.ttf, - BoldFont=FZYouHK_511M] -} - -\NewDocumentCommand\set_chinese_fontset_noto{}{ - % 思源宋体 https://www.google.com/get/noto/#serif-hans - \setCJKmainfont[ - UprightFont=NotoSerifCJKsc-Regular, - BoldFont=NotoSerifCJKsc-Bold, - ItalicFont=NotoSerifCJKsc-Regular, - BoldItalicFont=NotoSerifCJKsc-Bold, - ItalicFeatures=FakeSlant, - BoldItalicFeatures=FakeSlant]{Noto~Serif~CJK~SC} - - % 思源黑体 https://www.google.com/get/noto/#sans-hans - \setCJKsansfont[ - UprightFont=NotoSansCJKsc-Regular, - BoldFont=NotoSansCJKsc-Bold, - ItalicFont=NotoSansCJKsc-Regular, - BoldItalicFont=NotoSansCJKsc-Bold, - ItalicFeatures=FakeSlant, - BoldItalicFeatures=FakeSlant]{Noto~Sans~CJK~SC} - - % 包含于上述思源黑体 - \setCJKmonofont[ - UprightFont=NotoSansMonoCJKsc-Regular, - BoldFont=NotoSansMonoCJKsc-Bold, - ItalicFont=NotoSansMonoCJKsc-Regular, - BoldItalicFont=NotoSansMonoCJKsc-Bold, - ItalicFeatures=FakeSlant, - BoldItalicFeatures=FakeSlant]{Noto~Sans~Mono~SC} - - \setCJKfamilyfont{zhsong}{Noto~Serif~CJK~SC} - \setCJKfamilyfont{zhhei}{Noto~Sans~CJK~SC} - - % 方正楷体、方正仿宋为免费商用字体,且支持CJK字符集 - % 方正仿宋 http://www.foundertype.com/index.php/FontInfo/index/id/128.html - % 方正楷体 http://www.foundertype.com/index.php/FontInfo/index/id/137.html - \setCJKfamilyfont{zhfs}{方正仿宋简体}[AutoFakeBold=2.17] - \setCJKfamilyfont{zhkai}{方正楷体简体}[AutoFakeBold=2.17] -} - -% 字体判断 -\bool_if:NTF \nju_systemfont -% 根据操作系统自动选择相应字体 -{ - % 检测是否是 Windows - \sys_if_platform_windows:TF - { - \set_latin_fontset_windows - \set_chinese_fontset_windows - } - { - % 检测是否是 macOS - \ctex_if_platform_macos:TF - { - \set_latin_fontset_macos - \set_chinese_fontset_macos - } - % 其余系统一律使用自由字体 - { - \set_latin_fontset_gyre - \set_chinese_fontset_fandol - } - } -} -{ - % 如果用户需要自定义字体 - % 此处需要使用\str_case_e而不是\str_case使宏展开为字符串 - \str_case_e:nn { \nju_customlatinfont } - { - { windows } { \set_latin_fontset_windows } - { macos } { \set_latin_fontset_macos } - { gyre } { \set_latin_fontset_gyre } - { null } {} - } - \str_case_e:nn { \nju_customchinesefont } - { - { windows } { \set_chinese_fontset_windows } - { macos } { \set_chinese_fontset_macos } - { gyre } { \set_chinese_fontset_gyre } - { founder } { \set_chinese_fontset_founder } - { noto } { \set_chinese_fontset_noto } - { null } {} - } -} -% 选择其他字体,请确保相应字体已安装 - -% 设置数学字体 (XITS, 或者 STIX, 与 Times New Roman 最为相近) -% \setmathfont{STIXTwoMath-Regular}[Extension = .otf] -\setmathfont{XITSMath-Regular}[ - BoldFont = XITSMath-Bold, - Extension = .otf] - -\NewDocumentCommand\songti{}{\CJKfamily{zhsong}} -\NewDocumentCommand\heiti{}{\CJKfamily{zhhei}} -\NewDocumentCommand\fangsong{}{\CJKfamily{zhfs}} -\NewDocumentCommand\kaishu{}{\CJKfamily{zhkai}} -% \NewDocumentCommand\lishu{}{\CJKfamily{zhli}} diff --git a/macros/unicodetex/latex/njuthesis/profile/packages.sty b/macros/unicodetex/latex/njuthesis/profile/packages.sty deleted file mode 100644 index 029488b787..0000000000 --- a/macros/unicodetex/latex/njuthesis/profile/packages.sty +++ /dev/null @@ -1,71 +0,0 @@ -\ProvidesExplPackage{profile/packages}{2021-09-11}{0.6.0}{NJU Thesis packages used} - -\RequirePackage{expl3} -\RequirePackage{ifxetex} -\RequirePackage{fontspec} -\RequirePackage[ - top=2.5cm, - bottom=2.5cm, - left=3.2cm, - right=3.2cm -]{geometry} -\RequirePackage{ifthen} -\RequirePackage{xparse} -% \RequirePackage{etoolbox} -\RequirePackage{titlesec} % 修改章节标题功能由CTeX提供 -\RequirePackage{titletoc} -% \RequirePackage{appendix} % 定义附录样式 -\RequirePackage{fancyhdr} % 调整页眉页脚 -\RequirePackage[hyphens]{url} % generate better linebreaks in the url -% \RequirePackage[normalem]{ulem} % 绘制下划线 -% \RequirePackage{soul} % 用不起来 -% \RequirePackage{soulutf8} -\RequirePackage{dashundergaps} -\RequirePackage{setspace} -\RequirePackage{lastpage} -\RequirePackage{emptypage} % 清除空白页的页码 -\RequirePackage{listings} % 代码环境 -\RequirePackage{enumitem} % 用于修改列表环境 -\RequirePackage{caption} -\RequirePackage{floatrow} % 用于图表等页面元素的定位 -\RequirePackage{booktabs} % 用于绘制三线表 -\RequirePackage{multirow} % Cells occupying multiple rows in tables -\RequirePackage{multicol} % Multiple columns in dictionary -\RequirePackage{siunitx} % 用于书写单位符号 -\RequirePackage[version=4]{mhchem} % 用于绘制分子式 -\RequirePackage{hologo} % 用于生成可以被插入书签的LaTeX logo -% \RequirePackage{needspace} % Required to prevent page break right after a sectioning command -% \RequirePackage{xspace} % Better print trailing whitespace -\sys_if_engine_xetex:T{ - \RequirePackage{microtype}} -% \sys_if_engine_luatex:T{ -% \RequirePackage{emoji} -% \setemojifont{Segoe UI Emoji} % For windows. -% % Shipped with the best `grinning-face-with-sweat' support. -% % Use `Apple Color Emoji' for macos -% % or `Noto Color Emoji' if you prefer. -% } - -\RequirePackage{blindtext} % 生成用于测试的大段无意义英文文字 -\RequirePackage{zhlipsum} % 生成用于测试的大段无意义中文文字 -% \RequirePackage{showframe} % 加载以后展示内容边界 - -\RequirePackage{amsmath} % Must be loaded before unicode-math -\RequirePackage{amsthm} % Mathematical environments -\RequirePackage{mathtools} % Mathematical tools to use with amsmath -\RequirePackage{thmtools} % Theorem styles -\RequirePackage[ - warnings-off={% 消除与mathtools合用产生的警告 - mathtools-colon, - mathtools-overbracket} - ]{unicode-math} % Math fonts in xetex or luatex - -\RequirePackage{graphicx} -\DeclareGraphicsExtensions{.pdf,.eps,.jpg,.png} -\graphicspath{{figure/}} % 图片路径 -\RequirePackage{wrapfig} % Wrap text around figures - -% 必须以该顺序加载以下三个包 -% \RequirePackage{varioref} -\RequirePackage[hidelinks,bookmarksnumbered=true]{hyperref} -\RequirePackage[capitalise,nameinlink,noabbrev]{cleveref} diff --git a/macros/unicodetex/latex/njuthesis/profile/page.sty b/macros/unicodetex/latex/njuthesis/profile/page.sty deleted file mode 100644 index e926fa73ea..0000000000 --- a/macros/unicodetex/latex/njuthesis/profile/page.sty +++ /dev/null @@ -1,54 +0,0 @@ -\ProvidesExplPackage{profile/page}{2021-09-11}{0.6.0}{NJU Thesis page layout} - -% 论文页码 页脚居中、五号阿拉伯数字(新罗马体)连续编码 -\fancypagestyle{njuplain}{% - \fancyhead{} - \fancyfoot[C]{\zihao{5}\thepage} -} -% the header line -\tl_set:Nn \headrulewidth {0pt} -% the footer line -\tl_set:Nn \footrulewidth {0pt} - -\AtBeginDocument{\pagestyle{njuplain}} % 无页眉页脚 - -% ctex格式设置 -% 目录标题 三号宋体加粗 -% 各部分标题 四号黑体 -\ctexset{ - contentsname = \songti\bfseries\zihao{3}目\hspace{2em} 录, - chapter/format = \zihao{4}\heiti\centering, - section/format = \zihao{4}\heiti\raggedright, - subsection/format = \zihao{4}\heiti\raggedright, - subsubsection/format = \zihao{4}\heiti\raggedright -} - -% 重定义目录中章节标题样式 -% 目录内容中章的标题 四号黑体 -% 目录中其他内容 小四号宋体 -\titlecontents{chapter}% 标题级别 - [5em]% 标题左间距 - {\heiti\zihao{4}\vspace{10pt}}% 标题格式 - {\contentslabel{4em}}% 标题标志 - {\hspace*{-4em}}% 无序号标题 - {~\titlerule*[0.6pc]{$.$}~\contentspage}% 指引线与页码 - -\titlecontents{section} - [5em] - {\zihao{-4}\vspace{0pt}} - {\contentslabel{2.5em}} - {\hspace*{-4em}} - {~\titlerule*[0.6pc]{$.$}~\contentspage} - -\titlecontents{subsection} - [8em] - {\zihao{-4}\vspace{0pt}} - {\contentslabel{3em}} - {\hspace*{-4em}} - {~\titlerule*[0.6pc]{$.$}~\contentspage} - -% 将目录页插入pdf书签 -\let\savedtableofcontents\tableofcontents -\renewcommand{\tableofcontents}{% - \pdfbookmark{目录}{目录} - \savedtableofcontents} diff --git a/macros/unicodetex/latex/njuthesis/profile/reference.sty b/macros/unicodetex/latex/njuthesis/profile/reference.sty deleted file mode 100644 index 4087f9f561..0000000000 --- a/macros/unicodetex/latex/njuthesis/profile/reference.sty +++ /dev/null @@ -1,68 +0,0 @@ -\ProvidesExplPackage{profile/reference}{2021-09-11}{0.6.0}{NJU Thesis bibliography and reference} - -% biblatex设置 -\RequirePackage[ - style=gb7714-2015, - %style=numeric-comp, - %citestyle=authortitle-icomp, - % citestyle=numeric-comp, - %bibstyle=authoryear, - % bibstyle=numeric, - sorting=none, - %sorting=nyt, - %sortcites=true, - %autocite=footnote, - backend=biber, % Compile the bibliography with biber - hyperref=true, - backref=false, - citecounter=true, - pagetracker=true, - citetracker=true, - ibidtracker=context, - autopunct=true, - autocite=plain, - % gbpub=false, % Uncomment if you do NOT want '[S.l. : s.n.]' in reference entries, GitHub Issue (#47) - % gbnamefmt=lowercase, % Uncomment if you do NOT want uppercase author names in reference entries, GitHub Issue (#23) -]{biblatex} - -% Remove some unwanted entries from the bibliography -\AtEveryBibitem{ - \clearfield{abstract} - \clearfield{issn} - \clearfield{isbn} - \clearfield{archivePrefix} - \clearfield{arxivId} - \clearfield{pmid} - \clearfield{eprint} - \ifentrytype{online}{}{\ifentrytype{misc}{}{\clearfield{url}}} - % \ifentrytype{book}{\clearfield{doi}}{} -} - -% 修改标签名称 -\crefdefaultlabelformat{#2#1#3\,} % 默认在名称后面添加空格 - -\crefname{figure}{图}{图} -\crefname{table}{表}{表} -% \crefname{equation}{公式}{公式} -\crefformat{equation}{公式~#2#1#3~} % 删除公式编号的括号 - -\crefformat{chapter}{第#2#1#3章} -\crefformat{section}{第~#2#1#3~节} -\crefformat{subsection}{第~#2#1#3~小节} -\crefformat{subsubsection}{第~#2#1#3~小节} -% \crefname{chapter}{§}{§} -% \crefname{section}{§}{§} -% \crefname{subsection}{§}{§} -% \crefname{subsubsection}{§}{§} -\crefname{appendix}{附录}{附录} - -% \crefname{definition}{定义}{定义} -% \crefname{axiom}{公理}{公理} -% \crefname{property}{性质}{性质} -% \crefname{proposition}{命题}{命题} -% \crefname{lemma}{引理}{引理} -% \crefname{corollary}{推论}{推论} -% \crefname{remark}{注解}{注解} -% \crefname{condition}{条件}{条件} -% \crefname{conclusion}{结论}{结论} -% \crefname{assumption}{假设}{假设} -- cgit v1.2.3