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

Reb*_*bin 5 wolfram-mathematica mathematica-frontend

我一直在努力获得编号的细胞框架标签,遵循这些其他答案的伟大建议

将单元格定义扩展到CellFrameLabels定义

如何在Mathematica笔记本中自动编号单元格标签?

而我几乎就在那里.我想在Creative/Pastel颜色样式表中为节样式添加节号.我创建了一个新笔记本(这是我的公共Dropbox上的副本)

http://dl.dropbox.com/u/1997638/CellFrameMargins.nb

转到"格式"菜单,选择"样式表\ 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]]
Run Code Online (Sandbox Code Playgroud)

大!显示所有细节,或者我想.特别是,CellFrame项目为我{{0, 0}, {1, 3}}提供了使用Section样式排列我的单元格框架标签所需的信息.好的,回到我的笔记本的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 *) } } ]
Run Code Online (Sandbox Code Playgroud)

CellFrameMargins -> 4我通过反复试验找到的规则需要将单元格框架的顶部和底部排成一行,其余的部分样式排在右侧.我很遗憾地报告它几乎可以工作.CellFrameLabels的文本与框架之间存在间隙,我想填补这些空白.就好像CellFrameLabels中的字体不会向上和向下伸展得足够远,即使它们与Section单元格中的字体完全相同.我找不到填写标签背后的方法.我尝试过Background -> RGBColor[...],我尝试使用explict字体,我尝试设置CellFrameMargins和CellFrameLabelMargins,在许多组合中,但无济于事.

我很难过,并会感激任何建议.

截图

Hei*_*ike 4

这似乎适用于柔和的风格。其作用是将标签放入框架内。我不得不摆弄一下 和ImageMarginsFrameMargins使FrameBox一切对齐。

\n\n
Cell[StyleData["Section"],\n CellFrameLabels->{{\n  Cell[\n   BoxData[\n    FrameBox[\n     TemplateBox[{"\xc2\xa7", CounterBox["Section"], ": "},\n      "Row",\n       DisplayFunction->(RowBox[{#, " ", #2}]& )\n     ],\n     ImageMargins->-1,\n     Background->RGBColor[1., 0.886275, 0.741176],\n     FrameStyle->RGBColor[1., 0.886275, 0.741176],\n     FrameMargins->2\n    ]\n   ], \n   "SectionLabel", CellFrame -> {{0, 0}, {1, 3}}, \n   CellFrameMargins->0\n  ], Inherited}, \n  {Inherited, Inherited}},\n CellFrameLabelMargins->0\n]\n
Run Code Online (Sandbox Code Playgroud)\n\n

屏幕截图:\n截屏

\n