ElegantLaTeX/ElegantBook

标签名称和引用问题

MathZheng opened this issue · 4 comments

  1. 若定理环境的标签名称为 \label{thm:f=1},则会警告未定义标签。去掉 = ,则没有警告。
  2. 加载 \usepackage[nameinlink,capitalize]{cleveref} 后,运行 \cref{thm:f1}, 也会警告未定义标签。
  1. 我已经解决, 稍后上传
  2. \cref{thm:f1} 给出的警告应该为 cref reference format for label type tcb@cnt@theorem' undefined, 即 tcb@cnt@theorem 这个计数器对应的前缀没有定义. 可以查看这篇问题: https://tex.stackexchange.com/questions/125006/cross-referencing-tcolorbox-with-cleveref-package , 下面给出示例, 可以在更新模板文件后查看效果:
\documentclass[cn]{elegantbook}
\usepackage[nameinlink,capitalize]{cleveref}
\makeatletter
\crefname{tcb@cnt@theorem}{定理}{定理}
\makeatother
\begin{document}
  \begin{theorem}{title}{label}
    内容
  \end{theorem}
  \cref{thm:label}
  \begin{theorem}[title]\label{thm:label=2}
    内容
  \end{theorem}
  \cref{thm:label=2}
\end{document}

image

\documentclass[lang=cn]{elegantbook}
%\usepackage[nameinlink,capitalize]{cleveref}
%\makeatletter
%\crefname{tcb@cnt@theorem}{定理}{定理}
%\makeatother
\begin{document}
  \begin{theorem}
    1
  \end{theorem}

  \begin{theorem}
    2
  \end{theorem}
\end{document} 

若两个定理环境不加标签,显示

LaTex Warning: Label 'thm:-NoValue-' multiply defined.

aux 文件显示
\newlabel{thm:-NoValue-}{{0.1}{1}{}{tcb@cnt@theorem.0.1}{}}
\newlabel{thm:-NoValue-}{{0.2}{1}{}{tcb@cnt@theorem.0.2}{}}

运行环境: Win11, Texlive 2022, WinEdt 10.3

请问能简单地解决吗?

已修复, 可以更新 elegantbook.cls 来应用更改

可以了。谢谢!