Skip to main content

LatexOutput

LaTeX output widget for displaying mathematical notation.

Examples

Basic Usage

This example runs a form with a single page containing the widget

Example Code

from abstra.forms import LatexOutput, run

# Create a page with the widget
example_page = [
LatexOutput(r"\(ax^2 + bx + c = 0\)"),
]

# Run the form
result = run([example_page])

# Print the result
print(result)

With Text

LatexOutput can be used to display LaTeX math equations and text.

Example Code

from abstra.forms import LatexOutput, run

# Create a page with the widget
example_page = [
LatexOutput(
r"""When \(a \\ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$"""
),
]

# Run the form
result = run([example_page])

# Print the result
print(result)

Parameters

NameDescriptionTypeDefault
text (required)The LaTeX content to display.strNone
full_widthWhether the content should take up the full width of its container.boolFalse