""" Operator and symbol set definitions for MathML to LaTeX conversion. This module provides: - Mathematical symbol sets for symbol detection - Summation symbol mappings - Font to LaTeX command mappings - Large operator definitions (Unicode versions) """ # Mathematical symbol set for symbol detection MATH_SYMBOLS_SET = { "↑", "↓", "→", "←", "↔", "×", "⋅", "·", "÷", "∕", "−", # Added U+2212 MINUS SIGN "∩", "∪", "⊂", "⊃", "⊆", "⊇", "∈", "∉", "∋", "∌", "≤", "≥", "≠", "≈", "≅", "≡", "≢", "∼", "≃", "≄", "≜", "≝", "≞", "≟", "≦", "≧", "≨", "≩", "≲", "≳", "≴", "≵", "≶", "≷", "≸", "≹", "≺", "≻", "⪯", "⪰", "∝", "⊥", "∥", "∦", "±", "∓", "∗", "∘", "∙", "√", "∞", "∂", "∇", "∆", "∫", "∬", "∭", "∮", "∯", "∰", "∑", "∏", "∐", "⋃", "⋂", "⋁", "⋀", "⨁", "⨂", "⨄", "∀", "∃", "∄", "⊢", "⊣", "⊤", "⊥", "¬", "∧", "∨", "⟨", "⟩", "⌊", "⌋", "⌈", "⌉", "⏞", "⏟", "∠", "∁" } # Summation symbols for specific processing SUMMATION_SYMBOLS = { '∑': 'sum', '∏': 'prod', '∫': 'integral', 'Σ': 'sum', 'Π': 'prod' } # Font family to LaTeX command mapping FONT_TO_LATEX = { 'Times New Roman': 'mathrm', # Roman/upright text 'Times': 'mathrm', # Times font variant 'Cambria Math': None, # Default math font (no special formatting) 'Cambria': None, # Cambria variant 'Arial': 'mathsf', # Sans-serif 'Helvetica': 'mathsf', # Helvetica sans-serif 'Courier New': 'mathtt', # Typewriter/monospace 'Courier': 'mathtt', # Courier variant 'Computer Modern': None, # LaTeX default math font 'Latin Modern Math': None, # Modern LaTeX math font } # Large operators that should use \limits in display mode (LaTeX commands) LARGE_OPERATORS = [ "\\sum", "\\prod", "\\int", "\\iint", "\\iiint", "\\oint", "\\bigcup", "\\bigcap", "\\bigvee", "\\bigwedge", "\\bigoplus", "\\bigotimes", "\\biguplus", "\\coprod", "\\lim", "\\limsup", "\\liminf", "\\sup", "\\inf", "\\max", "\\min" ] # Unicode large operators for detection LARGE_OPERATORS_UNICODE = [ "∑", "Σ", # Summation "∏", "Π", # Product "∫", # Integral "⋃", "⋂", # Union, Intersection "⋁", "⋀", # Logical OR, AND "⨁", "⨂", "⨄", # Direct sum, tensor product, union ]