Is there plugin to render the mathjax content in flutter app ?
Hi, so I am creating a flutter where I am trying to render the mathjax i.e <p><math xmlns="http://www.w3.org/1998/Math/MathML"><msqrt><mn>2</mn></msqrt></math> This is the content for a question</p>
So, is there a plugin to render it in there.
Thanks, Gaurav
It looks like
https://pub.dev/packages/mathjax_view
might do what you are looking for, or perhaps
https://pub.dev/packages/flutter_tex
Note: this issue tracker is for reporting bugs in MathJax, not general questions. Those should be asked in the MathJax User Forum where more people will see them.
Thanks for the reference
Hi, so I am creating a flutter where I am trying to render the mathjax i.e
<p><math xmlns="http://www.w3.org/1998/Math/MathML"><msqrt><mn>2</mn></msqrt></math> This is the content for a question</p>So, is there a plugin to render it in there.
Thanks, Gaurav any update on this. even i am looking for it. please let me know if u have any update on this
@satishkodavalla well the above-mentioned package does render but what I am facing the issue is of rendering multiple cards in tab bar panel to render the mathjax content but it crashes my app.
Here's an effective approach using the flutter_tex package:
- Add flutter_tex to your dependencies, in your pubspec.yaml file, add the following line under the dependencies section:
YAML
flutter_tex: ^0.0.20
Use code [with caution.](https://github.com/faq#coding)
content_copy
Run pub get to install the package.
- Render the equation using flutter_tex:
Dart
import 'package:flutter/material.dart';
import 'package:flutter_tex/flutter_tex.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('MathJax Rendering'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TeXView(
child: TexParser.fromRtf(
r"$\sqrt{2}$ This is the content for a question",
),
renderingMode: RenderingMode.tex,
// You can customize styling here (optional)
textStyle: TextStyle(fontSize: 24),
),
],
),
),
),
);
}
}
The flutter_tex package uses a mini-MathJax library to render equations. TeXView displays the equation parsed by TexParser.fromRtf. The renderingMode is set to RenderingMode.tex for MathJax rendering. You can optionally customize the text style using textStyle.