Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The FrameStyle option in Framed seems to work for some graphics directives but not others, eg:

Framed["yo", FrameStyle -> Blue]

enter image description here

But

Framed["??", FrameStyle -> Thickness[0.1]]

and

Framed["??", FrameStyle -> Directive[Thickness[0.1]]]

seem to have no effect (having varied thickness parameter)

enter image description here

share|improve this question
2  
I can only confirm that this happens on my PC (Win7-64/MMA8.04) too. The documentation suggests that the above should be possible, though not a single example using Framed, FrameStyle and Thickness together is given. – Sjoerd C. de Vries Jul 31 '12 at 21:43
up vote 17 down vote accepted

It indeed seems that the thickness of the frame doesn't respond to any of the options in Frame. As a workaround, you could do this (although I would recommend the second approach below, instead!):

SetOptions[FrameBox, BoxFrame -> 3]; 
Framed["AA", FrameStyle -> Red]

However, the SetOptions will affect all frames drawn in your notebook (even ones that have been drawn before).

A more customizable approach would be to use the lower level FrameBox directly. This is shown here - using the ability of BoxFrame to specify thicknesses of all sides individually:

FrameBox["AA", FrameStyle -> Red, 
  BoxFrame -> {{1, 4}, {1, 1}}] // DisplayForm

framed

Edit: I neglected to add the comment by Mike Honeychurch, according to which it's also possible to get the above output with this line:

Framed["AA", BoxFrame -> {{1, 4}, {1, 1}}, FrameStyle -> Red]

However, the BoxFrame option appears in red because it's not an officially documented option (and therefore this last line may stop working in future versions).

But: This Framed["AA", "BoxFrame" -> {{1, 4}, {1, 1}}, FrameStyle -> Red] does not make "BoxFrame" red neither in the Front End nor in Workbench.

share|improve this answer
    
+1 Nice little insights ;-) – Vitaliy Kaurov Jul 31 '12 at 22:47
3  
BoxFrame can be used directly with Framed, so use of lower level boxes can be avoided: Framed["AA", BoxFrame -> {{1, 4}, {1, 1}}, FrameStyle -> Red] – Mike Honeychurch Jul 31 '12 at 23:32
4  
I've found this sort of syntax highlighting occasionally when doing things that work but are not documented. If it is distracting you can always change the colour. ;) – Mike Honeychurch Aug 1 '12 at 1:40
1  
Hmm BoxFrame -> {{1, 2}, {3, 4}} doesn't seem to work on 10.3 Windows. BoxFrame -> 3 is ok though. – Kuba Mar 9 at 9:20
1  
@Kuba Yes, same on Mac. So the warning about this not being an official option has to be reiterated... I'll just add that it did work for Mathematica version 8, in case anyone still uses that (I do quite often). – Jens Mar 9 at 16:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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