付録パッケージToCコントロール

付録パッケージToCコントロール

付録の配置を変更したいのですが、

\documentclass[12pt]{report}
...
\usepackage{titletoc}
\usepackage[toc,titletoc]{appendix}

\usepackage{tocloft}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % for chapters
\renewcommand{\cftchapfont}{\uppercase}
\renewcommand{\cftchappagefont}{}

\renewcommand{\cfttoctitlefont}{\hfill\uppercase}
\renewcommand{\cftaftertoctitle}{\hfill}
\setlength{\cftbeforetoctitleskip}{-3em}

\renewcommand{\cftloftitlefont}{\hfill\uppercase}
\renewcommand{\cftafterloftitle}{\hfill}
\setlength{\cftbeforeloftitleskip}{-3em}

\renewcommand{\cftlottitlefont}{\hfill\uppercase}
\renewcommand{\cftafterlottitle}{\hfill}
\setlength{\cftbeforelottitleskip}{-3em}

他にもいくつか変更が必要です。これが私の持っているものです。

APPENDICES................. 10
APPENDIX A ................ 13
APPENDIX B ................ 15

これが私に必要なものです。

APPENDICES................. 10
   APPENDIX A ............. 13
   APPENDIX B ............. 15

答え1

一つの可能​​性としては\titlecontentstitletocパッケージ。

備考:

  • titletocパッケージのオプションappendixは不要になったことに注意してください。

  • \uppercaseは、LaTeX 文書では使用すべきではない TeX コマンドです。\MakeUppercase代わりに を使用できます。ただし、これらのコマンドは両方とも引数を受け取るため、質問に示されている例のように\uppercase(または\MakeUppercase) を使用するとエラーが発生します。

  • また、私の回答では、元の設定の一部が再定義とパッチに置き換えられていることにも注意してください。特に、\l@chapter点線のリーダーを使用し、章のエントリを大文字でスタイル設定するために、 の再定義を使用しました。内部コマンド\@cftmaketoctitle\@cftmakeloftitle\@cftmakelottitleは、ToC、LoF、LoT のタイトルにそれぞれ大文字のフォントを使用するようにtocloft(パッケージの助けを借りて) パッチされました。etoolbox

コード:

\documentclass{report}
\usepackage[toc]{appendix}
\usepackage{titletoc}
\usepackage{tocloft}
\usepackage{etoolbox}
\usepackage{textcase}

\makeatletter
\renewcommand*\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \vskip 1.0em \@plus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      \MakeTextUppercase{#1}\nobreak\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hfill
\nobreak\hb@xt@\@pnumwidth{\hss #2}\par
      \penalty\@highpenalty
    \endgroup
  \fi}
\patchcmd{\@cftmaketoctitle}{\cfttoctitlefont\contentsname}{\cfttoctitlefont\MakeUppercase{\contentsname}}{}{}
\patchcmd{\@cftmakeloftitle}{\cftloftitlefont\listfigurename}{\cftloftitlefont\MakeUppercase{\listfigurename}}{}{}
\patchcmd{\@cftmakelottitle}{\cftlottitlefont\listtablename}{\cftlottitlefont\MakeUppercase{\listtablename}}{}{}
\makeatother

\renewcommand{\cfttoctitlefont}{\hfill}
\renewcommand{\cftaftertoctitle}{\hfill}
\setlength{\cftbeforetoctitleskip}{-3em}
%
\renewcommand{\cftloftitlefont}{\hfill}
\renewcommand{\cftafterloftitle}{\hfill}
\setlength{\cftbeforeloftitleskip}{-3em}
%
\renewcommand{\cftlottitlefont}{\hfill}
\renewcommand{\cftafterlottitle}{\hfill}
\setlength{\cftbeforelottitleskip}{-3em}

\begin{document}

\tableofcontents
\chapter{Test Regular Chapter}
\begin{appendices}
\titlecontents{chapter}[10em]
  {\addvspace{10pt}}
  {\contentslabel[\MakeUppercase{\appendixname~\thecontentslabel}]{8em}\MakeUppercase}
  {\hspace*{-8em}}{\titlerule*[.754em]{.}\contentspage}
\chapter{First Test Appendix}
\chapter{Second Test Appendix}
\end{appendices}

\end{document}

ここに画像の説明を入力してください

最後に(単なる提案として)、ToC のエントリには大文字フォントではなく小文字フォントを使用する方が良いと思います。これには追加の利点もあります。実装がかなり簡単になります。

関連情報