Documentation
¶
Overview ¶
Package gotex is a simple library to render LaTeX documents.
Example ¶
Use it like this:
package main
import "github.com/rwestlund/gotex"
func main() {
var document = `
\documentclass[12pt]{article}
\begin{document}
This is a LaTeX document.
\end{document}
`
var pdf, err = gotex.Render(document, gotex.Options{
Command: "/usr/bin/pdflatex",
Runs: 1,
Texinputs:"/my/asset/dir:/my/other/asset/dir"})
if err != nil {
log.Println("render failed ", err)
} else {
// Do something with the PDF file, like send it to an HTTP client
// or write it to a file.
sendSomewhere(pdf)
}
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// Command is the executable to run. It defaults to "pdflatex". Set this to
// a full path if $PATH will not be defined in your app's environment.
Command string
// Runs determines how many times Command is run. This is needed for
// documents that use refrences and packages that require multiple passes.
// If 0, gotex will automagically attempt to determine how many runs are
// required by parsing LaTeX log output.
Runs int
// Texinputs is a colon-separated list of directories containing assests
// such as image files that are needed to compile the document. It is added
// to $TEXINPUTS for the LaTeX process.
Texinputs string
// Args is a slice of additional arguments to be supplied while executing the
// command.
Args []string
}
Options contains the knobs used to change gotex's behavior.
Click to show internal directories.
Click to hide internal directories.