(latex: str)
| 27 | |
| 28 | |
| 29 | def aligned_to_array(latex: str) -> str: |
| 30 | pattern = re.compile(r"\\begin\{aligned\}(.*?)\\end\{aligned\}", flags=re.DOTALL) |
| 31 | |
| 32 | def repl(match): |
| 33 | content = match.group(1).strip() |
| 34 | new_content = content.replace("&", "") |
| 35 | return f"\\begin{{array}}{{l}}\n{new_content}\n\\end{{array}}" |
| 36 | |
| 37 | converted = pattern.sub(repl, latex) |
| 38 | return converted |
| 39 | |
| 40 | |
| 41 | def gathered_to_aligned(latex: str) -> str: |