In places where a function holds its arguments you can force evaluation by wrapping Evaluate. So for instance Hold[Evaluate[1+2]] will give you 3. The reson the right hand side is not evaluated is because SetDelayed has HoldAll:

 Attributes[SetDelayed]



{HoldAll, Protected, SequenceHold}



but you can simply force evaluation in the same manor:

 a = x^2
 f[x_] := Evaluate[a]

 f[k]



k^2



Depending on how much of your expression you want to evaluate this may work, but there may be cases where you need more control over the evaluation leaving some terms unevaluated until the actual function application of f. If this is the case and this doesn't work for you please extend your question.

As added by Szabolcs. Using Set rather then SetDelayed will also clear this up, since it doesn't hold its right hand side, only the left hand side (the first argument) arguments:

 Attributes[Set]



{HoldFirst, Protected, SequenceHold}



And here is a nice documentation reference again provided by Szabolcs: http://reference.wolfram.com/mathematica/tutorial/ImmediateAndDelayedDefinitions.html

Converting expressions into functions
I am writing a math work, and I'd like to create a background which looks like a math notebook. Any idea how to do it ?

I found this solution, but I don't know how to put it in a mini-page ...

%%%
%%% quarre Kaestchenmuster
%%%
\def\quarre{%
\raisebox{\footskip}[0pt][0pt]{%
\

setlength{\unitlength}{.01\textwidth}% Einheit_1/100_Textweite
\begin{picture}(100,115)%
\color{black!10}%
\linethickness{0.075mm}%
\multiput(2,0)(2,0){49}{\line(0,1){110}}% 110-VER
\multiput(0,2)(0,2){54}{\line(1,0){100}}% 54-HOR
\color{black}%
\put(1,112.1){%
\begin{footnotesize}
\textsl{\textbf{Notizen}}
\end{footnotesize}}%
\end{picture}%
}%
}


would be great to combine it with this:
Background image for minipage
