来源:
\documentclass{scrbook}
\usepackage{titlesec}
\titleformat{name=\section,numberless}[block]{}{}{0pt}{}
\begin{document}
\section*{Foo \hfill 1 January 1970}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis.
Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer
id, vulputate a, magna.
\end{document}
渲染为:
使用\documentclass[parskip]{scrbook}
,标题宽度减小:
如何在不影响标题宽度的情况下用垂直空间分隔段落?
答案1
不建议与 KOMA-Script 类一起使用titlesec
。您可以使用 KOMA-Script 的可能性:
\documentclass{scrbook}
\RedeclareSectionCommand[afterskip=1sp]{section}
\setkomafont{section}{\normalfont}
\renewcommand\raggedsection{}
\begin{document}
\section*{Without parskip\hfill1 January 1970}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis.
Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer
id, vulputate a, magna.
\KOMAoptions{parskip}
\section*{With parskip\hfill1 January 1970}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis.
Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer
id, vulputate a, magna.
\end{document}
请注意,我之所以使用,是afterskip=1sp
因为只有正值才会导致垂直跳过。如果值为0pt
或负值,则会激活跑入航向,而绝对值会导致水平跳过。