whutug / whu-thesis

:memo: 武汉大学毕业论文 LaTeX 模版 2024
LaTeX Project Public License v1.3c
908 stars 200 forks source link

附录中算法序号与图表公式的序号格式不同 #204

Closed ZerolAcqua closed 1 year ago

ZerolAcqua commented 1 year ago

检查

编译环境

描述问题

请在此处描述清楚您所遇到的问题:

  1. 在附录文件 appendix.tex 中添加算法,算法序号是按数字编号,与图表公式的序号格式不同。
  2. 如上
  3. 我尝试通过参考图、表以及公式的编号方法修改 whu-thesis.cls 文件,但由于对模板语法了解甚少,没能成功。

最小工作示例(MWE)

\documentclass[
  type=bachelor,
  draft=false,
  oneside
]{whu-thesis}
\whusetup
{
  element            =
    {
      appendix       = {pages/appendix}
    }
}

\begin{document}
%%----------- 主体部分 ----------- %%
\end{document}
% pages/appendix.tex

\chapter{数据}

\section{第一个测试}
测试公式编号
\begin{equation}
  1+1=2.
\end{equation}

\begin{equation}
  1+1=2.
\end{equation}

表格编号测试

\begin{table}[h]
  \centering
  \caption{测试表格}
  \begin{tabular}{*{5}c}
    \hline
    11 & 13  & 13  & 13  & 13 \\
    12 & 14  & 13  & 13  & 13 \\
    \hline
  \end{tabular}
\end{table}

测试算法如所示算法 \ref{alg:alg1}

\begin{algorithm}
  \SetAlgoLined
  \KwData{this text}
  \KwResult{how to write algorithm with \LaTeXe}
  initialization\;
  \While{not at end of this document}{
    read current\;
    \eIf{understand}{
      go to next section\;
      current section becomes this one\;
    }{
      go back to the beginning of current section\;
    }
  }
  \caption{如何写算法}\label{alg:alg1}
\end{algorithm}

链接

我还做了这些尝试

附件

附录部分渲染结果如下,期望的算法序号应该是 算法 A.1F7TRM)$TX`%K$HWDW3N5UZ3

note286 commented 1 year ago

你在附录文件第一行加一句\renewcommand{\thealgocf}{\thechapter.\arabic{algocf}}吧。

ZerolAcqua commented 1 year ago

有效了,非常感谢!