On a Windows system I'm using the Rubi rule-based integration package by Albert Rich which defines function "Int" in addition to Mathematica's Integrate. In my ..\ProgramData\kernel\init.m I have:
which sets up automatic loading of the package when Int is used. This works fine. Furthermore I have defined a little function "Pr" which prints a HoldForm of an expression, then "=", and then the evaluated form:
Pr[x_] := Print[HoldForm[x] /. Int -> Integrate, " = ", x] SetAttributes[Pr, HoldFirst]
Note that in the HoldForm it replaces Int by Integrate everywhere, because I want to obtain the representation with an integral sign instead of "Int[…]". This function, too, works fine, if I evaluate it inside of a Notebook and then use it there. All Ints are replaced and I get the desired result.
Now I have in ..\users..\AppData\Roaming\kernel\init.m
and in ..\applications a file PrettyPrint.m defining function "Pr":
BeginPackage["PrettyPrint`"] Pr::usage="Pretty output" Begin["`Private`"] Pr[x_]:=Print[HoldForm[x] /. Int -> Integrate," = ",x] SetAttributes[Pr,HoldFirst] End EndPackage
All this almost works fine, too. On using "Pr", the package is loaded correctly and Pr works normally. The only problem is that the Ints are not replaced. If I try some other replacement, e.g. Integrate -> D, this works fine with automatic loading of Pr. But loaded automatically, the replacement Int -> Integrate is not being done. As soon as I re-evaluate the function definition of Pr in the notebook, it works.
I'm fairly new to Mathematica, and I have tried out everything I could think of to eliminate the problem. Even if I definitely load Rubi automatically before I load Pr automatically, the problem remains. Even if I replace automatic loading of both Rubi and Pr by static "Get" commands in the respective init.m files, the problem remains.
What's the source of the problem and what's the solution? Thanks for help!