|
703 | 703 | tabularFontSize .tl_set:N = \l_@@_misc_tabular_font_size_tl,
|
704 | 704 | tabularFontSize .initial:n = {5},
|
705 | 705 | arialFont .tl_set:N = \l_@@_misc_arial_font_path_tl,
|
706 |
| - autoref / algo .code:n = { |
707 |
| - \AtBeginDocument{ |
708 |
| - % 定义算法标题 |
709 |
| - % 针对 algorithm 宏包 |
710 |
| - \tl_set:Nn \ALG@name {#1} |
711 |
| - % 针对 algorithm2e 宏包 |
712 |
| - \tl_set:Nn \algorithmcfname {#1} |
713 |
| - |
714 |
| - % 定义算法的 autoref |
715 |
| - % algorithm2e 宏包会覆写它,所以我们必须AtBeginDocument时再修改 |
716 |
| - \tl_set:Nn \algorithmautorefname {#1} |
717 |
| - } |
718 |
| - }, |
| 706 | + autoref / algo .tl_set:N = \l_@@_misc_autoref_algo_tl, |
719 | 707 | autoref / algo .initial:n = {\g_@@_const_autoref_algo_tl},
|
720 | 708 | autoref / them .tl_set:N = \themautorefname,
|
721 | 709 | autoref / them .initial:n = {\g_@@_const_autoref_them_tl},
|
|
985 | 973 | % \subsubsection{定义模板类样式}
|
986 | 974 | %
|
987 | 975 | % 加载所需的宏包。
|
| 976 | +% |
| 977 | +% 在加载宏包之前,尽量不使用 AtBeginDocument 等 hook。 |
| 978 | +% 因为 listings 等宏包也会用这些 hook。若在加载它们之前使用 hook,会导致我们所有 hook 在这些宏包“之前”运行。 |
| 979 | +% |
988 | 980 | % \begin{macrocode}
|
989 | 981 | \RequirePackage{geometry}
|
990 | 982 | \RequirePackage[table,xcdraw]{xcolor}
|
|
1675 | 1667 | \cs_gset:Npn \thelstlisting {\thechapter\g_@@_label_divide_char_tl\arabic{lstlisting}}
|
1676 | 1668 | \cs_gset:Npn \lstlistingname {\c_@@_label_code_tl}
|
1677 | 1669 |
|
| 1670 | + % 定义算法标题 |
| 1671 | + % 针对 algorithm 宏包 |
| 1672 | + \tl_set:Nn \ALG@name {\l_@@_misc_autoref_algo_tl} |
| 1673 | + % 针对 algorithm2e 宏包 |
| 1674 | + \tl_set:Nn \algorithmcfname {\l_@@_misc_autoref_algo_tl} |
| 1675 | + |
| 1676 | + % 定义算法的 autoref |
| 1677 | + % algorithm2e 宏包会覆写它,所以我们必须AtBeginDocument时再修改 |
| 1678 | + \tl_set:Nn \algorithmautorefname {\l_@@_misc_autoref_algo_tl} |
| 1679 | + |
1678 | 1680 | % 算法变成「章节号-序号」
|
1679 | 1681 | % 为了减少修改,我们只适配按章编号的情况。
|
1680 | 1682 | % 针对 algorithm 宏包
|
|
0 commit comments