All Projects → shah-xad → Flutter_tex

shah-xad / Flutter_tex

Licence: other
A Flutter Package to render Mathematics, Physics and Chemistry Equations based on LaTeX

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Flutter tex

Spmathkit
Render math exercises for your view. Contains the rendering of mathematical formulas and mathematical graphics, as well as the general text
Stars: ✭ 81 (-49.69%)
Mutual labels:  latex, mathjax, katex
pseudocode.js
Beautiful pseudocode for the Web
Stars: ✭ 132 (-18.01%)
Mutual labels:  latex, mathjax, katex
purple-pi
💜 LaTeX math wherever you want
Stars: ✭ 31 (-80.75%)
Mutual labels:  latex, mathjax, katex
Jekyll Spaceship
🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
Stars: ✭ 196 (+21.74%)
Mutual labels:  latex, mathjax, katex
Markdown Preview Enhanced
One of the 'BEST' markdown preview extensions for Atom editor!
Stars: ✭ 3,478 (+2060.25%)
Mutual labels:  mathjax, katex
react-latex-next
Render LaTeX in React apps
Stars: ✭ 18 (-88.82%)
Mutual labels:  latex, katex
Texme
Self-rendering Markdown + LaTeX documents
Stars: ✭ 1,970 (+1123.6%)
Mutual labels:  latex, mathjax
Franklin.jl
(yet another) static site generator. Simple, customisable, fast, maths with KaTeX, code evaluation, optional pre-rendering, in Julia.
Stars: ✭ 413 (+156.52%)
Mutual labels:  latex, katex
ckeditor5-math
Math feature for CKEditor 5.
Stars: ✭ 51 (-68.32%)
Mutual labels:  mathjax, katex
React Katex
Display math in TeX with KaTeX and ReactJS
Stars: ✭ 345 (+114.29%)
Mutual labels:  latex, katex
Mdmath
LaTeX Math for Markdown inside of Visual Studio Code.
Stars: ✭ 675 (+319.25%)
Mutual labels:  latex, katex
Jaxbin
MathJax and TeX pastebin
Stars: ✭ 15 (-90.68%)
Mutual labels:  latex, mathjax
Cocalc
CoCalc: Collaborative Calculation in the Cloud
Stars: ✭ 888 (+451.55%)
Mutual labels:  latex, mathjax
Mathjax
Beautiful and accessible math in all browsers
Stars: ✭ 8,551 (+5211.18%)
Mutual labels:  latex, mathjax
Qilin App
Fully hackable text editor developed for exact sciences with built-in KaTeX and AsciiMath support. Extensible via plugins and themes. Exportable as HTML, PDF and GFM.
Stars: ✭ 336 (+108.7%)
Mutual labels:  latex, katex
vscode-markdown-editor
A vscode extension to make your vscode become a full-featured WYSIWYG markdown editor
Stars: ✭ 249 (+54.66%)
Mutual labels:  mathjax, katex
Liandi
📕 一款桌面端的 Markdown 块级引用和双向链接笔记应用,支持 Windows、Mac 和 Linux。A desktop Markdown Block-Reference and Bidirectional-Link note-taking application, supports Windows, Mac and Linux.
Stars: ✭ 354 (+119.88%)
Mutual labels:  mathjax, katex
Katex
Fast math typesetting for the web.
Stars: ✭ 14,623 (+8982.61%)
Mutual labels:  latex, katex
notes
Simple text editor for your Markdown and LaTeX notes.
Stars: ✭ 24 (-85.09%)
Mutual labels:  mathjax, katex
Papers
Publications from the MathJax project
Stars: ✭ 6 (-96.27%)
Mutual labels:  latex, mathjax

flutter_tex

GitHub stars pub package

Contents

About

A Flutter Package to render fully offline so many types of equations and expressions based on LaTeX and TeX, most commonly used are as followings:

  • Mathematics / Maths Equations and expressions (Algebra, Calculus, Geometry, Geometry etc...)

  • Physics Equations and expressions

  • Signal Processing Equations and expressions

  • Chemistry Equations and expressions

  • Statistics / Stats Equations and expressions

  • It also includes full HTML with JavaScript support.

Rendering of equations depends on mini-mathjax a simplified version of MathJax and Katex JavaScript libraries.

This package mainly depends on webview_flutter_plus.

Demo Video

Click to Watch Demo on Youtube

Screenshots

Fonts Sample Quiz Sample TeX Document
TeX Document Image & Video InkWell

How to use?

1: Add flutter_tex latest pub package version under dependencies to your package's pubspec.yaml file.

dependencies:
  flutter_tex: ^3.6.7+9

2: You can install packages from the command line:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3: Now you need to put the following implementations in Android, iOS, and Web respectively.

Android

