Questions on Notebooks (*.nb, *.ma in earlier versions), structured interactive documents produced by Mathematica that can contain text, graphics, sound, calculations, typeset expressions, and user interface elements.

learn more… | top users | synonyms (1)

11
votes
3answers
2k views

Programmatically generate packages from notebook files?

Currently, there are two ways I know of to generate a package (.m) file from a notebook file; one is to set the AutoGeneratedPackage option in the Option Inspector, ...
11
votes
3answers
190 views

How to collect expressions from cells created by Print?

I have a notebook where evaluation of a certain cell produced hundreds of adjacent output cells using Print. I need to create a list containing all expressions from ...
11
votes
3answers
588 views

Is it possible to insert an animated image into Mathematica notebook?

I find it very convenient to use Mathematica notebooks to organise the codes + results. I was wondering if it is possible to insert an animated image (say an animated gif) in the middle of a ...
11
votes
3answers
350 views

Drawing an arrow pointing at the “Enable Dynamics” button

Sometimes my students are given Mathematica notebooks as part of an assignment, and asked to go through some demonstrations contained in the .nb file. A lot of times I get complaints that the "graphs ...
11
votes
2answers
404 views

How can I make a cell that contains an image which can be shifted?

When you're looking at some help pages, they may have cells containing images which can be shifted within the cell by left-clicking and dragging the mouse. Here is a sample: ...
11
votes
2answers
254 views

Is it possible to create Evaluatable cell which will be automatically overwritten?

Am trying to generate an Evaluatable cell which itself is an output cell which will be overwritten when the original Input cell ...
11
votes
3answers
204 views

How to sort cells in a notebook based on cell tags?

Suppose I have a notebook with cells tagged with both numbers and words with numbers always list first, and some cells without cell tags e.g.: ...
11
votes
1answer
164 views

Cell brackets on left side?

Is it possible to have the cell brackets on the left? I looked through the options and couldn't find anything, but maybe it's some kind of esoteric style setting or something. The reason I'm looking ...
11
votes
1answer
393 views

Saving a notebook as a $\LaTeX$ file, with syntax highlighting preserved

How can I save a notebook as a $\LaTeX$ file, while preserving the syntax highlighting (such as input/output boxes)?
10
votes
2answers
293 views

how to make cursor jump automatically to next input cell after evaluating previous one?

When making separate cells in order to make separate computations to better see the result of each one before going to the next cell to do the next computation (which is a good way of doing things), ...
10
votes
2answers
179 views

How can I set a fixed cell height?

I did this often in previous versions of the Mathematica notebook front end. I would have a cell with lots of raw data, e.g. a very long list. The list might go on for pages. I would set the cell ...
10
votes
3answers
323 views

Typeset unbalanced brackets

In LaTeX, you can typeset expressions containing unbalanced brackets, by balancing them with an invisible delimiter \left. or ...
10
votes
0answers
150 views

Is there a convenient/automatic way of uploading a notebook into SE?

This post discusses how to streamline the other way - extracting code from a fragmented and longish SE answer but I imagine a two-way workflow like: Fashion an answer/question in an SE-templated ...
9
votes
2answers
942 views

How do I automatically evaluate a cell when a notebook is opened?

I'm trying to put together a GUI in Mathematica and need to evaluate one cell to kick that off. Is there a way to automatically evaluate that cell when the notebook is opened? Here is an example of ...
9
votes
3answers
696 views

How can I type left (sub)superscript?

I want to type in my variable next to its plot and I'm typing the text in using Inset. However my variable has superscripts to the left. Say it looks like this: $ ...
9
votes
1answer
161 views

Knowing when a notebook has changed programmatically

Is there any way I can programatically determine whether a notebook has unsaved edits? Is that asterisk on the right of the notebook name represented in a notebook option or something, like ...
9
votes
1answer
494 views

Why is plot legend unsafe?

Every time I open a notebook contains a legend, I get the message warning that it's not safe. The file contains potentially unsafe dynamic content. Why does this happen and how to fix it?
9
votes
1answer
391 views

How to pipe a stream to another notebook?

Can I pipe an OutputStream object created by OpenWrite (or similar) to a notebook instead of a file? I am aware that I can use ...
9
votes
2answers
153 views

Backslash commands in strings?

I discovered by playing around that Text[DisplayForm@SubscriptBox["\[Lambda]", "k"]] produces the same result as ...
9
votes
1answer
136 views

How to make certain mathematical characters be written as bold by default

In a notebook, when writing \[RightVector] over a variable I always end up bolding it to make it more visible. But it'd be easier if it could be set up to bold that ...
9
votes
2answers
156 views

A notebook created on demand from a main document showing executable input along with output cells

I would like to make Mathematica documents with hidden calculations, such that they can be visualized on demand. In general it can be done in several forms and I actually use some. I would like to ask ...
9
votes
1answer
265 views

How can I change the style of every newly opened notebook?

I'd like to make Mathematica open a new notebook using the Natural Color template (under the Creative category) by default. Is that possible? If so, how?
8
votes
4answers
238 views

Create horizontal list in notebook

I want to create a multiple choice question paper and list the options horizontally. I am only looking at very simple document with horizontal list. What I want: What is 1+1? a) 2 b) 4 c) 3 d) 7 ...
8
votes
3answers
218 views

Quickly display a color graphically

