diff --git a/sjtutex/source/sjtutex.dtx b/sjtutex/source/sjtutex.dtx index f7a18cbb..1c02c4cc 100644 --- a/sjtutex/source/sjtutex.dtx +++ b/sjtutex/source/sjtutex.dtx @@ -1185,12 +1185,13 @@ % 页脚字体。默认为 |\zihao{-5}|,小五号字。 % \end{function} % -% \begin{function}[added=2022-12-03]{style/page-number} +% \begin{function}[added=2022-12-03,updated=2024-12-30]{style/page-number} % \begin{syntax} -% \OPT{page-number} = \marg{页码设置} +% \OPT{page-number} = \marg{格式定义} % \end{syntax} -% 设置页码的显示样式,其中 |#1| 代表当前页码。 -% 默认为 |{#1}|,即仅显示页码本身。 +% 设置页码的显示格式,\meta{格式定义} 有两个参数:参数 |#1| 是当前页码,参数 |#2| 是当前编码的总页码数。 +% 获取总页码数需要使用 \pkg{pageslts} 宏包。 +% 默认为 |{#1}|,即仅显示当前页码。 % \end{function} % % \begin{function}[added=2023-11-30]{style/keywords-format} @@ -3498,13 +3499,14 @@ % \end{macro} % % \begin{macro}{style/page-number} -% \begin{macro}[int]{\@@_page:n} +% \begin{macro}[int]{\@@_page:nn} % 页脚页码格式。 % \begin{macrocode} -\cs_new:Nn \@@_thepage: { \thepage } +\tl_set:Nn \@@_the_page_tl { \thepage } +\tl_new:N \@@_the_last_page_tl \keys_define:nn { sjtu / style } { - page-number .cs_set:Np = \@@_page:n #1 , + page-number .cs_set:Np = \@@_page:nn #1#2 , page-number .initial:n = { {#1} } } % \end{macrocode} @@ -3543,7 +3545,7 @@ \fancyhead [ L ] { \l_@@_header_tl } \fancyhead [ R ] { \@@_nouppercase:V \l_@@_rightmark_tl } } -\fancyfoot [ C ] { \@@_page:n { \@@_thepage: } } +\fancyfoot [ C ] { \@@_page:nn { \@@_the_page_tl } { \@@_the_last_page_tl } } % \end{macrocode} % % \begin{macro}{\headrule} @@ -5248,6 +5250,7 @@ % \begin{macro}{digest} % 大摘要。 % \begin{macrocode} +\NewHook { sjtutex / digest } \NewDocumentEnvironment { digest } { O{ } +b } { \AtEndDocument @@ -5257,7 +5260,8 @@ \legacy_if:nTF { @openright } { \cleardoublepage } { \clearpage } \pagenumbering { roman } - \cs_gset:Nn \@@_thepage: { \arabic { page } } + \tl_gset:Nn \@@_the_page_tl { \arabic { page } } + \UseHook { sjtutex / digest } \cs_gset_eq:NN \addcontentsline \use_none:nnn \clist_map_inline:Nn \l_@@_counter_without_chapter_clist { @@ -5415,6 +5419,26 @@ } % \end{macrocode} % +% \changes{unreleased}{2024/12/30}{使用 \pkg{pageslts} 宏包获取总页码。} +% \subsubsection{\pkg{pageslts} 宏包} +% +% \begin{macrocode} +\ctex_at_end_package:nn { pageslts } + { +% \pagenumbering { Alph } +% \pagenumbering { arabic } + \tl_set:Nn \@@_the_last_page_tl + { \lastpageref { pagesLTS.\pagesLTS@pnc } } +%<*thesis> + \AddToHook { sjtutex / digest } + { + \tl_gset:Nn \@@_the_last_page_tl + { \lastpageref { pagesLTS.roman.local } } + } +% + } +% \end{macrocode} +% % \subsubsection{\pkg{threeparttable} 宏包} % % \begin{macrocode}