Make sure to add this line android:usesCleartextTraffic="true" in your <project-directory>/android/app/src/main/AndroidManifest.xml under application like this.

<application
       android:usesCleartextTraffic="true">
</application>

It completely works offline, without internet connection, but these are required permissions to work properly:

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

It'll still work in debug mode without permissions, but it won't work in release application without mentioned permissions.

iOS

Add following code in your <project-directory>/ios/Runner/Info.plist

<key>NSAppTransportSecurity</key>
  <dict>
    <key>NSAllowsArbitraryLoads</key> <true/>
  </dict>
<key>io.flutter.embedded_views_preview</key> <true/> 

Web

For Web support you need to put <script src="assets/packages/flutter_tex/js/flutter_tex.js"></script> in <head> tag of your <project-directory>/web/index.html like this.

<head>
    <meta charset="UTF-8">
    <title>Flutter TeX</title>
    <script src="assets/packages/flutter_tex/js/flutter_tex.js"></script>
</head>

4: Now in your Dart code, you can use:

import 'package:flutter_tex/flutter_tex.dart'; 

5: Now you can use TeXView as a widget:

Examples

Quick Example

TeXView(
    child: TeXViewColumn(children: [
      TeXViewInkWell(
        id: "id_0",
        child: TeXViewColumn(children: [
          TeXViewDocument(r"""<h2>Flutter \( \rm\\TeX \)</h2>""",
              style: TeXViewStyle(textAlign: TeXViewTextAlign.Center)),
          TeXViewContainer(
            child: TeXViewImage.network(
                'https://raw.githubusercontent.com/shah-xad/flutter_tex/master/example/assets/flutter_tex_banner.png'),
            style: TeXViewStyle(
              margin: TeXViewMargin.all(10),
              borderRadius: TeXViewBorderRadius.all(20),
            ),
          ),
          TeXViewDocument(r"""<p>                                
                       When \(a \ne 0 \), there are two solutions to \(ax^2 + bx + c = 0\) and they are
                       $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$</p>""",
              style: TeXViewStyle.fromCSS(
                  'padding: 15px; color: white; background: green'))
        ]),
      )
    ]),
    style: TeXViewStyle(
      elevation: 10,
      borderRadius: TeXViewBorderRadius.all(25),
      border: TeXViewBorder.all(TeXViewBorderDecoration(
          borderColor: Colors.blue,
          borderStyle: TeXViewBorderStyle.Solid,
          borderWidth: 5)),
      backgroundColor: Colors.white,
    ),
   ),
  )

TeXView Document Example

TeXView Document Example

TeXView Markdown Example

TeXView Markdown Example

TeXView Quiz Example

TeXView Quiz Example

TeXView Custom Fonts Example

TeXView Custom Fonts Example

TeXView Image and Video Example

TeXView Image and Video Example

TeXView InkWell Example

TeXView InkWell Example

Complete Example

Complete Example Code

Application Demo.

Get it on Google Play

Demo Source

Web Demo.

You can find web demo at https://flutter-tex.web.app

Api Changes.

Api Usage.

  • children: A list of TeXViewWidget

  • TeXViewWidget

    • TeXViewDocument Holds TeX data by using a raw string e.g. r"""$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$<br> """ You can also put HTML and Javascript code in it.
    • TeXViewMarkdown Holds markdown data.
    • TeXViewContainer Holds a single TeXViewWidget with styling.
    • TeXViewImage renders image from assets or network.
    • TeXViewColumn holds a list of TeXViewWidget vertically.
    • TeXViewInkWell for listening tap events. Its child and id is mandatory.
    • TeXViewGroup a group of TeXViewGroupItem usually used to create quiz layout.
  • TeXViewStyle() You can style each and everything using TeXViewStyle() or by using custom CSS code by TeXViewStyle.fromCSS() where you can pass hard coded String containing CSS code. For more information please check the example.

  • renderingEngine: Render Engine to render TeX (Default is Katex Rendering Engine). Use Katex RenderingEngine for fast render and MathJax RenderingEngine for quality render.

  • loadingWidgetBuilder: Show a loading widget before rendering completes.

  • onRenderFinished: Callback with the rendered page height, when TEX rendering finishes.

  • onTeXViewCreated: Callback when TeXView loading finishes.

For more please see the Example.

To Do:

  • Speed Optimizations as it's a bit slow rendering speed. It takes 1-2 seconds to render after application loaded. (Solved by adding Katex Support)
  • Bug in Web Support on setState everything disappears.

Cautions:

  • Please avoid using too many TeXView in a single page, because this is based on webview_flutter_plus a complete web browser. Which may cause slowing down your app. I am trying to add all necessary widgets within TeXView, So please prefer to use TeXViewWidget. You can check example folder for details. If you find any problem you can report an issue.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].