Open
Description
Description
The Style
function in MathJSON, as documented here, does not seem to work correctly. Various attempts to apply styling have either resulted in errors or had no effect on the generated LaTeX output.
Steps to Reproduce
Example 1 (Throws Error)
const mathJSON = ["Multiply", 3, ["Style", ["Add", 2, 4], { "color": "blue" }]];
computeEngine.box(mathJSON).latex;
Example 2 (No effect)
const mathJSON = ["Multiply", 3, ["Style", ["Add", 2, 4], ["color", "blue"]]];
computeEngine.box(mathJSON).latex;
Actual Result
- Some variations throw errors when converting to LaTeX.
- Some variations produce LaTeX output but without any styling effect.
Expected Result
The styled portion of the MathJSON expression should be properly converted to LaTeX with the applied styles (e.g., color should be visible in the rendered LaTeX).
Suggested Fix
- Verify if
Style
is correctly implemented in the Compute Engine. - If it is supported, update the documentation with a correct usage example.
- If not implemented, consider adding support for styling (e.g., integrating basic CSS properties for LaTeX output).
- Styling a node with
textcolor
is problematic because it cannot be reverted to MathJSON. Instead, it might be a better approach to allow users to set aclassName
and/orid
for a node so that it can be styled later using the shadow DOM. This approach would prevent errors when converting back to MathJSON.
Metadata
Metadata
Assignees
Labels
No labels