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

feat: make sure that subsup responds to display mode #490

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion latex2mathml/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
r"\varsupsetneqq",
)
MATH_MODE_PATTERN = re.compile(r"\\\$|\$|\\?[^\\$]+")
display_mode = ""


class Mode(enum.Enum):
Expand All @@ -68,6 +69,8 @@ def convert(
display: str = "inline",
parent: Optional[Element] = None,
) -> str:
global display_mode
display_mode = display
math = convert_to_element(latex, xmlns, display, parent)
return _convert(math)

Expand Down Expand Up @@ -276,7 +279,9 @@ def _convert_command(node: Node, parent: Element, font: Optional[Dict[str, Optio
if column_lines:
attributes["columnlines"] = column_lines

if command == commands.SUBSUP and node.children is not None and node.children[0].token == commands.GCD:
if display_mode == "block" and command == commands.SUBSUP:
tag = "munderover"
elif command == commands.SUBSUP and node.children is not None and node.children[0].token == commands.GCD:
tag = "munderover"
elif command == commands.SUPERSCRIPT and modifier in (commands.LIMITS, commands.OVERBRACE):
tag = "mover"
Expand Down