
這回答展示了我們如何使用 \S 實現段落編號。
下面我們怎麼才能讓 §1 和 §2 之間的間距與上面 §1 文本中的行間距相同,而不改變後者的行間距?另外,§1 和上面的文字之間的間距如何符合相同的間距?
以下程式碼的第二個是我根據接受的答案使用的解決方案。
\documentclass[12pt]{article}
\usepackage{chngcntr}
\counterwithout{paragraph}{subsubsection}
\renewcommand{\theparagraph}{\S\arabic{paragraph}}
\setcounter{secnumdepth}{4}
\begin{document}
Here are just some words to show the normal spacing between lines in the main document.
\paragraph{} 1st paragraph
\paragraph{} 2nd paragraph
\end{document}
\documentclass{article}
\usepackage{chngcntr,titlesec}
\counterwithout{paragraph}{subsubsection}
\renewcommand{\theparagraph}{\S\arabic{paragraph}}
\setcounter{secnumdepth}{4}
\titlespacing{\paragraph}
{15pt}{0pt}{-8pt}
\usepackage{showframe}
\begin{document}
Here are just some words to show the normal spacing between lines in the main document.
\paragraph{} 1st paragraph
\paragraph{} 2nd paragraph
\end{document}```
答案1
從您的貼文中,了解您需要修改標籤之前的垂直間距\paragraph
,我的理解是否正確,那麼請使用以下內容MWE
:
\documentclass{article}
\usepackage{chngcntr,titlesec}
\counterwithout{paragraph}{subsubsection}
\renewcommand{\theparagraph}{\S\arabic{paragraph}}
\setcounter{secnumdepth}{4}
\makeatletter
\titlespacing{\paragraph}
{0pc}{3.5ex \@plus -1ex \@minus -.2ex}{10pt}
\makeatother
\begin{document}
Here are just some words to show the normal spacing between lines in the main document.
\paragraph{} 1st paragraph
\paragraph{} 2nd paragraph
\end{document}
注意:正如您在評論中提到的,您正在使用article
類文件,因此我為第一級標題保留了相同的上方垂直空間\paragraph
...
這是我根據接受的答案使用的解決方案:
\documentclass{article}
\usepackage{chngcntr,titlesec}
\counterwithout{paragraph}{subsubsection}
\renewcommand{\theparagraph}{\S\arabic{paragraph}}
\setcounter{secnumdepth}{4}
\titlespacing{\paragraph}
{15pt}{0pt}{-8pt}
\usepackage{showframe}
\begin{document}
Here are just some words to show the normal spacing between lines in the main document.
\paragraph{} 1st paragraph
\paragraph{} 2nd paragraph
\end{document}