Questions tagged [boxes]

Boxes are the underlying representation of two-dimensional forms in notebooks.

Filter by
Sorted by
Tagged with
31
votes
2answers
2k views

How do I extract the contents of a selected cell as plain text?

My aim is to extract the contents of an Input cells as plain text. Ideally I would like to be able to select one or more Input cells and press a button which would then extract the text from these ...
22
votes
3answers
927 views

How can I get the unchanged Box form of an arbitrary expression?

One may observe that MakeBoxes does not give the actual Box form of various expressions: MakeBoxes[{1*^4, 000123, a*b c}] <...
21
votes
3answers
666 views

Tokenize Mathematica input in a simple way

Background Usually, I give detailed descriptions when I have a question which sometimes lead to that users don't write their answers because they maybe think their answer is too simple. Therefore, I ...
20
votes
2answers
496 views

Understanding evaluation and typesetting

Background So, one could be surprised by the fact that: Hold @ Grid[{{1, 2}}] (*or*) Hold @ Graphics @ Disk[] This issue and methods of prevention are ...
20
votes
0answers
203 views

Inconsistent handling of Dynamic option values; intended, omission, or bug?

In answering Dynamic ClipPlanes calculated from current ViewPoint Kuba and I got into a brief exchange regarding how Option values wrapped in Dynamic should be ...
18
votes
3answers
370 views

What are “\<” and “\>” delimiters in box expressions?

