latex

package module
v0.0.0-...-5c1ce85 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

README

latex

go.dev reference GitHub release CI codecov GoDoc License

latex is a package holding Go tools for LaTeX.

latex is supposed to provide features akin to MathJax or matplotlib's TeX capabilities. ie: it is supposed to be able to draw mathematical equations, in pure-Go.

latex is NOT SUPPOSED to be a complete typesetting system like LaTeX or TeX.

For this, please take look at:

Eventually, go-latex/latex might just use star-tex.org/... to provide the MathJax-like capabilities. (once star-tex.org/... is ready and exports a nice Go API.)

Installation

$> go get github.com/go-latex/latex/...

Documentation

Documentation is served by godoc, here:

The main use case for go-latex/latex is to draw a mathematical equation. This is typically achieved via the latex/mtex.Render function that knows how to render mathematical TeX equations to a renderer interface.

Example
package main

import (
	"os"

	"github.com/go-latex/latex/drawtex/drawimg"
	"github.com/go-latex/latex/mtex"
)

func main() {
	f, err := os.Create("output.png")
	if err != nil {
		panic(err)
	}
	defer f.Close()

	dst := drawimg.NewRenderer(f)
	err = mtex.Render(dst, `$f(x) = \frac{\sqrt{x +20}}{2\pi} +\hbar \sum y\partial y$`, 12, 72, nil)
	if err != nil {
		panic(err)
	}

	err = f.Close()
	if err != nil {
		panic(err)
	}
}

LICENSE

BSD-3.

Documentation

Overview

Package latex provides types and functions to work with LaTeX.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseExpr

func ParseExpr(x string) (ast.Node, error)

ParseExpr parses a simple LaTeX expression.

Types

This section is empty.

Directories

Path Synopsis
Package ast declares the types used to represent syntax trees for LaTeX documents.
Package ast declares the types used to represent syntax trees for LaTeX documents.
cmd
mtex-render Module
Package drawtex describes the graphics interface for drawing LaTeX.
Package drawtex describes the graphics interface for drawing LaTeX.
drawimg
Package drawimg implements a canvas for img.
Package drawimg implements a canvas for img.
drawpdf
Package drawpdf implements a canvas for PDF.
Package drawpdf implements a canvas for PDF.
Package font holds types to handle and abstract away font management.
Package font holds types to handle and abstract away font management.
ttf
Package ttf provides a truetype font Backend
Package ttf provides a truetype font Backend
internal
fakebackend
Package fakebackend provides a fake tex Backend for testing purposes.
Package fakebackend provides a fake tex Backend for testing purposes.
tex2unicode
Package tex2unicode provides tools for associating TeX symbols to UTF-8.
Package tex2unicode provides tools for associating TeX symbols to UTF-8.
Package mtex provides tools to render LaTeX math expressions.
Package mtex provides tools to render LaTeX math expressions.
symbols
Package symbols contains logic about TeX symbols.
Package symbols contains logic about TeX symbols.
Package tex provides a TeX-like box model.
Package tex provides a TeX-like box model.
Package token defines constants representing the lexical tokens of LaTeX documents.
Package token defines constants representing the lexical tokens of LaTeX documents.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL