LaTeX \包括图形和文本行
好吧,我被打败了。我尝试了一些事情,但我无法实现这一点。我现在需要一些帮助。 我希望能够并排显示一些文本和图片(只有一行,因此不需要换行或其他乐趣。图片足够小,可以容纳文本行):
This is a text <temp.jpg placed center to the textline>
问题是,当我使用
This is a text \includegraphics{temp.jpg}
图片基线 时与文本基线对齐。我希望图片(垂直)中心与文本基线对齐。我怎样才能使这成为可能?
Ok, I am beat. I tried a few things but I am unable to make this happen. I need some help now.
I want to be able to have some text and picture side by side (only one line, thus no need for wrapping or other fun. The picture is small enough to fit in a text line):
This is a text <temp.jpg placed center to the textline>
Problem is, when I use
This is a text \includegraphics{temp.jpg}
the pictures baseline is alligned with the text baseline. I want the picture (vertical) center to be aligned with the text baseline. How can I make this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来你想要
\raisebox
(请参阅 raisebox 部分< LaTeX wikibook 的 /a>),带有否定参数。使用尺寸 ex(当前字体中“x”的名义高度)或\baselineskip
(文本基线之间的大小)作为单位。如果您想做更复杂的事情,例如将图形框向下移动一半高度,您可以,但它会变得很繁琐。如果图形大小不可预测,那么您最好手动调整它。
It sounds like you want
\raisebox
(see the raisebox section of the LaTeX wikibook), with a negative argument. Use dimensions ex (the notional height of an 'x' in the current font) or\baselineskip
(the size between text baselines) as your units.If you want to do more complicated things, such as move the graphics box down by half its height, you can, but it gets fiddly. If the graphic size isn't unpredictable, you're probably better off tuning this by hand anyway.
在我看来,最简单的答案
\raisebox{-0.5\totalheight}{}
说明:
\raisebox
垂直移动作为第二个参数给出的整个文本/图片。第一个参数是作为长度的垂直移位。此命令提供长度\totalheight
,这是不言自明的,您想要升高的整个文本/图片的高度。因子-0.5
恰好在长度的一半处降低(如问题所要求)。对于美观调整,只需修改该因子的值即可。顺便说一句,使用这种方法,不需要像 @AlexeiMalistov 答案那样进入数学模式,也不需要双命令
\vcenter
+\hbox
In my opinion, most simple answer
\raisebox{-0.5\totalheight}{<your graphic here>}
Explanation:
\raisebox
moves vertically the whole text/picture given as second argument. The first argument is the vertical shift as a length. This command provides the length\totalheight
which is, self-explanatory, the height of the whole text/picture that you want to raise. The factor-0.5
lowers exactly at the half of the length(as the question demands). For aesthetic adjustments just modify the factor's value.By the way, with this method there is no need to get into math mode as in @AlexeiMalistov answer, and no need of double command
\vcenter
+\hbox