Coding style 在Mathematica中向操纵输出添加对齐

Coding style 在Mathematica中向操纵输出添加对齐,coding-style,alignment,wolfram-mathematica,Coding Style,Alignment,Wolfram Mathematica,考虑到以下几点: Manipulate[ If[Intersection[Row1, Row2] == {}, Style[Plus @@ {Plus @@ Row1, Plus @@ Row2}, Bold, 20], "Error"], {{Row1, {1}}, {1, 2, 3, 4, 5}, ControlType -> TogglerBar}, {{Row2, {2}}, {1, 2, 3, 4,

考虑到以下几点:

Manipulate[
           If[Intersection[Row1, Row2] == {}, 
              Style[Plus @@ {Plus @@ Row1, Plus @@ Row2}, Bold, 20],
              "Error"],
{{Row1, {1}}, {1, 2, 3, 4, 5}, ControlType -> TogglerBar},
{{Row2, {2}}, {1, 2, 3, 4, 5}, ControlType -> TogglerBar}
           ]


-我希望“3”居中,可以吗?

使用
面板
,带有
对齐
选项:

Manipulate[
 Panel[
  If[Intersection[Row1, Row2] == {}, 
     Style[Plus @@ {Plus @@ Row1, Plus @@ Row2}, Bold, 20], "Error"
  ], 
  ImageSize -> 150, Alignment -> Center, Appearance -> "Frameless"
 ], 
 {{Row1, {1}}, {1, 2, 3, 4, 5}, ControlType -> TogglerBar},
 {{Row2, {2}}, {1, 2, 3, 4, 5}, ControlType -> TogglerBar}
]

使用带有对齐选项的
面板

Manipulate[
 Panel[
  If[Intersection[Row1, Row2] == {}, 
     Style[Plus @@ {Plus @@ Row1, Plus @@ Row2}, Bold, 20], "Error"
  ], 
  ImageSize -> 150, Alignment -> Center, Appearance -> "Frameless"
 ], 
 {{Row1, {1}}, {1, 2, 3, 4, 5}, ControlType -> TogglerBar},
 {{Row2, {2}}, {1, 2, 3, 4, 5}, ControlType -> TogglerBar}
]

操纵有自己的对齐选项。您可以查看这是否适用于您:

Manipulate[

If[Intersection[Row1,Row2]=={},Style[Plus@@{Plus@@Row1,Plus@@Row2},Bold,20],"Error"],   

{{Row1,{1}},{1,2,3,4,5},ControlType->TogglerBar},
{{Row2,{2}},{1,2,3,4,5},ControlType->TogglerBar},

Alignment->Center
]

操纵有自己的对齐选项。您可以查看这是否适用于您:

Manipulate[

If[Intersection[Row1,Row2]=={},Style[Plus@@{Plus@@Row1,Plus@@Row2},Bold,20],"Error"],   

{{Row1,{1}},{1,2,3,4,5},ControlType->TogglerBar},
{{Row2,{2}},{1,2,3,4,5},ControlType->TogglerBar},

Alignment->Center
]

非常感谢,这太完美了。刚刚发布了一个关于DelaunayTriangulation的问题,这个问题几乎是针对你的:)你知道为什么代码中的“中心”显示为红色,尽管工作正常?我在屏幕上看不到。你真的忠实地复制了它吗?以前,最后一个括号从上面的蓝色代码框中放错了位置。你可能错过了那个。但是,代码根本不应该起作用。哦,我只是理解了正在发生的事情:在多个上下文中隐藏!非常感谢,这太完美了。刚刚发布了一个关于DelaunayTriangulation的问题,这个问题几乎是针对你的:)你知道为什么代码中的“中心”显示为红色,尽管工作正常?我在屏幕上看不到。你真的忠实地复制了它吗?以前,最后一个括号从上面的蓝色代码框中放错了位置。你可能错过了那个。但是,代码根本不应该起作用。哦,我只是理解了正在发生的事情:在多个上下文中隐藏!