# Avoid evaluating left-hand side of rule

I am trying to force some integrales in the form $\int \mathrm{d}x f(x)+g(x)$ into $\int \mathrm{d}x f(x)+\int \mathrm{d}x g(x)$. My first naive solution was

Integrate[f@x + g@x, x] /. Integrate[x__Plus, ks__] :> Distribute@Integrate[x, ks]

however the funny issue is that the first integral in the rule is directly evaluated to

ks__ x__Plus

which cannot indeed match the expression. So I'd need a way to stop evaluating not only the right-hand side of the rule with :> but also the left-hand side. I've cursorily tried with combinations of Hold, Unevaluated and such, but with no luck.

I understand that I could apply Distribute, but I would rather like to have a rule, because it fits better into my workflow, and let's say also for exercise.

• Look up HoldPattern – Carl Woll Mar 10 '17 at 14:28
• @CarlWoll Thank you, I'd accept the answer. – Lorenzo Pistone Mar 10 '17 at 14:35