# FontSize problematic when used in LabelStyle

Bug introduced in 9.0 and persisting through 11.0.1 or later

Consider the following few examples, each producing a trivial graphic object:

Graphics[Circle[], PlotLabel -> "X", Frame -> True]


It is a circle in a frame, with a label, naturally works fine.

Graphics[Circle[], LabelStyle -> {FontSize -> 24}, Frame -> True, PlotLabel -> "X"]


All the same, but now we define the size of the labels. Works okay.

Now the problem, try defining FontSize through, e.g. FontSize->Large:

Graphics[Circle[], LabelStyle -> {FontSize -> Large}, Frame -> True, PlotLabel -> "X"]


This gives a complain "specified setting for FontSize" cannot be used.

I would guess, maybe the syntax for fonts has changed in V10, but the problem does not appear if no plotlabel is specified (i.e. the labels on the frame are displayed properly):

Graphics[Circle[], LabelStyle -> {FontSize -> Large}, Frame -> True]


This works okay.

What is more, even in documentation one examplifies using FontSize in a construction like this:

Table[Text[Style["ABC", FontSize -> p]], {p, {Tiny, Small, Medium, Large}}]


To summarize: It looks as if when construction LabelStyle -> {FontSize -> Large} goes together with PlotLabel->"Something", an error pops up.

Question: Can anyone reproduce it? (done, see comments to Lou's answer) Is it an intended behavior? If so, why?

I am using ubuntu 14.04, MMA 10.0.1

Edit: And yes, I have tried it on MMA 9.0, Windows 7, and the problem does not appear there.

Edit 2: Added a summary of the problem in a separate answer.

• Note: LabelStyle -> {"Large"} works on both the frame and the PlotLabel. ("Large" is a style defined in core.nb. I'm not sure why Large without the quotes fails on PlotLabel. Bug, perhaps?) – Michael E2 Nov 6 '14 at 2:32
• Strange, indeed. By the way Graphics[Circle[], LabelStyle -> Larger, Frame -> True, PlotLabel -> "X"] works (Larger instead of Large) – user18792 Nov 6 '14 at 6:36
• Still there in 10.0.2 – Sjoerd C. de Vries Dec 11 '14 at 19:46
• The style "Label" has the setting FontSize->"Small" defined in Core.nb and leads to the same error when "Label" is used as the LabelStyle in Graphics. (At least in V10.0.2.) It seems to be the only style in Core.nb that has FontSize defined this way. – Michael E2 Jan 23 '15 at 13:38
• Still there in 11.0.1 as well. – M.R. Oct 16 '16 at 21:01

Some final remarks on this, concluding from nice communications with Wolfram support.

A command of this form is generally intended to work and to produce a label in large size:

Graphics[Disk[], LabelStyle -> {FontSize -> Large}, PlotLabel -> "X"]


It doesn't however, and it is a known bug since MMA version 9 (that is, at least in V9 and V10). In V10 it produces an error message, whereas in V9 it does not work as intended.

Some workarounds have been mentioned in comments and answers, here is a workaround summary:

• Use FrameLabel instead of PlotLabel (credit to Lou). Though not identical, this might serve as a substitute
• Use {FontSize -> 24} instead of {FontSize -> Large}, or analagously for other sizes
• Use {FontSize -> "Large"} instead of {FontSize -> Large}. It happens to work because of default style definition for a style called "Large" (indeed in Core.nb), but it will not work generally, e.g. {FontSize -> "Tiny"} does not work.
• Further examples of working commands might be found in the answer by Mr.Wizard

So much for it, and let's hope to see the bug fixed in the future versions.

Thanks for making us aware of this problem.

Momentarily exploring this myself I note that these also work:

LabelStyle -> {"Large"}

LabelStyle -> {"Tiny"}

LabelStyle -> {24}

LabelStyle -> Directive["Large"]

LabelStyle -> Directive["Tiny"]

LabelStyle -> Directive[24]


Hopefully this is useful information to someone encountering the problem.

• Thanks a lot for your addition! I will refer to your answer in my summary post. – Alexey Bobrick Nov 10 '14 at 17:23

I can repeat the error with 10.0 for Mac OS X x86 (64-bit) (September 10, 2014), but 9.0 for Mac OS X x86 (64-bit) (January 24, 2013) does not seem to exhibit this behavior.

Frame labels are affected by LabelStyle, i.e., as a Workaround one can use:

Graphics[Circle[], Frame -> True, FrameLabel -> "X", LabelStyle -> Directive[Red, Large]]


works as expected.

Whether an error or a bug or a glitch, PlotLabel and FrameLabel as such must be distinguished carefully:

• @Alexey Bobrick, Yep, the same problem with 10.0 for Mac OS X x86 (64-bit) (September 10, 2014), I showed a workaround. With Directive you do not have an error message. – user9660 Nov 5 '14 at 20:25