在回憶錄中使用小寫大寫字母對子附錄進行編號

在回憶錄中使用小寫大寫字母對子附錄進行編號

我希望subappendices使用小寫大寫字母對 中的部分進行編號memoir。也就是說,我希望對這些部分的所有引用都使用小寫大寫字母。從我的想法來看,這包括:

  1. 章節標題\section{An appendix\label{an_appendix}}
  2. 參考章節\ref{an_appendix}
  3. 目錄中的條目
  4. 在該部分內浮動
  5. 對節內浮動的引用

可能還有更多我想不到的。

我懷疑最好透過更改環境中使用的部分計數器來解決此memoir問題subappendices。但我不知道該怎麼做。

在下面的 MWE 中,我註解掉了一些部分修復,它們處理 (1) 節標題編號、(3) 浮動標題編號和 (4) TOC 編號。

我更喜歡一個乾淨的解決方案,可以更改子附錄部分的計數器(或者是我看不到的更乾淨的東西),但會解決修復參考文獻的問題。

我該做什麼呢?

\documentclass{memoir}
\usepackage{amsmath}
\usepackage{fontspec}
\setmainfont{EBGaramond-Regular}[
  BoldFont = EBGaramond-Bold,
  ItalicFont = EBGaramond-Italic,
  BoldItalicFont = EBGaramond-BoldItalic,
  Numbers={Proportional, OldStyle},
]
\AtBeginEnvironment{subappendices}{
  \numberwithin{table}{section}
}
\setsecnumformat{\textsc{\csname the#1\endcsname}\quad}
% \setsecnumformat{\textsc{\MakeLowercase{\csname the#1\endcsname}}\quad} % (1) Make numbers in section headings lowercase small caps
\usepackage{caption}
\DeclareCaptionLabelFormat{lowercase}{\MakeLowercase{#1}~#2}
% \DeclareCaptionLabelFormat{lowercase}{\MakeLowercase{#1~#2} % (3) Make numbers in float captions lowercase small caps
\captionsetup{
  labelfont=sc,
  labelformat=lowercase,
}
% \makeatletter % (4) Make numbers in the table of contents lowercase small caps
% \patchcmd\numberline{\@cftbsnum #1\@cftasnum}{\@cftbsnum{#1}\@cftasnum}{}{\ERROR}
% \makeatother
% \renewcommand\cftsectionpresnum{\scshape\MakeLowercase}
\begin{document}
  \tableofcontents*

  \chapter{A chapter}
  \section{A section}
  See table~\ref{tab:a_table} in appendix~\ref{an_appendix}.

  \begin{subappendices}
    \section{An appendix\label{an_appendix}}
    \begin{table}[h]
      \caption{A table\protect\label{tab:a_table}}
      \centering
      \begin{tabular}{lcc}
        & Column A & Column B \\
        First row & 123 & 456 \\
        Second row & 123 & 456 \\
      \end{tabular}
    \end{table}
  \end{subappendices}
\end{document}

輸出在不需要的特徵周圍添加了紅色矩形

答案1

兩者都可以用一行來解決

\renewcommand{\setthesection}{\thechapter.\alph{section}}

一開始subappendices我們運行這個命令

\newcommand{\@resets@ppsub}{
  \par
  \setcounter{section}{0}
  \renewcommand{\thesection}{\setthesection}
  \def\theHsection{\theHchapter.\Alph{section}}
}

\newcommand{\setthesection}{\thechapter.\Alph{section}}

所以搞亂它就足夠了。

然後使用 outcommented 修復目錄

\renewcommand\cftsectionpresnum{\scshape\MakeLowercase}

這樣就解決了參考的問題。它hyperref也適用於。如果有一些套件向 中添加了可選參數\ref,那麼也需要選擇它。還在想是否有鉤錐可以代替。

\AtBeginDocument{
  \NewCommandCopy\oldref\ref
  \RenewDocumentCommand\ref{sm}{%
    \textsc{%
      \IfBooleanTF{#1}%
      {\oldref*{#2}}%
      {\oldref{#2}}%
    }%
  }
}

相關內容