Questions tagged [boxes]

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

Filter by
Sorted by
Tagged with
22
votes
3answers
949 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}] <...
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 ...
18
votes
3answers
384 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 ...
11
votes
2answers
233 views

ToExpression and ToBoxes aren't inverses of each other?

Applying ToExpression and ToBoxes repeatedly to Hold[1/1] gives many ...
20
votes
2answers
505 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 ...
21
votes
3answers
672 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 ...
8
votes
1answer
338 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 ...
16
votes
2answers
662 views

Backslash commands in strings?

I discovered by playing around that Text[DisplayForm@SubscriptBox["λ", "k"]] produces the same result as ...
20
votes
0answers
205 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 ...
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 ...
5
votes
0answers
224 views

How to prevent formatting as Mathematica code in inline cells?

We can start a new inline cell using Insert → Typesetting → Start Inline Cell. This is often used to insert mathematical formulae in text cells. Instead, I want to use it to insert small bits of non-...
12
votes
1answer
616 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 ...
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 ...
6
votes
4answers
377 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 <...
14
votes
1answer
746 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 ...
13
votes
2answers
862 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 ...
7
votes
1answer
242 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: ...
5
votes
2answers
403 views

Symbolize Does Not Work in `.m` Files or What?

I have a .nb (notebook) file which I should convert to a .m (mathematica package) file to run it remotely from command line of a ...
4
votes
2answers
225 views

ToBoxes Respect Spaces Code

Is there a way to force either ToBoxes or MakeBoxes to respect the spacing that occurs in the code? For example is there a way ...
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 ...
7
votes
0answers
162 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 <...
3
votes
2answers
135 views

NotebookWrite in EvaluationBox forces Input CellStyle

There is a promissing new function EvaluationBox[] and a nice last example in documentation section for it: ...
18
votes
3answers
516 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, <...
7
votes
2answers
243 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 ...
9
votes
1answer
228 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 ...
8
votes
2answers
181 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....
9
votes
1answer
125 views

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

Sometimes, having all double brackets [[...]] transformed into \\[LeftDoubleBracket] ... \\[RightDoubleBracket] can really ...
8
votes
1answer
612 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\{...
6
votes
1answer
127 views

To TagSet or not to TagSet when using MakeBoxes

What is the difference between the following two: ...
5
votes
2answers
145 views

Combination of CellPrint and PrintTemporary, or DisplayForm for Cells

I'm programmatically generating some formatted output that generates a cell in the form of a Cell[] expression. For instance, the output might be ...
11
votes
2answers
416 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: <...
7
votes
1answer
159 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 ...
6
votes
2answers
382 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
190 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
100 views

How to work with BoxOptions (ButtonBoxOptions, PanelBoxOptions, etc.)

The main question is in the title. Here are subtopics I'd like to focus on: Is there a tutorial related to them anywhere in documentation? How can I check what are current values of e.g. ...
5
votes
2answers
163 views

Removing spurious parenthesis in `TraditionalForm`

I don't understand the following behavior (in v 9.0.1) of TraditionalForm regarding insertion of parenthesis. Let us start with the a definition for ...
5
votes
2answers
180 views

How do I mimic the functionality of “<>”?

The Cell expression for: <> is Cell[BoxData["<>"], "Input"] However similar expressions are parsed into RowBox(...
4
votes
1answer
129 views

How to make TeXForm use TemplateBox to generate code?

If I define the TraditionalForm formatting of myFunction without TemplateBox, then ...
4
votes
1answer
173 views

Unexpected result when reading Cell with comment-lines by NotebookRead

Bug introduced in 9.0 and fixed in 9.0.1 When considering this question about re-formatting Cell (also this one), I encountered an issue which confuses me. I'll ...
3
votes
2answers
162 views

Show additional box border in 3D plot

How to best draw an additional box boder at {x, y, 0} as indicated by the red arrow below? PlotRange is ...
3
votes
1answer
211 views

How to make some RowBox to be string

GeneralUtilities`GetUsages["System`Sin"] I want to get $\color{red}{\textbf{1}}$ plain string,but this function actually will give me some ...
2
votes
1answer
2k views

How to import a Microsoft Word document into Mathematica?

I have a Microsoft Word document in DOCX format. I need to import it into Mathematica as a String preserving all formatting (font, size, bold/italic style, colors, ...