Wolfram mathematica 如何在Mathematica笔记本样式中填写CellFrameLabels?

Wolfram mathematica 如何在Mathematica笔记本样式中填写CellFrameLabels?,wolfram-mathematica,mathematica-frontend,Wolfram Mathematica,Mathematica Frontend,我一直在按照其他答案中的建议,制作编号的单元格框标签 我就快到了。我想在Creative/Pastel colors样式表中将节号添加到节样式中。我创建了一个新笔记本(在我的公共dropbox上有一个副本) 转到“格式”菜单,选择“样式表\Creative\PastelColor”,然后 “格式化”“编辑样式表”“选择样式:节”,然后单击样式表编辑对话框顶部的Creative\Pastelcolor.nb 这将打开另一个样式表编辑器,我转到下面的第四项“标题和部分单元格的样式”,然后是其中

我一直在按照其他答案中的建议,制作编号的单元格框标签

我就快到了。我想在Creative/Pastel colors样式表中将节号添加到节样式中。我创建了一个新笔记本(在我的公共dropbox上有一个副本)

转到“格式”菜单,选择“样式表\Creative\PastelColor”,然后 “格式化”“编辑样式表”“选择样式:节”,然后单击样式表编辑对话框顶部的Creative\Pastelcolor.nb

这将打开另一个样式表编辑器,我转到下面的第四项“标题和部分单元格的样式”,然后是其中的第二项“部分”。将鼠标十字光标放在其中并单击,然后选择“单元格”菜单,“显示表达式”项,其中显示以下表达式:

Cell[StyleData["Section"],
 CellFrame->{{0, 0}, {1, 3}},
 CellFrameColor->RGBColor[1., 0.819608, 0.658824],
 FontFamily->"Helvetica",
 FontSize->18,
 FontWeight->"Bold",
 FontColor->RGBColor[0.882353, 0.419608, 0.0784314],
 Background->RGBColor[1., 0.886275, 0.741176]]
太好了!透露了所有的细节,至少我是这么想的。特别是,CellFrame项为我提供了
{{0,0},{1,3}
信息,我需要将单元格框架标签与节样式对齐。好的,回到笔记本的steylsheet编辑器对话框,按照前面提到的答案,我键入

Cell[
 StyleData["Section"],
 CellFrameLabelMargins -> 0,
  CellFrameLabels-> { {
   Cell[
    TextData[{ "§", CounterBox["Section"], ": " }], 
    "SectionLabel",
    CellFrame -> {{0, 0}, {1, 3}},
    CellFrameMargins -> 4
   ] (* left label *),
   Inherited (* right label *) }, 
  {Inherited (* bottom label *), 
   Inherited (* top label *) } } ]
我通过反复试验找到的
CellFrameMargins->4
规则需要将单元格框架的顶部和底部与右侧的其余部分样式对齐。我很难过地报告说,它几乎不起作用。CellFrameLabels的文本和框架之间有间隙,我想填补这些间隙。这就好像CellFrameLabels中的字体上下伸展不够远,即使它们与部分单元格中的字体完全相同。我找不到填充标签后面背景的方法。我尝试了
Background->RGBColor[…]
,尝试了使用显式字体,尝试了多种组合设置CellFrameMargins和CellFrameLabelMargins,但都无济于事

我被难住了,希望你能给我一些建议


这似乎适用于粉彩风格。这样做的目的是将标签放在框架内。我不得不稍微摆弄一下
FrameBox
ImageMargins
FrameMargins
,使所有内容对齐

Cell[StyleData["Section"],
 CellFrameLabels->{{
  Cell[
   BoxData[
    FrameBox[
     TemplateBox[{"§", CounterBox["Section"], ": "},
      "Row",
       DisplayFunction->(RowBox[{#, " ", #2}]& )
     ],
     ImageMargins->-1,
     Background->RGBColor[1., 0.886275, 0.741176],
     FrameStyle->RGBColor[1., 0.886275, 0.741176],
     FrameMargins->2
    ]
   ], 
   "SectionLabel", CellFrame -> {{0, 0}, {1, 3}}, 
   CellFrameMargins->0
  ], Inherited}, 
  {Inherited, Inherited}},
 CellFrameLabelMargins->0
]
截图:

非常好!也给了我很多新东西可以玩