I have to insert some mathematica code in my latex document. For that, I'm using the answer given here by user Ronny. Is it possible to add sth that would make my comments look grey in the resulting pdf document?



You can use commentstyle=\color{gray}. Taking the code from answer linked by OP in the question:



\nonumber W_{r     → ∞}=&-∫_{r}^{∞}\!F\,\mathrm{d}y=-    ∫_r^∞ \!     \dfrac{1}{4π\epsilon₀} \dfrac{q²}{\alpha²}     \dfrac{\alpha³}{y³}\left(1-    \dfrac{\alpha²}    {y²}\right)⁻²\,\mathrm{d}y\\
=&-\dfrac{1}{4π\epsilon₀} \dfrac{q²}{\alpha²}\alpha³     \underbrace{∫_r^∞     \! y⁻³ \left(1-\dfrac{\alpha²}    {y²}\right)⁻² \,\mathrm{d}y}_{I} \label{eq:WcondI}

In[1]:= Integrate[{y^(-3)*(1-(a/y)²)^(-2)},{y,r,Infinity}]
Out[1]= {ConditionalExpression[$\displaystyle-\frac{1}{2(a²-r²)}$, Im[r]
Re[a] $     ≠     $ Im[a] Re[r] || (( $a+r>0$ || $a+r      ∉      $ Reals) && ($a<r$ ||
$a-r      ∉     $ Reals) || $r     ∉     $ Reals )]} (* this is a comment *)

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.