使用 vspace,带有间距吗?

使用 vspace,带有间距吗?

当我使用 vspace 命令时,除非我在命令前后添加新的空行,否则它不会起作用。这是正常的吗?如果是,为什么会这样?为什么命令周围需要空格?

答案1

\vspace仅在 LaTeX 创建换行符或新段落时生效。我认为从技术角度来说,\vspace仅在 LaTeX 处于垂直模式时才有效。如果 LaTeX 当前未处于垂直模式,则 LaTeX保存直到\vspace下次进入垂直模式。

例如我可以写:

\documentclass{article}
\begin{document}

  Alice was beginning \vspace{2ex} to get very tired of sitting by her sister on
  the bank, and of having nothing to do. Once or twice she had peeped
  into the book her sister was reading, but it had no pictures or
  conversations in it, ``and what is the use of a book,'' thought
  Alice, ``without pictures or conversations?''

\end{document}

结果是

在此处输入图片描述

如果我想强制将其\vspace放置在我放置的位置,那么我还必须在那里开始换行符:

\documentclass{article}
\begin{document}

  Alice was beginning \vspace{2ex}\newline to get very tired of sitting by her sister on
  the bank, and of having nothing to do. Once or twice she had peeped
  into the book her sister was reading, but it had no pictures or
  conversations in it, ``and what is the use of a book,'' thought
  Alice, ``without pictures or conversations?''

\end{document}

在此处输入图片描述

或者你可以开始一个新段落:

\documentclass{article}
\begin{document}

  Alice was beginning \vspace{2ex}

  \noindent
  to get very tired of sitting by her sister on
  the bank, and of having nothing to do. Once or twice she had peeped
  into the book her sister was reading, but it had no pictures or
  conversations in it, ``and what is the use of a book,'' thought
  Alice, ``without pictures or conversations?''

\end{document}

在此处输入图片描述

\parskip最后两个例子可能看起来非常相似,但是如果您设置为非零值,效果可能会有所不同,这通常是不鼓励的。

相关内容