0
$\begingroup$

When I want to convert the following expression

Integrate[1/(1 + t (-I - 1)) (-I - 1), {t, 0, 1}]

to TeX, I do:

HoldForm[Integrate[1/(1 + t (-I - 1)) (-I - 1), {t, 0, 1}]] // TeXForm

which works fine.

Now, I want to do the same without having to add HoldForm. I thought that the following might work.

tex[exp_] := TeXForm[HoldForm[exp]]

Integrate[1/(1 + t (-I - 1)) (-I - 1), {t, 0, 1}] //tex

Sadly, this does not work.

Is there a way to make this work?

Update: Just found out that //HoldForm //TeXForm works as well at end of line. But how to shorten that?

$\endgroup$
  • 1
    $\begingroup$ Add SetAttributes[tex,HoldFirst] and your tex function will work. $\endgroup$ – Alx Sep 4 at 9:58
  • $\begingroup$ It does! Thank you very much. $\endgroup$ – nilo de roock Sep 4 at 10:00
  • $\begingroup$ You are welcome! $\endgroup$ – Alx Sep 4 at 10:01

Your Answer

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

Browse other questions tagged or ask your own question.