Skip to contents

Compiles a figure with the dune spice.pic prelude, as spice_pic() does, and renders it to SVG: the drawing whose shape numbers spice_pic()'s overlay map refers to. A figure need not be marked spice = 1 to be drawn, and a figure whose extraction has errors still draws.

Usage

spice_pic_svg(x)

spice_pic_texlabels()

Arguments

x

The figure: a spice_pic (its source is drawn), a path to a .pic file or the figure text, as in spice_pic().

Value

The SVG document, a single string.

spice_pic_texlabels(): TRUE when this build typesets $...$ labels.

Details

Labels written entirely in $...$ ("$T_1$", "$V_{CC}$") are typeset as math when the figure turns on rpic's texlabels = 1 and the package was built with its texlabels feature (the default; check with spice_pic_texlabels()); otherwise they stay literal. Typesetting never changes the netlist.

Errors

A figure rpic rejects is a spice_error_pic condition with its line and column, as for spice_pic().

Mirror of the Python package

This is spice.pic.render() in Python; spice_pic_texlabels() is spice.pic.TEXLABELS.

Examples

fig <- '.PS
spice = 1
texlabels = 1
V1: vsource((0,1), (0,0), DC 5, "$V_1$")
R1: resistor((0,1), (1.5,1), 1k)
line from R1.N to (1.5,0) then to V1.N; ground(V1.N)
.op
.PE'
svg <- spice_pic_svg(fig)
substr(svg, 1, 60)
#> [1] "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"212.28884\" he"
spice_pic_texlabels()
#> [1] TRUE