Questions tagged [cells]

Questions about cells and functionality related to cell structures, or the notebook cell hierachy which serves to organize the information in a Mathematica notebooks. This includes questions related to properties and options for cells that determine the overall look and behavior of the notebook.

Filter by
Sorted by
Tagged with
0 votes
0 answers
18 views

Unknown Cell Collapse Type

Going through a notebook someone else put together, there are segments where a cell is mostly collapsed - you can see it is a code cell but not the code inside, but you can still evaluate the cell (...
  • 105
0 votes
1 answer
26 views

How to launch the cell associated with many tags?

Consider some section Section 1 and its subsection Subsection 1. I want to associate the whole cell with ...
  • 5,112
3 votes
1 answer
110 views

What is the difference between code cell and input cell?

What is the difference between code cell and input cell?
  • 1,057
4 votes
1 answer
105 views

How to programmatically create a notebook from a list of Input Cell[]'s with syntax highlighting?

consider the following list of Cell[]'s: ...
0 votes
1 answer
77 views

Why does font weight sometimes lighten in certain Input cells?

Why do font weights sometimes change in cells, where they evolve from a regular weight to a dimmer or lighter font weight? The notebook I have open is not heavy as it only has a few cells. Also, there ...
  • 2,337
1 vote
1 answer
89 views

How to check that a user-input of a list of CellObject-s actually belong to the EvaluationNotebook?

Suppose a user inputs a list of CellObject-s to operate on. How might one check these objects to determine if they actually belong to the ...
  • 2,337
1 vote
1 answer
76 views

How can I change the default cell type in Mathematica from Input to Code?

Every time I type something into a notebook, I am compelled to first change the cell type from Input to Code, and then unset the ...
  • 4,927
2 votes
2 answers
127 views

ChangeCellStyle function works in one direction but not in reverse

This post is a continuation of an earlier Question, How to programmatically change CellStyle of all Cells from "Input" to "Code"? but with a ...
  • 2,337
1 vote
0 answers
58 views

How to acquire the background color and font color of output cells?

The following is how I grab the general colors used for an EvaluationNotebook but how does one target the colors to be used when creating an ...
  • 2,337
0 votes
0 answers
42 views

How do I find the background color of a cell when the cell group is closed?

I am trying to key some actions based on the background color of the selected cells. However, if the cell is in a closed group, CurrentValue returns a gray level. Once the cell is opened, then ...
0 votes
0 answers
60 views

Code to delete all output in a notebook

I am looking for a code I can paste at the beginning of a notebook to delete all the output cells so that when I execute the "Evaluate notebook" command, all the output cells are also ...
  • 135
1 vote
1 answer
51 views

Enums in ONE text cell of a notebook?

Is it possible to have an enumeration as an integral part of a text cell, so that they all together form one cell? Reason for this question: I would like to have a text cell (e.g. for a theorem) and ...
  • 257
0 votes
0 answers
31 views

How might one create a Button that wraps everything hilghlighted with mouse with double quotes similar to Comment/Uncomment?

I find typing doublequotes around characters to create strings a bit annoying because it always slows me down. The doublequotation marks lie right at my achilles heel on keyboards. It's too close to ...
  • 2,337
4 votes
1 answer
176 views

Collapse (hide) code inside a function

I often use structures similar to the "func" below, however I would like to be able to "hide" the function definitions (similar to cell grouping using a group opener). I think an ...
  • 151
0 votes
0 answers
211 views

The new Default Toolbar in 13.1 may have a bug in which a label appears over it. Can label be removed?

This post does not ask how to stop new toolbar from appearing but how to remove the described label above it. I finally installed 13.1 and to my surprise Wolfram added a new ...
  • 2,337
1 vote
1 answer
88 views

hidden newline in long cell entries

I need to store long strings from mathematica to a text file. Unfortunately, mathematica provides long cell entries (input/output) after approx the 70th position with a hidden backslash and a new line ...
  • 13
2 votes
0 answers
32 views

How to make my own external language cell evaluator

We can type > and select python to insert python external language cell into notebook. Then we can write python code inside it and evaluate it by pressing ...
  • 5,915
1 vote
0 answers
23 views

Sequential vs Nested Module for closing tagged cell

I have the following simple line of code in my notebook Plot[x^2, {x, 0, 2}] I add a CellTag with the string "Plot" to that cell. Sequential Module I ...
  • 14.3k
8 votes
2 answers
245 views

Creating Picture-in-Picture functionality by Attaching a Notebook to a Notebook using AttachCell[]

I use Mathematica for math lectures at my school. I would like to find a way to attach a secondary notebook to a primary notebook using AttachCell[]. The idea is to have picture-in-picture (PIP) ...
  • 5,221
0 votes
0 answers
31 views

Convenient way to make a text cell togglable

I like being able to hide text cells in a notebook. Currently I am doing this by writing another text cell above the current text cell, writing "open" and then grouping the cells. That way ...
  • 4,599
3 votes
2 answers
94 views

Left, center, and right justification within a single cell

I can write a cell with the text alignment on the right: ...
0 votes
1 answer
54 views

Is there a simple method to export an input cell? [duplicate]

This is a code of an input cell: a = 1 + 5*8; b = {6, 99}; Entity["MathWorld", "FunctionGraph"] Plot[x, {x, First[b], Last[b]}] I hope to get a ...
  • 25.3k
2 votes
1 answer
53 views

What properties make a valid CellID?

The documentation for CellID only mentions that it will be a number. But what kind of number? Can it be a real number with a decimal? How about a negative number?
  • 2,337
1 vote
2 answers
87 views

How restore Default stylesheet's new type of group openers?

With the Default stylesheet (in Mathematica 13.1 and several versions earlier), the new kind of group opener for sections, subsections, etc., appears as in this screenshot: When I apply a certain ...
  • 11.6k
1 vote
1 answer
135 views

Cannot find DockedCells with Cells or NotebookFind

Request 1: A workaround for Cells or NotebookFind needs to be found for locating and returning the ...
  • 2,337
12 votes
1 answer
174 views

How to decorate cells with widgets like jupyter and collab?

I would like to add a couple UI features from cells in python notebooks that I find helpful. Specifically, these two features from google's collaboratory and vs-code's jupyter mode: To the left of ...
  • 30.8k
2 votes
2 answers
55 views

Automatically close the parent cell in a grouped set

There are several questions in Mma.SE related to programmatically opening and closing cells, but I could not find quite what I'm seeking. Here's a minimal example: ...
2 votes
2 answers
114 views

How to prevent overwriting the latest output

Suppose I have a long notebook with three parts: ...
  • 1,440
2 votes
1 answer
141 views

How to use same cell for printing in a loop?

I want to manually tag images. For example, we prepare a list of images like imgList = Table[Rasterize[i, ImageSize -> 50], {i, {a, b, c}}] it gives Now I made ...
  • 16.6k
6 votes
1 answer
157 views

How to stop opening of cell groups after evaluation of the whole Notebook?

Bug introduced in 12.3 or earlier and persisting through 13.1.0 I have a long notebook with Section, Subsection, ...
  • 1,542
4 votes
1 answer
52 views

How to select the outermost CellGroup that contains given cell?

Suppose we have a Notebook with a deeply nested structure (this is a simplified example, the Notebook can be huge): ...
4 votes
1 answer
142 views

How to convert any string of code to an input cell?

This is a generalization of this question, which already has very nice answers. Suppose str is a string of valid code, so that ...
  • 802
2 votes
2 answers
263 views

How to generate input cells whose code is determined dynamically?

Following this post, I want to use code to generate an input cell with new code. However, unlike the linked post, I want my code to dynamically determine the new code to be printed in the input cell. ...
  • 802
0 votes
0 answers
23 views

Can I generated an initialization cell using CellPrint?

I want to do exactly what is done in this post, except I would like the generated cell to be an initialization cell. That is, I'd like to have my code automatically generate an input cell with new ...
  • 802
8 votes
4 answers
216 views

How to determine the current width of the output cell area?

When answering this question, I suddenly realized that it is surprisingly difficult to determine the current width of the output cell contents. I tried to employ the ...
7 votes
3 answers
137 views

How to insert AutomaticNumbering programmatically?

Preamble: I often work with the JournalArticle Stylesheet and use in it the styles "Figure" for graphics and "FigurCaption" for the corresponding caption. The figures should be ...
2 votes
1 answer
177 views

Stop Mathematica’s automatic indentation on existing notebooks

This question relates to Mathematica 12.3 (and possibly many other versions). Mathematica's automatic indentation does not conform to my workflow. From the very old days of Mathematica 1.2, i.e. ...
2 votes
1 answer
66 views

CellObject[Number] to its content

As in the following sreenshots, roughly speaking, Out[43] is CellObject[97601]. I want to set ...
  • 3,541
4 votes
1 answer
117 views

Deploy and Deployed

I was trying to understand what happens when I insert Deployed -> True/False in an ExpressionCell but couldn't see a ...
  • 41
0 votes
1 answer
55 views

Indefinitely Drag and Drop an Attached Cell

I created a drag and drop attached cell which can be moved and anchored anywhere in a notebook window. To try it out, execute the following code and click the Start button. Then move the panel ...
  • 5,221
1 vote
2 answers
131 views

Change style of the above cell

How can I change the style of a given cell, by writing some code on the cell directly below the cell and executing it? ...
  • 3,541
2 votes
1 answer
92 views

Text cell numbering

For input cells and output cells, there are automatic,natural numbering. In[1] 2+2 Out[1] 4 I mean In[1] and Out...
  • 3,541
3 votes
0 answers
38 views

Consistent cell background color when using CellFrameLabels

Let's say I have the simple notebook ...
  • 199
8 votes
2 answers
284 views

Drag and Drop an Attached Cell

I'm trying to create an attached cell that can be mouse dragged. I'm envisioning mouse-dragging the blue header bar to bring the entire header and the graphic to a new location at which point both ...
  • 5,221
3 votes
0 answers
48 views

Are there any cell properties that you can use to terminate a cellgroup without starting a new one?

Suppose I have the following notebook: ...
  • 20.1k
14 votes
2 answers
250 views

Stretching a mesh

Imagine I want to stretch a mesh with a 'rubberband-type' effect. That is, upon and elastic stretch from both side edges, the mesh centres simply scale as follows where the points are seeds for ...
  • 4,362
2 votes
2 answers
110 views

How can the format of Initialization Cells be set to the format of normal input cells?

I don't like how initialization (or "Code") cells are formatted in notebooks, namely the grey background color and the spacing/wrapping settings. I want ...
  • 483
3 votes
1 answer
129 views

How to find next graphic in notebook?

I have a notebook bloated by graphics and would like to delete many of them. To do this I would like an expression to find the next graphic. I tried: ...
  • 1,867
1 vote
1 answer
44 views

How to attach output from Button function to bottom of Tabview output

My question is best explained with a simple example. Lets suppose we have: ...
2 votes
2 answers
121 views

First character of inline cell is partially cut off

Bug introduced in 12.3 or earlier and persisting through 13.1.0 [CASE:4900891] Notice how the "f" is partially cutoff in the following inline cell. Here is the textual form. ...
  • 199

1
2 3 4 5
9