# Revision history [back]

Usually, for symbolic expressions, there is a hold parameter that prevent Sage to evaluate your input so that you can get its latex representation, for example:

sage: (x^2).add(x^2, hold=True)
x^2 + x^2
sage: latex(_)
x^{2} + x^{2}

sage: tan(pi/2, hold=True)
tan(1/2*pi)
sage: latex(_)
\tan\left(\frac{1}{2} \, \pi\right)
sage: tan(pi/2)
Infinity
sage: latex(_)
\infty


The problem here is that there is no hold parameter for integration:

sage: integral(x^2, x, 0, 3, hold=True)
TypeError: integrate() got an unexpected keyword argument 'hold'


The workaround could be to use definite_integral that supports this paramter:

sage: from sage.symbolic.integration.integral import definite_integral
sage: definite_integral(x^2, x, 0, 3, hold=True)
integrate(x^2, x, 0, 3)
sage: latex(_)
\int_{0}^{3} x^{2}\,{d x}


Once trac ticket 10035 will be solved, you will be able to write something along the line:

def myshow(s):
with hold=True:
left = str(eval(s))
right = str(eval(s))
return left + '=' + right


Usually, for symbolic expressions, there is a hold parameter that prevent Sage to evaluate your input so that you can get its latex representation, for example:

sage: (x^2).add(x^2, hold=True)
x^2 + x^2
sage: latex(_)
x^{2} + x^{2}

sage: tan(pi/2, hold=True)
tan(1/2*pi)
sage: latex(_)
\tan\left(\frac{1}{2} \, \pi\right)
sage: tan(pi/2)
Infinity
sage: latex(_)
\infty


The problem here is that there is no hold parameter for integration:

sage: integral(x^2, x, 0, 3, hold=True)
TypeError: integrate() got an unexpected keyword argument 'hold'


The workaround could be to use definite_integral that supports this paramter:

sage: from sage.symbolic.integration.integral import definite_integral
sage: definite_integral(x^2, x, 0, 3, hold=True)
integrate(x^2, x, 0, 3)
sage: latex(_)
\int_{0}^{3} x^{2}\,{d x}


Once trac ticket 10035 and trac ticket 16941 (which i opened for the occasion) will be solved, you will be able to write something along the line:

def myshow(s):
with hold=True:
left = str(eval(s))
right = str(eval(s))
return left + '=' + right


Usually, for symbolic expressions, there is a hold parameter that prevent Sage to evaluate your input so that you can get its latex representation, for example:

sage: (x^2).add(x^2, hold=True)
x^2 + x^2
sage: latex(_)
x^{2} + x^{2}

sage: tan(pi/2, hold=True)
tan(1/2*pi)
sage: latex(_)
\tan\left(\frac{1}{2} \, \pi\right)
sage: tan(pi/2)
Infinity
sage: latex(_)
\infty


The problem here is that there is no hold parameter for integration:

sage: integral(x^2, x, 0, 3, hold=True)
TypeError: integrate() got an unexpected keyword argument 'hold'


The workaround could be to use definite_integral that supports this paramter:

sage: from sage.symbolic.integration.integral import definite_integral
sage: definite_integral(x^2, x, 0, 3, hold=True)
integrate(x^2, x, 0, 3)
sage: latex(_)
\int_{0}^{3} x^{2}\,{d x}


Once trac ticket 10035 and trac ticket 16941 (which i opened for the occasion) occasion, and needs rewiew) will be solved, you will be able to write something along the line:

def myshow(s):
with hold=True:
left = str(eval(s))
right = str(eval(s))
return left + '=' + right


Usually, for symbolic expressions, there is a hold parameter that prevent prevents Sage to evaluate your input so that you can get its latex representation, for example:

sage: (x^2).add(x^2, hold=True)
x^2 + x^2
sage: latex(_)
x^{2} + x^{2}

sage: tan(pi/2, hold=True)
tan(1/2*pi)
sage: latex(_)
\tan\left(\frac{1}{2} \, \pi\right)
sage: tan(pi/2)
Infinity
sage: latex(_)
\infty


The problem here is that there is no hold parameter for integration:

sage: integral(x^2, x, 0, 3, hold=True)
TypeError: integrate() got an unexpected keyword argument 'hold'


The workaround could be to use definite_integral that supports this paramter:

sage: from sage.symbolic.integration.integral import definite_integral
sage: definite_integral(x^2, x, 0, 3, hold=True)
integrate(x^2, x, 0, 3)
sage: latex(_)
\int_{0}^{3} x^{2}\,{d x}


Once trac ticket 10035 and trac ticket 16941 (which i opened for the occasion, and needs rewiew) will be solved, you will be able to write something along the line:

lines: sage: def myshow(s):
....:    with hold=True:
....:        left = str(eval(s))
....:    right = str(eval(s))
....:    return left + '=' + right

sage: myshow('integral(x^2, x, 0, 3)')
\int_{0}^{3} x^{2}\,{d x} = 9