LaTeX - 垂直空间相当于 \makebox?

发布于 2024-09-05 07:03:29 字数 203 浏览 3 评论 0原文

我正在制作一个 LaTeX 文档,并且使用 \makebox 取得了成功,它将文本放入一个不可见的框中,并在末尾添加额外的水平空白,以使整个内容适合您的大小指定。

垂直空间有类似的东西吗?

我有一些可变长度的段落、图像等,我想将它们放入这个垂直框中。我希望 LaTeX 放入适量的垂直空间(在底部),以便整个内容具有我给它的设定大小。

I'm making a LaTeX document and I'm getting success with \makebox, which puts text in an invisible box and will add extra horizontal whitespace to the end to make the whole thing fit within the size you specify.

Is there something like that for vertical space?

I have a few variable length paragraphs, images, etc. that I want to put in this vertical box. I want LaTeX to put in the right amount of vertical space (at the bottom) so that the whole thing is of the set size that I give it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

温柔戏命师 2024-09-12 07:03:29

LaTeX 提供的用于进行垂直调整的框命令是 \raisebox

\raisebox{distance}[extend-above][extend-below]{insert your text here...}

使用 distance 参数,您可以指定升高或降低文本的偏移量,以及 extend- aboveextend-below 参数可用于添加额外的空间。例如,此命令非常适合将小字体大小的少量文本放置在较大字体大小的行中。

还可以使用 \vspace*{distance} 命令创建简单的附加垂直空间,该命令会插入附加垂直空间。 (带星号的版本还在开头和结尾添加了空格,普通版本仅在文本块之间添加了空格)。您可以将其放在段落末尾或您自己的命令末尾,以便在之后(或之前)添加一些间隔符。

但对于较长的文本提取,我建议使用 \minipage 环境:

\begin{minipage}[position][height][inner-pos]{width}
    insert your long text here
\end{minipage}

The box command LaTeX offers for doing vertical adjustments is \raisebox:

\raisebox{distance}[extend-above][extend-below]{insert your text here...}

With the distance parameter, you can specify a offset to raise or lower the text, and extend-above and extend-below parameters can be used to add additional space. This command is for example great for positioning a small amount of text with a small font size in a line with a bigger font size.

Simple additional vertical spaces can also be created with the \vspace*{distance} command, which inserts an additional vertical space. (The starred version also adds the space on the beginning and end, the normal version only adds space between text blocks). You might put that on the end of your paragraph or at the end of your own command to add some spacer afterwards (or before).

But for longer text extracts, I would recommend to use the \minipage environment:

\begin{minipage}[position][height][inner-pos]{width}
    insert your long text here
\end{minipage}
冷默言语 2024-09-12 07:03:29

minipage 环境有一个高度参数:

\begin{minipage}[position][height][inner-pos]{width}
 text
\end{minipage}

抱歉,我找不到适合该环境的文档页面。

A minipage environment has a height parameter:

\begin{minipage}[position][height][inner-pos]{width}
 text
\end{minipage}

I can't find a nice documentation page for this environment, sorry.

从来不烧饼 2024-09-12 07:03:29

下面显示了总体思路(未经测试):

\def\exampleheight{3in}
\def\examplecontents{\vrule height 1in width 1pt \par Some text}
\vbox to \exampleheight {\examplecontents \vfill}

这是 Plain Tex,它在 Latex 中工作得很好,并且在 Eijkhout 的 TeX 按主题

The following shows the general idea (untested):

\def\exampleheight{3in}
\def\examplecontents{\vrule height 1in width 1pt \par Some text}
\vbox to \exampleheight {\examplecontents \vfill}

This is Plain Tex, which works fine in Latex, and is well-documented in Eijkhout's TeX by Topic.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文