LaTeX:查找给定文本的宽度并添加该宽度的水平空间

发布于 2024-10-01 00:19:50 字数 214 浏览 1 评论 0 原文

我想添加一个与给定文本宽度完全相同的空白。我可以使用 \hspace{},但随后我需要给定文本片段将在我的 LaTeX 文档中使用的宽度。

另一个想法是创建一个包含文本的隐形框。类似于 \mbox{text},但不可见。因为我非常确定我不能只是告诉 LaTeX 不要打印那个特定的框,所以我确信还有另一个解决方案。

有什么想法吗?

I would like to add a white space of exactly the width of a given text. I could use \hspace{}, but then I need the width that given piece of text is going to use in my LaTeX document.

Another idea is to create an invisible box containing the text. Like \mbox{text}, but invisible. As I am pretty sure that I cannot just tell LaTeX not to print that particular box, I am sure that there is another solution.

Any ideas?

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

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

发布评论

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

评论(1

森林很绿却致人迷途 2024-10-08 00:19:50

您正在搜索 \hphantom ,它会创建一个水平幻影框:

\par Here is some text
\par \hphantom{Here is some} more text.

将导致如下结果:

Here is some text
             more text

You’re searching for \hphantom which creates a horizontal phantom box:

\par Here is some text
\par \hphantom{Here is some} more text.

Will result in something like this:

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