如何在 Mathematica 中将 Row[] 的元素对齐到底部或顶部?
当我写
Row[ {Framed@Column[{1,2}], Framed@"123"}, Alignment->Top]
或
Row[ {Framed@Column[{1,2}], Framed@"123"}, Alignment->{Left,Top}]
无论哪种情况,都不会发生任何情况。默认对齐方式为居中,并且列出的元素与彼此的中线对齐。
Grid[ {{Framed@Column[{1,2}], Framed@"123"}}, Alignment->Top]
工作得很好,但是当 Row 时
就足够了。Grid[]
就有点矫枉过正了[]
帮助系统说对齐应该可以工作(列出 {Left,Baseline}
作为示例),但它似乎无法更改。我正在使用 v8.0.4。
When I write
Row[ {Framed@Column[{1,2}], Framed@"123"}, Alignment->Top]
or
Row[ {Framed@Column[{1,2}], Framed@"123"}, Alignment->{Left,Top}]
in either case, nothing happens. Default alignment is Center, and elements are listed aligned to each other's midline.
Grid[ {{Framed@Column[{1,2}], Framed@"123"}}, Alignment->Top]
works just fine, but Grid[]
is an overkill when a Row[]
would suffice.
Help system says Alignment should work (lists {Left,Baseline}
as example), but it doesn't seem to be changeable. I'm using v8.0.4.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Row
中的Alignment
选项并不对齐各个元素本身,而是对齐外部边界框中的这些元素。这可以通过以下方式查看:使用
Grid
代替。The
Alignment
option inRow
does not align the individual elements themselves, but rather these elements within an outer bounding box. This can be seen with:Use
Grid
instead.正如 Mr.Wizard 所说,
Grid
可能是您最好的选择,但如果您想使用Row
,您可以执行类似请注意,
Framed
还有一个选项BaselinePosition
,因此对于这个特定示例,您还可以执行类似的操作但
Pane
可以在任何情况。As Mr.Wizard said
Grid
is probably your best option, but if you want to useRow
you could do something likeNote that
Framed
also has an optionBaselinePosition
so for this particular example you can also do something likebut
Pane
works in any case.