20

「付録」という単語を目次に表示するにはどうすればよいですか? 現在、toc は次のようになっています。

1 ......  
2 ......  
.  
.  
A .....  
B ..... 

私はそれが欲しい:

1 ......  
2 ......  
.  
.  
Appendix A .....  
Appendix B ..... 

私のラテックスソースファイル構造は次のようなものです:

\begin{document}  
\tableofcontents  
\include{...}  
\include{...}  
\appendix  
\include{...}  
\include{...}  
\end{document}  
4

5 に答える 5

13

この問題を解決するには、いくつかの方法があります。残念ながら、私はこの段階であなたのためのハックしか持っていません。1つの問題は、セクション番号「A」を再定義して「付録」という単語を含めると、目次のフォーマットが混乱することです。その代わりに、番号なしでセクションを印刷し、「付録X」を手動で挿入する新しいセクショニングコマンドを定義しました。

ちょっと醜いですが、少なくともマークアップを変更しなくても機能します:)

\ documentclass {article}

\ makeatletter
\ newcommand \ appendix @ section [1] {%
  \ refstepcounter {section}%
  \ orig @ section*{付録\@Alph\ c @ section:#1}%
  \ addcontentsline {toc}{section}{付録\@Alph\ c @ section:#1}%
}
\ let \ orig @ section \ section
\ g @ addto @ macro \ appendix {\ let \ section \ appendix @ section}
\ makeatother

\ begin {document}

\目次

\ section {goo}
\ label {a}
これはsec〜\ref{a}です

\ section {har}
\ label {b}
これはsec〜\ref{b}です

\付録
\ section {ji}
\ label {c}
これはapp〜\ref{c}です
\ subsection {me}
これは正しく見えますか?

\ end {document}
于 2009-04-05T00:11:07.723 に答える
11

私の論文では、次のことを行いました。

\appendix
\addcontentsline{toc}{section}{Appendix~\ref{app:scripts}: Training Scripts}
\section*{Sample Training Scripts}
\label{app:scripts}
Blah blah appendix content blah blah blah.

説明: TOC に手動で行を追加したので、TOC に "Appendix X:..." が表示されます。次に、アスタリスクを使用して、実際のセクション コマンドを TOC から除外しました。

于 2010-11-04T09:27:11.933 に答える
11

これはおそらく、付録パッケージまたはmemoir クラスを使用することによって最も簡単に実現できます。

パッケージ化されたソリューションを使用したくない場合は、セクション化コマンドをハックする必要があります。論文でこれを行う必要があったとき、クラスを複製しreport、余白の女性が満足するまで編集しました。あなたが探しているのは、\addcontentslineマクロの定義です。

于 2009-04-04T17:02:29.830 に答える
1

付録パッケージは本当に優れたシンプルなソリューションです。私の答えは、たとえば、キリル文字やローマ数字を使用して、章の番号付けスタイルを変更したい人に役立ちます。付録の番号付けスタイルは \@resets@pp コマンドでハードコードされています (私はここのソースを調べましたhttp://hal.in2p3.fr/docs/00/31/90/21/TEX/appendix.sty )。このコマンドを自分のものに再定義するだけで解決しました。このコードをプリアンブルに追加するだけです:

\makeatletter

    \renewcommand{\@resets@pp}{\par
        \@ppsavesec
        \stepcounter{@pps}
        \setcounter{section}{0}

        \if@chapter@pp
            \setcounter{chapter}{0}
            \renewcommand\@chapapp{\appendixname}
            \gdef\thechapter{\Asbuk{chapter}} % changed
        \else
            \setcounter{subsection}{0}
            \gdef\thechapter{\Asbuk{section}} % changed
        \fi

        \if@pphyper
            \if@chapter@pp
                \renewcommand{\theHchapter}{\theH@pps.\Asbuk{chapter}} % changed
            \else
                \renewcommand{\theHsection}{\theH@pps.\Asbuk{section}} % changed
            \fi

            \def\Hy@chapapp{\appendixname}%
        \fi
    \restoreapp
}

\makeatother

結果として、

Appendix A
Appendix B
Appendix C
...

に変わります

Appendix A
Appendix Б
Appendix В
... etc

私はラテックスの専門家ではないので、このコードが他のものを壊さないことを保証することはできません.

于 2013-05-04T09:55:42.517 に答える