我正在编写一份技术规范文档,每个部分都是规范的一部分。但在许多情况下,将规范的多个部分组合在一起并一起编写是有意义的。如下所示:
\subsubsection{Subsubsection A}
\subsubsection{Subsubsection B}
\subsubsection{Subsubsection C}
% This text concerns the subsubsections A, B and C
This is the subsubsection text.
\subsubsection{Subsubsection D}
% This text concerns the subsubsection D
This is the subsubsection text.
\subsubsection{Subsubsection F}
% This text concerns the subsubsection F
This is the subsubsection text.
我希望它的排版如下:
使用默认排版得到的结果是:
所以我希望将多个重复的空小节组合在一起,并且它们之间没有垂直空格。
答案1
只是为了好玩...
顺便说一句,1px 大约是 TeX 可以获得的最小值。0pt 会产生不同的结果。
\documentclass{article}
\makeatletter
\newenvironment{mygroup}{\par\vskip 3.25ex\@plus 1ex \@minus .2ex % normal skip at beginning
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-1px}{1px}% for positive/negative tests
{\normalfont\normalsize\bfseries}}}%
{\vskip 1.5ex \@plus .2ex}% normal skip at end
\makeatother
\begin{document}
\section{Section A}
\subsection{Section A}
\begin{mygroup}
\subsubsection{Subsubsection A}
\subsubsection{Subsubsection B}
\subsubsection{Subsubsection C}
\end{mygroup}
This is the text.
\subsubsection{Subsubsection D}
This is the text.
\subsubsection{Subsubsection F}
This is the text.
\end{document}
答案2
找到了一个解决方案(使用\vspace
),它可以满足我的要求。
\documentclass{article}
\usepackage{titlesec}
\usepackage{lipsum}
\usepackage{parskip}
\begin{document}
\section{Section A}
\subsection{Section A}
\subsubsection{Subsubsection A} \vspace{-1.0\parskip}
\subsubsection{Subsubsection B} \vspace{-1.0\parskip}
\subsubsection{Subsubsection C}
This is the text.
\subsubsection{Subsubsection D}
This is the text.
\subsubsection{Subsubsection F}
This is the text.
\end{document}