Recent version: dvisvgm 1.5.1
Here you find answers to a couple of questions that have frequently been asked in the past.
The generated SVG is most likely valid but your SVG viewer/editor probably doesn't support embedded fonts. Actually, only few SVG renderers, e.g. Batik evaluate embedded fonts properly. You can run dvisvgm with option
--no-fonts to replace the fonts with path elements. Most viewers should render the resulting SVG file correctly. As a drawback, you get bigger files, and the information about the text (characters, baselines, ...) gets lost.
Run dvisvgm with option
--exact. By default, dvisvgm uses the character dimensions (height, depth, width, italic correction, etc.) stored in a font's TFM file to compute the bounding boxes. However, as the TFM bounds are optimized for TeX's character positioning, and as the actual glyphs may exceed their TFM bounds, clipped SVG files are the result. Option
--exact tells dvisvgm to analyze each glyph and to compute the exact bounding rectangle.
There are several reasons that could cause these warnings, e.g.:
WARNING: can't embed font 'name:LinuxLibertineO'. dvisvgm doesn't support external fonts yet.
-n, the results of some files look wrong. What can I do?
Perhaps you run dvisvgm with PostScript support disabled. See below how to check this and how you can enable the processing of PostScript specials.
dvisvgm requires access to the Ghostscript library in order to process PostScript specials. In contrast to the other third-party libraries needed to build dvisvgm (which are always linked directly), Ghostscript can be attached to dvisvgm in three different ways:
dvisvgm -l showing entry ps:
$ dvisvgm -l bgcolor background color special color complete support of color specials dvisvgm special set for embedding raw SVG snippets em line drawing statements of the emTeX special set html hyperref specials pdf pdfTeX font map specials ps dvips PostScript specials tpic TPIC specials
-V1 can be used to check the availability of
PostScript support too (Ghostscript entry is present):
$ dvisvgm -V1 dvisvgm 1.3 (x86_64-pc-win64) ----------------------------- freetype: 2.5.0 Ghostscript: 9.07 MiKTeX: 2.9 potrace: 1.11 zlib: 1.2.8
The latest versions of dvisvgm print a message if PostScript support is disabled because Ghostscript can't be found. In this case, tell dvisvgm where to find the Ghostscript library, e.g. by assigning its location to environment variable LIBGS. For more information see below.
Depending on the configuration options, the dvisvgm binary can be built in three different flavors. You can determine the variant used to build your binary by checking the output of
dvisvgm -h and
dvisvgm -hdoesn't list option
dvisvgm -llists entry ps
dvisvgm -hlists option
dvisvgm -ldoesn't show entry ps, verify whether the directory containing libgs.so (Linux), gsdll32.dll (Windows, dvisvgm 32 bit binary), or gsdll64.dll (Windows, dvisvgm 64 bit binary) is present in the library or program search path, respectively. On Windows, check environment variable PATH.
LIBGSor call dvisvgm with option
LIBGS, e.g. with
dvisvgm -hdoesn't list option
dvisvgm -ldoesn't list entry ps
gsdll64.dll(usually something like
bindirectory to the environment variable PATH, e.g. by appending
;c:\program files\gs\gs9.07\binto the existing entry. See here for more information on how to set the PATH variable permanently.
set LIBGS="c:\program files\gs\gs9.07\bin\gsdll32.dll".
--libgsto tell dvisvgm where the GS DLL is located, e.g.
dvisvgm --libgs="c:\program files\gs\gs9.07\bin\gsdll32.dll" ...
PostScript is a pretty complex language and its interaction with the DVI operations is rather tricky, especially, if plain PostScript snippets are supposed to change the current graphic position or the current font.
The SVG standard allows to define clipping paths by intersection like so:
<clipPath id="clip1"> <rect x="0" y="0" width="50" height="50"/> </clipPath> <clipPath id="clip2" clip-path="url(#clip1)"> <circle cx="50" cy="50" r="20"/> </clipPath>
While clipping path clip1 is the outline of a square, clip2 is defined as the intersection of the square with a circle at the given position. Thus, we get a quadrant here. All following drawing operations restricted to clip2 should produce visible results inside the quadrant only. Unfortunately, merely a few SVG viewers render these intersections properly. Since dvisvgm creates SVG files containing this kind of path intersections, the results might look wrong.
Here's an example: The following images show the rendering results of the same SVG file opened in several applications. The SVG was generated with dvisvgm 1.0.8 out of this TikZ example.