When manipulating colors, the output is shown as a textual expression like Hue[1/5], RGBColor[2/3, 1, 1/3], ...
8
votes
4answers
936 views

Automatically counting the number of lines of code in a set of notebooks

How can I automatically count the number of lines of code "Input" existing inside all the notebook files contained in a specified folder? I know there is the issue of considering or not the automatic ...
8
votes
2answers
258 views

Prevent text from wrapping in a notebook

By default in the Notebook interface the text wraps. Is it possible to prevent this wrapping?
8
votes
3answers
1k views

Keyboard shortcut to evaluate notebook

(If this is entirely trivial, although I couldn't find an answer as much as I searched the archives, I will delete the question.) How could I add a keyboard shortcut to evaluate the entire notebook ...
8
votes
4answers
567 views

Is there a notebook autosave frequency configuration?

I've had Mathematica crash on me a number of times, and have had to recreate notebook contents from the last save point. I was looking for something in the preferences like an autosave frequency ...
8
votes
3answers
89 views

Create a closed notebook

When using nb = CreateDocument[], is there an option that prevents the notebook from opening automatically? And is there a command that opens the notebook when ...
8
votes
2answers
155 views

Substituting confidential tagged cells by a “content removed” cell

When producing a notebook with both code and text, I often end up with pieces of code, or even entire chapters, that I don't want to be shown on the final output. I generally hide or close them by ...
8
votes
2answers
535 views

Building documentation with interactive examples in Wolfram Mathematica

There are interactive examples in the documentation in Wolfram Mathematica. Thus to compile them we just need Shift+Enter. I want to develop such examples for functions from my own package, how can I ...
8
votes
1answer
199 views

Inheriting Stylesheets when using CreateDocument

I build a lot of presentations and custom notebooks with very different stylesheets, and use Button and CreateDocument quite ...
8
votes
1answer
101 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 ...
8
votes
2answers
134 views

Alternative to NotebookLocate or NotebookFind

In Mathematica 8.0 and older, there are two ways to select cells based on cell tags. NotebookLocate["CellTag"]; NotebookGet[EvaluationNotebook[]] and ...
8
votes
1answer
234 views

Determine page count programmatically [duplicate]

Possible Duplicate: Generating a table of contents By selecting File > Printing Settings > Headers and Footers from the menu, I am able to enter << Total Pages >> to print the total ...
8
votes
1answer
333 views

How do you insert more columns into Table cells?

How do you insert more columns into Table cells as shown below? To get to this table, go to File -> New -> Styled Notebook -> Textbook -> New -> Scroll down to the Table Cells.
8
votes
1answer
149 views

After modifying expression, new result doesn't replace old one

After I modify and re-evaluate an expression, the new result doesn't replace the old one. Rather, what happens is that the old result gets pushed down and Mathematica displays the current result at ...
8
votes
1answer
482 views

How to copy code out of notebook to an external text editor without extra line feeds being added?

I am simply trying to copy code from a cell (input cell) in a notebook, to paste the code into a plain text editor, and not have some lines wrap in the middle. I need to copy the code, as is, to a ...
8
votes
1answer
191 views

How can I add a background to a stylesheet?

In version 9 we can set the background to an image, however I'd like to save this into a stylesheet that can be installed.
8
votes
1answer
273 views

How to suppress undesirable kerning rules in math inline cells?

Update: (11/29/2012) Looks like Mathematica 9 has the same behavior. The following graphic shows how Mathematica kerns italic characters in an inline math formula cell (first row) where an ...
8
votes
2answers
238 views

Save notebook without including Front End version information

How can a notebook be saved without including the front end version? If you open a .nb file, you'll see something like ...
8
votes
1answer
162 views

Accessing the Options of the parent Cell

From within the Kernel, it is possible to access a Cell's options using CurrentValue. For instance, in a ...
8
votes
0answers
254 views

Keyboard issues with Mathematica 9.0.1 for Linux [closed]

After working for a while with Manipulate function and increasing the number of variables to be manipulated, keyboard stops working properly in the Notebook. It ...
8
votes
0answers
113 views

Esc-esc for special characters and autocomplete in Mathematica 9 [duplicate]

I recently upgraded to Mathematica 9 and have noticed a slightly annoying behavior that I was looking to remedy. In the past I would type special characters, e.g. ...
8
votes
0answers
197 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 ...
7
votes
3answers
446 views

How do I create a package from an existing notebook?

I have a notebook containing some functions, for example: f[x_] := 2*x g[x_] := x^2 Now I would like to convert this notebook to a package, ...
7
votes
2answers
402 views

How do I view initialization (or other invisible) cells in a notebook?

I am looking at someone else's notebook, and when I go to evaluate it, it asks whether I want to evaluate the initialization cells. I would like to look at them first, but "I do not see them here nor ...
7
votes
3answers
153 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 ...
7
votes
3answers
732 views

How to export notebook in colored PDF form [duplicate]

Possible Duplicate: Saving a notebook as PDF, preserving syntax highlighting I would like to export my notebook code in a colored PDF form. What I do is select the brace in the right side ...
7
votes
1answer
111 views

Auto highlighting input cells depending on input expression (eg its Head)

Is it possible to programmatically highlight (eg, by change background color) an input cell conditional on the input expression's Head (or other attributes) upon evaluation? For example, would like ...