章番号を削除し、セクション番号は保持する

章番号を削除し、セクション番号は保持する

Chapter #各章の前の章番号 ( ) を削除し、同時にセクション番号を保持する方法がわかりません。そのため、次のようなものが必要です。

章名

1.1 第1節

1.2 第2セクション

また、写真の番号付けが少し変です。現在、写真 2.1 があります (写真はセクション 2 にあるため)。写真 1、写真 2 などの通常の番号付けにしたいだけです。

助けてくれてありがとう!

答え1

最も簡単な方法は\thechapter何も設定しないことです。つまり、 ですが、これでは末尾に{}が残り、章の見出しは引き続き表示されます(または)。\thesection.Chapter\chaptername

連続した図番号を取得するには、図カウンターを章リセット リストから除外する必要があります\counterwithout{figure}{chapter}。つまり、. thenを使用します。

質問が少し不明瞭なので、\@makechapterhead今のところ変更しません。

\documentclass{book}


\usepackage{chngcntr}%


\renewcommand{\thechapter}{}%
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}%
\counterwithout{figure}{chapter}

\begin{document}
\tableofcontents
\listoffigures
\chapter{First chapter}

\section{First section}



\begin{figure}
\caption{Dummy figure}
\end{figure}

\chapter{Second chapter}

\section{First section in 2nd chapter}

\begin{figure}
\caption{Another dummy figure}
\end{figure}


\end{document}

答え2

これを実行する方法は次のとおりですtitlesec(ただし、最新バージョンでは何らかの問題があるようです。以前のバージョンの titlesec では、この方法では実行しませんでした)。

\documentclass{book}
\usepackage[utf8]{inputenc} \usepackage{titlesec}

\titleformat{\chapter}[block]{\bfseries\Huge}{}{0em}{}
\titleformat{\section}[hang]{\bfseries\Large}{}{1em}{\thesection\enspace}

\begin{document}
\tableofcontents
\listoffigures
\chapter{First chapter}

\section{First section}

\begin{figure}
\caption{Dummy figure}
\end{figure}

\end{document}

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

関連情報