
付録のタイトルを「付録 A: [タイトル]」、「付録 B: [その他のタイトル]」などの接頭辞を付けて印刷したいです。
私は次の定義済みコマンドを使用しました (最後に実行可能な tex ドキュメントがあります)。
\newcounter{rsss}
\DeclareRobustCommand{\appendixString}{
\setcounter{rsss}{\value{chapter}}
\addtocounter{rsss}{- \value{chapterCounter}}
Appendix\Alph{rsss} :
}
\DeclareRobustCommand{\appendixStringHeadline}{
\setcounter{rsss}{\value{chapter}}
\addtocounter{rsss}{- \value{chapterCounter}}
\addtocounter{rsss}{1}
Appendix \Alph{rsss} :
}
\DeclareRobustCommand{\appendix}[2]{
\addchap[\appendixStringHeadline #1]{\appendixStringHeadline #1}\label{#2}
\ihead{
\appendixString #1
}
\stepcounter{chapter}
}
これはタイトルと見出しには有効ですが、目次には常に「付録 A」があります。どうすれば修正できますか? 手動で目次名を設定しようとしましたが、うまく[]
いきませんでした :/。ご協力ありがとうございます :)
実行可能なTEXファイル
\documentclass{scrreprt}
\usepackage{scrpage2}\pagestyle{scrheadings}
\newcounter{chapterCounter}
\newcounter{rsss}
\DeclareRobustCommand{\appendixString}{
\setcounter{rsss}{\value{chapter}}
\addtocounter{rsss}{- \value{chapterCounter}}
Appendix \Alph{rsss} :
}
\DeclareRobustCommand{\appendixStringHeadline}{
\setcounter{rsss}{\value{chapter}}
\addtocounter{rsss}{- \value{chapterCounter}}
\addtocounter{rsss}{1}
Appendix \Alph{rsss} :
}
\DeclareRobustCommand{\appendix}[2]{
\addchap[\appendixStringHeadline #1]{\appendixStringHeadline #1}\label{#2}
\ihead{
\appendixString #1
}
\stepcounter{chapter}
}
\begin{document}
\tableofcontents
\chapter{ Bla}
\chapter{ Bla Bla}
\appendix{test 1}{bla bla}
\appendix{test 2}{bla}
\end{document}
答え1
なぜこのような複雑なアプローチを採用しているのか分かりません。
\documentclass{scrreprt}
\usepackage{scrpage2}
\pagestyle{scrheadings}
\newcommand{\appendixString}{Appendix \thechapter: }
\newcommand{\addappendix}[1]{%
\refstepcounter{chapter}
\addchap{\appendixString #1}%
\ihead{\appendixString #1}%
}
\begin{document}
\tableofcontents
\chapter{Bla}
\chapter{Bla Bla}
\appendix
\addappendix{test 1}\label{bla bla}
\addappendix{test 2}\label{bla}
\end{document}
いずれにしても、再定義は\appendix
最善の選択ではありません。
答え2
\addchap の引数内にカウンターを設定しないでください。
\documentclass{scrreprt}
\usepackage{scrpage2}\pagestyle{scrheadings}
\newcounter{chapterCounter}
\newcounter{rsss}
\DeclareRobustCommand{\appendix}[2]{%
\clearpage
\setcounter{rsss}{\value{chapter}}%
\addtocounter{rsss}{- \value{chapterCounter}}%
\addtocounter{rsss}{1}%
\addchap[Anhang \Alph{rsss} : #1]{Anhang \Alph{rsss} : #1}\label{#2}
\ihead{%
Appendix \Alph{rsss} : #1
}%
\stepcounter{chapter}
}
\begin{document}
\tableofcontents
\chapter{ Bla}
\chapter{ Bla Bla}
\appendix{test 1}{bla bla}
\appendix{test 2}{bla}
\end{document}
(なぜこれらすべての追加カウンターを使用しているのか、なぜ KOMA スクリプトによって提供される章のプレフィックスを使用しないのか、なぜテキストでは「Anhang」を使用し、ヘッダーでは「Appendix」を使用しているのに、コードのこの部分を変更しなかったのかは理解できません。)