Skip to content

Commit 1a62cc5

Browse files
committed
fix: add autoref label for figure(fig),table(tab),euqation(equ)
1 parent 03aed48 commit 1a62cc5

File tree

6 files changed

+104
-5
lines changed

6 files changed

+104
-5
lines changed

Diff for: bithesis.dtx

+26-4
Original file line numberDiff line numberDiff line change
@@ -1197,9 +1197,9 @@
11971197
% \end{latex}
11981198
% \end{function}
11991199
%
1200-
% \begin{function}[added=2023-04-22]{misc/autoref/algo, misc/autoref/them, misc/autoref/lem,
1200+
% \begin{function}[added=2023-05-09]{misc/autoref/algo, misc/autoref/them, misc/autoref/lem,
12011201
% misc/autoref/prop, misc/autoref/cor, misc/autoref/axi, misc/autoref/defn, misc/autoref/conj,
1202-
% misc/autoref/exmp, misc/autoref/case, misc/autoref/rem}
1202+
% misc/autoref/exmp, misc/autoref/case, misc/autoref/rem,misc/autoref/fig,misc/autoref/tab,misc/autoref/equ}
12031203
% \begin{bitsyntax}[emph={[1]tabularFontSize}]
12041204
% autoref = {
12051205
% algo = (*(算法)|\marg{字符串}*),
@@ -1213,6 +1213,9 @@
12131213
% exmp = (*(例)|\marg{字符串}*),
12141214
% case = (*(情形)|\marg{字符串}*),
12151215
% rem = (*(备注)|\marg{字符串}*),
1216+
% fig = (*(图)|\marg{字符串}*),
1217+
% tab = (*(表)|\marg{字符串}*),
1218+
% equ = (*(式)|\marg{字符串}*),
12161219
% }
12171220
% \end{bitsyntax}
12181221
%
@@ -1254,10 +1257,11 @@
12541257
% 该选项包含许多子项目,用于调整其他选项。具体内容见下:
12551258
% \end{function}
12561259
%
1257-
% \begin{variable}[added=2023-04-22]{const/autoref/algo,const/autoref/them,
1260+
% \begin{variable}[added=2023-05-09]{const/autoref/algo,const/autoref/them,
12581261
% const/autoref/lem,const/autoref/prop,const/autoref/cor,const/autoref/axi,
12591262
% const/autoref/defn,const/autoref/conj,const/autoref/exmp,
1260-
% const/autoref/case,const/autoref/rem}
1263+
% const/autoref/case,const/autoref/rem,
1264+
% const/autoref/fig,const/autoref/tab,const/autoref/equ}
12611265
% \begin{bitsyntax}[emph={[1]tabularFontSize}]
12621266
% autoref = {
12631267
% algo = (*(算法)|\marg{字符串}*),
@@ -1271,6 +1275,9 @@
12711275
% exmp = (*(例)|\marg{字符串}*),
12721276
% case = (*(情形)|\marg{字符串}*),
12731277
% rem = (*(备注)|\marg{字符串}*),
1278+
% fig = (*(图)|\marg{字符串}*),
1279+
% tab = (*(表)|\marg{字符串}*),
1280+
% equ = (*(式)|\marg{字符串}*),
12741281
% }
12751282
% \end{bitsyntax}
12761283
%
@@ -2328,6 +2335,9 @@
23282335
{exmp} {例} {Example},
23292336
{case} {情形} {Case},
23302337
{rem} {注} {Remark},
2338+
{fig} {图} {Figure},
2339+
{tab} {表} {Table},
2340+
{equ} {式} {Equation},
23312341
}
23322342
{\@@_define_label:nnn #1}
23332343
% \end{macrocode}
@@ -2522,6 +2532,12 @@
25222532
autoref / rem .initial:n = {\g_@@_const_autoref_rem_tl},
25232533
hideLinks .bool_set:N = \l_@@_misc_hide_links_bool,
25242534
hideLinks .initial:n = {true},
2535+
autoref / figure .tl_set:N = \figureautorefname,
2536+
autoref / figure .initial:n = {\g__bithesis_const_autoref_fig_tl},
2537+
autoref / table .tl_set:N = \tableautorefname,
2538+
autoref / table .initial:n = {\g__bithesis_const_autoref_tab_tl},
2539+
autoref / equ .tl_set:N = \equationautorefname,
2540+
autoref / equ .initial:n = {\g__bithesis_const_autoref_equ_tl},
25252541
}
25262542
% \end{macrocode}
25272543
%
@@ -2551,6 +2567,12 @@
25512567
autoref / case .initial:n = {\@@_get_const:N {case}},
25522568
autoref / rem .tl_set:N = \g_@@_const_autoref_rem_tl,
25532569
autoref / rem .initial:n = {\@@_get_const:N {rem}},
2570+
autoref / figure .tl_set:N = \g__bithesis_const_autoref_fig_tl,
2571+
autoref / figure .initial:n = {\__bithesis_get_const:N {fig}},
2572+
autoref / table .tl_set:N = \g__bithesis_const_autoref_tab_tl,
2573+
autoref / table .initial:n = {\__bithesis_get_const:N {tab}},
2574+
autoref / equ .tl_set:N = \g__bithesis_const_autoref_equ_tl,
2575+
autoref / equ .initial:n = {\__bithesis_get_const:N {equ}},
25542576
}
25552577

