1.

1.

許多文章的架構如下:

1. [第 1 節標題]

1.1.[第 1.1 款的標題].1.1 小節的文本

1.2.[第 1.2 款的標題].1.2 小節的文字。

2. [第 2 節標題]

2.1.[第 2.1 款的標題].2.1 小節的文本

2.2.[第 2.2 款的標題].2.2 小節的文字。

我怎樣才能做到這一點(以正確的方式)?謝謝。

答案1

一種選擇是使用titlesec

\documentclass{article}
\usepackage{titlesec} 

\titleformat{\subsection}[runin]
  {\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}[runin]
  {\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}

\begin{document}

\section{Test section}
test text
\subsection{Test subsection}
test text
\subsection{Test subsection}
test text
\section{Test section}
test text
\subsection{Test subsection}
test text
\subsection{Test subsection}
test text

\end{document}

在此輸入影像描述

不含包:

\documentclass{article}

\makeatletter
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {-1.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {-1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\bfseries}}
\makeatother

\begin{document}

\section{Test section}
test text
\subsection{Test subsection}
test text
\subsection{Test subsection}
test text
\section{Test section}
test text
\subsection{Test subsection}
test text
\subsection{Test subsection}
test text

\end{document}

在此輸入影像描述

Subsubsection:刪除換行符號(如段落) 維爾納對於小節的情況提供了類似的答案;他也對此給了很好的解釋\@startsection

相關內容