WOLFRAM

ToBoxes[expr]

generates boxes corresponding to the printed form of expr in StandardForm.

ToBoxes[expr,form]

gives the boxes corresponding to output in the specified form.

Details

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Box representation of a polynomial:

Out[1]=1

Display boxes as formatted:

Box representation of a graphic:

Out[1]=1

A special function in StandardForm and TraditionalForm:

Out[1]=1
Out[2]=2

Scope  (8)Survey of the scope of standard use cases

Basic Objects  (2)

Integer, Rational, Real, and Complex numbers:

Out[1]=1

Arbitrary-precision Real and Complex numbers:

Out[2]=2

Special constants:

Out[3]=3

Characters and strings of characters:

Out[1]=1

Control characters for strings:

Out[2]=2

Special Input Forms  (4)

Box representations for various Power expressions:

Out[1]=1

Special typeset expressions:

Out[1]=1

Different list structures:

Out[1]=1
Out[2]=2
Out[3]=3
Out[4]=4

Inputs with subscripts, superscripts, etc.:

Out[1]=1

Special Output Forms  (2)

Some objects use a special output representation with interpretation:

Out[1]=1
Out[2]=2

Some objects use an elided output representation:

Out[1]=1
Out[3]=3

Properties & Relations  (5)Properties of the function, and connections to other functions

ToBoxes evaluates expr, while MakeBoxes does not:

Out[1]=1
Out[2]=2

Use ToExpression to interpret boxes:

Out[1]=1
Out[2]=2

Use DisplayForm to see how the boxes display:

Out[1]=1

Use formatting rules added through Format:

Out[1]=1

Add formatting for bin:

Out[3]=3

Use formatting rules added through MakeBoxes:

Out[1]=1
Out[3]=3
Wolfram Research (1996), ToBoxes, Wolfram Language function, https://reference.wolfram.com/language/ref/ToBoxes.html.
Wolfram Research (1996), ToBoxes, Wolfram Language function, https://reference.wolfram.com/language/ref/ToBoxes.html.

Text

Wolfram Research (1996), ToBoxes, Wolfram Language function, https://reference.wolfram.com/language/ref/ToBoxes.html.

Wolfram Research (1996), ToBoxes, Wolfram Language function, https://reference.wolfram.com/language/ref/ToBoxes.html.

CMS

Wolfram Language. 1996. "ToBoxes." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ToBoxes.html.

Wolfram Language. 1996. "ToBoxes." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ToBoxes.html.

APA

Wolfram Language. (1996). ToBoxes. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ToBoxes.html

Wolfram Language. (1996). ToBoxes. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ToBoxes.html

BibTeX

@misc{reference.wolfram_2025_toboxes, author="Wolfram Research", title="{ToBoxes}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/ToBoxes.html}", note=[Accessed: 09-April-2025 ]}

@misc{reference.wolfram_2025_toboxes, author="Wolfram Research", title="{ToBoxes}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/ToBoxes.html}", note=[Accessed: 09-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_toboxes, organization={Wolfram Research}, title={ToBoxes}, year={1996}, url={https://reference.wolfram.com/language/ref/ToBoxes.html}, note=[Accessed: 09-April-2025 ]}

@online{reference.wolfram_2025_toboxes, organization={Wolfram Research}, title={ToBoxes}, year={1996}, url={https://reference.wolfram.com/language/ref/ToBoxes.html}, note=[Accessed: 09-April-2025 ]}