# How can I get a manipulated parameter to show up with text next to it?

I'm trying to make a dynamic demonstration involving the $\epsilon-\delta$ proof of the limit, $$\lim_{x\to c}(2x-1)=2c-1$$ with the following code. d and e correspond to $\delta$ and $\epsilon$.

d[e_]=e/2;
Manipulate[
Row[{d[e], Plot[2x-1, {x,-1,4}]}],
{c,0,3},
{e,0,5},
SaveDefinitions->True]


I've omitted the part of the code that contains c (it's a bunch of lines added via Epilog).

I would like to make the label to the left, currently the value of d given a fixed e, like d=(value of d), which I've tried using "d=" d[e]. However, this displays the value I want followed by the text d=. I can't seem to find anything that addresses this option in the documentation.

Edit: I'm now considering including the current values of c and e in a column to the right of the plot. I've changed the code as follows:

d[e_]=e/2;
Manipulate[
Row[
{Plot[2x-1, {x,-1,4}],
Column[{{"e=",e}, {"d=",e/2}, {"c=",c}}]}
],
{c,0,3},
{e,0,5},
SaveDefinitions->True]


but this gives me awkward labels that look like {e=,0} when e is $0$, for example.

• Try "d=" <> ToString[d[e]] where you now have d[e]. – bill s May 13 '15 at 19:45
• Just add a comma between "d = " and d[e], i.e. Row[{"d = ", d[e], Plot[2 x - 1, {x, -1, 4}]}]? – kglr May 13 '15 at 19:50
• Thanks @kguler for the very simple fix :) – user170231 May 13 '15 at 19:51
• Did you consider using the Appearance option: {e,0,5,Appearance->"Labeled"} ? The label appears at the end of the slider but is a bit less visible than the solution below. (This, of course, doesn't help with displaying d.) – JimB May 14 '15 at 0:04

d[e_] = e/2;

Manipulate[Row[{"d = ", d[e], Plot[2 x - 1, {x, -1, 4}, ImageSize -> 300]}, Spacer[5]],
{e, 0, 5}]


Perhaps a better alternative is to use Labeled and to wrap the label with Pane to avoid jittering of the plot as the size of the label changes:

Manipulate[Labeled[Plot[2 x - 1, {x, -1, 4}],
Pane[Row@{"d = ", d[e]}, ImageSize -> 100], Left],
{e, 0, 5}]


Update:

... including the current values of c and e in a column to the right of the plot.

Manipulate[Labeled[Plot[2 x - 1, {x, -1, 4}],
Pane[Column[Row /@ {{"e = ", e}, {"d = ", e/2}, {"c = ", c}}],
ImageSize -> {100, Automatic}], Right], {c, 0, 3}, {e, 0, 5}]


Alternatively, instead of Column[Row /@ {{"e = ", e}, {"d = ", e/2}, {"c = ", c}}] use

Grid[{{"e = ", e}, {"d = ", e/2}, {"c = ", c}}]

• Yes! I've been looking for way to stop the constant shifting. Do you have any suggestions regarding displaying the column of parameters? – user170231 May 13 '15 at 20:26
• @user170231, I updated with a suggestion to display a column of parameters on the right. – kglr May 13 '15 at 20:36
• Ah I see, I have to nest Row within Column. Thanks for the suggestion! – user170231 May 13 '15 at 20:38
• @user170231, my pleasure. Thank you for the accept. You could also use Grid instead of Column/Row combination: Grid[{{"e = ", e}, {"d = ", e/2}, {"c = ", c}}] is perhaps more straightforward than Column[Row/@{...}]. – kglr May 13 '15 at 20:43
• Grid introduces some alignment issues, but that's easily dealt with. – user170231 May 13 '15 at 20:45