25562578
% \end{macrocode}

Diff for: templates/graduate-thesis/bithesis.cls

+15
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@
240240
{exmp} {例} {Example},
241241
{case} {情形} {Case},
242242
{rem} {注} {Remark},
243+
{fig} {图} {Figure},
244+
{tab} {表} {Table},
245+
{equ} {式} {Equation},
243246
}
244247
{\__bithesis_define_label:nnn #1}
245248
\clist_const:Nn \c__bithesis_bachelor_thesis_header_clist
@@ -405,6 +408,12 @@
405408
autoref / rem .initial:n = {\g__bithesis_const_autoref_rem_tl},
406409
hideLinks .bool_set:N = \l__bithesis_misc_hide_links_bool,
407410
hideLinks .initial:n = {true},
411+
autoref / figure .tl_set:N = \figureautorefname,
412+
autoref / figure .initial:n = {\g__bithesis_const_autoref_fig_tl},
413+
autoref / table .tl_set:N = \tableautorefname,
414+
autoref / table .initial:n = {\g__bithesis_const_autoref_tab_tl},
415+
autoref / equ .tl_set:N = \equationautorefname,
416+
autoref / equ .initial:n = {\g__bithesis_const_autoref_equ_tl},
408417
}
409418
\keys_define:nn { bithesis / const }
410419
{
@@ -430,6 +439,12 @@
430439
autoref / case .initial:n = {\__bithesis_get_const:N {case}},
431440
autoref / rem .tl_set:N = \g__bithesis_const_autoref_rem_tl,
432441
autoref / rem .initial:n = {\__bithesis_get_const:N {rem}},
442+
autoref / figure .tl_set:N = \g__bithesis_const_autoref_fig_tl,
443+
autoref / figure .initial:n = {\__bithesis_get_const:N {fig}},
444+
autoref / table .tl_set:N = \g__bithesis_const_autoref_tab_tl,
445+
autoref / table .initial:n = {\__bithesis_get_const:N {tab}},
446+
autoref / equ .tl_set:N = \g__bithesis_const_autoref_equ_tl,
447+
autoref / equ .initial:n = {\__bithesis_get_const:N {equ}},
433448
}
434449

435450
\keys_define:nn { bithesis / style }

Diff for: templates/paper-translation/bithesis.cls

