# How to customize traditional form for inactive functions?

Let's say I define

Lg[n_]:=Log[2,n].


How do I make

Inactive[Lg][x]//TraditionalForm


output

lg(x)


From GeneralUtilitiesPrintDefinitions @ Inactive one can gather that it is NumericFunction attribute which enables () in TraditionalForm, as opposed to [].

So if you don't mind we can set them. And one thing that is left is to change Lg to lowercase during typesetting:

ClearAll[Lg];

Lg[n_] := Log[2, n];

SetAttributes[Lg, NumericFunction];
Lg /: MakeBoxes[Lg, TraditionalForm] := "lg"



In general I would definitely prefer @Kuba's solution, but in case you can't add the NumericFunction attribute for some reason and you still want (…) instead of […], or if you want more control in general, you can do something like the following:

Unprotect@Inactive

Of course, this simple formatting rule does not show the "Inactive[…]" tooltip that is normally added (if you want it, just adapt the above rule)
Important: Be sure to evaluate this before anything else relating to Inactive, otherwise it won't work.
The issue is that Inactive expressions are formatted via upvalues (or apparently FormatValues to be more precise) of Inactive. This means that you cannot attach the rule to MakeBoxes or Format` as you would normally, as these are applied too late in the process. And to make sure that your definition is evaluated before any of the other definitions, you have to make your definition before any of the others are loaded.