セクションの接尾辞を変更する方法

セクションの接尾辞を変更する方法

私が欲しいもの:

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

私が持っているもの:

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

見た目が良くないことは分かっていますが、このようにする必要があります。 と を使用してtitlesecこれ\subsection{A section}を書いています。ありがとうございます!

答え1

を使用している場合、最善の提案は、runin シェイプを使用し、最後の (オプションの) 引数で次のように手動で改行することtitlesecです。\thesubsection

サブセクションの場合:

\titleformat{\subsection}[runin]{\large\bfseries}{}{0pt}{}[\quad {\thesubsection\\[0.5\baselineskip]}]

(そして、セクションに同様のものが必要な場合...)

\titleformat{\section}[runin]{\Large\bfseries}{}{0pt}{}[\quad {\thesection\\[0.5\baselineskip]}]

特にタイトルが長い場合は、おそらく調整が必要になるでしょう。

答え2

試す\subsection*{A section \quad 2.1}

答え3

セクションの形式を適切に定義します。

\documentclass{book}

\usepackage{titlesec}

\titleformat{name=\section}[hang]
 {\Large\bfseries}
 {}
 {0pt}
 {\maketitlewithnumber{\thesection}}
\titleformat{name=\section,numberless}[hang]
 {\Large\bfseries}
 {}
 {0pt}
 {}
\newcommand{\maketitlewithnumber}[2]{#2~#1}

\begin{document}

\setcounter{chapter}{2} % just to match your numbers

\section{A section}

Some text

\section{Another section}

Some text

\end{document}

コツは、最後の引数の資料が\titleformatセクション タイトルを引数として取得し、\maketitlewithnumber2 つの部分を交換するように定義できることです。

numberlessのバリアントも\section*必要です。

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

関連情報