MathJax Configs

To apply a custom MathJax configuration, create a file named flutter_tex.js in the root of your project's assets directory, your project structure should look like this:

1
2
3
4
5
your_flutter_app/
├── assets/
│   └── flutter_tex.js
├── lib/
...
and make sure to add this into pubspec.yaml like:

1
2
3
4
flutter:
  uses-material-design: true
  assets:
    - assets/flutter_tex.js

An example flutter_tex.js file:

1
2
3
4
5
6
7
8
9
window.MathJax = {
    tex: {
        inlineMath: [['$', '$'], ['\\(', '\\)']],
        displayMath: [['$$', '$$'], ['\\[', '\\]']],
    },
    svg: {
        fontCache: 'global'
    }
};

For more info please refer to the MathJax Docs