djade007 / latext

A flutter package to efficiently display scientific LaTeX equations using the flutter_math library, without relying on WebView or JavaScript.
European Union Public License 1.2
12 stars 5 forks source link

No such environment align #5

Closed ndthinh02 closed 7 months ago

ndthinh02 commented 10 months ago

hi, i have a latext string like this " \left[ \begin{align} & x=\frac{\pi }{4}+k\pi \ & x=\frac{\pi }{12}+k\frac{\pi }{7} \ \end{align} \right. " but when converting, it says no such environment align, so is there any way to fix it? thank you

ss0314 commented 9 months ago

Hello,

Use "aligned" environment instead of "align" environment.

This latext package depends on Flutter_math_fork library, and the "align" environment seems not supported in "flutter_math_fork" .

Use "aligned" environment like this:

$\begin{aligned}
  (a+b)^2 &= (a+b)(a+b) \\
  &= a(a+b)+b(a+b) \\
  &= a^2+ab+ba+b^2 \\
  &= a^2+2ab+b^2
  \end{aligned}$

Output:

IMG_5648

greatsam4sure commented 5 months ago

The above code fail to run in Flutter 3.16 and Dart 3.2. What can I do to get it working

greatsam4sure commented 4 months ago

Finally got it to work by replacing \ with \cr as shown below \begin{aligned} (a+b)^2 &= (a+b)(a+b) \cr &= a(a+b)+b(a+b) \cr &= a^2+ab+ba+b^2 \cr &= a^2+2ab+b^2   \end{aligned}$