Message Boards Message Boards

4 Replies
9 Total Likes
View groups...
Share this post:

Auto Numbering with a cell style that has a background

Posted 12 years ago
Strong of the help I got on the community site for using all kinds of auto numbering, I am trying to use it on Cell that have a background color.

I had to add some parameters to the Cell of the Dingbat to match the cell, but still, on most cells the height is wrong by one pixel, which makes the cell look bad. (the background behind the number is not as tall as the background behind the text)

here is the style definition in my stylesheet:
CellDingbat->Cell[ TextData[{ CounterBox["ItemNumbered"], "."}], FontSize -> 24, CellFrame -> True,
CellFrameMargins -> 8,CellFrameColor->RGBColor[0.34641031509880216`, 0.544151979858091, 0.6997787441824979]],
MenuCommandKey->"2", FontSize->24, FontColor->GrayLevel[1],
Background->RGBColor[0.34641031509880216`, 0.544151979858091, 0.6997787441824979]
Is there a better way to do this?
POSTED BY: Luc Barthelet
4 Replies
You can use CellFrameMargins to push the dingbat inside of the background-painted region.  E.g.,
Cell["Test", "ItemNumbered", Background -> Orange,
  CellFrameMargins -> {{25, Inherited}, {Inherited, Inherited}}]]
POSTED BY: John Fultz
I'd be curious to find a solution to this too. If I understand correctly a very simple example would be something like the following (one doesn't have to add this to stylesheet - just execute this line):
CellPrint[Cell["Test", "ItemNumbered", Background -> Orange]]

POSTED BY: Vitaliy Kaurov
Here is what I am talking about :

Cell[StyleData["ItemNumbered"], CellDingbat->Cell[   TextData[{     CounterBox["ItemNumbered"]}], FontWeight -> "Bold"], CellMargins->{{91, 10}, {4, 4}}, CellGroupingRules->{"SectionGrouping", 100}, ShowCellTags->True, MenuCommandKey->"6", FontFamily->"Times", FontSize->16, FontWeight->"Plain", FontSlant->"Plain"]
POSTED BY: Luc Barthelet
I don't see the problem.  I'm working on v9 in OS X.  I put your StyleData into the stylesheet for a blank document (inherited from Default.nb) and then inputted the following cell. 
Cell["Blah, blah, blah", "ItemNumbered"]
It looks fine for me.  Is this a platform glitch?  Is there another inherited stylesheet for your notebook?  The only issue I see is that it looks bad when the text is long enough to scroll into a second line.
POSTED BY: Terrence Honan
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract