在命令中使用 \vspace 在段落之间添加空格,但不在节​​之前添加空格

在命令中使用 \vspace 在段落之间添加空格,但不在节​​之前添加空格

我正在使用自定义命令排版一些短语,我需要在它们之间留出一些垂直空间。不幸的是,这也会给标题前增加垂直section空间subsection

由于我必须输入很多引号,因此如果能\vspace在分段命令之前自动删除引号就好了。

有什么方法可以防止\vspace发生这种行为吗?

\documentclass[]{article}

\usepackage{lipsum}

\newcommand{\philquote}[1]{\noindent ``#1'' \vspace{12pt}}

\begin{document}

\section{Section 1}

\philquote{Socrates asked questions but gave no replies: for he confessed he had no knowledge}

\philquote{Socrates asked questions but gave no replies: for he confessed he had no knowledge}

\section{Section 2} % Wrong vertical spacing

\lipsum[1]

\section{Section 3} % Correct vertical spacing

\end{document}

答案1

你也\vspace{12pt}可以使用\par\addvspace{12pt}

\documentclass[]{article}

\usepackage{lipsum}

\newcommand{\philquote}[1]{\noindent ``#1'' \par\addvspace{12pt}}

\begin{document}

\section{Section 1}

\philquote{Socrates asked questions but gave no replies: for he confessed he had no knowledge}

\philquote{Socrates asked questions but gave no replies: for he confessed he had no knowledge}

\section{Section 2} % Correct vertical spacing

\lipsum[1]

\section{Section 3} % Correct vertical spacing

\end{document}

在此处输入图片描述

相关内容