我一直在努力按照这些其他答案中的好建议来获取编号的单元格框架标签
如何在 Mathematica Notebooks 中自动编号单元格标签?
我快到了。我想在 Creative / Pastel 颜色样式表中将部分编号添加到部分样式中。我创建了一个新笔记本(这是我的公共保管箱上的副本)
http://dl.dropbox.com/u/1997638/CellFrameMargins.nb
转到“格式”菜单,选择“样式表\创意\ 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}}
单元格框架标签与 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 *) } } ]
CellFrameMargins -> 4
我通过反复试验找到的规则需要将单元格框架的顶部和底部与右侧的其余部分样式对齐。我很遗憾地报告它几乎只能工作。CellFrameLabels 的文本和框架之间存在空白,我想填补这些空白。就好像 CellFrameLabels 中的字体没有向上和向下伸展足够远,即使它们与 Section 单元格中的字体完全相同。我找不到填充标签背后背景的方法。我试过Background -> RGBColor[...]
了,我尝试输入显式字体,我尝试以多种组合设置 CellFrameMargins 和 CellFrameLabelMargins,但无济于事。
我很难过,不胜感激任何建议。