Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to use Mathematica as a kind of report generator.

I'm working in a Mathematica notebook and I want to handle Mathematica like this:

1) I want to define one cell as a text cell. In this cell I want to integrate an expression (maybe as an inline cell) lets say a*b (a and b have been defined in an input cell before).

2) After evaluating this cell a*b should be replaced by (assume a=10 and b=5) 50, so that the resulting cell would look like this.

some text ....... 50.. some other text......

More general: I want to have the possibility to call a function or an expression (which has been defined before) in a text cell. The displayed result of the call should be updated, whenever I change the input values.

share|improve this question

In addition to @Rojo's here's a more detailed explanation:

total = Dynamic[x + y]

Define the variable total that dynamically sums x and y

x = 10;
y = 5;

Now create a text cell by right clicking on the cell bracket at the right and choose style Text. I Type:

When I count the value x plus y I get: total

Now double click on total and right click and choose Create Inline Cell. A background color will appear on the word total. Now double click again again on the word total , right click, and choose Evaluate in Place.

The TEXT cell now changed to:

When I count the value x plus y I get: 15

Every time x or y changes your text cell adjust the correct value

share|improve this answer

How about using TextCell?

computation = 1 + 2;
TextCell[StringJoin@{"And the result is ", ToString@computation, 
   " according to the computation."}, "Section"]

Mathematica graphics

Of course other styles can be also used instead of "Section". You can even make it dynamic, and then you don't have to evaluate the TextCell again:

  StringJoin@{"And the result is ", ToString@computation, 
    " according to the computation."}, "Section"]

Any subsequent calls updating computation updates the TextCell as well.

share|improve this answer
Congrats on 5K :P – Rojo Apr 23 '12 at 20:36
@Rojo: 5K? Where? :) – István Zachar Apr 23 '12 at 22:58
I could have swooorn – Rojo Apr 23 '12 at 23:11

If I understood correctly you want to run a Dynamic[a*b] in an inline cell and evaluate it in place

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.