
Я хочу определить вертикальное пространство, которое вставляется между абзацами текста, когда в коде есть пустая строка. Если я использую
\setparsizes{0pt}{1.0\baselineskip}{0pt plus 1fil}
или
\setlength{\parskip}{\bigskipamount}
\setlength{\parindent}{0pt}
затем это влияет также на вертикальное пространство между заголовками и т. д.
Есть ли простое решение, при котором мне не придется использовать что-то вроде \mypar
with \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}