Git Product home page Git Product logo

latexpp's Introduction

latexpp

GitHub license

latexpp is a first-of-its kind C++ library for generating LaTeX equations via C++. It supports conversion of LaTeX equations to HTML as well as JPG, PNG and SVG image formats.

Usage

#include "latex.hpp"

int main(int argc, const char* argv[])
{
	// Single class
	Latex latex;

	const std::string equation = "\\sum_{i=1}^{n} i = \\frac{n(n + 1)}{2}";

	// Convert to PNG, store in 'equation.png'
	latex.to_png(equation, "equation.png");

	// Convert to HTML, returns a HTML snippet
	std::string html = latex.to_html(equation);
}

equation.png:

equation.png

Implementation Overview

latexpp uses KaTeX to render LaTeX to HTML. Because KaTeX is a JavaScript library, latexpp uses Google's V8 engine to write JavaScript from C++. Image output is enabled by the wkhtmltox C library.

To build this project, you will need:

  • The Google V8 engine to compile JavaScript.
  • The wkhtmltox library for image output.
  • Boost for some cross-platform directory operations (can be dropped as a dependency if platform-indpendence is not required, or when the C++ standard committee decides to roll out boost's filesystem library in the C++ standard library.)

KaTeX is not a dependency as it is entirely contained in the katex folder.

Documentation

You can build extensive documentation with doxygen. See the doxyfile in the docs/ folder. There are also some example programs in the examples folder.

LICENSE

This project is released under the MIT License. For more information, see the LICENSE file.

Authors

Peter Goldsborough + cat ❤️

latexpp's People

Contributors

goldsborough avatar zubrim avatar pengelbrecht avatar

Watchers

James Cloos avatar Yuhui Liu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.