Skip to content

Latest commit

 

History

History
65 lines (44 loc) · 1.66 KB

README.md

File metadata and controls

65 lines (44 loc) · 1.66 KB

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