2012-01-25 57 views
5

我一直在努力讓號單元幀標籤下面的這些其他的答案如何在Mathematica Notebook樣式中填寫CellFrameLabels?

Extending cell definition to CellFrameLabels definition

How to Autonumber Cell Tags in Mathematica Notebooks?

非常好的建議,我幾乎沒有。我想在廣告素材/蠟筆顏色樣式表中爲章節樣式添加章節編號。我創建了一個新的筆記本(這裏是一個副本,在我公開的Dropbox)

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

去「格式」菜單,選擇「樣式表\創意\ PastelColor」,然後 「格式」「編輯樣式表」,「選擇樣式:部分「,然後單擊樣式表編輯對話框頂部的Creative \ Pastelcolor.nb。

打開另一個樣式表編輯器,然後在第四個項目中選擇「標題和截面單元格樣式」,然後選擇第二個項目「Section」。把鼠標十字線在那裏,並單擊,然後選擇「單元格」菜單中的「顯示錶達式」項目,從而揭示了下面的表達式:

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]] 

GREAT!揭示了所有的細節,或者我想過的。特別是,CellFrame項目爲我提供{{0, 0}, {1, 3}}信息,我需要使用Section樣式將我的單元格框架標籤對齊。好了,回到下面的上述答案steylsheet編輯器對話框,我的筆記本電腦,以及I型

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,但許多組合都無濟於事。

我很難過,並希望得到任何建議。

Screenshot

回答

4

這似乎爲柔和的工作作風。這樣做是將標籤放在框架內。我必須用ImageMargins和來調整一切,以使所有事情保持一致。

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 
] 

截圖: screen shot

+1

很不錯!也給了我很多新的東西來玩 –

相關問題