Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
a35983e
formatting OutputForm
mmatera Nov 10, 2024
3b5a2ba
Merge branch 'master' into 1d_OutputForm
mmatera Feb 11, 2025
b5fd7da
Merge branch 'master' into 1d_OutputForm
mmatera Sep 7, 2025
3932011
merge
mmatera Dec 23, 2025
b6d0de4
Merge branch 'master' into 1d_OutputForm
mmatera Dec 26, 2025
1388dd5
fix typo
mmatera Dec 26, 2025
89678aa
merge
mmatera Dec 26, 2025
777b418
add Pane and PaneBox
mmatera Dec 27, 2025
9bd5cad
improve Pane in mathml
mmatera Dec 27, 2025
d8b8bff
Merge remote-tracking branch 'origin/master' into Pane
mmatera Dec 27, 2025
088e657
improve compatibility in OutputForm
mmatera Dec 27, 2025
0e7a3a4
reduce trivial changes
mmatera Dec 27, 2025
c00f0dc
merge
mmatera Dec 28, 2025
4cd237b
Update mathics/eval/makeboxes/makeboxes.py
mmatera Dec 28, 2025
89f5063
Update mathics/eval/makeboxes/makeboxes.py
mmatera Dec 28, 2025
1c8a7f7
Merge branch 'master' into 1d_OutputForm
mmatera Dec 28, 2025
72eb41a
system symbols
mmatera Dec 28, 2025
b1ad184
Merge remote-tracking branch 'origin/master' into 1d_OutputForm
mmatera Dec 29, 2025
4810a6c
tests for MakeBoxes
mmatera Dec 30, 2025
794ca77
add tests for the structure
mmatera Dec 30, 2025
65a1656
another round.
mmatera Dec 30, 2025
8c2d721
Merge remote-tracking branch 'origin/master' into 1d_OutputForm
mmatera Dec 30, 2025
a4963b6
fix parametrize
mmatera Dec 30, 2025
fa6b828
Merge remote-tracking branch 'origin/master' into 1d_OutputForm
mmatera Dec 31, 2025
9232a85
Merge remote-tracking branch 'origin/master' into 1d_OutputForm
mmatera Dec 31, 2025
b3984f3
merge
mmatera Dec 31, 2025
8029135
Merge branch 'test_makeboxes' into 1d_OutputForm
mmatera Dec 31, 2025
38a766a
Merge remote-tracking branch 'origin/master' into 1d_OutputForm
mmatera Dec 31, 2025
8cbe6dd
Merge branch 'master' into test_makeboxes
mmatera Dec 31, 2025
e93512e
basic implementation for OutputForm grid
mmatera Dec 31, 2025
2948b44
fix typos
mmatera Dec 31, 2025
f4a8d60
more typos
mmatera Dec 31, 2025
b56e59a
move more tests to the yaml file
mmatera Jan 2, 2026
5018aef
merge
mmatera Jan 2, 2026
82555bc
merge
mmatera Jan 3, 2026
211f07a
merge
mmatera Jan 3, 2026
7b02dbc
Merge remote-tracking branch 'origin/master' into 1d_OutputForm
mmatera Jan 4, 2026
25454a0
remove default options in boxes
mmatera Jan 4, 2026
5627a81
adjust format renders
mmatera Jan 4, 2026
555588b
add options to InterpretationBox. Add quotes to PaneBox.
mmatera Jan 4, 2026
ec30ffb
Merge branch 'remove_default_options' into 1d_OutputForm
mmatera Jan 4, 2026
f30c754
Merge remote-tracking branch 'origin/master' into 1d_OutputForm
mmatera Jan 5, 2026
67459c1
Merge branch 'master' into 1d_OutputForm
mmatera Jan 5, 2026
5b51ed6
Merge remote-tracking branch 'origin/1d_OutputForm' into 1d_OutputForm
mmatera Jan 5, 2026
6f2ef5e
remove unused imports. lexicographic order functions in `mathics.form…
mmatera Jan 5, 2026
d0857fd
more on mathics.format.outputform
mmatera Jan 6, 2026
ae5533f
Fix evaluation of InterpretationBox with options
mmatera Jan 7, 2026
108731b
merge
mmatera Jan 7, 2026
bf17739
Misc tweaks... (#1599)
rocky Jan 7, 2026
7e401fb
merge
mmatera Jan 8, 2026
340a023
Merge branch 'master' into 1d_OutputForm
mmatera Jan 9, 2026
4046386
Merge remote-tracking branch 'origin/1d_OutputForm' into 1d_OutputForm
mmatera Jan 9, 2026
80160ac
restore
mmatera Jan 9, 2026
736bbc8
comment out a test until we finish fixing TeXForm in another round
mmatera Jan 9, 2026
fa243fe
merge reorganization of mathics.builtin.forms
mmatera Jan 9, 2026
e0d8ce3
comment out
mmatera Jan 9, 2026
c840a6a
mypy
mmatera Jan 9, 2026
5fded9f
isort
mmatera Jan 9, 2026
2480ce5
Merge branch 'master' into 1d_OutputForm
mmatera Jan 9, 2026
5bcb2bb
fix Image.atom_to_boxes
mmatera Jan 10, 2026
8846c13
fix ImageBox.boxes_to_*
mmatera Jan 10, 2026
c098a32
== bool -> is bool
mmatera Jan 10, 2026
b9fd972
DRY input/outputform
mmatera Jan 10, 2026
1e554eb
adjust dtype comparison
mmatera Jan 10, 2026
d4908ca
Merge branch 'Image_to_boxes_1' into 1d_OutputForm
mmatera Jan 10, 2026
83972c6
remove form parameter
mmatera Jan 10, 2026
dbd4173
and more
mmatera Jan 10, 2026
0cdbaf1
phase 2
mmatera Jan 11, 2026
c2a8880
Merge remote-tracking branch 'origin/master' into 1d_OutputForm_phase2
mmatera Jan 11, 2026
f1fd1ee
baseform
mmatera Jan 11, 2026
d61836e
Merge remote-tracking branch 'origin/master' into 1d_OutputForm_phase2
mmatera Jan 11, 2026
0399a4a
trailing prints
mmatera Jan 11, 2026
65bbe5c
remove simple grid. add baseform
mmatera Jan 11, 2026
e0134db
texform
mmatera Jan 11, 2026
b0210ae
bracket->square_bracket
mmatera Jan 11, 2026
1ed63c1
parenthesized
mmatera Jan 11, 2026
ca7eebf
Grid and TableForm
mmatera Jan 11, 2026
3669274
improve StringForm implementation
mmatera Jan 11, 2026
0ecea0b
merge
mmatera Jan 11, 2026
9fc55ad
Definitions fix
mmatera Jan 11, 2026
dcf3a68
numberform1
mmatera Jan 12, 2026
1f0c833
adding tests. Handlind escaped backquotes.
mmatera Jan 12, 2026
2644dd1
Merge remote-tracking branch 'origin/master' into StringForm
mmatera Jan 12, 2026
7d635f9
another trailing dot
mmatera Jan 12, 2026
5794dd9
merge
mmatera Jan 12, 2026
379fd01
NumberForm refactor
mmatera Jan 13, 2026
7a30b07
merge
mmatera Jan 14, 2026
5389363
Update comment for clarity on exponent handling
mmatera Jan 14, 2026
5d69033
Integer
mmatera Jan 14, 2026
83a92e6
more reorganization of tests
mmatera Jan 14, 2026
71e8280
merge
mmatera Jan 14, 2026
5cd8b23
remove trailing export of int_to_string_shorter_repr
mmatera Jan 14, 2026
1fef4c0
merge
mmatera Jan 16, 2026
b15f050
merge
mmatera Jan 16, 2026
93f23b1
restaurate test_series and test.helper
mmatera Jan 16, 2026
f1ecfba
restore numbers.calculus
mmatera Jan 16, 2026
369e8cc
almost ready
mmatera Jan 17, 2026
33d29d7
Improve SeriesData format function
mmatera Jan 17, 2026
ae73cd6
merge
mmatera Jan 17, 2026
0dfe96f
merge
mmatera Jan 17, 2026
d54149b
adjusting documentation
mmatera Jan 17, 2026
4c05064
working
mmatera Jan 18, 2026
62c583c
full
mmatera Jan 18, 2026
d0d0dde
partial
mmatera Jan 18, 2026
b437fba
adding init
mmatera Jan 18, 2026
432b157
mathics.format -> mathics.format.export
mmatera Jan 18, 2026
cb30454
working
mmatera Jan 18, 2026
ad3a50b
mathics.eval.makeboxes-> mathics.format.makeboxes
mmatera Jan 18, 2026
cdae853
mathics.form->mathics.format.forms
mmatera Jan 18, 2026
0109171
moving implementation of format methods to mathics.format.formvalues
mmatera Jan 18, 2026
8def057
missing files
mmatera Jan 18, 2026
ea5fdbd
ruff
mmatera Jan 18, 2026
fc81d43
Format module reorganization tweaks (#1632)
rocky Jan 18, 2026
f62e663
Format module reorganization mypy (#1633)
mmatera Jan 19, 2026
8f4ec34
mathics.format
mmatera Jan 19, 2026
d0b07be
remove export
mmatera Jan 19, 2026
7f43f91
restore eval_makeboxes_outputform
mmatera Jan 19, 2026
e0b91dc
merge
mmatera Jan 19, 2026
ef51080
merge
mmatera Jan 19, 2026
fc32505
merge
mmatera Jan 19, 2026
a285a61
trailing rename
mmatera Jan 19, 2026
fd06ac4
ruff
mmatera Jan 19, 2026
611cfc9
Merge branch 'more_on_inputform' into 1d_OutputForm
mmatera Jan 19, 2026
3722dc6
merge
mmatera Jan 19, 2026
2b7f101
merge
mmatera Jan 19, 2026
059a0dc
Merge branch 'more_on_inputform' into 1d_OutputForm
mmatera Jan 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mathics/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def print_result(self, result, no_out_prompt=False, strict_wl_output=False):

out_str = str(result.result)
if eval_type == "System`String" and not strict_wl_output:
out_str = '"' + out_str.replace('"', r"\"") + '"'
out_str = out_str.replace('"', r"\"")
if eval_type == "System`Graph":
out_str = "-Graph-"

