# DisplayForm problem with $\pi$ in FractionBox

The following line produces an output with the text "Pi" displayed instead of the symbol (greek letter) $$\pi$$.

Code line:

    FractionBox[π,2] // DisplayForm


All help with an alternative or correction of this would be much appreciated, thank you.

Responding to a question below here is an image of how FractionBox enters an equation display. The first line produces an unintended rearrangement of the fraction in the sum. The second line is the intended result. There is no calculation intended, only display.

Here are the code lines

Sum[(-1)^n * StieltjesGamma[n]/n! *
Subscript[B, n + 1][-I c, 2 x - 1], {0, Infinity}] // Defer //
HoldForm // DisplayForm // TraditionalForm


and

Sum[(-1)^n * FractionBox[StieltjesGamma[n], n!] *
Subscript[B, n + 1][-I c, 2 x - 1], {0, Infinity}] // Defer //
HoldForm // DisplayForm // TraditionalForm

• Try FractionBox[π, 2] // MakeExpression // ReleaseHold? However, what are you trying to achieve with these expressions? Just evaluating π/2 would achieve the same result. – MarcoB Mar 18 '19 at 21:23
• People here generally like users to post code as Mathematica code instead of just images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find this meta Q&A helpful – Michael E2 Mar 18 '19 at 22:54
• @MarcoB - thank you, your solution works and is better than mine. To be clearer about the question, I should have added that the FractionBox is part of a long equation displayed using TraditionalForm and DisplayForm. I posted only the part of the equation that causes the problem. This is a display issue so no evaluation is intended. Thank you again. I still don't understand why MMA does this, by the way. Why the string "Pi" instead of the actual greek letter? I am wondering if this is a bug or there is some reason for this. – Ohcolowisc Mar 20 '19 at 16:42
• @Michael E2 - Thank you for the comment. I am aware of the preference of code vs. images but I couldn't find an quick and easy way to show the incorrect output as well. (I.e. to show how MMA returns the text "Pi" instead of the pi symbol. – Ohcolowisc Mar 20 '19 at 16:44
• @Ohcolowisc That seems to depend specifically on your use of DisplayForm. If you use TraditionalForm, or StandardForm instead, it gets formatted as $\pi$. – MarcoB Mar 20 '19 at 16:53

Why are you inputting a FractionBox? There should not be any need to do so. However, if you must do this, you should generate the boxes using MakeBoxes instead:

MakeBoxes[π/2]


FractionBox["π", "2"]

Update

For the follow on question presented as an answer, i would use Divide instead of FractionBox:

Sum[
(-1)^n Divide[StieltjesGamma[n],n!] Subscript[B,n+1][-I c,2 x-1],
{0,Infinity}