Message Boards Message Boards


[✓] Insert a variable value in text cell?

Posted 1 month ago
2 Replies
2 Total Likes

This is probably a very stupid question, but I can't find the answer in the documentation. I have a text cell for which I would like to insert the value of a symbol. For example,


(where this line is a separate text cell)

I would like to do this n times 

I would like the text cell to show up as

I would like to do this 7 times

Is this possible

2 Replies

This is one way to do it:

  1. In the middle of your text cell, insert an inline cell (Ctrl-9)
  2. Type Dynamic[n] inside it
  3. With Dynamic[n] selected, evaluate it in place (Shift-Ctrl-Enter)

Now when you change n it gets updated automatically.

Posted 1 month ago

Many thanks Gustavo. It works fine. Perhaps, because I am on a Mac your step 3 didn't work quite as expected. However I was able to choose "evaluate in place" from a menu. Mike

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract