I'd like use rounded rectangles for my cell style, but I'm not sure if this is possible. Perhaps it can be faked with an image as a background for it?
I don't think this is possible. One can set the four sides of the cell frame to various different styles using the undocumented option CellFrameStyle
which you have to prefix with the System`
context to get it to work (syntax coloring won't recognize it as a valid option):
CellPrint[
TextCell[
StringTake[ExampleData[{"Text", "AliceInWonderland"}], {200, 1000}],
"Text",
CellFrame -> True,
System`CellFrameStyle ->
{ Directive[Red, Thickness[5] ],
Directive[Green, Thickness[10], Dashed ],
Directive[Blue, Thickness[5] , Dotted],
Directive[Gray, Thickness[5] , Dashing[{20, 3}]]
},
CellMargins -> {{100, 50}, {5, 5}}]]
.
The fact that you can specify it as four separate frame parts make me believe rounded corners are not possible. With sides specified separately I don't think an option like RoundingRadius
would work.
-
$\begingroup$ On my system (v9 Linux), the
System
context is not required, andDashed
andDotted
do not seem to work the same as your example (butDashing
does).CapForm
orJoinForm
might be useful for producing rounding but also do not work. $\endgroup$ – Xerxes Mar 1 '13 at 23:45 -
$\begingroup$ @xerxes interesting. On Windows, using it without context, doesn't do anything. Upon inspection of the cell code (ctrl shift E) I see an extra $CellContext tagged to CellFrameStyle. Tagging it with System prevents this. $\endgroup$ – Sjoerd C. de Vries Mar 2 '13 at 9:00
You might work around the limitations of CellFrame
by framing the content. Framed
allows for a RoundingRadius
.
CellPrint[
Framed[TextCell[
StringTake[
ExampleData[{"Text", "AliceInWonderland"}], {200, 1000}], "Text",
CellMargins -> {{100, 50}, {5, 5}}], RoundingRadius -> 15,
FrameStyle -> Red]]
-
$\begingroup$ Sorry, Szabolcs. I only noticed your comment after answering the question. Really. $\endgroup$ – DavidC Mar 1 '13 at 23:44
-
1$\begingroup$ You notice the artefacts this yields in the text? $\endgroup$ – Sjoerd C. de Vries Mar 1 '13 at 23:49
-
$\begingroup$ Thanks. Placing
Framed
around theTextCell
seems to take care of it. $\endgroup$ – DavidC Mar 2 '13 at 0:00 -
1$\begingroup$ Much better. Though not really a cell frame as asked by the OP, I think this is the closest to what it would look like. $\endgroup$ – Sjoerd C. de Vries Mar 2 '13 at 8:56
-
Framed
has the optionRoundingRadius
. This is not for cell frames though, but it may lead the way to a solution. $\endgroup$ – Szabolcs Mar 1 '13 at 18:42