3
$\begingroup$

I have no problem with the current formatting of the function, but for the sake of the reader less familiar with Mathematica functions, is there a way to define, say, li = LogIntegral so that any form of LogIntegral in my output is presented as li instead? This seems to be the way it's usually presented.

$\endgroup$
2
  • $\begingroup$ LogIntegral[z] // TraditionalForm? -- Sometimes TraditionalForm is the default output form. In output cells, it's StandardForm. E.g., Plot[LogIntegral[z], {z, 0, 1}, PlotLabel -> LogIntegral[z]] $\endgroup$
    – Michael E2
    May 3, 2016 at 16:35
  • $\begingroup$ @MichaelE2 that definitely works, but let's say I want to express LogIntegral as li while still in StandardForm. Is that possible? $\endgroup$
    – user170231
    May 3, 2016 at 16:39

2 Answers 2

8
$\begingroup$

I'll make this brief: it's a job for a MakeBoxes rule. In this case a particularly simple one:

MakeBoxes[li : LogIntegral, StandardForm] := InterpretationBox["li", li]

Now LogIntegral prints as li.

$\endgroup$
2
$\begingroup$

According to the documentation, Format[] seems to be done for that :

Unprotect[LogIntegral]
Format[LogIntegral[z_]] := li[z]
Protect[LogIntegral]
$\endgroup$

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.