+15
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@
240240
{exmp} {例} {Example},
241241
{case} {情形} {Case},
242242
{rem} {注} {Remark},
243+
{fig} {图} {Figure},
244+
{tab} {表} {Table},
245+
{equ} {式} {Equation},
243246
}
244247
{\__bithesis_define_label:nnn #1}
245248
\clist_const:Nn \c__bithesis_bachelor_thesis_header_clist
@@ -405,6 +408,12 @@
405408
autoref / rem .initial:n = {\g__bithesis_const_autoref_rem_tl},
406409
hideLinks .bool_set:N = \l__bithesis_misc_hide_links_bool,
407410
hideLinks .initial:n = {true},
411+
autoref / figure .tl_set:N = \figureautorefname,
412+
autoref / figure .initial:n = {\g__bithesis_const_autoref_fig_tl},
413+
autoref / table .tl_set:N = \tableautorefname,
414+
autoref / table .initial:n = {\g__bithesis_const_autoref_tab_tl},
415+
autoref / equ .tl_set:N = \equationautorefname,
416+
autoref / equ .initial:n = {\g__bithesis_const_autoref_equ_tl},
408417
}
409418
\keys_define:nn { bithesis / const }
410419
{
@@ -430,6 +439,12 @@
430439
autoref / case .initial:n = {\__bithesis_get_const:N {case}},
431440
autoref / rem .tl_set:N = \g__bithesis_const_autoref_rem_tl,
432441
autoref / rem .initial:n = {\__bithesis_get_const:N {rem}},
442+
autoref / figure .tl_set:N = \g__bithesis_const_autoref_fig_tl,
443+
autoref / figure .initial:n = {\__bithesis_get_const:N {fig}},
444+
autoref / table .tl_set:N = \g__bithesis_const_autoref_tab_tl,
445+
autoref / table .initial:n = {\__bithesis_get_const:N {tab}},
446+
autoref / equ .tl_set:N = \g__bithesis_const_autoref_equ_tl,
447+
autoref / equ .initial:n = {\__bithesis_get_const:N {equ}},
433448
}
434449

435450
\keys_define:nn { bithesis / style }

Diff for: templates/undergraduate-thesis-en/bithesis.cls

+15
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@
240240
{exmp} {例} {Example},
241241
{case} {情形} {Case},
242242
{rem} {注} {Remark},
243+
{fig} {图} {Figure},
244+
{tab} {表} {Table},
245+
{equ} {式} {Equation},
243246
}
244247
{\__bithesis_define_label:nnn #1}
245248
\clist_const:Nn \c__bithesis_bachelor_thesis_header_clist
@@ -405,6 +408,12 @@
405408
autoref / rem .initial:n = {\g__bithesis_const_autoref_rem_tl},
406409
hideLinks .bool_set:N = \l__bithesis_misc_hide_links_bool,
407410
hideLinks .initial:n = {true},
411+
autoref / figure .tl_set:N = \figureautorefname,
412+
autoref / figure .initial:n = {\g__bithesis_const_autoref_fig_tl},
413+
autoref / table .tl_set:N = \tableautorefname,
414+
autoref / table .initial:n = {\g__bithesis_const_autoref_tab_tl},
415+
autoref / equ .tl_set:N = \equationautorefname,
416+
autoref / equ .initial:n = {\g__bithesis_const_autoref_equ_tl},
408417
}
409418
\keys_define:nn { bithesis / const }
410419
{
@@ -430,6 +439,12 @@
430439
autoref / case .initial:n = {\__bithesis_get_const:N {case}},
431440
autoref / rem .tl_set:N = \g__bithesis_const_autoref_rem_tl,
432441
autoref / rem .initial:n = {\__bithesis_get_const:N {rem}},
442+
autoref / figure .tl_set:N = \g__bithesis_const_autoref_fig_tl,
443+
autoref / figure .initial:n = {\__bithesis_get_const:N {fig}},
444+
autoref / table .tl_set:N = \g__bithesis_const_autoref_tab_tl,
445+
autoref / table .initial:n = {\__bithesis_get_const:N {tab}},
446+
autoref / equ .tl_set:N = \g__bithesis_const_autoref_equ_tl,
447+
autoref / equ .initial:n = {\__bithesis_get_const:N {equ}},
433448
}
434449

