
答案1
如果您使用titlesec
,我最好的建議是使用 runin 形狀,\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
章節標題作為參數,因此我們可以定義\maketitlewithnumber
交換這兩個部分。
還需要 的變numberless
體。\section*