1
$\begingroup$

I'm programically constructing a palette, and trying to add items/cells to the palette with a dingbat. The cells themselves have a style of "Item" which should show up with the dingbat, but when adding the cell to the palette via DisplayForm[cell], the dingbat doesn't show.

OpenerView[{"Definitions", Column[(DisplayForm[#])&/@definitions]}]

@definitions is a list of full form Cell expressions, with a style of Item. I've tried manipulating the cell with CellStyle, Style, and other techniques before adding the cell to the palette, with no luck.

For instance:

 definitions = {Cell[TextData[{"A ", StyleBox["unit vector", FontWeight -> "Bold"],
   " is a vector that has a magnitude of 1, with no units."}], "Item",
   CellChangeTimes -> {{3.726004891*10^9, 3.726004913*10^9}},
   CellTags -> "definition"]};

After trial and error, I was able to prepend a dingbat to the text in the cell like

PrependTo[cell[[1,1]], StyleBox["\[FilledSquare] ", Red]];

But it would be nice to know how to do it using a CellDingbat.

$\endgroup$
2
  • 1
    $\begingroup$ Could you provide the code for a few definitions? $\endgroup$
    – bbgodfrey
    Commented May 6, 2018 at 12:09
  • $\begingroup$ Thanks bbodfrey, I'm pulling the definitions from another notebook, but basically, they are all mostly like this. Cell[TextData[{"A ", StyleBox["unit vector", FontWeight -> "Bold"], " is a vector that has a magnitude of 1, with no units."}], "Item", CellChangeTimes -> {{3.726004891*10^9, 3.726004913*10^9}}, CellTags -> "definition"] After trial and error, I was able to prepend a dingbat to the text in the cell like PrependTo[cell[[1,1]], StyleBox["[FilledSquare] ", Red]]; , but it would be nice to know how to do it using a CellDingbat. $\endgroup$
    – mitcheljh
    Commented May 6, 2018 at 19:34

1 Answer 1

1
$\begingroup$

Some options make more sense when the Cell is in the list of Cells of a Notebook[{cell1, cell2,...}] and less sense when the cell is an inline cell as in the OP's use. For instance CellMargins is one these. Apparently CellDingbat is also. Just adding CellDingbat -> StyleBox["\[FilledSquare]", Red] manually to the cell can confirm this. One can see that the CellDingbat is in the output cell by selecting the cell and using the menu command Cell > Show Expression. One can also see that the dingbat is not displayed. One might go further and map CellPrint /@ definitions (after adding CellDingbat, of course) to see that the dingbat is displayed in this form.

From this I infer that the CellDingbat option is ignored when displaying an inline cell. I cannot find documentation to confirm this, though.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.