Message Boards Message Boards

0
|
7713 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

[?] Insert a variable value in text cell?

Posted 5 years ago

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,

n=7

(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

POSTED BY: Mike Luntz
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 BY: Gustavo Delfino
Posted 5 years 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

POSTED BY: Mike Luntz
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract