SYNOPSIS

dvisvgm [ options ] file [.dvi]

DESCRIPTION

The program dvisvgm generates an SVG file from a given DVI file. DVI is the device independent output format produced by TeX and some other typesetting systems. Output from groff can be converted to DVI using grodvi.

The recent version of dvisvgm provides advanced conversion functionality but currently only one page can be converted even if the DVI file is made up of multiple pages. You can select the page to be processed with option -p. dvisvgm should properly convert all pages that are made up of fonts and rules only. Additionally, some sets of specials are understood as well. For a more detailed overview, see section support of specials below.

Since SVG is a vector based graphics format, dvisvgm tries to convert the glyph outlines of all used fonts into scalable path descriptions. The fastest way to do that is to extract the path information from PFB (PostScript Type 1) files. So if dvisvgm is able to find a PFB file for a used font, it will read the necessary information from it.

Because TeX's main source for font descriptions is Metafont which produces bitmap output, not all obtainable TeX fonts are available in PFB format. In these cases dvisvgm tries to vectorize Metafont's output by tracing the glyph bitmaps. The results are not as perfect as most (manually optimized) PFB outlines but are nonetheless really nice in most cases.

OPTIONS

-b, --bbox-format=fmt

Sets the bounding box of the generated graphic to the specified format. The argument fmt is argument a case-insensitive string that denotes the paper size. Following size names are supported:

International DIN/ISO paper sizes

An, Bn, Cn, Dn, where n is a non-negative integer, e.g. A4 or a4 for DIN/ISO A4 format (210mm × 297mm).

North American paper sizes

invoice, executive, legal, letter, ledger

Special bounding box sizes
dvi the page size stored in the DVI file will be used
min the minimal bounding box will be computed and assigned
none no bounding box will be assigned
Page orientation

The default page orientation for DIN/ISO and American paper sizes is portrait, i.e. width < height. Appending -landscape or simply -l to the format string switches to landscape mode (width > height). For symmetry reasons you can also explicitly add -portrait or -p to indicate the default portrait format. Note that these suffixes are part of the size string and not separate options. Thus they must directly follow the above mentioned size specifiers without additional blanks. Furthermore, the orientation suffixes can't be used with dvi, min and none.

Note Option -b, --bbox-format only affects the bounding box and doesn't transform the page content. Hence if you choose a landscape format the page won't be rotated.
-c, --scale=sx[,sy]

Scales page content horizontally by sx and vertically by sy. This option is equivalent to -TSsx,sy.

-C, --cache=dir

To speed up the conversion process of bitmap fonts, dvisvgm saves intermediate conversion information in cache files. By default, these files are stored in $HOME/.dvisvgm. If you prefer a different location use option --cache to overwrite the default. Furthermore, it is also possible to disable the font caching mechanism completely with option --cache=none. The variant --cache=? prints the default cache directory and exits the program.

-l, --list-specials

Prints a list of registered special handlers and exits. Each handler processes a set of special statements belonging to the same category. The categories are identified by the prefix of the special statements. It's usually a leading word separated from the rest of the statement by a colon or a blank, e.g. color or ps.

-m, --map-file=file

Sets the map file that is used to look up font names and encodings. dvisvgm doesn't provide its own map file but tries to use available ones coming with dvips or dvipdfm. If option -m is not given dvisvgm looks for ps2pk.map, dvipdfm.map, and psfonts.map (in this order). Without further options, the file specified by option -m will be used instead of the default maps. If you want dvisgvm to load the given file additionally to the default maps, add a leading + to the file/path, e.g. --map-file=+myfonts.map. For further information about the file format see the manuals of dvips and dvipdfm.

-M, --mag=factor

Sets the maginfication factor used for Metafont calls prior tracing the glyphs. The larger this value the better the tracing results. Nevertheless large magnification values can cause Metafont arithmetic errors due to number overflows. So use this option with care. The default setting usually produces nice results.

-n, --no-fonts

If this option is given, dvisvgm doesn't create font elements but uses paths instead. The resulting SVG file is usually bigger but concurrently more compatible with most applications that don't support SVG fonts yet. This option implies --no-styles.

-S, --no-specials[=names]

Disable processing of special commands that are embedded in the DVI file. If no further parameter is given, all specials are ignored. To selectively disable sets of specials, an optional comma-separated list of names can be appended to this option. A name is a unique identifier referencing a special handler. Option --list-specials lists all currently available handlers and their names. All unsupported special statements are silently ignored.

--no-styles

By default, dvisvgm uses CSS styles and class attributes to reference fonts because it's more compact than repeatedly set the complete font information in each text element. However, if you prefer direct font references, the default behavior can be disabled with option --no-styles.

--no-mktexmf

Suppresses the generation of missing font files. If dvisvgm can't find a font file through the kpathsea lookup mechanism, it calls the external tools mktextfm or mktexmf by default. This option disables these calls.

-o, --output=file

Sets the name of the output file.

-p, --page=number

With this option you can choose the page to be processed. Please consider that the parameter of this option denotes the actual page count and not the number printed on that page. This is because the latter can be ambiguous, i.e. different pages may have the same page number (e.g. in cases where multiple DVI files have been merged). If this option is omitted, the first page will be selected.

-r, --rotate=angle

Rotates page content clockwise by angle degrees around the page center. This option is equivalent to -TRangle.

-s, --stdout

Don't write output to a file but redirect it to stdout.

-a, --trace-all

This option forces dvisvgm not to trace just the actually needed glyphs but to trace all glyphs of the bitmap fonts used in a DVI file. Since the tracing results are stored in the font cache, all following conversions (without option --trace-all) of DVI files using these fonts will be much faster. By default, only the actually referenced glyphs are traced and added to the cache during a DVI conversion.

Note This option only takes affect if font caching is active. Thus, --trace-all cannot be combined with option --cache=none.
-t, --translate=tx[,ty]

Translates (moves) page content in direction of vector (tx,ty). This option is equivalent to -TTtx,ty.

-T, --transform=commands

Applies a sequence of transformations to the SVG content. Each transformation is described by a command that begins with a capital letter followed by a list of comma-separated parameters. Following transformation commands are supported:

T tx[,ty]

Translates (moves) page in direction of vector (tx,ty). If ty is omitted, ty=0 is assumed. The expected unit length of tx and ty are TeX points (1pt = 1/72.27in). However, there are several constants defined to simplify the unit conversion (see below).

S sx[,sy]

Scales page horizontally by sx and vertically by sy. If sy is omitted sy=sx is assumed.

R angle[,x,y]

Rotates page clockwise by angle degrees around point (x,y). If the optional arguments x and y are omitted the page will be rotated around its center depending on the chosen page format. When option -bnone is given, the rotation center is origin (0,0).

KX angle

Skews page along the x-axis by angle degrees. Argument angle can take any value except 90+180'k', where k is an integer.

KY angle

Skews page along the y-axis by angle degrees. Argument angle can take any value except 90+180'k', where k is an integer.

FH [y]

Mirrors (flips) page at the horizontal line through point (0,y). Omitting the optional argument leads to y=h/2, where h denotes the page height (see pre-defined constants below).

FV [x]

Mirrors (flips) page at the vertical line through point (x,0). Omitting the optional argument leads to x=w/2, where w denotes the page width (see pre-defined constants below).

M m1,…,m6

Applies a transformation described by the 3×3 matrix ((m1,m2,m3),(m4,m5,m6),(0,0,1)), where the inner triples denote the rows.

Note

All transformation commands of option -T, --transform are applied in the order of their appearance. Multiple commands can optionally be separated by spaces. In this case the whole transformation string has to be enclosed in double quotes. All parameters are expressions of floating point type. You can either give plain numbers or arithmetic terms combined by the operators + (addition), - (substraction), * (multiplication), / (division) or % (modulo) with common associativity and precedence rules. Parentheses may be used as well.

Additionally, some pre-defined constants are provided:

ux horizontal position of upper left page corner in TeX point units
uy vertical position of upper left page corner in TeX point units
h page height in TeX point units (0 in case of -bnone)
w page width in TeX point units (0 in case of -bnone)

Furthermore, you can use the length constants pt, mm, cm and in, e.g. 2cm or 1.6in. Thus, option -TT1in,0R45 moves the page content 1 inch to the right and rotates it by 45 degrees around the page center afterwards.

For single transformations you can also use options -c, -t and -r. Note that the order in which these options are given is not significant, i.e. you can't use them to describe transformation sequences. They are simply independent shorthand options for common transformations.

