How to set the font color of quantity objects (Version 11.3 vs version 12)?How can I set the background color to the Popupmenu?Change base font for all graphics objectsChange Default Font Color of CommandsHow to change the font color and size of tick labels by defaultFont presentation difference between version 9 and version 10How to change the texture of the graphical objects?Remove color artifacts in overlay of several Graphics objects?Catching MachineUnderflow in Version 11.3How do I import RiemannSurfacePlot3D to Mathematica 11.3?How do I make InverseBetaRegularized function behave the same in Mathematica 11.3 compared to 11.2?

How to increase row height of a table and vertically "align middle"?

Make me a minimum magic sum

HTML folder located within IOS Image file?

Concatenate all values of the same XML element using XPath/XQuery

In a series of books, what happens after the coming of age?

How do I give a darkroom course without negs from the attendees?

All of my Firefox add-ons have been disabled suddenly, how can I re-enable them?

Why is the blank symbol not considered part of the input alphabet of a Turing machine?

call() a function within its own context

How to make a kid's bike easier to pedal

Which "exotic salt" can lower water's freezing point by 70 °C?

What is more safe for browsing the web: PC or smartphone?

Can a player choose to add detail and flavor to their character's spells and abilities?

Was there a dinosaur-counter in the original Jurassic Park movie?

How to increase speed on my hybrid bike with flat handlebars and 700X35C tyres?

shebang or not shebang

An adjective or a noun to describe a very small apartment / house etc

Where do 5 or more U.S. counties meet in a single point?

A♭ major 9th chord in Bach is unexpectedly dissonant/jazzy

How is it believable that Euron could so easily pull off this ambush?

How can I finally understand the confusing modal verb "мочь"?

Does every non-empty set admit an (affine) scheme structure (in ZFC)?

Drug Testing and Prescribed Medications

My large rocket is still flipping over



How to set the font color of quantity objects (Version 11.3 vs version 12)?


How can I set the background color to the Popupmenu?Change base font for all graphics objectsChange Default Font Color of CommandsHow to change the font color and size of tick labels by defaultFont presentation difference between version 9 and version 10How to change the texture of the graphical objects?Remove color artifacts in overlay of several Graphics objects?Catching MachineUnderflow in Version 11.3How do I import RiemannSurfacePlot3D to Mathematica 11.3?How do I make InverseBetaRegularized function behave the same in Mathematica 11.3 compared to 11.2?













6












$begingroup$


TD = 8 + 12 + 12 + 12 + 33 + (61 + 1/4) + (41 + 1/4)/2 + 
15/2 + (18 + 3/4) + (18 + 3/4)/2 + 14/2;
CM = 15/2 + (61 + 1/4) + (41 + 1/4)/2 +
24 + (3 + 3/4) + (18 + 3/4) + (18 + 3/4)/2 + 14/2 + (24 + 3/4) +
9/2;
TP = 2*90;

countsDim1 = CM, TD, TP/(TD + TP + CM)

