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
2 votes
1 answer
45 views

Export Notebook as Text (in 13.3 &14)

What is the best way to export a notebook as readable plaintext - while preserving as much structure as possible? The motivation here is the need to bulk-ingest notebooks and chunk them (for use in ...
user5601's user avatar
  • 3,601
0 votes
0 answers
54 views

Can Manipulate's execution result be represented by In&Out Cell?

I wrote the following code. ...
Hoony's user avatar
  • 1,470
0 votes
0 answers
32 views

Help fixing dynamic graphics with multiple features

I'm trying to create a graph drawing widget, here are its basics that just allow you to create and drag vertices: ...
swish's user avatar
  • 7,611
1 vote
1 answer
49 views

How to force GeneratedCell -> True for non-editable cells?

If I generate an arbitrary non-editable cell: ExpressionCell[1, "Output", Editable -> False, GeneratedCell -> True] And then try to edit it, the ...
swish's user avatar
  • 7,611
1 vote
0 answers
23 views

Changing cell selection style

How to change this default selection style for a cell?
swish's user avatar
  • 7,611
0 votes
1 answer
62 views

Coloring text in Mathematica [closed]

Mathematica gives the possibility to write normal text as input in cells. One can use bold (ctrl+b) or italic (ctrl+i) for text, but can one color the text? For example writing some red words?
mattiav27's user avatar
  • 6,587
2 votes
1 answer
93 views

How to write code realizing this manual operation? [closed]

I want to use the output of N[E,15]. However the output is really 2.71828182845904523533978449066641588615`15. if you copy the ...
amon xu's user avatar
  • 31
1 vote
1 answer
38 views

How to clear all definitions/symbols declared in all sections with the given tag?

Consider a list of chapters/sections etc. that have the same tag, say, "evaluation". Could you please tell me how to clear all the functions/symbols/definitions etc. that have been defined ...
John Taylor's user avatar
  • 4,642
0 votes
0 answers
27 views

Problem with repeated cells evaluation using tags

Consider the following code: ...
John Taylor's user avatar
  • 4,642
0 votes
0 answers
30 views

Defining cell background colours by default [duplicate]

Is there a way to define the background colour of new cells by default, so that whenever I create a new cell in a Mathematica notebook, it is automatically shaded accordingly?
sam wolfe's user avatar
  • 4,179
3 votes
0 answers
108 views

CellLabel alignment issues in version 13.2

I found that when the global magnification is set to 75% and the number on the CellLabel is larger, there will be alignment issues. Below is a comparison to version 12.2 I tried to change some ...
expression's user avatar
  • 5,562
0 votes
0 answers
40 views

Dynamic of the content of a certain cell (using NotebookRead)

Initial state : ...
imida k's user avatar
  • 4,047
0 votes
1 answer
32 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
185 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
1 vote
1 answer
82 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
  • 4,047
1 vote
0 answers
74 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
46 views

String in a Box representation makes a subtle error

...
imida k's user avatar
  • 4,047
0 votes
0 answers
36 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,642
3 votes
1 answer
57 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,422
4 votes
1 answer
74 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
  • 153
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
  • 4,047
5 votes
1 answer
187 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
  • 4,047
1 vote
1 answer
85 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
  • 4,047
0 votes
0 answers
20 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
29 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,642
4 votes
1 answer
227 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,163
4 votes
1 answer
122 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
137 views

Why does font weight sometimes lighten in certain Input cells? [closed]

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,397
1 vote
1 answer
212 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,397
2 votes
1 answer
158 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
  • 5,117
2 votes
2 answers
193 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,397
1 vote
0 answers
95 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,397
0 votes
0 answers
44 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
1 vote
0 answers
81 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
  • 145
1 vote
1 answer
58 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
  • 277
0 votes
0 answers
32 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,397
4 votes
1 answer
191 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
227 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,397
1 vote
1 answer
94 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
53 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
  • 9,703
1 vote
0 answers
25 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.4k
8 votes
2 answers
256 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,463
3 votes
2 answers
128 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
59 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
  • 26.3k
2 votes
1 answer
56 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,397
2 votes
2 answers
134 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.8k
1 vote
1 answer
147 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,397
12 votes
1 answer
205 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
  • 31.2k
2 votes
2 answers
59 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
146 views

How to prevent overwriting the latest output

Suppose I have a long notebook with three parts: ...
Lacia's user avatar
  • 2,208

1
2 3 4 5
9