Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

MathJax indentation error

I am trying to display latex using python. However, whenever I add a dollar sign and \ I get a indentation error in my my q expression in my sage online interactive. What is the problem?

Here is my code:

x, y = var('x y')
html("<h1>Double Integrator</h1>")
@interact
def interplay(function=input_box(x*y),lower_x_bound=input_box(0),upper_x_bound=input_box(x),lower_y_bound=input_box(0),upper_y_bound=input_box(1),dydx=checkbox(default=False)):
 try:
    if dydx is False:
      result = integral(integral(function, x, lower_x_bound, upper_x_bound),y, lower_y_bound, upper_y_bound)
      print('hello');
      pretty_print(html("hello"))
      q = r"$\int {0}^{1}\int_{2}^{3} {4} \,dx\,dy = {5}$".format(lower_y_bound, upper_y_bound,lower_x_bound, upper_x_bound,function, result)
    else:
      result = integral(integral(function, x, lower_x_bound, upper_x_bound),y, lower_y_bound, upper_y_bound)
      q = r"$ int {0}^{1} int_{2}^{3} {4} ,dx,dy = {5} $".format(lower_y_bound, upper_y_bound,lower_x_bound, upper_x_bound,function, result)

    pretty_print(html("%s" % q))
 except Exception as e :
    print("Please enter better inputs")
    print(e)

Here is my error

 * BackslashOperator() * int {Integer(0)}**{Integer(1)} * BackslashOperator() * int_{Integer(2)}**{Integer(3)} {Integer(4)}  * BackslashOperator() * ,dx * BackslashOperator() * ,dy = {Integer(5)}
IndentationError: unexpected indent

MathJax indentation error

I am trying to display latex using python. However, whenever I add a dollar sign and \ I get a indentation error in my my q expression in my sage online html interactive. What is the problem?

Here is my code:

x, y = var('x y')
html("<h1>Double Integrator</h1>")
@interact
def interplay(function=input_box(x*y),lower_x_bound=input_box(0),upper_x_bound=input_box(x),lower_y_bound=input_box(0),upper_y_bound=input_box(1),dydx=checkbox(default=False)):
 try:
    if dydx is False:
      result = integral(integral(function, x, lower_x_bound, upper_x_bound),y, lower_y_bound, upper_y_bound)
      print('hello');
      pretty_print(html("hello"))
      q = r"$\int {0}^{1}\int_{2}^{3} {4} \,dx\,dy = {5}$".format(lower_y_bound, upper_y_bound,lower_x_bound, upper_x_bound,function, result)
    else:
      result = integral(integral(function, x, lower_x_bound, upper_x_bound),y, lower_y_bound, upper_y_bound)
      q = r"$ int {0}^{1} int_{2}^{3} {4} ,dx,dy = {5} $".format(lower_y_bound, upper_y_bound,lower_x_bound, upper_x_bound,function, result)

    pretty_print(html("%s" % q))
 except Exception as e :
    print("Please enter better inputs")
    print(e)

Here is my error

 * BackslashOperator() * int {Integer(0)}**{Integer(1)} * BackslashOperator() * int_{Integer(2)}**{Integer(3)} {Integer(4)}  * BackslashOperator() * ,dx * BackslashOperator() * ,dy = {Integer(5)}
IndentationError: unexpected indent