我想定义当代码中有空行时在文本段落之间插入的垂直空间。如果我使用
\setparsizes{0pt}{1.0\baselineskip}{0pt plus 1fil}
或者
\setlength{\parskip}{\bigskipamount}
\setlength{\parindent}{0pt}
那么它也会影响标题和其他内容之间的垂直空间。
有没有一个简单的解决方案,让我不需要使用类似的\mypar
东西\newcommand{\mypar}{\par\bigskip}
。
\documentclass{scrreprt}
%% Method by KOMA-Script
%\setparsizes{0pt}{1.0\baselineskip}{0pt plus 1fil}
%% Other Method
\setlength{\parskip}{\bigskipamount}
\setlength{\parindent}{0pt}
\begin{document}
\chapter{}
==========================================
\section{TestSection Large Space}
\subsection{TestSubsection Large Space}
\subsubsection{TestSubSubsection Large Space}
Here we have big vertical space between headings because parskip
is inserted. I just want a parskip between text paragraphs.
==========================================
\newcommand{\mypar}{\par\bigskip}
\setlength{\parskip}{0pt}
\section{TestSection space I want}
\subsection{TestSubSection space I want}
\subsubsection{TestSubSubsection space I want}
Here I have the space between the headings that I want. And the space between text-paragraphs that I want.
\mypar
I wonder if there is an easy way to achieve this.
I would like to keep using an empty line as par bigskip instead newcommand a new command to achieve that.
\end{document}
答案1
不要\parskip
手动设置。KOMA-Script 类的默认方式是使用parskip
带有值的选项,如、half
等。有关更多详细信息,请参阅文档 - 并参阅注释full
full-
埃格尔以下。
要设置跳过标题级别之前或之后,请使用
\RedeclareSectionCommand[
beforeskip=<length or glue>,
afterskip=<length or glue>
]{<heading level name>}
\parskip
但是,即使使用最小的正值,标题后的垂直空间至少也是均匀的afterskip=1sp
。如果水平跳过的值为负值afterskip
,则使用垂直跳过。另请参阅https://tex.stackexchange.com/a/292202/43317。
\parskip
如果你真的想删除标题末尾插入的空格,有一个办法
\usepackage{xpatch}
\xapptocmd{\sectionlinesformat}{\vspace*{-\parskip}}{}{}
代码:
\documentclass[parskip=full-]{scrreprt}
\RedeclareSectionCommand[
beforeskip=3.3\baselineskip,
afterskip=.725\baselineskip plus .115\baselineskip minus .192\baselineskip
]{chapter}
\RedeclareSectionCommand[
beforeskip=-2ex plus -1ex minus -.2ex
]{section}
\RedeclareSectionCommands[
beforeskip=-1.75ex plus -1ex minus -.2ex
]{subsection,subsubsection}
\usepackage{xpatch}
\xapptocmd{\sectionlinesformat}{\vspace*{-\parskip}}{}{}
\usepackage{blindtext}% dummy text
\begin{document}
\chapter{Chapter}
\section{TestSection Large Space}
\subsection{TestSubsection Large Space}
\subsubsection{TestSubSubsection Large Space}
\Blindtext[2]
\Blinddocument
\end{document}
答案2
您可以只\parskip
在组内进行修改以限制其在该组内的效果
\documentclass{scrreprt}
%% Method by KOMA-Script
%\setparsizes{0pt}{1.0\baselineskip}{0pt plus 1fil}
%% Other Method
\setlength{\parskip}{\bigskipamount}
\setlength{\parindent}{0pt}
\begin{document}
{\parskip=0pt
\chapter{}
==========================================
\section{TestSection Large Space}
\subsection{TestSubsection Large Space}
\subsubsection{TestSubSubsection Large Space}
}
Here we have big vertical space between headings because parskip
is inserted. I just want a parskip between text paragraphs.
==========================================
{\parskip=0pt
\section{TestSection space I want}
\subsection{TestSubSection space I want}
\subsubsection{TestSubSubsection space I want}
}
Here I have the space between the headings that I want. And the space between text-paragraphs that I want.
I wonder if there is an easy way to achieve this.
I would like to keep using an empty line as par bigskip instead newcommand a new command to achieve that.
\end{document}
答案3
以下可作为快速修复方法:
\usepackage[parfill]{parskip}