Expand Down
4 changes: 2 additions & 2 deletions mathics/builtin/datentime.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ class DateObject(_DateFormat, ImmutableValueMixin):
</dl>

>> DateObject[{2020, 4, 15}]
= [...]
= ...
"""

fmt_keywords = {
Expand Down Expand Up @@ -697,7 +697,7 @@ def eval_makeboxes(
fmt: BaseElement,
evaluation: Evaluation,
) -> Optional[Expression]:
"MakeBoxes[DateObject[datetime_List, gran_, cal_, tz_, fmt_], StandardForm|TraditionalForm|OutputForm]"
"MakeBoxes[DateObject[datetime_List, gran_, cal_, tz_, fmt_], StandardForm|TraditionalForm]"
# TODO:
if fmt.sameQ(SymbolAutomatic):
fmt = ListExpression(String("DateTimeShort"))
Expand Down
5 changes: 0 additions & 5 deletions mathics/builtin/drawing/graphics3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ class Graphics3D(Graphics):

messages = {"invlight": "`1` is not a valid list of light sources."}

rules = {
"MakeBoxes[Graphics3D[content_, OptionsPattern[Graphics3D]], "
" OutputForm]": '"-Graphics3D-"'
}


def total_extent_3d(extents):
xmin = xmax = ymin = ymax = zmin = zmax = None
Expand Down
34 changes: 11 additions & 23 deletions mathics/builtin/forms/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,16 @@
"""
from typing import Any, Callable, Dict, List, Optional

