強制回憶錄子索引中的偶數頁表格與 amsmath 的 \numberwithin 混淆

強制回憶錄子索引中的偶數頁表格與 amsmath 的 \numberwithin 混淆

當我使用Schweinebacke 確保表格放置在偶數頁上的解決方案裡面的memoir環境subappendicesamsmaths一起\numberwithin,然後\numberwithin就不再工作了。也就是說,該表編號為「1.1.1」而非「1.A.1」。

我如何解決它?

\documentclass{memoir}
\usepackage{afterpage}
\usepackage{amsmath}
\newcommand{\atevenpage}[1]{%
  \afterpage{\clearpage%
    \ifodd\value{page}%
      \atevenpage{#1}%
    \else%
      #1%
    \fi%
  }%
}
\usepackage{filecontents}
\begin{filecontents*}{my_input.tex}
  \begin{table}[p]
    \caption{A table}
    \begin{tabular}{lrr}
      & A & B \\
      First row & 123 & 456 \\
      Second row & 123 & 456 \\
    \end{tabular}
  \end{table}
\end{filecontents*}
\begin{document}
  \chapter{A chapter}
  \begin{subappendices}
    \numberwithin{table}{section}
    \section{An appendix}
    \atevenpage{\input{my_input}}
  \end{subappendices}
\end{document}

答案1

很長的評論。

嘗試將其添加到您的序言中

\AddToHook{env/subappendices/begin}{\typeout{begin subapp}}
\AddToHook{env/subappendices/end}{\typeout{end subapp}}
\AddToHook{env/table/begin}{\typeout{begin table}}
\AddToHook{env/table/end}{\typeout{end table}}

然後你可以在日誌中看到,由於表上的延遲,子附錄在表運行時已經結束了。這\numberwithin{table}{section}是一個本地定義,因此消失在\end{subappendices}

相關內容