2
$\begingroup$

How can I keep the argument of TeXForm[Integrate[1/Sqrt[1 + x], x]] from being evaluated?

This is what I am getting:

TeXForm[Integrate[1/Sqrt[1 + x], x]]
2 \sqrt{x+1}

But I want:

\int_{0}^{\pi/2} 1/\sqrt{x+1}
$\endgroup$
3
  • 1
    $\begingroup$ how about TeXForm[HoldForm@Integrate[1/Sqrt[1 + x], x]]? $\endgroup$
    – kglr
    Aug 28, 2019 at 21:09
  • $\begingroup$ @kglr Works, thanks! $\endgroup$
    – blabla
    Aug 28, 2019 at 21:10
  • $\begingroup$ I suggest TeXForm[Defer @ Integrate[1/Sqrt[1 + x], {x, 0, \[Pi]}]] to get the exact output form you say you want. $\endgroup$
    – m_goldberg
    Aug 28, 2019 at 22:23

1 Answer 1

3
$\begingroup$

Try HoldForm or Defer or Unevaluated:

TeXForm[HoldForm @ Integrate[1/Sqrt[1 + x], x]]

\int \frac{1}{\sqrt{1+x}} \, dx

TeXForm[Defer @ Integrate[1/Sqrt[1 + x], x]]

\int \frac{1}{\sqrt{1+x}} \, dx

TeXForm[Unevaluated @ Integrate[1/Sqrt[1 + x], x]]

\int \frac{1}{\sqrt{1+x}} \, dx

$\int \frac{1}{\sqrt{1+x}} \, dx$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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