from mathics.builtin.box.layout import RowBox, StyleBox
from mathics.builtin.box.layout import RowBox, StyleBox, SuperscriptBox
from mathics.builtin.forms.base import FormBaseClass
from mathics.core.atoms import Integer, Real, String
from mathics.core.builtin import Builtin
from mathics.core.element import BaseElement
from mathics.core.evaluation import Evaluation
from mathics.core.expression import Expression
from mathics.core.list import ListExpression
from mathics.core.number import dps
from mathics.core.symbols import Atom, Symbol, SymbolFalse, SymbolNull, SymbolTrue
from mathics.core.systemsymbols import (
SymbolAutomatic,
SymbolInfinity,
SymbolMakeBoxes,
SymbolRowBox,
SymbolSuperscriptBox,
)
from mathics.core.systemsymbols import SymbolAutomatic, SymbolInfinity, SymbolMakeBoxes
from mathics.eval.strings import eval_StringForm_MakeBoxes, eval_ToString
from mathics.format.box import (
StringLParen,
Expand Down Expand Up @@ -95,7 +88,7 @@ class BaseForm(FormBaseClass):

def eval_makeboxes(self, expr, n, f, evaluation: Evaluation):
"""MakeBoxes[BaseForm[expr_, n_],
f:StandardForm|TraditionalForm|OutputForm]"""
(f:StandardForm|TraditionalForm)]"""
try:
return eval_baseform(expr, n, f, evaluation)
except ValueError:
Expand Down Expand Up @@ -564,16 +557,13 @@ def default_NumberFormat(
py_exp = exp.get_string_value()
if py_exp:
mul = String(options["NumberMultiplier"])
return Expression(
SymbolRowBox,
ListExpression(man, mul, Expression(SymbolSuperscriptBox, base, exp)),
)
return RowBox(man, mul, SuperscriptBox(base, exp))

return man

def eval_makeboxes(self, fexpr, form, evaluation):
"""MakeBoxes[fexpr:NumberForm[_?AtomQ, ___],
form:StandardForm|TraditionalForm|OutputForm]"""
form:StandardForm|TraditionalForm]"""
try:
target, prec_parms, py_options = get_numberform_parameters(
fexpr, evaluation
Expand Down Expand Up @@ -603,7 +593,6 @@ def eval_makeboxes(self, fexpr, form, evaluation):

if py_n is not None:
py_options["_Form"] = form.get_name()

return numberform_to_boxes(target, py_n, py_f, evaluation, py_options)
return Expression(SymbolMakeBoxes, target, form)

Expand Down Expand Up @@ -637,7 +626,7 @@ class SequenceForm(FormBaseClass):

def eval_makeboxes(self, args, form, evaluation, options: dict):
"""MakeBoxes[SequenceForm[args___, OptionsPattern[SequenceForm]],
form:StandardForm|TraditionalForm|OutputForm]"""
form:StandardForm|TraditionalForm]"""
encoding = options["System`CharacterEncoding"]
return RowBox(
*[
Expand Down Expand Up @@ -712,7 +701,7 @@ class StringForm(FormBaseClass):

def eval_makeboxes(self, s, args, form, evaluation):
"""MakeBoxes[StringForm[s_String, args___],
form:StandardForm|TraditionalForm|OutputForm]"""
form:StandardForm|TraditionalForm]"""
try:
result = eval_StringForm_MakeBoxes(s, args.get_sequence(), form, evaluation)
except ValueError:
Expand Down Expand Up @@ -771,8 +760,8 @@ class TableForm(FormBaseClass):
summary_text = "format as a table"

