回想録では小文字の大文字を使用してサブ付録に番号を付ける

回想録では小文字の大文字を使用してサブ付録に番号を付ける

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

どちらも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}}

だから、それをいじるだけで十分です。

次に、コメントアウトされた部分を使用して目次を修正します。

\renewcommand\cftsectionpresnum{\scshape\MakeLowercase}

これで参照の問題が解決します。hyperrefにも同様に機能します。 にオプションの引数を追加するパッケージがある場合は\ref、それも選択する必要があります。 代わりに使用できるフック cone があるかどうかはまだわかりません。

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

関連情報