String formatting of plot labels produces "nothing"

I would like to format strings to autonomously change the plotting labels depending on the parameters used. I tried using the Printf package and have been partially successful:

label="⟨σ_1 σ_$s⟩$(@printf("%d", s))"

produces for s=2
image
I would like to remove the string of “nothing” at the end of the label but I don’t know what causes it to appear. Using @printf("%d", s) in the REPL produces the right output, without the added “nothing” string.

@printf prints to stdout, you want @sprintf.

4 Likes