def eval_makeboxes(self, table, f, evaluation, options):
"""MakeBoxes[%(name)s[table_, OptionsPattern[%(name)s]],
f:StandardForm|TraditionalForm|OutputForm]"""
"""MakeBoxes[%(name)s[table_, OptionsPattern[]],
f:StandardForm|TraditionalForm]"""
return eval_tableform(self, table, f, evaluation, options)


Expand Down Expand Up @@ -803,9 +792,8 @@ class MatrixForm(TableForm):
summary_text = "format as a matrix"

def eval_makeboxes_matrix(self, table, form, evaluation, options):
"""MakeBoxes[%(name)s[table_, OptionsPattern[%(name)s]],
form:StandardForm|TraditionalForm]"""

"""MakeBoxes[MatrixForm[table_, OptionsPattern[]],
(form:StandardForm|TraditionalForm)]"""
result = super().eval_makeboxes(table, form, evaluation, options)
if result.get_head_name() == "System`GridBox":
return RowBox(StringLParen, result, StringRParen)
Expand Down
27 changes: 20 additions & 7 deletions mathics/builtin/forms/print.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@
from mathics.core.atoms import String
from mathics.core.expression import Expression
from mathics.core.symbols import SymbolFalse, SymbolFullForm, SymbolTrue
from mathics.core.systemsymbols import SymbolInputForm
from mathics.format.box import eval_makeboxes_fullform, eval_mathmlform, eval_texform
from mathics.core.systemsymbols import SymbolInputForm, SymbolOutputForm
from mathics.format.box import (
eval_makeboxes_fullform,
eval_makeboxes_outputform,
eval_mathmlform,
eval_texform,
)
from mathics.format.form import render_input_form