If I enter a string (say, "abc") in a cell, and then switch to box representation (Shift+Ctrl+E or menu item ...
18
votes
3answers
304 views

How do I use the third and fourth arguments of Parenthesize?

Parenthesize seems to do a good job with constructing boxes that need to be appropriately parenthesized: ...
18
votes
3answers
509 views

Notebook vs. DocumentNotebook; display a Notebook inline, like a DocumentNotebook

If you evaluate a DocumentNotebook[] expression in the front-end, it nicely displays inline, inside of an output cell in the current notebook: For my purposes, <...
16
votes
2answers
637 views

Backslash commands in strings?

I discovered by playing around that Text[DisplayForm@SubscriptBox["λ", "k"]] produces the same result as ...
16
votes
0answers
165 views

Issue with undo after copying a string inside a string

Bug introduced in 10.0 and persisting through V11.3 Here's a small but annoying issue related to undo and copying of strings. Steps required to get the problem: Type ...
13
votes
2answers
850 views

How to embed an image into a string?

Note: The bug described in the post is in Mathematica 9, and has been fixed in 10.0. The documentation for String contains the following statements: Strings can ...
13
votes
1answer
727 views

How to convert a notebook cell to a string retaining all formatting, colorization of identifiers etc?

I have an opened Mathematica notebook containing several cells. Suppose, I am interested in one of them -- it may contain a complete or incomplete expression (e.g. with syntax errors, highlighted ...
12
votes
1answer
610 views

How to change the font color of a variable in whole input cell

I want to track the occurrence of a particular variable in a code. So the idea is to change its color. Usually I do it in a crude way - convert the code into text and then use ...
12
votes
1answer
151 views

Strange behavior of UpSetDelayed together with MakeBoxes

In order to answer this question, I just stumbled into the world of UpValues. Though I managed to find a solution for the problem, I'm confused by my own code now 囧,...
11
votes
6answers
8k views

Notation of partial derivative

I want to write partial derivatives of functions with many arguments. Why is it that when I type f[x,y] ctrl+6 (0,1) it turns out to be bad syntax? The output of ...
11
votes
2answers
406 views

What are the differences between using MakeBoxes and Interpretation?

Say I want to define a custom graphical representation for my function foo. I can do this using MakeBoxes as in the following: <...
11
votes
2answers
227 views

ToExpression and ToBoxes aren't inverses of each other?

Applying ToExpression and ToBoxes repeatedly to Hold[1/1] gives many ...
11
votes
1answer
205 views

Functions returns Command Completion Output

Is there a function that returns the output as if you invoked Command Completion. To help clarify I am looking for a function that returns the Cell Data as if you invoked ...
9
votes
1answer
324 views

How to get a list of all expressions in a notebook matching a certain pattern?

Suppose I have a Mathematica notebook saved to a certain location on disk. Given a pattern I need to get the list of all expressions matching this pattern that appear in input, output or print cells ...
9
votes
3answers
234 views

Why does MakeBoxes mess up RowBox ordering?

When I use RowBox for MakeBoxes the order of the elements is changed for TraditionalForm, if there is a plus (+) in the list of elements. ...
9
votes
1answer
226 views

Is there a way to have a Tooltip for non-editable raster graphics produced by MakeBoxes?

I have a function which produces a large object I would like to hide. Formatting is of course an option but I'm hoping for something a little more meaningful using raster graphics and ...
9
votes
1answer
173 views

How to defer creating/displaying boxes in front end until requested?

If the size of an output expression is larger than threshold ByteCount, the front end will display an abbreviated version of it by producing an ...
9
votes
1answer
124 views

On an existing notebook, how to transform all “double brackets” into “DoubleBracket”

Sometimes, having all double brackets [[...]] transformed into \\[LeftDoubleBracket] ... \\[RightDoubleBracket] can really ...
9
votes
1answer
258 views

Pasting TemplateBox with a Dynamic argument

Ok, this is pretty specific... The objective is to use a TemplateBox to format something that is programatically inserted with ...
8
votes
2answers
88 views

MakeBoxes for Power not matching when inside Times?

If I try to define boxes for Power[x,-1] like this, MakeBoxes[Power[x, -1], TraditionalForm] := "matched"; it works as long ...
8
votes
1answer
192 views

How to get string representation of boxes in v10.2?

In Mathematica versions up to 10.1 we could get string representation of given boxes by passing them to ToString with InputForm: ...
8
votes
1answer
603 views

How to change brackets in TraditionalForm output

I'm trying to improve TraditionalForm's output by using different brackets when there are more than one. For instance, instead of $u(v(r(b))))$, I'd like to get $u\{...
8
votes
2answers
698 views

How to convert expression with Subscript to string

I've tried ToString[], but it doesn't work properly with subscripts: How to convert expr containing subscript to a string with ...
8
votes
1answer
328 views

How to convert arbitrary raw boxes directly into String?

This question is motivated by the recent question about searching inside of the NB files. According to the Documentation, ToString expects a high-level WL ...
8
votes
2answers
175 views

Reading Cells or Boxes expression by expression

Let's say we have a cell: (*newline*) (*newline*) Plot[ x, {x, 0, 1} ] (*newline*) Plot[x, {x, 0, 2}] How to read it expression by expression? So e....
8
votes
2answers
174 views

How to open and explore the codes of the system Palettes files

The built in Palettes of Mathematica are simply .nb files which can be found in the following place: ...
8
votes
0answers
120 views

What does the pair “\<” and “\>” in a string do? [duplicate]

What do \< and \> mean inside of a string? ...
7
votes
2answers
1k views

Formatted text in a Dynamic or Manipulate control

I am using a Manipulate control to show different calculations for the same user-specified parameters. I would like to show the results for the calculation the ...
7
votes
2answers
241 views

How can you resize all the images in a notebook section?

I've pasted a large number of photos and they are too big which makes scrolling hard. Is there a way to automatically have Mathematica size them to 10% or something reasonable without have to click on ...
7
votes
3answers
245 views

How to avoid spaces between numbers when displaying TagBox(es)

The instruction : DisplayForm[RowBox[List[0,1,Superscript[2,3],Superscript[1,2],a]]] displays a gap between the first two items of the list but if one is careful ...
7
votes
3answers
299 views

How to extract the displayed name of an entity

Entities are typically displayed in their elided form: It's useful when exploring the output of EntityList to have access to the canonical name of the ...
7
votes
1answer
107 views

Why doesn't defined MakeBoxes display what is constructed in RHS?

Inspired by the @ybeltukov 's answer to this question, if I have the following polynomial poly = a^2 + (a^2 + b^2 - c^2)*x + b^2*x^2; var = x; this generates ...
7
votes
1answer
318 views

Why only up to two \[Prime] superscripts are interpreted as derivatives?

I noticed that only up to two \[Prime] superscripts are interpreted as derivatives. Is there a reason for this restriction? Is it documented? ...
7
votes
1answer
234 views

Converting string representation of boxes into explicit boxes [duplicate]

It is very easy and convenient to write textual labels as Strings in the WYSIWYG mode. For example, I define a short form describing a linear model: ...
7
votes
1answer
117 views

Quick way to preview and tweak styles?

I find the old stylesheet UI clunky and hard to use: FrontEndExecute @ FrontEndToken @ "EditStyleDefinitions" There's also the clunky style previewer as well: ...
7
votes
1answer
166 views

Ways to obtain a BoxObject

Is there any way to get a BoxObject, except with EvaluationBox or ParentBox? So usually one ...
7
votes
1answer
153 views

Problem with conversion of UI controllers' boxes to expressions

Bug introduced in V10 and partially fixed in V11.1.1 TLDR Various of expressions which have fancy typeset form or are designed as UI elements won't survive ...
7
votes
0answers
161 views

Undocumented Backslash-LessThan operator in strings? [duplicate]

I'm aware of the backslash operators in strings, as in this SE answer, but I ran across a new one. I opened a new Styled Notebook ... in the front-end GUI, chose <...
6
votes
4answers
371 views

Make a custom object look like MatrixForm of a matrix?

Let's say I have a custom object that I denote Obj[a,b,c,...] There are always n^2 entries in the object for some integer <...
6
votes
2answers
378 views

Customizing display of partial differential equations

I am manipulating partial differential equations symbolically, and would like to get the easily readable form $\rho \frac{\partial v}{\partial t}$, leaving variables implicit. Based on suggestions ...
6
votes
1answer
360 views

On Reverting Code that Mma Switches to Raw Input Form Back to Standard Form

I experienced a similar issue to what is described in this post while editing formatted usage messages (that contained italics) in the declaration section of a package that I'm developing in the ...
6
votes
1answer
253 views

This code crashes the FrontEnd - can I remove anything else?

Bug present in version 11.0.0 Thank you for contacting Wolfram Technical Support and for taking the time to report this issue. I have forwarded it to our development team. I want to file a ...
6
votes
2answers
334 views

Add semicolon at the end of code line programmatically

Suppose we have several lines of code in a cell: a b; Module[{}, c d] e How can we wrap them in a CompoundExpression i.e. ...
6
votes
1answer
183 views

TagBox + InterpretationBox vs ConvertTo/StandardForm

There appears to be a problem with a menu command Convert To / StandardForm (Crtl+Shift+N) with respect to InterpretationBox ...
6
votes
1answer
87 views

How to display fractional expression like this?

For example: The default output is I want to the output display like I noticed that FractionBoxOptions, but couldn't find a appropriate options.