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
1 answer
24 views

Print into different cell groups inside module

I have a function with the following (simplified) structure: ...
michelangelov's user avatar
6 votes
1 answer
171 views

Implementation of rainbow style for multiple cells in a notebook

We are aware that a user may utilize 'ColorFunction' gradients such as 'Rainbow' for plotting. How can we implement a gradient style as a rainbow spectrum to multiple cells in which there are multiple ...
monfneg's user avatar
  • 541
0 votes
0 answers
74 views

Physical length of a graphic changes, very exceptional

This is one of the most exceptional, unexpected phenomenon in Mathematica at least for me. The physical length of a graphic changes, with scroll (mouse wheel scroll). In other words, the pixel length ...
imida k's user avatar
  • 3,859
0 votes
1 answer
73 views

Overlay two cells without changing size

At present I am interested in overlaying cells without change of size. Cells may be graphic or not graphic. For example, it can be a complicated mathematical formula or grid. Also cells may be output ...
imida k's user avatar
  • 3,859
0 votes
1 answer
61 views

How to restore LightGray Background to initialization cells?

I am running Mathematica 13.2.1 on a new MacBook Pro M2 with Ventura 13.2.1. I have done something that causes any initialization cells that I create or view to no longer have a LightGray background. ...
Spencer Rugaber's user avatar
0 votes
1 answer
44 views

String in a Box representation makes a subtle error

...
imida k's user avatar
  • 3,859
0 votes
0 answers
29 views

How to forbid Mathematica to expand the section if launching it by tags?

Consider some section in a notebook tagged as "Evaluation". We want to launch it in e.g. the following way: ...
John Taylor's user avatar
  • 4,866
3 votes
1 answer
56 views

Insert a cell to "push" an output cell down so that my next output will not overwrite the last output [duplicate]

Normally when you evaluate a function, its result overwrites previous results. I would like to insert a cell between my function so and the last output (push down the last result} so that the new ...
George Wolfe's user avatar
  • 5,412
4 votes
1 answer
69 views

How can I wrap groups of cells with HTML tags on export?

Exporting a notebook to HTML in a way that worked with my site's styles was far easier than I anticipated: ...
alltom's user avatar
  • 143
0 votes
0 answers
28 views

FontSize of fraction after TableForm is small [duplicate]

FontSize of fraction after applying TableForm is small. ...
imida k's user avatar
  • 3,859
5 votes
1 answer
169 views

Validate `Box` grammar, is it possible?

Is it possible to validate grammar related to Box formed expression (RowBox, FractionBox, ......
imida k's user avatar
  • 3,859
1 vote
1 answer
79 views

The ultimate output control method

The ultimate substance of all matter is the atom, likewise, the ultimate substance of mathematica cell is the cell expression, and it can be obtained easily. After copying the cell expression, and ...
imida k's user avatar
  • 3,859
0 votes
0 answers
19 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 (...
Chloe's user avatar
  • 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 ...
John Taylor's user avatar
  • 4,866
3 votes
1 answer
148 views

What is the difference between code cell and input cell?

What is the difference between code cell and input cell?
vasili111's user avatar
  • 1,057
4 votes
1 answer
110 views

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

consider the following list of Cell[]'s: ...
podge cassidy's user avatar
0 votes
1 answer
83 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 ...
Jules Manson's user avatar
  • 2,347
1 vote
1 answer
135 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 ...
Jules Manson's user avatar
  • 2,347
1 vote
1 answer
87 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 ...
Shredderroy's user avatar
  • 4,957
2 votes
2 answers
153 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 ...
Jules Manson's user avatar
  • 2,347
1 vote
0 answers
64 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 ...
Jules Manson's user avatar
  • 2,347
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 ...
Daniel P. Johnson's user avatar
0 votes
0 answers
63 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 ...
akr's user avatar
  • 135
1 vote
1 answer
53 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 ...
JJJanezic's user avatar
  • 267
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 ...
Jules Manson's user avatar
  • 2,347
4 votes
1 answer
180 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 ...
user8281's user avatar
  • 151
0 votes
0 answers
215 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 ...
Jules Manson's user avatar
  • 2,347
1 vote
1 answer
89 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 ...
2stein's user avatar
  • 13
2 votes
0 answers
40 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 ...
azerbajdzan's user avatar
  • 5,935
1 vote
0 answers
24 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 ...
Jack LaVigne's user avatar
  • 14.3k
8 votes
2 answers
247 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) ...
B flat's user avatar
  • 5,377
0 votes
0 answers
32 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 ...
userrandrand's user avatar
  • 5,567
3 votes
2 answers
106 views

Left, center, and right justification within a single cell

I can write a cell with the text alignment on the right: ...
David G. Stork's user avatar
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 ...
yode's user avatar
  • 25.6k
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?
Jules Manson's user avatar
  • 2,347
2 votes
2 answers
125 views

How can I 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 ...
murray's user avatar
  • 11.7k
1 vote
1 answer
140 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 ...
Jules Manson's user avatar
  • 2,347
12 votes
1 answer
187 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 ...
M.R.'s user avatar
  • 30.9k
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: ...
David G. Stork's user avatar
2 votes
2 answers
125 views

How to prevent overwriting the latest output

Suppose I have a long notebook with three parts: ...
Lacia's user avatar
  • 1,693
2 votes
1 answer
150 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 ...
matheorem's user avatar
  • 16.6k
6 votes
1 answer
173 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, ...
BabaYaga's user avatar
  • 1,542
4 votes
1 answer
56 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): ...
Alexey Popkov's user avatar
4 votes
1 answer
150 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 ...
WillG's user avatar
  • 844
2 votes
2 answers
265 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. ...
WillG's user avatar
  • 844
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 ...
WillG's user avatar
  • 844
8 votes
4 answers
227 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 ...
Alexey Popkov's user avatar
7 votes
3 answers
140 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 ...
Alexei Boulbitch's user avatar
2 votes
1 answer
192 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. ...
Adalbert Hanßen's user avatar
2 votes
1 answer
73 views

CellObject[Number] to its content

As in the following sreenshots, roughly speaking, Out[43] is CellObject[97601]. I want to set ...
imida k's user avatar
  • 3,859

1
2 3 4 5
9