Formatting usage messages

前端 未结 4 1761
离开以前
离开以前 2021-02-03 14:04

If you take a look at the Combinatorica package in Mathematica8 in (mathematicapath)/AddOns/LegacyPackages/DiscreteMath/Combinatorica.m you wi

4条回答
  •  不知归路
    2021-02-03 14:39

    The way to embed style information in a String expression is to use linear syntax. For a box expression such as:

    StyleBox["foo", FontSlant->Italic]
    

    You can embed this inside of a String by adding \* to the front of it and escaping any special characters such as quotes:

    "blah \*StyleBox[\"foo\", FontSlant->Italic] blah"
    

    This should work for any box expression, no matter how complicated:

    "blah \*RowBox[{SubsuperscriptBox[\"\[Integral]\",\"0\",\"1\"],RowBox[{FractionBox[\"1\",RowBox[{\"x\",\"+\",\"1\"}]],RowBox[{\"\[DifferentialD]\",\"x\"}]}]}] blah"
    

提交回复
热议问题