sort_order = "mathics.builtin.forms.general-purpose-forms"
Expand Down Expand Up @@ -113,7 +118,7 @@ class InputForm(FormBaseClass):

# TODO: eventually, remove OutputForm in the second argument.
def eval_makeboxes(self, expr, evaluation):
"""MakeBoxes[InputForm[expr_], Alternatives[StandardForm,TraditionalForm,OutputForm]]"""
"""MakeBoxes[InputForm[expr_], Alternatives[StandardForm,TraditionalForm]]"""

inputform = String(render_input_form(expr, evaluation))
inputform = StyleBox(
Expand Down Expand Up @@ -165,7 +170,7 @@ class MathMLForm(FormBaseClass):
summary_text = "format expression as MathML commands"

def eval_mathml(self, expr, evaluation) -> Expression:
"MakeBoxes[MathMLForm[expr_], (OutputForm|StandardForm|TraditionalForm)]"
"MakeBoxes[MathMLForm[expr_], Alternatives[StandardForm,TraditionalForm]]"
return eval_mathmlform(expr, evaluation)


Expand Down Expand Up @@ -194,9 +199,15 @@ class OutputForm(FormBaseClass):
= -Graphics-
"""

formats = {"OutputForm[s_String]": "s"}
summary_text = "format expression in plain text"
# Remove me at the end of the refactor
rules = {"MakeBoxes[OutputForm[expr_], form_]": "MakeBoxes[expr, OutputForm]"}

def eval_makeboxes(self, expr, form, evaluation):
"""MakeBoxes[OutputForm[expr_], form_]"""
pane = eval_makeboxes_outputform(expr, evaluation, form)
return InterpretationBox(
pane, Expression(SymbolOutputForm, expr), **{"System`Editable": SymbolFalse}
)


class StandardForm(FormBaseClass):
Expand Down Expand Up @@ -266,5 +277,7 @@ class TeXForm(FormBaseClass):
summary_text = "format expression as LaTeX commands"

def eval_tex(self, expr, evaluation) -> Expression:
"MakeBoxes[TeXForm[expr_], (OutputForm|StandardForm|TraditionalForm)]"
"MakeBoxes[TeXForm[expr_], Alternatives[StandardForm,TraditionalForm]]"
# TeXForm by default uses `TraditionalForm`

return eval_texform(expr, evaluation)
6 changes: 2 additions & 4 deletions mathics/builtin/functional/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ class Slot(SympyFunction, PrefixOperator):
rules = {
"Slot[]": "Slot[1]",
"MakeBoxes[Slot[n_Integer?NonNegative],"
" f:StandardForm|TraditionalForm|InputForm|OutputForm]": (
'"#" <> ToString[n]'
),
" (f:StandardForm|TraditionalForm)]": ('"#" <> ToString[n]'),
}
summary_text = "one argument of a pure function"

Expand Down Expand Up @@ -237,6 +235,6 @@ class SlotSequence(PrefixOperator, Builtin):
rules = {
"SlotSequence[]": "SlotSequence[1]",
"MakeBoxes[SlotSequence[n_Integer?Positive],"
"f:StandardForm|TraditionalForm|InputForm|OutputForm]": ('"##" <> ToString[n]'),
"(f:StandardForm|TraditionalForm)]": ('"##" <> ToString[n]'),
}
summary_text = "the full sequence of arguments of a pure function"
2 changes: 1 addition & 1 deletion mathics/builtin/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class Graphics(Builtin):

def eval_makeboxes(self, content, evaluation, options):
"""MakeBoxes[%(name)s[content_, OptionsPattern[%(name)s]],
StandardForm|TraditionalForm|OutputForm]"""
Alternatives[StandardForm,TraditionalForm]]"""

def convert(content):
head = content.get_head()
Expand Down
4 changes: 2 additions & 2 deletions mathics/builtin/kernel_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class Out(Builtin):
"Out[k_Integer?Negative]": "Out[$Line + k]",
"Out[]": "Out[$Line - 1]",
"MakeBoxes[Out[k_Integer?((-10 <= # < 0)&)],"
" f:StandardForm|TraditionalForm|InputForm|OutputForm]": r'StringJoin[ConstantArray["%%", -k]]',
" f:StandardForm|TraditionalForm]": r'StringJoin[ConstantArray["%%", -k]]',
"MakeBoxes[Out[k_Integer?Positive],"
" f:StandardForm|TraditionalForm|InputForm|OutputForm]": r'"%%" <> ToString[k]',
" f:StandardForm|TraditionalForm]": r'"%%" <> ToString[k]',
}
summary_text = "result of the Kth input line"