-v, --verbosity=level

Controls the type of messages printed during a dvisvgm run:

0 no message output
1 informal output only
2 warning messages only
4 error messages only
Note By adding these values you can combine the categories. The default level is 7, i.e. all messages are printed.
-z, --zip[=level]

Creates a compressed SVG file with suffix .svgz. The optional argument specifies the compression level. Valid values are in the range of 1 to 9 (default is 9). Larger values cause better compression results but take more computation time.

Caution This option cannot be combined with -s, --stdout.

SUPPORT OF SPECIALS

dvisvgm supports several sets of special commands that can be used to enrich DVI files with additional features, like color, graphics or hyperlinks. The evaluation of special commands is done by various handlers, where each handler is responsible for all special statements of the same command set, i.e. commands beginning with the same prefix. To get a list of actually provided special handlers, use option --list-specials (see above).

bgcolor

Special statement for changing the background/page color. Since SVG 1.1 doesn't support background colors, dvisvgm inserts a rectangle of the chosen color. In the current version, this rectangle always gets the size of the minimal bounding box.

color

Statements of this command set provide instructions to change the text/paint color. For an overview of the exact syntax, see the documentation of dvips, for instance.

dvisvgm

dvisvgm offers its own small set of specials. The following list gives a brief overview.

dvisvgm:raw text

Embeds an arbitrary sequence of characters into the SVG output. dvisvgm does not perform any validation here, thus the user of this special has to ensure that the resulting SVG is still valid. The parameter text may contain the macros {?x}, {?y}, and {?color} which are expanded to the current x or y coordinate and the current color, respectively.

dvisvgm:img width height file

Creates an image element at the current graphic position referencing the given file. JPEG, PNG, and SVG images can be used here. However, dvisvgm doesn't check the file format or the file name suffix. The lengths width and height must be given in TeX point units (1in = 72.27pt).

dvisvgm:bbox width height

Updates the bounding box of the current page by embedding a virtual rectangle of given width and height relative to the current DVI drawing position. This command should be used in conjunction with raw to update the viewport of the page properly.

em

These specials were introduced with the emTeX distribution by Eberhard Mattes. They provide line drawing statements, instructions for embedding MSP, PCX, and BMP image files, as well as two PCL commands. dvisvgm supports only the line drawing statements, all other em specials are silently ignored. A description of the command syntax can be found in the DVI driver documentation coming with emTeX (see CTAN).

tpic

The TPIC special set defines instructions for drawing simple geometric objects. Some LaTeX packages, like eepic and tplot, use these specials to describe graphics.

EXAMPLES

dvisvgm file

Converts first page of file.dvi to file.svg.

dvisvgm -z file

Converts first page of file.dvi to file.svgz with default compression level 9.

dvisvgm -p5 -z3 -ba4-l -onewfile file

Converts fifth page of file.dvi to newfile.svgz with compression level 3. The bounding box is set to DIN/ISO A4 in landscape format.

dvisvgm --transform="R20,w/3,2h/5 T1cm,1cm S2,3" file

Converts first page of file.dvi to file.svg where three transformations are applied.

ENVIRONMENT

dvisvgm uses the kpathsea library for locating the files that it opens. Hence, the environment variables described in the library's documentation influence the converter.

The pre-compiled Windows version of dvisvgm requires a working installation of MiKTeX 2.7 or above.

FILES

The location of the following files is determined by the kpathsea library. To check the actual kpathsea configuration you can use the kpsewhich utility.

*.enc Font encoding files
*.fgd Font glyph data files (cache files created by dvisvgm)
*.map Font map files
*.mf Metafont input files
*.pfb PostScript Type 1 font files
*.tfm TeX font metric files
*.ttf TrueType font files
*.vf Virtual font files

SEE ALSO

tex(1), mf(1), mktexmf(1), grodvi(1), potrace(1), and the kpathsea library info documentation.

RESOURCES

Project home page: http://dvisvgm.sourceforge.net
SourceForge project site: http://sourceforge.net/projects/dvisvgm

AUTHOR

Written by Martin Gieseking <martin.gieseking@uos.de>

COPYING

Copyright © 2005-2009 by Martin Gieseking. Free use of this software is granted under the terms of the GNU General Public License (GPL) version 2.