API for latex - Incanter 2.0 (in development)

by David Edgar Liebke

Full namespace name: incanter.latex

Overview

This library is used to render LaTex Math equations, based
on the jLateXMath library, and applying them incanter.charts as annotations
and subtitles.

Public Variables and Functions



add-latex

function
Usage: (add-latex chart x y latex-str & {:keys [color], :or {color darkGray}})
Adds an LaTeX equation annotation to the chart at the given x,y coordinates.

Arguments:
  chart -- the chart to add the polygon to.
  x, y -- the coordinates to place the image
  latex-str -- a string of latex code


Options:
  :color (default java.awt.Color/darkGray) -- the text color


Examples:
  (use '(incanter core charts stats latex))

    (doto (function-plot pdf-normal -3 3)
      (add-latex 0 0.1 "f(x)=\\frac{1}{\\sqrt{2\\pi \\sigma^2}} e^{\\frac{-(x - \\mu)^2}{2 \\sigma^2}}")
      view)

    
    
    Source
  


add-latex-subtitle

function
Usage: (add-latex-subtitle chart latex-str & {:keys [color], :or {color darkGray}})
Adds the given LaTeX equation as a subtitle to the chart.

Options:
  :color (default java.awt.Color/darkGray) -- the text color


Examples:
  (use '(incanter core charts stats latex))

  (doto (function-plot pdf-normal -3 3)
    (add-latex-subtitle "f(x)=\\frac{1}{\\sqrt{2\\pi \\sigma^2}} e^{\\frac{-(x - \\mu)^2}{2 \\sigma^2}}")
    view)

    
    
    Source
  


latex

function
Usage: (latex latex-txt & {:keys [color background border], :or {color black, background white, border [5 5 5 5]}})
Returns the given LaTeX equation rendered as an java.awt.Image.

Options:
  :color (default java.awt.Color/black) -- the text color
  :background (default java.awt.Clolor/white) -- the background color
  :border (default [5 5 5 5]) -- image border

Examples:
  (use '(incanter io core charts stats latex))

  (def latex-img (latex "\\frac{(a+b)^2} {(a-b)^2}"))
  (save latex-img "/tmp/latex-example1.png")
  (view "file:///tmp/latex-example1.png")

  (view (latex "f(x)=\\frac {1} {\\sqrt {2\\pi \\sigma ^2}} e^{\\frac {-(x - \\mu)^2}{2 \\sigma ^2}}"))

  (view (latex "\\begin{pmatrix}
                 a & b & c \\\\
                 d & e & f \\\\
                 g & h & i
                 \\end{pmatrix}"))

    
    
    Source
  


to-latex

function
Usage: (to-latex mx & {:keys [mxtype preamble col-just row-names-tex-cmd hline table-newline table-newline-suppress-last newline], :or {mxtype pmatrix, preamble , col-just [], row-names-tex-cmd [], hline false, table-newline \\, table-newline-suppress-last false, newline }})
Convert an Incanter Matrix into a string of LaTeX commands to render it.

Options:
  :mxtype (default pmatrix) -- the type of matrix to output, see LaTeX documentation for other options.
Example:
  (use '(incanter core latex))
  (view (latex (to-latex (matrix [[1 0][0 1]]))))

    
    
    Source
  
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.