Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.opencollab:jlatexmath:1.0.7'
}
dependencies {
implementation("com.github.opencollab:jlatexmath:1.0.7")
}
<dependency>
<groupId>com.github.opencollab</groupId>
<artifactId>jlatexmath</artifactId>
<version>1.0.7</version>
</dependency>
libraryDependencies += "com.github.opencollab" % "jlatexmath" % "1.0.7"
:dependencies [[com.github.opencollab/jlatexmath "1.0.7"]]
<a href="https://travis-ci.org/opencollab/jlatexmath"><img src="https://travis-ci.org/opencollab/jlatexmath.svg"/></a><br/>
<br/>
JLaTeXMath is a Java library. Its main purpose is to display mathematical formulas written in LaTeX. JLaTeXMath is the best Java library to display LaTeX code.
This library is used by numerous important projects like <a href="http://www.scilab.org/">Scilab</a>, <a href="http://www.geogebra.org/">Geogebra</a>, <a href="http://freeplane.sourceforge.net">Freeplane</a>, <a href="http://www.mathpiper.org/">Mathpiper</a>, <a href="http://db-maths.nuxit.net/CaRMetal/index_en.html">CaRMetal</a>, <a href="http://ultrastudio.org/">Ultrastudio</a>, etc.
The default encoding is UTF-8.
Most LaTeX commands are available including:
\includegraphics
(without options)\over
\definecolor
, \textcolor
, \colorbox
and \fcolorbox
from the package <i>color</i>\rotatebox
, \reflectbox
and \scalebox
from the package <i>graphicx</i>\newcommand
and \newenvironment
array
, matrix
, pmatrix
,..., eqnarray
, cases
\tiny
, \small
,...,\LARGE
, \huge
, \Huge
A few examples are available in the source distribution, they show how to use <i>JLaTeXMath</i> and how to write new commands using Java.
A first example :
<img src="docs/images/Formula1.png"/>
a second one :
<img src="docs/images/Formula2.png"/>
and a third one :
<img src="docs/images/Formula3.png"/>
<i>JLaTeXMath</i> is used by <a href="http://www.scilab.org">Scilab</a> to display formulas written in LaTeX in graphic windows:
<img src="docs/images/ScilabScreenshot.png"/><i>JLaTeXMath</i> is a fork of the excellent project <a href="http://jmathtex.sourceforge.net/">JMathTeX</a>.
To build the jlatexmath artifacts just type
mvn clean install
Some examples are provided to show how to use easily the library.
Have fun and if you meet any problem, don't hesitate to create a new issue on github.
Regarding JLaTeXMath’s Classpath Exception and JavaScript: If you use the Google Web Toolkit (GWT) to compile JLaTeXMath to an “executable” (in JavaScript) you can then include/link this “executable” JavaScript library on a website or inside another program. In this case the rest of the website/program need not be licensed under the GPL.
To run jmh benchmarks (measuring parse and render performance):
# benchmarks are in core module
cd jlatexmath
mvn clean install -P benchmark
To run code coverage
mvn -DrepoToken=TOKEN clean cobertura:cobertura coveralls:report