Skip to content

judemanutd/KaTeXView

Folders and files

NameName
Last commit message
Last commit date
Feb 16, 2020
Mar 14, 2019
Feb 16, 2020
Apr 17, 2019
Apr 6, 2019
Feb 16, 2020
Feb 16, 2020
Feb 16, 2020
Apr 5, 2019
Mar 14, 2019
Mar 14, 2019
Mar 14, 2019
Mar 14, 2019

Repository files navigation

KaTeX View

Download license API

A library that uses Khan Academy KaTeX for TeX math rendering.

Usage

Gradle

Add this to your module's build.gradle file:

dependencies {
    // ... other dependencies
    implementation 'com.github.judemanutd:katexview:1.0.2'
}

Maven

<dependency>
  <groupId>com.github.judemanutd</groupId>
  <artifactId>katexview</artifactId>
  <version>1.0.2</version>
  <type>pom</type>
</dependency>

Include the following code in your xml layout

<com.judemanutd.katexview.KatexView
    android:id="@+id/katex_text"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:textColor="@color/colorPrimary" />

You can then supply the text to be rendered in kotlin or java

val text = "$$ c = \\pm\\sqrt{a^2 + b^2} $$"
katex_text.setText(text)

Supported Attributes

All webview attributes are automatically inherited, in addition to that, the following can be customized

  • color
    • can be specified in xml using the textColor attribute
    • can be used in code by calling the setTextColor on the KatexView
  • text size - coming soon