Expand Down
6 changes: 3 additions & 3 deletions mathics/builtin/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Grid(Builtin):

def eval_makeboxes(self, array, f, evaluation: Evaluation, options) -> Expression:
"""MakeBoxes[Grid[array_List, OptionsPattern[Grid]],
f:StandardForm|TraditionalForm|OutputForm]"""
f:StandardForm|TraditionalForm]"""

elements = array.elements

Expand Down Expand Up @@ -221,7 +221,7 @@ class Pane(Builtin):
A Pane is treated as an unbroken rectangular region for purposes of line breaking.

>> Pane[37!]
= 13763753091226345046315979581580902400000000
= Pane[13763753091226345046315979581580902400000000]

In TeXForm, $Pane$ produce minipage environments:
>> {{Pane[a,3], Pane[expt, 3]}}//TableForm//TeXForm
Expand Down Expand Up @@ -398,7 +398,7 @@ class Row(Builtin):

def eval_makeboxes(self, items, sep, form, evaluation: Evaluation):
"""MakeBoxes[Row[{items___}, sep_:""],
form:StandardForm|TraditionalForm|OutputForm]"""
form:StandardForm|TraditionalForm]"""

items = items.get_sequence()
if not isinstance(sep, String):
Expand Down
2 changes: 1 addition & 1 deletion mathics/builtin/list/associations.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Association(Builtin):

def eval_makeboxes(self, rules, f, evaluation: Evaluation):
"""MakeBoxes[<|rules___|>,
f:StandardForm|TraditionalForm|OutputForm|InputForm]"""
(f:StandardForm|TraditionalForm)]"""

def validate(exprs):
for expr in exprs:
Expand Down
2 changes: 1 addition & 1 deletion mathics/builtin/list/constructing.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def eval(self, elements, evaluation: Evaluation):

def eval_makeboxes(self, items, f, evaluation):
"""MakeBoxes[{items___},
f:StandardForm|TraditionalForm|OutputForm|InputForm|FullForm]"""
(f:StandardForm|TraditionalForm)]"""

items = items.get_sequence()
return RowBox(*list_boxes(items, f, evaluation, "{", "}"))
Expand Down
7 changes: 2 additions & 5 deletions mathics/builtin/list/eol.py
Original file line number Diff line number Diff line change
Expand Up @@ -1168,14 +1168,11 @@ class Part(Builtin):

def eval_makeboxes(self, list, i, f, evaluation):
"""MakeBoxes[Part[list_, i___],
f:StandardForm|TraditionalForm|OutputForm|InputForm]"""
(f:StandardForm|TraditionalForm)]"""

i = i.get_sequence()
list = Expression(SymbolMakeBoxes, list, f).evaluate(evaluation)
if f.get_name() in ("System`OutputForm", "System`InputForm"):
open, close = "[[", "]]"
else:
open, close = "\u301a", "\u301b"
open, close = "\u301a", "\u301b"
indices = list_boxes(i, f, evaluation, open, close)
result = RowBox(list, *indices)
return result
Expand Down
1 change: 1 addition & 0 deletions mathics/builtin/mainloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class In(Builtin):
. In[2] = x = x + 1
.
. In[1] = x = 1
.
"""

attributes = A_LISTABLE | A_PROTECTED
Expand Down
13 changes: 6 additions & 7 deletions mathics/builtin/makeboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,17 @@ class MakeBoxes(Builtin):

