![首次使用 newtheorem 的書籤等級未知](https://rvso.com/image/254722/%E9%A6%96%E6%AC%A1%E4%BD%BF%E7%94%A8%20newtheorem%20%E7%9A%84%E6%9B%B8%E7%B1%A4%E7%AD%89%E7%B4%9A%E6%9C%AA%E7%9F%A5.png)
下面的 MWE 在日誌中產生以下訊息:
套件 hyperref 資訊:輸入行 12 上未知 thm 的書籤等級預設為 0
我怎樣才能防止這種情況發生?
\documentclass{article}
\usepackage{amsmath}
\usepackage[amsmath,hyperref]{ntheorem}
\newtheorem{thm}{Theorem}
\usepackage{hyperref}
\begin{document}
\begin{thm}
$1+1=2$
\end{thm}
\begin{thm}
$1-1=0$
\end{thm}
\end{document}
請注意,第二個定理不會出現該訊息。所以我認為這與初始化有關...
PS:如果有人認為該theorems
標籤不合適,請隨時刪除!
答案1
%% <---
解決方案:新增以下程式碼範例中標記的行:
\documentclass{article}
\usepackage{amsmath}
\usepackage[amsmath,hyperref]{ntheorem}
\newtheorem{thm}{Theorem}
\makeatletter %% <---
\providecommand*{\toclevel@thm}{0}% %% <---
\makeatother %% <---
\usepackage{hyperref}
\begin{document}
\begin{thm}
$1+1=2$
\end{thm}
\begin{thm}
$1-1=0$
\end{thm}
\end{document}