3

I would like Mathematica to symbolically line up partial derivative symbol with a value stored in variable. I wrote this simple code below

x = 2*z;
StringJoin["∂", x, "/∂y"]
m_goldberg
  • 107,779
  • 16
  • 103
  • 257
PatStarks
  • 33
  • 2

1 Answers1

2
x = 2 z;

Well you might write

StringJoin["∂(", ToString@x, ")/∂y"]

"∂(2 z)/∂y"

which appears in an output cell as

out1

but I think you should consider

Row[{"∂(", x, ")/∂y"}]

Row[{"∂(", 2 z, ")/∂y"}]

This appears in an output cell as

out2

Even though its internal form is very different from the string returned by StringJoin, its output form is very similar. I like Row because it does a better job of spacing the 2 z term.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257