rules = {
"MakeBoxes[Infix[head_[elements___]], "
" f:StandardForm|TraditionalForm|OutputForm]": (
" f:StandardForm|TraditionalForm]": (
'MakeBoxes[Infix[head[elements], StringForm["~`1`~", head]], f]'
),
"MakeBoxes[expr_]": "MakeBoxes[expr, StandardForm]",
# The following rule is temporal.
"MakeBoxes[expr_, form:(TeXForm|MathMLForm)]": "MakeBoxes[form[expr], StandardForm]",
(
"MakeBoxes[(form:StandardForm|TraditionalForm)"
"[expr_], StandardForm|TraditionalForm|OutputForm]"
"[expr_], StandardForm|TraditionalForm]"
): ("MakeBoxes[expr, form]"),
# BoxForms goes as second argument
"MakeBoxes[(form:StandardForm|TraditionalForm|OutputForm)[expr_], OutputForm]": "MakeBoxes[expr, form]",
"MakeBoxes[PrecedenceForm[expr_, prec_], f_]": "MakeBoxes[expr, f]",
"MakeBoxes[Style[expr_, OptionsPattern[Style]], f_]": (
"StyleBox[MakeBoxes[expr, f], "
Expand All @@ -118,26 +117,26 @@ def eval_fullform(self, expr, evaluation):

def eval_general(self, expr, f, evaluation):
"""MakeBoxes[expr_,
f:TraditionalForm|StandardForm|OutputForm]"""
f:TraditionalForm|StandardForm]"""
return eval_generic_makeboxes(expr, f, evaluation)

def eval_outerprecedenceform(self, expr, precedence, form, evaluation):
"""MakeBoxes[PrecedenceForm[expr_, precedence_],
form:StandardForm|TraditionalForm|OutputForm]"""
form:StandardForm|TraditionalForm]"""

py_precedence = precedence.get_int_value()
boxes = MakeBoxes(expr, form)
return parenthesize(py_precedence, expr, boxes, True)

def eval_postprefix(self, p, expr, h, precedence, form, evaluation):
"""MakeBoxes[(p:Prefix|Postfix)[expr_, h_, precedence_:None],
form:StandardForm|TraditionalForm|OutputForm]"""
form:StandardForm|TraditionalForm]"""
return eval_postprefix(self, p, expr, h, precedence, form, evaluation)

def eval_infix(
self, expr, operator, precedence: Integer, grouping, form: Symbol, evaluation
):
"""MakeBoxes[Infix[expr_, operator_, precedence_:None, grouping_:None], form:StandardForm|TraditionalForm|OutputForm]"""
"""MakeBoxes[Infix[expr_, operator_, precedence_:None, grouping_:None], form:StandardForm|TraditionalForm]"""
return eval_infix(self, expr, operator, precedence, grouping, form, evaluation)


Expand Down
5 changes: 1 addition & 4 deletions mathics/builtin/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,9 @@ class MessageName(InfixOperator):
messages = {"messg": "Message cannot be set to `1`. It must be set to a string."}
rules = {
"MakeBoxes[MessageName[symbol_Symbol, tag_String], "
"f:StandardForm|TraditionalForm|OutputForm]": (
"f:StandardForm|TraditionalForm]": (
'RowBox[{MakeBoxes[symbol, f], "::", MakeBoxes[tag, f]}]'
),
"MakeBoxes[MessageName[symbol_Symbol, tag_String], InputForm]": (
'RowBox[{MakeBoxes[symbol, InputForm], "::", tag}]'
),
}
summary_text = "associate a message name with a tag"

Expand Down
1 change: 0 additions & 1 deletion mathics/builtin/numbers/calculus.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ class Derivative(PostfixOperator, SympyFunction):
r' "\[Prime]\[Prime]", If[{n} === {1}, "\[Prime]", '
r' RowBox[{"(", Sequence @@ Riffle[{n}, ","], ")"}]]]]'
),
"MakeBoxes[Derivative[n:1|2][f_], form:OutputForm]": """RowBox[{MakeBoxes[f, form], If[n==1, "'", "''"]}]""",
# The following rules should be applied in the eval method, instead of relying on the pattern matching
# mechanism.
"Derivative[0...][f_]": "f",
Expand Down
Loading