n = 384 + 179;
labels = Placed[
Row /@ Thread["" <> ToString@# <>
" H" & /@ N[(n countsDim1[[1]]), 5],
N[(n countsDim1[[2]]), 5], Round@N[(n countsDim1)[[3]]]],
"RadialOuter"];
legend = Placed[
SwatchLegend[Automatic,
Row /@ Thread["CM ", "TD ", "TP ",
Row["(", #, , ")"] & /@
Quantity[Round[100 countsDim1], "Percent"]],
LabelStyle -> FontSize -> 26, FontFamily -> "Latin Modern Roman",
FontColor -> Black, FontWeight -> Bold,
LegendMarkerSize -> 26], After, Bottom, Framed];

type = Framed[
PieChart[countsDim1, ChartLabels -> labels, ChartLegends -> legend,
PlotRange -> All,
LabelStyle -> FontSize -> 26, FontFamily -> "Latin Modern Roman",
FontColor -> White, FontWeight -> Bold, PlotTheme -> "Business",
ImageSize -> Medium], Background -> LightGreen]


In Mathematica 11.3 above code would produce a Pie Chart with the percentage of the Legend black. In Mathematica 12, I get the text of the percentage with gray color.



Version 12



Below the same figure with Mathematica 11.3 (albeit without the bold text of the LegendLabel)



Version 11.3



What is different in Mathematica 12?



How can I get the percentage in black color (and bold)?










share|improve this question











$endgroup$
















    6












    $begingroup$


    TD = 8 + 12 + 12 + 12 + 33 + (61 + 1/4) + (41 + 1/4)/2 + 
    15/2 + (18 + 3/4) + (18 + 3/4)/2 + 14/2;
    CM = 15/2 + (61 + 1/4) + (41 + 1/4)/2 +
    24 + (3 + 3/4) + (18 + 3/4) + (18 + 3/4)/2 + 14/2 + (24 + 3/4) +
    9/2;
    TP = 2*90;

    countsDim1 = CM, TD, TP/(TD + TP + CM)

    n = 384 + 179;
    labels = Placed[
    Row /@ Thread["" <> ToString@# <>
    " H" & /@ N[(n countsDim1[[1]]), 5],
    N[(n countsDim1[[2]]), 5], Round@N[(n countsDim1)[[3]]]],
    "RadialOuter"];
    legend = Placed[
    SwatchLegend[Automatic,
    Row /@ Thread["CM ", "TD ", "TP ",
    Row["(", #, , ")"] & /@
    Quantity[Round[100 countsDim1], "Percent"]],
    LabelStyle -> FontSize -> 26, FontFamily -> "Latin Modern Roman",
    FontColor -> Black, FontWeight -> Bold,
    LegendMarkerSize -> 26], After, Bottom, Framed];

    type = Framed[
    PieChart[countsDim1, ChartLabels -> labels, ChartLegends -> legend,
    PlotRange -> All,
    LabelStyle -> FontSize -> 26, FontFamily -> "Latin Modern Roman",
    FontColor -> White, FontWeight -> Bold, PlotTheme -> "Business",
    ImageSize -> Medium], Background -> LightGreen]


    In Mathematica 11.3 above code would produce a Pie Chart with the percentage of the Legend black. In Mathematica 12, I get the text of the percentage with gray color.



    Version 12



    Below the same figure with Mathematica 11.3 (albeit without the bold text of the LegendLabel)



    Version 11.3



    What is different in Mathematica 12?



    How can I get the percentage in black color (and bold)?










    share|improve this question











    $endgroup$














      6












      6








      6





      $begingroup$


      TD = 8 + 12 + 12 + 12 + 33 + (61 + 1/4) + (41 + 1/4)/2 + 
      15/2 + (18 + 3/4) + (18 + 3/4)/2 + 14/2;
      CM = 15/2 + (61 + 1/4) + (41 + 1/4)/2 +
      24 + (3 + 3/4) + (18 + 3/4) + (18 + 3/4)/2 + 14/2 + (24 + 3/4) +
      9/2;
      TP = 2*90;

      countsDim1 = CM, TD, TP/(TD + TP + CM)

      n = 384 + 179;
      labels = Placed[
      Row /@ Thread["" <> ToString@# <>
      " H" & /@ N[(n countsDim1[[1]]), 5],
      N[(n countsDim1[[2]]), 5], Round@N[(n countsDim1)[[3]]]],
      "RadialOuter"];
      legend = Placed[
      SwatchLegend[Automatic,
      Row /@ Thread["CM ", "TD ", "TP ",
      Row["(", #, , ")"] & /@
      Quantity[Round[100 countsDim1], "Percent"]],
      LabelStyle -> FontSize -> 26, FontFamily -> "Latin Modern Roman",
      FontColor -> Black, FontWeight -> Bold,
      LegendMarkerSize -> 26], After, Bottom, Framed];

      type = Framed[
      PieChart[countsDim1, ChartLabels -> labels, ChartLegends -> legend,
      PlotRange -> All,
      LabelStyle -> FontSize -> 26, FontFamily -> "Latin Modern Roman",
      FontColor -> White, FontWeight -> Bold, PlotTheme -> "Business",
      ImageSize -> Medium], Background -> LightGreen]


      In Mathematica 11.3 above code would produce a Pie Chart with the percentage of the Legend black. In Mathematica 12, I get the text of the percentage with gray color.



      Version 12



      Below the same figure with Mathematica 11.3 (albeit without the bold text of the LegendLabel)



      Version 11.3



      What is different in Mathematica 12?



      How can I get the percentage in black color (and bold)?










      share|improve this question











      $endgroup$




      TD = 8 + 12 + 12 + 12 + 33 + (61 + 1/4) + (41 + 1/4)/2 + 
      15/2 + (18 + 3/4) + (18 + 3/4)/2 + 14/2;
      CM = 15/2 + (61 + 1/4) + (41 + 1/4)/2 +
      24 + (3 + 3/4) + (18 + 3/4) + (18 + 3/4)/2 + 14/2 + (24 + 3/4) +
      9/2;
      TP = 2*90;

      countsDim1 = CM, TD, TP/(TD + TP + CM)

      n = 384 + 179;
      labels = Placed[
      Row /@ Thread["" <> ToString@# <>
      " H" & /@ N[(n countsDim1[[1]]), 5],
      N[(n countsDim1[[2]]), 5], Round@N[(n countsDim1)[[3]]]],
      "RadialOuter"];
      legend = Placed[
      SwatchLegend[Automatic,
      Row /@ Thread["CM ", "TD ", "TP ",
      Row["(", #, , ")"] & /@
      Quantity[Round[100 countsDim1], "Percent"]],
      LabelStyle -> FontSize -> 26, FontFamily -> "Latin Modern Roman",
      FontColor -> Black, FontWeight -> Bold,
      LegendMarkerSize -> 26], After, Bottom, Framed];

      type = Framed[
      PieChart[countsDim1, ChartLabels -> labels, ChartLegends -> legend,
      PlotRange -> All,
      LabelStyle -> FontSize -> 26, FontFamily -> "Latin Modern Roman",
      FontColor -> White, FontWeight -> Bold, PlotTheme -> "Business",
      ImageSize -> Medium], Background -> LightGreen]


      In Mathematica 11.3 above code would produce a Pie Chart with the percentage of the Legend black. In Mathematica 12, I get the text of the percentage with gray color.



      Version 12



      Below the same figure with Mathematica 11.3 (albeit without the bold text of the LegendLabel)



      Version 11.3



      What is different in Mathematica 12?



      How can I get the percentage in black color (and bold)?







      graphics version-11.3 version-12






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 28 at 18:49









      user64494

      3,65111222




      3,65111222










      asked Apr 28 at 8:40









      DimitrisDimitris

      2,4741332




      2,4741332




















          2 Answers
          2






          active

          oldest

          votes


















          6












          $begingroup$

          To be fully in control of the styling, I would suggest converting the quantity to a number.



          I suggest replacing



          Row["(", #, , ")"]


          with



          Row["(", QuantityMagnitude[#], "%)"]





          share|improve this answer











          $endgroup$












          • $begingroup$
            Or eliminate Quantity: Row["(", #, , "%)"] & /@ Round[100 countsDim1]
            $endgroup$
            – Bob Hanlon
            Apr 28 at 19:28


















          7












          $begingroup$

          Looks like a bug to me:



          In version 12.0, the typesetting of Quantity objects in TraditionalForm (which is used for legends in Legended expressions) breaks after typesetting a quantity with the same unit in StandardForm. To see this, consider the following example: (use a fresh kernel)



          TraditionalForm@Quantity[3.5, "Percent"]
          Quantity[3.5, "Percent"]
          TraditionalForm@Quantity[3.5, "Percent"]
          TraditionalForm@Quantity[1, "Percent"]


          enter image description here



          As you can see, quantities are typeset differently in TraditionalForm, and the one for TraditionalForm changes after typesetting in StandardForm once. The case of 1 is handled differently for some reason and does not break.



          In 11.3, the typesetting of the TraditionalForm variant does not break after typesetting the StandardForm variant. This is why your example works in 11.3: The style for TraditionalForm does not set the FontColor, while the StandardForm one does (see CurrentValue[StyleDefinitions, "QuantityPanel"], which is only used for StandardForm). That this works seems like a lucky coincidence, so I would suggest to use the method from @C.E.'s answer anyway, even if this gets fixed.



          Tracking down the issue



          The issue is caused by a change to the caching used for quantity typesetting:



          (* cache lookup in 11.3 typesetting code for Quantity *)
          QuantityUnits`QuantityBox[
          Quantity[n_, unit_?QuantityUnits`Private`UnitDisplayCacheContainsQ], form:StandardForm]
          ] :=
          Quiet[QuantityUnits`Private`getUnitDisplayForm[unit, n, form], Part::partw]

          (* cache lookup in 12.0 typesetting code for Quantity *)
          QuantityUnits`QuantityBox[
          Quantity[n_, unit_?QuantityUnits`Private`UnitDisplayCacheContainsQ], form_:StandardForm]
          ] :=
          Quiet[QuantityUnits`Private`getUnitDisplayForm[unit, n, form], Part::partw]


          Note the change from form:StandardForm to form_:StandardForm - this extends the caching from StandardForm to all forms. The reason I think this is a bug is that this is the only definition of QuantityBox that defaults form to anything (all the others require an explicit form to be given), which suggests someone "fixed" a typo.



          The issue with the caching code is that it ignores form when performing the cache lookup. Writing to the cache still requires StandardForm (here, the form:StandardForm pattern is still present in 12.0). The code was already questionable in 11.3 (since the caching partially supports forms other than StandardForm), but this was not an issue since it was only ever called with StandardForm.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Should I change the title of the question since it is misleading?
            $endgroup$
            – Dimitris
            Apr 28 at 13:54










          • $begingroup$
            Well, it describes the original issue you were having - you could change it to "How to set the font color of quantity objects" to make it a bit more descriptive. This answer was more intended as an explanation of what changed, rather than as a direct solution to your problem
            $endgroup$
            – Lukas Lang
            Apr 28 at 14:06











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "387"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f197228%2fhow-to-set-the-font-color-of-quantity-objects-version-11-3-vs-version-12%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          6












          $begingroup$

          To be fully in control of the styling, I would suggest converting the quantity to a number.



          I suggest replacing



          Row["(", #, , ")"]


          with



          Row["(", QuantityMagnitude[#], "%)"]





          share|improve this answer











          $endgroup$












          • $begingroup$
            Or eliminate Quantity: Row["(", #, , "%)"] & /@ Round[100 countsDim1]
            $endgroup$
            – Bob Hanlon
            Apr 28 at 19:28















          6












          $begingroup$

          To be fully in control of the styling, I would suggest converting the quantity to a number.



          I suggest replacing



          Row["(", #, , ")"]


          with



          Row["(", QuantityMagnitude[#], "%)"]





          share|improve this answer











          $endgroup$












          • $begingroup$
            Or eliminate Quantity: Row["(", #, , "%)"] & /@ Round[100 countsDim1]
            $endgroup$
            – Bob Hanlon
            Apr 28 at 19:28













          6












          6








          6





          $begingroup$

          To be fully in control of the styling, I would suggest converting the quantity to a number.



          I suggest replacing



          Row["(", #, , ")"]


          with



          Row["(", QuantityMagnitude[#], "%)"]





          share|improve this answer











          $endgroup$



          To be fully in control of the styling, I would suggest converting the quantity to a number.



          I suggest replacing



          Row["(", #, , ")"]


          with



          Row["(", QuantityMagnitude[#], "%)"]






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 28 at 14:54

























          answered Apr 28 at 11:37









          C. E.C. E.

          51.7k3101208




          51.7k3101208











          • $begingroup$
            Or eliminate Quantity: Row["(", #, , "%)"] & /@ Round[100 countsDim1]
            $endgroup$
            – Bob Hanlon
            Apr 28 at 19:28
















          • $begingroup$
            Or eliminate Quantity: Row["(", #, , "%)"] & /@ Round[100 countsDim1]
            $endgroup$
            – Bob Hanlon
            Apr 28 at 19:28















          $begingroup$
          Or eliminate Quantity: Row["(", #, , "%)"] & /@ Round[100 countsDim1]
          $endgroup$
          – Bob Hanlon
          Apr 28 at 19:28




          $begingroup$
          Or eliminate Quantity: Row["(", #, , "%)"] & /@ Round[100 countsDim1]
          $endgroup$
          – Bob Hanlon
          Apr 28 at 19:28











          7












          $begingroup$

          Looks like a bug to me:



          In version 12.0, the typesetting of Quantity objects in TraditionalForm (which is used for legends in Legended expressions) breaks after typesetting a quantity with the same unit in StandardForm. To see this, consider the following example: (use a fresh kernel)



          TraditionalForm@Quantity[3.5, "Percent"]
          Quantity[3.5, "Percent"]
          TraditionalForm@Quantity[3.5, "Percent"]
          TraditionalForm@Quantity[1, "Percent"]


          enter image description here



          As you can see, quantities are typeset differently in TraditionalForm, and the one for TraditionalForm changes after typesetting in StandardForm once. The case of 1 is handled differently for some reason and does not break.



          In 11.3, the typesetting of the TraditionalForm variant does not break after typesetting the StandardForm variant. This is why your example works in 11.3: The style for TraditionalForm does not set the FontColor, while the StandardForm one does (see CurrentValue[StyleDefinitions, "QuantityPanel"], which is only used for StandardForm). That this works seems like a lucky coincidence, so I would suggest to use the method from @C.E.'s answer anyway, even if this gets fixed.



          Tracking down the issue



          The issue is caused by a change to the caching used for quantity typesetting:



          (* cache lookup in 11.3 typesetting code for Quantity *)
          QuantityUnits`QuantityBox[
          Quantity[n_, unit_?QuantityUnits`Private`UnitDisplayCacheContainsQ], form:StandardForm]
          ] :=
          Quiet[QuantityUnits`Private`getUnitDisplayForm[unit, n, form], Part::partw]

          (* cache lookup in 12.0 typesetting code for Quantity *)
          QuantityUnits`QuantityBox[
          Quantity[n_, unit_?QuantityUnits`Private`UnitDisplayCacheContainsQ], form_:StandardForm]
          ] :=
          Quiet[QuantityUnits`Private`getUnitDisplayForm[unit, n, form], Part::partw]


          Note the change from form:StandardForm to form_:StandardForm - this extends the caching from StandardForm to all forms. The reason I think this is a bug is that this is the only definition of QuantityBox that defaults form to anything (all the others require an explicit form to be given), which suggests someone "fixed" a typo.



          The issue with the caching code is that it ignores form when performing the cache lookup. Writing to the cache still requires StandardForm (here, the form:StandardForm pattern is still present in 12.0). The code was already questionable in 11.3 (since the caching partially supports forms other than StandardForm), but this was not an issue since it was only ever called with StandardForm.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Should I change the title of the question since it is misleading?
            $endgroup$
            – Dimitris
            Apr 28 at 13:54










          • $begingroup$
            Well, it describes the original issue you were having - you could change it to "How to set the font color of quantity objects" to make it a bit more descriptive. This answer was more intended as an explanation of what changed, rather than as a direct solution to your problem
            $endgroup$
            – Lukas Lang
            Apr 28 at 14:06















          7












          $begingroup$

          Looks like a bug to me:



          In version 12.0, the typesetting of Quantity objects in TraditionalForm (which is used for legends in Legended expressions) breaks after typesetting a quantity with the same unit in StandardForm. To see this, consider the following example: (use a fresh kernel)



          TraditionalForm@Quantity[3.5, "Percent"]
          Quantity[3.5, "Percent"]
          TraditionalForm@Quantity[3.5, "Percent"]
          TraditionalForm@Quantity[1, "Percent"]


          enter image description here



          As you can see, quantities are typeset differently in TraditionalForm, and the one for TraditionalForm changes after typesetting in StandardForm once. The case of 1 is handled differently for some reason and does not break.



          In 11.3, the typesetting of the TraditionalForm variant does not break after typesetting the StandardForm variant. This is why your example works in 11.3: The style for TraditionalForm does not set the FontColor, while the StandardForm one does (see CurrentValue[StyleDefinitions, "QuantityPanel"], which is only used for StandardForm). That this works seems like a lucky coincidence, so I would suggest to use the method from @C.E.'s answer anyway, even if this gets fixed.



          Tracking down the issue



          The issue is caused by a change to the caching used for quantity typesetting:



          (* cache lookup in 11.3 typesetting code for Quantity *)
          QuantityUnits`QuantityBox[
          Quantity[n_, unit_?QuantityUnits`Private`UnitDisplayCacheContainsQ], form:StandardForm]
          ] :=
          Quiet[QuantityUnits`Private`getUnitDisplayForm[unit, n, form], Part::partw]

          (* cache lookup in 12.0 typesetting code for Quantity *)
          QuantityUnits`QuantityBox[
          Quantity[n_, unit_?QuantityUnits`Private`UnitDisplayCacheContainsQ], form_:StandardForm]
          ] :=
          Quiet[QuantityUnits`Private`getUnitDisplayForm[unit, n, form], Part::partw]


          Note the change from form:StandardForm to form_:StandardForm - this extends the caching from StandardForm to all forms. The reason I think this is a bug is that this is the only definition of QuantityBox that defaults form to anything (all the others require an explicit form to be given), which suggests someone "fixed" a typo.



          The issue with the caching code is that it ignores form when performing the cache lookup. Writing to the cache still requires StandardForm (here, the form:StandardForm pattern is still present in 12.0). The code was already questionable in 11.3 (since the caching partially supports forms other than StandardForm), but this was not an issue since it was only ever called with StandardForm.






          share|improve this answer









          $endgroup$












          • $begingroup$
            Should I change the title of the question since it is misleading?
            $endgroup$
            – Dimitris
            Apr 28 at 13:54










          • $begingroup$
            Well, it describes the original issue you were having - you could change it to "How to set the font color of quantity objects" to make it a bit more descriptive. This answer was more intended as an explanation of what changed, rather than as a direct solution to your problem
            $endgroup$
            – Lukas Lang
            Apr 28 at 14:06













          7












          7








          7





          $begingroup$

          Looks like a bug to me:



          In version 12.0, the typesetting of Quantity objects in TraditionalForm (which is used for legends in Legended expressions) breaks after typesetting a quantity with the same unit in StandardForm. To see this, consider the following example: (use a fresh kernel)



          TraditionalForm@Quantity[3.5, "Percent"]
          Quantity[3.5, "Percent"]
          TraditionalForm@Quantity[3.5, "Percent"]
          TraditionalForm@Quantity[1, "Percent"]


          enter image description here



          As you can see, quantities are typeset differently in TraditionalForm, and the one for TraditionalForm changes after typesetting in StandardForm once. The case of 1 is handled differently for some reason and does not break.



          In 11.3, the typesetting of the TraditionalForm variant does not break after typesetting the StandardForm variant. This is why your example works in 11.3: The style for TraditionalForm does not set the FontColor, while the StandardForm one does (see CurrentValue[StyleDefinitions, "QuantityPanel"], which is only used for StandardForm). That this works seems like a lucky coincidence, so I would suggest to use the method from @C.E.'s answer anyway, even if this gets fixed.



          Tracking down the issue



          The issue is caused by a change to the caching used for quantity typesetting:



          (* cache lookup in 11.3 typesetting code for Quantity *)
          QuantityUnits`QuantityBox[
          Quantity[n_, unit_?QuantityUnits`Private`UnitDisplayCacheContainsQ], form:StandardForm]
          ] :=
          Quiet[QuantityUnits`Private`getUnitDisplayForm[unit, n, form], Part::partw]

          (* cache lookup in 12.0 typesetting code for Quantity *)
          QuantityUnits`QuantityBox[
          Quantity[n_, unit_?QuantityUnits`Private`UnitDisplayCacheContainsQ], form_:StandardForm]
          ] :=
          Quiet[QuantityUnits`Private`getUnitDisplayForm[unit, n, form], Part::partw]


          Note the change from form:StandardForm to form_:StandardForm - this extends the caching from StandardForm to all forms. The reason I think this is a bug is that this is the only definition of QuantityBox that defaults form to anything (all the others require an explicit form to be given), which suggests someone "fixed" a typo.



          The issue with the caching code is that it ignores form when performing the cache lookup. Writing to the cache still requires StandardForm (here, the form:StandardForm pattern is still present in 12.0). The code was already questionable in 11.3 (since the caching partially supports forms other than StandardForm), but this was not an issue since it was only ever called with StandardForm.






          share|improve this answer









          $endgroup$



          Looks like a bug to me:



          In version 12.0, the typesetting of Quantity objects in TraditionalForm (which is used for legends in Legended expressions) breaks after typesetting a quantity with the same unit in StandardForm. To see this, consider the following example: (use a fresh kernel)



          TraditionalForm@Quantity[3.5, "Percent"]
          Quantity[3.5, "Percent"]
          TraditionalForm@Quantity[3.5, "Percent"]
          TraditionalForm@Quantity[1, "Percent"]


          enter image description here



          As you can see, quantities are typeset differently in TraditionalForm, and the one for TraditionalForm changes after typesetting in StandardForm once. The case of 1 is handled differently for some reason and does not break.



          In 11.3, the typesetting of the TraditionalForm variant does not break after typesetting the StandardForm variant. This is why your example works in 11.3: The style for TraditionalForm does not set the FontColor, while the StandardForm one does (see CurrentValue[StyleDefinitions, "QuantityPanel"], which is only used for StandardForm). That this works seems like a lucky coincidence, so I would suggest to use the method from @C.E.'s answer anyway, even if this gets fixed.



          Tracking down the issue



          The issue is caused by a change to the caching used for quantity typesetting:



          (* cache lookup in 11.3 typesetting code for Quantity *)
          QuantityUnits`QuantityBox[
          Quantity[n_, unit_?QuantityUnits`Private`UnitDisplayCacheContainsQ], form:StandardForm]
          ] :=
          Quiet[QuantityUnits`Private`getUnitDisplayForm[unit, n, form], Part::partw]

          (* cache lookup in 12.0 typesetting code for Quantity *)
          QuantityUnits`QuantityBox[
          Quantity[n_, unit_?QuantityUnits`Private`UnitDisplayCacheContainsQ], form_:StandardForm]
          ] :=
          Quiet[QuantityUnits`Private`getUnitDisplayForm[unit, n, form], Part::partw]


          Note the change from form:StandardForm to form_:StandardForm - this extends the caching from StandardForm to all forms. The reason I think this is a bug is that this is the only definition of QuantityBox that defaults form to anything (all the others require an explicit form to be given), which suggests someone "fixed" a typo.



          The issue with the caching code is that it ignores form when performing the cache lookup. Writing to the cache still requires StandardForm (here, the form:StandardForm pattern is still present in 12.0). The code was already questionable in 11.3 (since the caching partially supports forms other than StandardForm), but this was not an issue since it was only ever called with StandardForm.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 28 at 12:53









          Lukas LangLukas Lang

          7,72511032




          7,72511032











          • $begingroup$
            Should I change the title of the question since it is misleading?
            $endgroup$
            – Dimitris
            Apr 28 at 13:54










          • $begingroup$
            Well, it describes the original issue you were having - you could change it to "How to set the font color of quantity objects" to make it a bit more descriptive. This answer was more intended as an explanation of what changed, rather than as a direct solution to your problem
            $endgroup$
            – Lukas Lang
            Apr 28 at 14:06
















          • $begingroup$
            Should I change the title of the question since it is misleading?
            $endgroup$
            – Dimitris
            Apr 28 at 13:54










          • $begingroup$
            Well, it describes the original issue you were having - you could change it to "How to set the font color of quantity objects" to make it a bit more descriptive. This answer was more intended as an explanation of what changed, rather than as a direct solution to your problem
            $endgroup$
            – Lukas Lang
            Apr 28 at 14:06















          $begingroup$
          Should I change the title of the question since it is misleading?
          $endgroup$
          – Dimitris
          Apr 28 at 13:54




          $begingroup$
          Should I change the title of the question since it is misleading?
          $endgroup$
          – Dimitris
          Apr 28 at 13:54












          $begingroup$
          Well, it describes the original issue you were having - you could change it to "How to set the font color of quantity objects" to make it a bit more descriptive. This answer was more intended as an explanation of what changed, rather than as a direct solution to your problem
          $endgroup$
          – Lukas Lang
          Apr 28 at 14:06




          $begingroup$
          Well, it describes the original issue you were having - you could change it to "How to set the font color of quantity objects" to make it a bit more descriptive. This answer was more intended as an explanation of what changed, rather than as a direct solution to your problem
          $endgroup$
          – Lukas Lang
          Apr 28 at 14:06

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Mathematica Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f197228%2fhow-to-set-the-font-color-of-quantity-objects-version-11-3-vs-version-12%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

          What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

          Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos