Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MathJSON Styling Not Working as Documented #60

Open
alexisflesch opened this issue Feb 2, 2025 · 0 comments
Open

MathJSON Styling Not Working as Documented #60

alexisflesch opened this issue Feb 2, 2025 · 0 comments
Assignees

Comments

@alexisflesch
Copy link

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 a className and/or id for a node so that it can be styled later using the shadow DOM. This approach would prevent errors when converting back to MathJSON.
@arnog arnog self-assigned this Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants