Expand description
tikra: TikZ figures to SVG and PNG, with no TeX install. Math labels are drawn by mathra.
let r = tikra::convert(r"\begin{tikzpicture} \draw[->] (0,0) -- (1,1) node[right] {$x$}; \end{tikzpicture}").unwrap();
assert!(r.svg.starts_with("<svg"));Modules§
- axes
- A pgfplots subset:
\begin{axis}[…] \addplot[…] {expr}; \addplot coordinates {…}; \addlegendentry{…}. Draws the frame or the axes, ticks at round values, the curves clipped to the window, and the legend. - color
- xcolor colors: names, mixes
orange!80!black,blue!10(with white),rgb,HTML,-red(complement). - expr
- pgfmath expressions inside coordinates and options:
2*\R,sin(30),sqrt(2)/2,\x+1. Trigonometry in degrees, as in TikZ. Units (cm,pt,mm) become centimeters. - label
- Node text, typeset by mathra:
{Exit},{$\vec{v}$},{Check every value twice}. Lines by\\, automatic wrapping attext width, sizes\small,\Large. - options
- TikZ option lists:
[->, thick, draw=red!50, fill=blue!10, minimum width=1.2cm, pointer]. Styles from\tikzset{name/.style={…}}are expanded recursively. - path
- One path statement:
\draw[->, thick] (A) -- (B) node[midway, above] {$F$} -- cycle;. - reader
- Interpreter for the supported TikZ subset (spec/subset.md):
\draw,\fill,\filldraw,\path,\node,\coordinate,\foreach,scope,\def,\pgfmathsetmacro,\tikzset,\definecolor, positioning (below=of A),calc,plot. - render
- From the scene to SVG. SVG units are points (1 cm = 28.4528 pt), y pointing down.
- scene
- The scene: what is left of the TikZ after reading it. Paths (segments and curves) and nodes (text in a shape). Everything in centimeters, y pointing up, as in TikZ.
Structs§
Enums§
Constants§
- MAX_
PIXELS - PNG pixel cap (100 megapixels, ~400 MB of memory).
- PT
- Centimeters per TeX point.
- VERSION