6

私はこのようなものを持っています:

Section 1
...
Section 2
...
Section 3
Subsection 3.1
...
Section 4
...

そして、私はこのようなものが欲しいです:

Section 1
...
Section 2
...
Section A
Subsection A.1
...
Section 4
...

言い換えれば、セクション番号の1つを別の番号に変更します3 == A記事クラスで書かれた論文にこれが必要です。付録を追加しようとすると、hyperrefパッケージが壊れ、セクション1への「リンク」が付録に向けられました。A

編集:問題の説明を間違えました。LaTeXがコード(* .tocファイル)を生成するため、目次が機能しないことを意味しました。

\contentsline {section}{\numberline {1}}{1}{section.1}
\contentsline {section}{\numberline {2}}{1}{section.2}
\contentsline {section}{\numberline {A}}{1}{section.1}
4

5 に答える 5

8

次の構造を作成し、更新しました

説明:

\begin{alphasection}...\end{alphasection}ブロックでのみ使用される、セクションの新しいカウンター。ブロックをネストしないでください。元のセクション番号が失われます。この場合、エラー メッセージが表示されます。各ブロックは「A」から数え始めます。HyperRef で必要なため、元のセクション カウントが続行されます。

Preambleに次のコードを挿入します。

\newcounter{alphasect}
\def\alphainsection{0}

\let\oldsection=\section
\def\section{%
  \ifnum\alphainsection=1%
    \addtocounter{alphasect}{1}
  \fi%
\oldsection}%

\renewcommand\thesection{%
  \ifnum\alphainsection=1% 
    \Alph{alphasect}
  \else%
    \arabic{section}
  \fi%
}%

\newenvironment{alphasection}{%
  \ifnum\alphainsection=1%
    \errhelp={Let other blocks end at the beginning of the next block.}
    \errmessage{Nested Alpha section not allowed}
  \fi%
  \setcounter{alphasect}{0}
  \def\alphainsection{1}
}{%
  \setcounter{alphasect}{0}
  \def\alphainsection{0}
}%

ドキュメント内:

\section{First test}
First content
\section{Second test}
Second content
\begin{alphasection}
\section{Third test}
\subsection{Subsection test}
Content test
\section{Test Other section}
\end{alphasection}
\section{Fourth test}
Last content

プロデュース

1 First test
   First content

2 Second test
   Second content

A Third test
A.1 Subsection test
   Content test

B Test Other section

5 Fourth test
   Last content

テスト済み、HyperRef で動作します。

于 2010-05-15T10:34:43.930 に答える
3

Sandra へ、私は上記の Pi​​ndatjuh コードを使用する際にスペーシングの問題を抱えていました。すべてのリストに影響していました。コードの 3 番目のブロックの数行の末尾に「%」を追加して修正しました。これで間隔がなくなりました。

から:

\renewcommand\thesection{%
 \ifnum\alphainsection=1% 
   \Alph{alphasect}
 \else%
  \arabic{section}
 \fi%
}%

に:

\renewcommand\thesection{%
 \ifnum\alphainsection=1% 
   \Alph{alphasect}%
 \else
   \arabic{section}%
 \fi%
}%
于 2012-04-16T04:54:27.947 に答える
1

Karpik が抱えていた問題 (hyperref の問題) は、オプション [naturalnames] を hyperref パッケージに追加することで、より簡単に解決できます。 \usepackage[naturalnames]{hyperref}

于 2012-08-29T11:47:22.767 に答える
0

titlesecパッケージを見てください。

于 2010-05-15T10:09:33.163 に答える
0

わかりました、@ Pindatjuhコードを使用して解決します。解決策はかなり醜いです...

 \newcounter{alphasect}

 \renewcommand\thesection{%
 \ifnum\value{alphasect}=1%
A%%
 \else
\ifnum\value{alphasect}=2%
B%%
\else
\ifnum\value{alphasect}=3%
C%%
\else
\ifnum\value{alphasect}=4%
D%%
\else
 \arabic{section}%%
 \fi\fi\fi\fi}%

 \newenvironment{asection}{%
 \setcounter{alphasect}{1}%%
 }{%
 \setcounter{alphasect}{0}%%
 }%

 \newenvironment{bsection}{%
 \setcounter{alphasect}{2}%%
 }{%
 \setcounter{alphasect}{0}%%
 }%

a 文書より:

\section{First test}
First content
\section{Second test}
Second content
\begin{asection}
\section{Third test}
\subsection{Subsection test}
Content test
\end{asection}
\begin{bsection}
\section{Test Other section}
\end{bsection}
\section{Fourth test}
Last content

コンテンツのリストが機能し、正常に表示されるようになりました

于 2010-05-15T12:06:59.010 に答える