Closed mahdiyarz closed 3 weeks ago
Actually this was an intended behaviour. You can't use both \(..\)
and $..$
at same time. But you can achieve both \(..\)
and $..$
syntax at the same time using code given bellow
String tex = r'\(x^2\) $x^2$';
tex = tex
.replaceAllMapped(
RegExp(
r"(?<!\\)\$\$(.*?)(?<!\\)\$\$",
dotAll: true,
),
(match) => "\\[${match[1] ?? ""}\\]")
.replaceAllMapped(
RegExp(
r"(?<!\\)\$(.*?)(?<!\\)\$",
),
(match) => "\\(${match[1] ?? ""}\\)");
tex = tex.splitMapJoin(
RegExp(r"\[.*?\]|\(.*?\)"),
onNonMatch: (p0) {
return p0.replaceAll("\\\$", "\$");
},
);
The pas the tex to TexMarkdown widget.
First of all I need to thank you for the great job.
As you see in the title I need to show both syntax at the same time in one String value. e.g.