When I do...


I get:


BUT I'd like to get:


How can I get this result? I want to display the subtraction, unevaluated -- but I want an expression within the subtraction to get evaluated.

  • 8
    $\begingroup$ Why not With[]? With[{p = 3}, HoldForm[p - 2]] $\endgroup$ Commented Mar 15, 2016 at 3:25
  • $\begingroup$ @J.M. Yes that is better. Why not add a separate answer? $\endgroup$
    – Sean
    Commented Mar 15, 2016 at 3:31
  • 1
    $\begingroup$ Because that bit is also in the thread you linked to, and the threads that thread is linked to. $\endgroup$ Commented Mar 15, 2016 at 3:33

1 Answer 1


Here's one way:

HoldForm[p - 2] /. HoldPattern[p] :> RuleCondition[p]
  • $\begingroup$ Found after some deeper digging into comments of this question: mathematica.stackexchange.com/questions/75260/… $\endgroup$
    – Sean
    Commented Mar 15, 2016 at 3:24
  • 4
    $\begingroup$ Sean, perhaps you could add the With method outlined by J.M. in your answer, since you found it useful as well. (+1 for self-answering!) $\endgroup$
    – MarcoB
    Commented Mar 15, 2016 at 3:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.