
我想定義當程式碼中有空行時在文字段落之間插入的垂直空間。如果我使用
\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}