首次使用 newtheorem 的書籤等級未知

首次使用 newtheorem 的書籤等級未知

下面的 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}

相關內容