435450
\keys_define:nn { bithesis / style }

Diff for: templates/undergraduate-thesis/bithesis.cls

+15
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@
240240
{exmp} {例} {Example},
241241
{case} {情形} {Case},
242242
{rem} {注} {Remark},
243+
{fig} {图} {Figure},
244+
{tab} {表} {Table},
245+
{equ} {式} {Equation},
243246
}
244247
{\__bithesis_define_label:nnn #1}
245248
\clist_const:Nn \c__bithesis_bachelor_thesis_header_clist
@@ -405,6 +408,12 @@
405408
autoref / rem .initial:n = {\g__bithesis_const_autoref_rem_tl},
406409
hideLinks .bool_set:N = \l__bithesis_misc_hide_links_bool,
407410
hideLinks .initial:n = {true},
411+
autoref / figure .tl_set:N = \figureautorefname,
412+
autoref / figure .initial:n = {\g__bithesis_const_autoref_fig_tl},
413+
autoref / table .tl_set:N = \tableautorefname,
414+
autoref / table .initial:n = {\g__bithesis_const_autoref_tab_tl},
415+
autoref / equ .tl_set:N = \equationautorefname,
416+
autoref / equ .initial:n = {\g__bithesis_const_autoref_equ_tl},
408417
}
409418
\keys_define:nn { bithesis / const }
410419
{
@@ -430,6 +439,12 @@
430439
autoref / case .initial:n = {\__bithesis_get_const:N {case}},
431440
autoref / rem .tl_set:N = \g__bithesis_const_autoref_rem_tl,
432441
autoref / rem .initial:n = {\__bithesis_get_const:N {rem}},
442+
autoref / figure .tl_set:N = \g__bithesis_const_autoref_fig_tl,
443+
autoref / figure .initial:n = {\__bithesis_get_const:N {fig}},
444+
autoref / table .tl_set:N = \g__bithesis_const_autoref_tab_tl,
445+
autoref / table .initial:n = {\__bithesis_get_const:N {tab}},
446+
autoref / equ .tl_set:N = \g__bithesis_const_autoref_equ_tl,
447+
autoref / equ .initial:n = {\__bithesis_get_const:N {equ}},
433448
}
434449

435450
\keys_define:nn { bithesis / style }

Diff for: tests/autorefs/main.tex

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
\documentclass[type=master]{bithesis}
1+
\documentclass[type=bachelor]{bithesis}
22

33

44
\begin{document}
@@ -63,6 +63,23 @@ \chapter{Lorem}
6363
Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.
6464
\end{rem}
6565

66+
% figure
67+
\begin{figure}[htbp]
68+
\caption{测试图片}\label{TestFig}
69+
\end{figure}
70+
% table
71+
\begin{table}[htbp]
72+
\caption{统计表}\label{TestTable}
73+
\end{table}
74+
% equation
75+
\begin{equation}
76+
LRI=1\ \ \sqrt{1+{\left(\frac{{\mu }_{R}}{{\mu }_{s}}\right)}^{2}{\left(\frac{{\delta }_{R}}{{\delta }_{s}}\right)}^{2}}
77+
\label{TestEquation}
78+
\end{equation}
79+
80+
81+
6682
\autoref{algo}, \autoref{them}, \autoref{lem}, \autoref{cor}, \autoref{prop}, \autoref{cor}, \autoref{axi}, \autoref{defn}, \autoref{conj}, \autoref{exmp}, \autoref{case}, \autoref{rem}.
83+
\autoref{TestFig},\autoref{TestTable},\autoref{TestEquation}
6784

6885
\end{document}

0 commit comments

Comments
 (0)