LaTeX \rule 填充该行
为什么以下命令不会生成填充行尾之前的空间的水平线?
Hello \rule[0.5em]{\fill}{1pt}
据我了解,这应该打印文本“Hello
”,后跟一条延伸到行尾的水平线,类似于宏 \hfill
,它实际上是相当于\hspace\fill
。 – 但实际上,这个命令只是产生文本“Hello
”,没有规则。
我知道效果可以由 \hrulefill
产生,但不能在这里使用,因为我想要一个 raised 规则和 \hrulefill
不能与 \raisebox
一起使用,并且我希望我的规则悬挂在基线之上(最好位于该行的中间)。
Why does the following command not produce a horizontal rule filling the space until the end of the line?
Hello \rule[0.5em]{\fill}{1pt}
It is my understanding that this should print the text “Hello
” followed by a horizontal rule that extends until the end of the line, analogously to the macro \hfill
which is effectively equivalent to \hspace\fill
. – But in effect, this command just produces the text “Hello
”, no rule.
I am aware that the effect can be produced by \hrulefill
but it can’t be used here because I want a raised rule and \hrulefill
doesn’t work together with \raisebox
and I want my rule to hang above the baseline (at best in the middle of the line).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
对于为什么您提供的命令不起作用,我没有令人满意的答案,但我可以提供有效的解决方法。将其放入
文档的前言中,然后您就可以完成您希望的事情:
I don't have a satisfying answer as to why the command you presented doesn't work, but I can offer an effective workaround. Put
into your document's preface, and then you can accomplish what you were hoping to with:
水平尺高度为 1pt,并升高 1.5pt。
The horizontal rule of 1pt height and raised by 1.5pt.
有一个名为 ulem 的包,它
会生成
为了满足您的好奇心, ulem 包的选项
normalem
可以防止 ulem 使用\em
或\emph
生成额外的下划线。There is a package called ulem which does this
which will produce
For your curiosity, the option
normalem
for package ulem prevents ulem to produce extra underline with\em
or\emph
.您可以使用命令 \hrulefill 来完成此操作
请参阅http://en.wikibooks.org/wiki/LaTeX/Lengths#Fill_the_rest_of_the_line
You can do this with the command \hrulefill
see http://en.wikibooks.org/wiki/LaTeX/Lengths#Fill_the_rest_of_the_line
% 我做到了!
%
% I did it!
%