1818 BoxConstruct ,
1919 BoxConstructError ,
2020 Operator ,
21- Predefined ,
2221)
2322from mathics .builtin .tensors import get_dimensions
2423from mathics .builtin .comparison import expr_min
5150MULTI_NEWLINE_RE = re .compile (r"\n{2,}" )
5251
5352
54- class UseSansSerif (Predefined ):
55- """
56- <dl>
57- <dt>'$UseSansSerif'
58- <dd>controls whether the Web interfaces use a Sans-Serif font.
59- </dl>
60-
61- When set True, the output in MathMLForm uses SansSerif fonts instead
62- of the standard fonts.
63-
64- X> $UseSansSerif
65- = True
66- X> $UseSansSerif = False
67-
68- """
69-
70- context = "System`"
71- name = "$UseSansSerif"
72- attributes = ("Unprotected" ,)
73- value = True
74-
75- rules = {"$UseSansSerif" : str (value )}
76-
77- messages = {}
78-
79- def evaluate (self , evaluation ):
80- return Integer (self .value )
81-
82-
8353class Format (Builtin ):
8454 """
8555 <dl>
@@ -2105,7 +2075,7 @@ def apply_mathml(self, expr, evaluation) -> Expression:
21052075
21062076 # mathml = '<math><mstyle displaystyle="true">%s</mstyle></math>' % xml
21072077 # #convert_box(boxes)
2108- query = evaluation .parse ("System `$UseSansSerif" )
2078+ query = evaluation .parse ("Settings `$UseSansSerif" )
21092079 usesansserif = query .evaluate (evaluation ).to_python ()
21102080 if not is_a_picture :
21112081 if usesansserif :
@@ -2115,55 +2085,6 @@ def apply_mathml(self, expr, evaluation) -> Expression:
21152085 return Expression ("RowBox" , Expression (SymbolList , String (mathml )))
21162086
21172087
2118- class HTMLForm (Builtin ):
2119- """
2120- <dl>
2121- <dt>'HTMLForm[$expr$]'
2122- <dd>displays $expr$ as a HTML expression.
2123- </dl>
2124-
2125- >> HTMLForm[HoldForm[Sqrt[a^3]]]
2126- = ...
2127-
2128- ## Test cases for Unicode - redo please as a real test
2129- >> MathMLForm[\\ [Mu]]
2130- = ...
2131-
2132- # This can causes the TeX to fail
2133- # >> MathMLForm[Graphics[Text["\u03bc "]]]
2134- # = ...
2135-
2136- ## The <mo> should contain U+2062 INVISIBLE TIMES
2137- ## MathMLForm[MatrixForm[{{2*a, 0},{0,0}}]]
2138- = ...
2139- """
2140-
2141- def apply_hml (self , expr , evaluation ) -> Expression :
2142- "MakeBoxes[expr_, HTMLForm]"
2143-
2144- boxes = MakeBoxes (expr ).evaluate (evaluation )
2145- try :
2146- xml = boxes .boxes_to_mathml (evaluation = evaluation )
2147- except BoxError :
2148- evaluation .message (
2149- "General" ,
2150- "notboxes" ,
2151- Expression ("FullForm" , boxes ).evaluate (evaluation ),
2152- )
2153- xml = ""
2154- is_a_picture = xml [:6 ] == "<mtext"
2155-
2156- # mathml = '<math><mstyle displaystyle="true">%s</mstyle></math>' % xml
2157- # #convert_box(boxes)
2158- query = evaluation .parse ("System`$UseSansSerif" )
2159- usesansserif = query .evaluate (evaluation ).to_python ()
2160- if not is_a_picture :
2161- if usesansserif :
2162- xml = '<mstyle mathvariant="sans-serif">%s</mstyle>' % xml
2163-
2164- mathml = '<math display="block">%s</math>' % xml # convert_box(boxes)
2165- return Expression ("RowBox" , Expression (SymbolList , String (mathml )))
2166-
21672088class PythonForm (Builtin ):
21682089 """
21692090 <dl>
0 commit comments