开发者

LaTeX: Finding width of a given text and adding a horizontal space of that width

开发者 https://www.devze.com 2023-01-24 13:19 出处:网络
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.

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 i开发者_如何学Cnvisible 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?


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
0

精彩评论

暂无评论...
验证码 换一张
取 消