1DVISVGM(1) dvisvgm Manual DVISVGM(1)
2
3
4
6 dvisvgm - converts DVI and EPS files to the XML-based SVG format
7
9 dvisvgm [ options ] file [.dvi]
10
11 dvisvgm --eps [ options ] file [.eps]
12
13 dvisvgm --pdf [ options ] file [.pdf]
14
16 The command-line utility dvisvgm converts DVI files, as generated by
17 TeX/LaTeX, to the XML-based scalable vector graphics format SVG. It
18 supports the classic DVI version 2 as well as version 3 (created by
19 pTeX in vertical mode), and the XeTeX versions 5 to 7 which are also
20 known as XDV. Besides the basic DVI commands, dvisvgm also evaluates
21 many so-called specials which heavily extend the capabilities of the
22 plain DVI format. For a more detailed overview, see section Supported
23 Specials below.
24
25 Since the current SVG standard 1.1 doesn’t specify multi-page graphics,
26 dvisvgm creates separate SVG files for each DVI page. Because of
27 compatibility reasons, only the first page is converted by default. In
28 order to select a different page or arbitrary page sequences, use
29 option -p which is described below.
30
31 SVG is a vector-based graphics format and therefore dvisvgm tries to
32 convert the glyph outlines of all fonts referenced in a DVI page
33 section to scalable path descriptions. The fastest way to achieve this
34 is to extract the path information from vector-based font files
35 available in PFB, TTF, or OTF format. If dvisvgm is able to find such a
36 file, it extracts all necessary outline information about the glyphs
37 from it.
38
39 However, TeX’s main source for font descriptions is Metafont, which
40 produces bitmap output (GF files). That’s why not all obtainable TeX
41 fonts are available in a scalable format. In these cases, dvisvgm tries
42 to vectorize Metafont’s output by tracing the glyph bitmaps. The
43 results are not as perfect as most (manually optimized) PFB or OTF
44 counterparts, but are nonetheless really nice in most cases.
45
46 When running dvisvgm without option --no-fonts, it creates font
47 elements (<font>...</font>) to embed the font data into the SVG files.
48 Unfortunately, only few SVG renderers support these elements yet. Most
49 web browsers and vector graphics applications don’t evaluate them
50 properly so that the text components of the resulting graphics might
51 look strange. In order to create more compatible SVG files,
52 command-line option --no-fonts can be given to replace the font
53 elements by plain graphics paths.
54
56 dvisvgm provides a POSIX-compliant command-line interface with short
57 and long option names. They may be given before and/or after the name
58 of the file to be converted. Also, the order of specifying the options
59 is not significant, i.e. you can add them in any order without changing
60 dvisvgm’s behavior. Certain options accept or require additional
61 parameters which are directly appended to or separated by whitespace
62 from a short option (e.g. -v0 or -v 0). Long options require an
63 additional equals sign (=) between option name and argument but without
64 any surrounding whitespace (e.g. --verbosity=0). Multiple short options
65 that don’t expect a further parameter can be combined after a single
66 dash (e.g. -ejs rather than -e -j -s).
67
68 -b, --bbox=fmt
69 Sets the bounding box of the generated graphic to the specified
70 format. The parameter fmt takes either one of the format specifiers
71 listed below, or a sequence of four comma- or whitespace-separated
72 length values x1, y1, x2 and y2. The latter define the absolute
73 coordinates of two diagonal corners of the bounding box. Each
74 length value consists of a floating point number and an optional
75 length unit (pt, bp, cm, mm, in, pc, dd, cc, or sp). If the unit is
76 omitted, TeX points (pt) are assumed.
77
78 It’s also possible to give only one length value l. In this case,
79 the minimal bounding box is computed and enlarged by adding (-l,-l)
80 to the upper left and (l,l) to the lower right corner.
81
82 Additionally, dvisvgm also supports the following format
83 specifiers:
84
85 International DIN/ISO paper sizes
86 An, Bn, Cn, Dn, where n is a non-negative integer, e.g. A4 or
87 a4 for DIN/ISO A4 format (210mm × 297mm).
88
89 North American paper sizes
90 invoice, executive, legal, letter, ledger
91
92 Special bounding box sizes
93
94 dvi page size stored in the
95 DVI file
96 min computes the
97 minimal/tightest bounding
98 box
99 none no bounding box is
100 assigned
101 papersize box sizes specified by
102 papersize specials present
103 in the DVI file
104 preview bounding box data computed
105 by the preview package (if
106 present in the DVI file)
107
108
109 Page orientation
110 The default page orientation for DIN/ISO and American paper
111 sizes is portrait, i.e. width < height. Appending -landscape
112 or simply -l to the format string switches to landscape mode
113 (width > height). For symmetry reasons you can also explicitly
114 add -portrait or -p to indicate the default portrait format.
115 Note that these suffixes are part of the size string and not
116 separate options. Thus, they must directly follow the size
117 specifier without additional blanks. Furthermore, the
118 orientation suffixes can’t be used with dvi, min, and none.
119
120 Note
121 Option -b, --bbox only affects the bounding box and does
122 not transform the page content. Hence, if you choose a
123 landscape format, the page won’t be rotated.
124
125 -C, --cache[=dir]
126 To speed up the conversion process of bitmap fonts, dvisvgm saves
127 intermediate conversion information in cache files. By default,
128 these files are stored in $HOME/.dvisvgm/cache. If you prefer a
129 different location, use option --cache to overwrite the default.
130 Furthermore, it is also possible to disable the font caching
131 mechanism completely with option --cache=none. If argument dir is
132 omitted, dvisvgm prints the path of the default cache directory
133 together with further information about the stored fonts.
134 Additionally, outdated and corrupted cache files are removed.
135
136 -j, --clipjoin
137 This option tells dvisvgm to compute all intersections of clipping
138 paths itself rather than delegating this task to the SVG renderer.
139 The resulting SVG files are more portable because some SVG viewers
140 don’t support intersecting clipping paths which are defined by
141 clipPath elements containing a clip-path attribute.
142
143 --color
144 Enables colorization of messages printed during the conversion
145 process. The colors can be customized via environment variable
146 DVISVGM_COLORS. See the Environment section below for further
147 information.
148
149 --colornames
150 By default, dvisvgm exclusively uses RGB values of the form #RRGGBB
151 or #RGB to represent colors in the SVG file. The latter is a short
152 form for colors whose RGB components each consist of two identical
153 hex digits, e.g. #123 equals #112233. According to the SVG
154 standard, it’s also possible to use color names (like black and
155 darkblue) for a limited number of predefined colors. In order to
156 apply these color names rather than their RGB values, call dvisvgm
157 with option --colornames. All colors without an SVG color name will
158 still be represented by RGB values.
159
160 --comments
161 Adds comments with further information about selected data to the
162 SVG file. Currently, only font elements and font CSS rules related
163 to native fonts are annotated.
164
165 -E, --eps
166 If this option is given, dvisvgm does not expect a DVI but an EPS
167 input file, and tries to convert it to SVG. In order to do so, a
168 single psfile special command is created and forwarded to the
169 PostScript special handler. This option is only available if
170 dvisvgm was built with PostScript support enabled, and requires
171 Ghostscript to be available. See option --libgs for further
172 information.
173
174 -e, --exact
175 This option tells dvisvgm to compute the precise bounding box of
176 each character. By default, the values stored in a font’s TFM file
177 are used to determine a glyph’s extent. As these values are
178 intended to implement optimal character placements and are not
179 designed to represent the exact dimensions, they don’t necessarily
180 correspond with the bounds of the visual glyphs. Thus, width and/or
181 height of some glyphs may be larger (or smaller) than the
182 respective TFM values. As a result, this can lead to clipped
183 characters at the bounds of the SVG graphics. With option --exact
184 given, dvisvgm analyzes the actual shape of each character and
185 derives a usually tight bounding box.
186
187 -f, --font-format=format
188 Selects the file format used to embed the font data into the SVG
189 files. Following formats are supported: SVG (that’s the default),
190 TTF (TrueType), WOFF, and WOFF2 (Web Open Font Format version 1 and
191 2). By default, dvisvgm creates unhinted fonts that might look bad
192 on low-resolution devices. In order to improve the display quality,
193 the generated TrueType, WOFF, or WOFF2 fonts can be autohinted. The
194 autohinter is enabled by appending ,autohint or ,ah to the font
195 format, e.g. --font-format=woff,autohint or --font-format=woff,ah.
196
197 Option --font-format is only available if dvisvgm was built with
198 WOFF support enabled.
199
200 -m, --fontmap=filenames
201 Loads and evaluates a single font map file or a sequence of font
202 map files. These files are required to resolve font file names and
203 encodings. dvisvgm does not provide its own map files but tries to
204 read available ones coming with dvips or dvipdfm. If option
205 --fontmap is omitted, dvisvgm looks for the default map files
206 ps2pk.map, pdftex.map, dvipdfm.map, and psfonts.map (in this
207 order). Otherwise, the files as option arguments are evaluated in
208 the given order. Multiple filenames must be separated by commas
209 without leading and/or trailing whitespace. By default, redefined
210 mappings do not replace previous ones. However, each filename can
211 be preceded by an optional mode specifier (+, -, or =) to change
212 this behavior:
213
214 +mapfile
215 Only those entries in the given map file that don’t redefine a
216 font mapping are applied, i.e. fonts already mapped keep
217 untouched. That’s also the default mode if no mode specifier is
218 given.
219
220 -mapfile
221 Ensures that none of the font mappings defined in the given map
222 file are used, i.e. previously defined mappings for the
223 specified fonts are removed.
224
225 =mapfile
226 All mappings defined in the map file are applied. Previously
227 defined settings for the same fonts are replaced.
228
229 If the first filename in the filename sequence is preceded by a
230 mode specifier, dvisvgm loads the default font map (see above)
231 and applies the other map files afterwards. Otherwise, none of
232 default map files will be loaded automatically.
233
234 Examples: --fontmap=myfile1.map,+myfile2.map loads myfile1.map
235 followed by myfile2.map where all redefinitions of myfile2.map
236 are ignored. --fontmap==myfile1.map,-myfile2.map loads the
237 default map file followed by myfile1.map and myfile2.map where
238 all redefinitions of myfile1.map replace previous entries.
239 Afterwards, all definitions for the fonts given in myfile2.map
240 are removed from the font map tree.
241
242 For further information about the map file formats and the mode
243 specifiers, see the manuals of dvips and dvipdfm.
244
245 --grad-overlap
246 Tells dvisvgm to create overlapping grid segments when
247 approximating color gradient fills (also see option --grad-segments
248 below). By default, adjacent segments don’t overlap but only touch
249 each other like separate tiles. However, this alignment can lead to
250 visible gaps between the segments because the background color
251 usually influences the color at the boundary of the segments if the
252 SVG renderer uses anti-aliasing to create smooth contours. One way
253 to avoid this and to create seamlessly touching color regions is to
254 enlarge the segments so that they extent into the area of their
255 right and bottom neighbors. Since the latter are drawn on top of
256 the overlapping parts, the visible size of all segments keeps
257 unchanged. Just the former gaps disappear as the background is now
258 completely covered by the correct colors. Currently, dvisvgm
259 computes the overlapping segments separately for each patch of the
260 mesh (a patch mesh may consist of multiple patches of the same
261 type). Therefore, there still might be visible gaps at the seam of
262 two adjacent patches.
263
264 --grad-segments=number
265 Determines the maximal number of segments per column and row used
266 to approximate gradient color fills. Since SVG 1.1 only supports a
267 small subset of the shading algorithms available in PostScript,
268 dvisvgm approximates some of them by subdividing the area to be
269 filled into smaller, monochromatic segments. Each of these segments
270 gets the average color of the region it covers. Thus, increasing
271 the number of segments leads to smaller monochromatic areas and
272 therefore a better approximation of the actual color gradient. As a
273 drawback, more segments imply bigger SVG files because every
274 segment is represented by a separate path element.
275
276 Currently, dvisvgm supports free- and lattice-form triangular patch
277 meshes as well as Coons and tensor-product patch meshes. They are
278 approximated by subdividing the area of each patch into a n×n grid
279 of smaller segments. The maximal number of segments per column and
280 row can be changed with option --grad-segments.
281
282 --grad-simplify=delta
283 If the size of the segments created to approximate gradient color
284 fills falls below the given delta value, dvisvgm reduces their
285 level of detail. For example, Bézier curves are replaced by
286 straight lines, and triangular segments are combined to tetragons.
287 For a small delta, these simplifications are usually not noticeable
288 but reduce the size of the generated SVG files significantly.
289
290 -h, --help[=mode]
291 Prints a short summary of all available command-line options. The
292 optional mode parameter is an integer value between 0 and 2. It
293 selects the display variant of the help text. Mode 0 lists all
294 options divided into categories with section headers. This is also
295 the default if dvisvgm is called without parameters. Mode 1 lists
296 all options ordered by the short option names, while mode 2 sorts
297 the lines by the long option names.
298
299 --keep
300 Disables the removal of temporary files as created by Metafont
301 (usually .gf, .tfm, and .log files) or the TrueType/WOFF module.
302
303 --libgs=filename
304 This option is only available if the Ghostscript library is not
305 directly linked to dvisvgm and if PostScript support was not
306 completely disabled during compilation. In this case, dvisvgm tries
307 to load the shared GS library dynamically during runtime. By
308 default, it expects the library’s name to be libgs.so.X (on
309 Unix-like systems, where X is the ABI version of the library) or
310 gsdll32.dll/gsdll64.dll (Windows). Option --libgs can be used to
311 give a different name. Alternatively, it’s also possible to set the
312 GS library name by the environment variable LIBGS. The latter has
313 less precedence than the command-line option, i.e. dvisvgm ignores
314 variable LIBGS if --libgs is given.
315
316 -L, --linkmark=style
317 Selects the method how to mark hyperlinked areas. The style
318 argument can take one of the values none, box, and line, where box
319 is the default, i.e. a rectangle is drawn around the linked region
320 if option --linkmark is omitted. Style argument line just draws the
321 lower edge of the bounding rectangle, and none tells dvisvgm not to
322 add any visible objects to hyperlinks. The lines and boxes get the
323 current text color selected. In order to apply a different,
324 constant color, a colon followed by a color specifier can be
325 appended to the style string. A color specifier is either a
326 hexadecimal RGB value of the form #RRGGBB, or a dvips color name
327 (https://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips).
328
329 Moreover, argument style can take a single color specifier to
330 highlight the linked region by a frameless box filled with that
331 color. An optional second color specifier separated by a colon
332 selects the frame color.
333
334 Examples: box:red or box:#ff0000 draws red boxes around the linked
335 areas. yellow:blue creates yellow filled rectangles with blue
336 frames.
337
338 -l, --list-specials
339 Prints a list of registered special handlers and exits. Each
340 handler processes a set of special statements belonging to the same
341 category. In most cases, the categories are identified by the
342 prefix of the special statements. It’s usually a leading string
343 followed by a colon or a blank, e.g. color or ps. The listed
344 handler names, however, don’t need to match these prefixes, e.g. if
345 there is no common prefix or if functionality is split into
346 separate handlers in order to allow to disable them separately with
347 option --no-specials. All special statements not covered by one of
348 the special handlers are silently ignored.
349
350 -M, --mag=factor
351 Sets the magnification factor applied in conjunction with Metafont
352 calls prior tracing the glyphs. The larger this value, the better
353 the tracing results. Nevertheless, large magnification values can
354 cause Metafont arithmetic errors due to number overflows. So, use
355 this option with care. The default setting usually produces nice
356 results.
357
358 --no-merge
359 Puts every single character in a separate text element with
360 corresponding x and y attributes. By default, new text or tspan
361 elements are only created if a string starts at a location that
362 differs from the regular position defined by the characters'
363 advance values.
364
365 --no-mktexmf
366 Suppresses the generation of missing font files. If dvisvgm can’t
367 find a font file through the kpathsea lookup mechanism, it calls
368 the external tools mktextfm or mktexmf. This option disables these
369 calls.
370
371 -n, --no-fonts[=variant]
372 If this option is given, dvisvgm doesn’t create SVG font elements
373 but uses paths instead. The resulting SVG files tend to be larger
374 but they are concurrently more compatible with most applications
375 that don’t support SVG fonts yet. The optional argument variant
376 selects the method how to substitute fonts by paths. Variant 0
377 creates path and use elements in order to avoid lengthy duplicates.
378 Variant 1 creates path elements only. Option --no-fonts implies
379 --no-styles.
380
381 -c, --scale=sx[,sy]
382 Scales the page content horizontally by sx and vertically by sy.
383 This option is equivalent to -TSsx,sy.
384
385 -S, --no-specials[=names]
386 Disable processing of special commands embedded in the DVI file. If
387 no further parameter is given, all specials are ignored. To disable
388 a selected set of specials, an optional comma-separated list of
389 names can be appended to this option. A name is the unique
390 identifier referencing the intended special handler as listed by
391 option --list-specials.
392
393 --no-styles
394 By default, dvisvgm creates CSS styles and class attributes to
395 reference fonts. This variant is more compact than adding the
396 complete font information to each text element over and over again.
397 However, if you prefer direct font references, the default behavior
398 can be disabled with option --no-styles.
399
400 -o, --output=pattern
401 Sets the pattern specifying the names of the generated SVG files.
402 Parameter pattern is a string that may contain static character
403 sequences as well as the variables %f, %p, %P, %hd, %ho, and %hc.
404 %f expands to the base name of the DVI file, i.e. the filename
405 without suffix, %p is the current page number, and %P the total
406 number of pages in the DVI file. An optional number (0-9) given
407 directly after the percent sign specifies the minimal number of
408 digits to be written. If a particular value consists of less
409 digits, the number is padded with leading zeros. Example: %3p
410 enforces 3 digits for the current page number (001, 002, etc.).
411 Without an explicit width specifier, %p gets the same number of
412 digits as %P.
413
414 If you need more control over the numbering, you can use arithmetic
415 expressions as part of a pattern. The syntax is %(expr) where expr
416 may contain additions, subtractions, multiplications, and integer
417 divisions with common precedence. The variables p and P contain the
418 current page number and the total number of pages, respectively.
419 For example, --output="%f-%(p-1)" creates filenames where the
420 numbering starts with 0 rather than 1.
421
422 The variables %hX contain different hash values computed from the
423 DVI page data and the options given on the command-line. %hd and
424 %hc are only set if option --page-hashes is present. Otherwise,
425 it’s empty. For further information, see the description of option
426 --page-hashes below.
427
428 The default pattern is %f-%p.svg if the DVI file consists of more
429 than one page, and %f.svg otherwise. That means, a DVI file foo.dvi
430 is converted to foo.svg if foo.dvi is a single-page document.
431 Otherwise, multiple SVG files foo-01.svg, foo-02.svg, etc. are
432 produced. In Windows environments, the percent sign indicates
433 dereferenced environment variables, and must therefore be protected
434 by a second percent sign, e.g. --output=%%f-%%p.
435
436 -p, --page=ranges
437 This option selects the pages to be processed. Parameter ranges
438 consists of a comma-separated list of single page numbers and/or
439 page ranges. A page range is a pair of numbers separated by a
440 hyphen, e.g. 5-12. Thus, a page sequence might look like this:
441 2-4,6,9-12,15. It doesn’t matter if a page is given more than once
442 or if page ranges overlap. dvisvgm always extracts the page numbers
443 in ascending order and converts them only once. In order to stay
444 compatible with previous versions, the default page sequence is 1.
445 dvisvgm therefore converts only the first page and not the whole
446 document if option --page is omitted. Usually, page ranges consist
447 of two numbers denoting the first and last page to be converted. If
448 the conversion should start at page 1, or if it should continue up
449 to the last DVI page, the first or second range number can be
450 omitted, respectively. Example: --page=-10 converts all pages up to
451 page 10, --page=10- converts all pages starting with page 10.
452 Please consider that the page values don’t refer to the page
453 numbers printed on the corresponding page. Instead, the physical
454 page count is expected, where the first page always gets number 1.
455
456 -H, --page-hashes[=params]
457 If this option is given, dvisvgm computes hash values of all pages
458 to be processed. As long as the page contents don’t change, the
459 hash value of that page stays the same. This property can be used
460 to determine whether a DVI page must be converted again or can be
461 skipped in consecutive runs of dvisvgm. This is done by propagating
462 the hash value to variable %hd which can be accessed in the output
463 pattern (see option --output). By default, dvisvgm changes the
464 output pattern to %f-%hd if option --page-hashes is given. As a
465 result, all SVG file names contain the hash value instead of the
466 page number. When calling dvisvgm again with option --page-hashes
467 with the same output pattern, it checks the existence of the SVG
468 file to be created and skips the conversion if it’s already
469 present. This also applies for consecutive calls of dvisvgm with
470 different command-line parameters. If you want to force another
471 conversion of a DVI file that hasn’t changed, you must remove the
472 corresponding SVG files beforehand or add the parameter replace
473 (see below). If you manually set the output pattern to not contain
474 a hash value, the conversion won’t be skipped.
475
476 Alternatively, the output pattern may contain the variables %ho and
477 %hc. %ho expands to a 32-bit hash representing the given
478 command-line options that affect the generated SVG output, like
479 --no-fonts and --precision. Different combinations of options and
480 parameters lead to different hashes. Thus pattern %f-%hd-%ho
481 creates filenames that change depending on the DVI data and the
482 given command-line options. Variable %hc provides a combined hash
483 computed from the DVI data and the command-line options. It has the
484 same length as %hd.
485
486 Since the page number isn’t part of the file name by default,
487 different DVI pages with identical contents get the same file name.
488 Therefore, only the first one is converted while the others are
489 skipped. To create separate files for each page, you can add the
490 page number to the output pattern, e.g. --output="%f-%p-%hc".
491
492 By default, dvisvgm uses the XXH64 hash algorithm to compute the
493 values provided through %hd and %hc. It’s extremely fast, and a
494 64-bit hash should be sufficient for most documents with an average
495 size of pages. Alternatively, XXH32 and MD5 can be used as well.
496 The desired algorithm is specified by argument params of option
497 --page-hashes. It takes one of the strings MD5, XXH32, and XXH64,
498 where the names can be given in lower case too, like
499 --page-hashes=md5.
500
501 Finally, option --page-hashes can take a second argument that must
502 be separated by a comma. Currently, only the two parameters list
503 and replace are evaluated, e.g. --page-hashes=md5,list or
504 --page-hashes=replace. When list is present, dvisvgm doesn’t
505 perform any conversion but just lists the hash values %hd and %hc
506 of the pages specified by option --page. Parameter replace forces
507 dvisvgm to convert a DVI page even if a file with the target name
508 already exists.
509
510 -P, --pdf
511 If this option is given, dvisvgm does not expect a DVI but a PDF
512 input file, and tries to convert it to SVG. Similar to the
513 conversion of DVI files, only the first page is processed by
514 default. Option --page can be used to select different pages, page
515 ranges, and/or page sequences. The conversion is realized by
516 creating a single pdffile special command which is forwarded to the
517 PostScript special handler. Therefore, this option is only
518 available if dvisvgm was built with PostScript support enabled, and
519 requires Ghostscript to be accessible. See option --libgs for
520 further information.
521
522 -d, --precision=digits
523 Specifies the maximal number of decimal places applied to
524 floating-point attribute values. All attribute values written to
525 the generated SVG file(s) are rounded accordingly. The parameter
526 digits accepts integer values from 0 to 6, where 0 enables the
527 automatic selection of significant decimal places. This is also the
528 default value if dvisvgm is called without option --precision.
529
530 --progress[=delay]
531 Enables a simple progress indicator shown when time-consuming
532 operations like PostScript specials are processed. The indicator
533 doesn’t appear before the given delay (in seconds) has elapsed. The
534 default delay value is 0.5 seconds.
535
536 -r, --rotate=angle
537 Rotates the page content clockwise by angle degrees around the page
538 center. This option is equivalent to -TRangle.
539
540 -R, --relative
541 SVG allows to define graphics paths by a sequence of absolute
542 and/or relative path commands, i.e. each command expects either
543 absolute coordinates or coordinates relative to the current drawing
544 position. By default, dvisvgm creates paths made up of absolute
545 commands. If option --relative is given, relative commands are
546 created instead. This slightly reduces the size of the SVG files in
547 most cases.
548
549 --stdin
550 Tells dvisvgm to read the DVI or EPS input data from stdin instead
551 from a file. Alternatively to option --stdin, a single dash (-) can
552 be given. The default name of the generated SVG file is stdin.svg
553 which can be changed with option --output.
554
555 -s, --stdout
556 Don’t write the SVG output to a file but redirect it to stdout.
557
558 --tmpdir[=path]
559 In some cases, dvisvgm needs to create temporary files to work
560 properly. These files go to the system’s temporary folder by
561 default, e.g. /tmp on Linux systems. Option --tmpdir allows to
562 specify a different location if necessary for some reason. Please
563 note that dvisvgm does not create this folder, so you must ensure
564 that it actually exists before running dvisvgm.
565
566 If the optional parameter path is omitted, dvisvgm prints the
567 location of the system’s temp folder and exits.
568
569 -a, --trace-all=[retrace]
570 This option forces dvisvgm to vectorize not only the glyphs
571 actually required to render the SVG file correctly – which is the
572 default –, but processes all glyphs of all fonts referenced in the
573 DVI file. Because dvisvgm stores the tracing results in a font
574 cache, all following conversions of these fonts will speed up
575 significantly. The boolean option retrace determines how to handle
576 glyphs already stored in the cache. By default, these glyphs are
577 skipped. Setting argument retrace to yes or true forces dvisvgm to
578 retrace the corresponding bitmaps again.
579
580 Note
581 This option only takes effect if font caching is active.
582 Therefore, --trace-all cannot be combined with option
583 --cache=none.
584
585 -T, --transform=commands
586 Applies a sequence of transformations to the SVG content. Each
587 transformation is described by a command beginning with a capital
588 letter followed by a list of comma-separated parameters. Following
589 transformation commands are supported:
590
591 T tx[,ty]
592 Translates (moves/shifts) the page in direction of vector
593 (tx,ty). If ty is omitted, ty=0 is assumed. The expected unit
594 length of tx and ty are TeX points (1pt = 1/72.27in). However,
595 there are several constants defined to simplify the unit
596 conversion (see below).
597
598 S sx[,sy]
599 Scales the page horizontally by sx and vertically by sy. If sy
600 is omitted, sy=sx is assumed.
601
602 R angle[,x,y]
603 Rotates the page clockwise by angle degrees around point (x,y).
604 If the optional arguments x and y are omitted, the page will be
605 rotated around its center depending on the chosen page format.
606 When option -bnone is given, the rotation center is origin
607 (0,0).
608
609 KX angle
610 Skews the page along the x-axis by angle degrees. Argument
611 angle can take any value except 90+180k, where k is an integer.
612
613 KY angle
614 Skews the page along the y-axis by angle degrees. Argument
615 angle can take any value except 90+180k, where k is an integer.
616
617 FH [y]
618 Mirrors (flips) the page at the horizontal line through point
619 (0,y). Omitting the optional argument leads to y=h/2, where h
620 denotes the page height (see pre-defined constants below).
621
622 FV [x]
623 Mirrors (flips) the page at the vertical line through point
624 (x,0). Omitting the optional argument leads to x=w/2, where w
625 denotes the page width (see pre-defined constants below).
626
627 M m1,...,m6
628 Applies a transformation described by the 3×3 matrix
629 ((m1,m2,m3),(m4,m5,m6),(0,0,1)), where the inner triples denote
630 the rows.
631
632 Note
633 All transformation commands of option -T, --transform are
634 applied in the order of their appearance. Multiple commands
635 can optionally be separated by spaces. In this case the
636 whole transformation string has to be enclosed in double
637 quotes to keep them together. All parameters are
638 expressions of floating point type. You can either give
639 plain numbers or arithmetic terms combined by the operators
640 + (addition), - (subtraction), * (multiplication), /
641 (division) or % (modulo) with common associativity and
642 precedence rules. Parentheses may be used as well.
643
644 Additionally, some pre-defined constants are provided:
645
646 ux horizontal position of
647 upper left page corner in
648 TeX point units
649 uy vertical position of upper
650 left page corner in TeX
651 point units
652 h page height in TeX point
653 units (0 in case of
654 -bnone)
655 w page width in TeX point
656 units (0 in case of
657 -bnone)
658
659 Furthermore, you can use the 9 length constants pt, bp, cm,
660 mm, in, pc, dd, cc, and sp, e.g. 2cm or 1.6in. Thus,
661 option -TT1in,0R45 moves the page content 1 inch to the
662 right and rotates it by 45 degrees around the page center
663 afterwards.
664
665 For single transformations, there are also the short-hand
666 options -c, -t and -r available. In contrast to the
667 --transform commands, the order of these options is not
668 significant, so that it’s not possible to describe
669 transformation sequences with them.
670
671 -t, --translate=tx[,ty]
672 Translates (moves) the page content in direction of vector (tx,ty).
673 This option is equivalent to -TTtx,ty.
674
675 -v, --verbosity=level
676 Controls the type of messages printed during a dvisvgm run:
677
678 0 no message output at all
679 1 error messages only
680 2 warning messages only
681 4 informational messages
682 only
683
684
685 Note
686 By adding these values you can combine the categories. The
687 default level is 7, i.e. all messages are printed.
688
689 -V, --version[=extended]
690 Prints the version of dvisvgm and exits. If the optional argument
691 is set to yes, the version numbers of the linked libraries are
692 printed as well.
693
694 -z, --zip[=level]
695 Creates a compressed SVG file with suffix .svgz. The optional
696 argument specifies the compression level. Valid values are in the
697 range of 1 to 9 (default value is 9). Larger values cause better
698 compression results but may take slightly more computation time.
699
700 -Z, --zoom=factor
701 Multiplies the values of the width and height attributes of the SVG
702 root element by argument factor while the coordinate system of the
703 graphic content is retained. As a result, most SVG viewers zoom the
704 graphics accordingly. If a negative zoom factor is given, the width
705 and height attributes are omitted.
706
708 dvisvgm supports several sets of special commands that can be used to
709 enrich DVI files with additional features, like color, graphics, and
710 hyperlinks. The evaluation of special commands is delegated to
711 dedicated handlers provided by dvisvgm. Each handler is responsible for
712 all special statements of the same command set, i.e. commands beginning
713 with the same prefix. To get a list of the actually provided special
714 handlers, use option --list-specials (see above). This section gives an
715 overview of the special commands currently supported.
716
717 bgcolor
718 Special statement for changing the background/page color. Since SVG
719 1.1 doesn’t support background colors, dvisvgm inserts a rectangle
720 of the chosen color into the generated SVG document. This rectangle
721 always gets the same size as the selected or computed bounding box.
722 This background color command is part of the color special set but
723 is handled separately in order to let the user turn it off. For an
724 overview of the command syntax, see the documentation of dvips, for
725 instance.
726
727 color
728 Statements of this command set provide instructions to change the
729 text/paint color. For an overview of the exact syntax, see the
730 documentation of dvips, for instance.
731
732 dvisvgm
733 dvisvgm offers its own small set of specials. The following list
734 gives a brief overview.
735
736 dvisvgm:raw text
737 Adds an arbitrary sequence of characters to the page section of
738 the SVG document. dvisvgm does not perform any validation here,
739 thus the user has to ensure that the resulting SVG is still
740 valid. Parameter text may contain the expressions {?x}, {?y},
741 and {?color} that expand to the current x or y coordinate and
742 the current color, respectively. Furthermore, {?nl} expands to
743 a newline character.
744
745 dvisvgm:rawdef text
746 This command is similar to dvisvgm:raw, but puts the raw text
747 into the <defs> section of the SVG document currently being
748 generated.
749
750 dvisvgm:rawset name ... dvisvgm:endrawset
751 This pair of specials marks the begin and end of a definition
752 of a named raw SVG fragment. All dvisvgm:raw and dvisvgm:rawdef
753 specials enclosed by dvisvgm:rawset and dvisvgm:endrawset are
754 not evaluated immediately but jointly stored under the given
755 name for later use. Once defined, the named fragment can be
756 referenced throughout the DVI file by dvisvgm:rawput (see
757 below). The two commands dvisvgm:rawset and dvisvgm:endrawset
758 must not be nested, i.e. each call of dvisvgm:rawset has to be
759 followed by a corresponding call of dvisvgm:endrawset before
760 another dvisvgm:rawset may occur. Also, the identifier name
761 must be unique throughout the DVI file. Using dvisvgm:rawset
762 multiple times together with the same name leads to warning
763 messages.
764
765 dvisvgm:rawput name
766 Inserts raw SVG fragments previously stored under the given
767 name. dvisvgm distinguishes between fragments that were
768 specified with dvisvgm:raw or dvisvgm:rawdef, and handles them
769 differently: It inserts all dvisvgm:raw parts every time
770 dvisvgm:rawput is called, whereas the dvisvgm:rawdef portions
771 go to the <defs> section of the current SVG document only once.
772
773 dvisvgm:img width height file
774 Creates an image element at the current graphic position
775 referencing the given file. JPEG, PNG, and SVG images can be
776 used here. However, dvisvgm does not check the file format or
777 the file name suffix. The lengths width and height can be given
778 together with a unit specifier (see option --bbox) or as plain
779 floating point numbers. In the latter case, TeX point units are
780 assumed (1in = 72.27pt).
781
782 dvisvgm:bbox n[ew] name
783 Defines or resets a local bounding box called name. The name
784 may consist of letters and digits. While processing a DVI page,
785 dvisvgm continuously updates the (global) bounding box of the
786 current page in order to determine the minimal rectangle
787 containing all visible page components (characters, images,
788 drawing elements etc.) Additionally to the global bounding box,
789 the user can request an arbitrary number of named local
790 bounding boxes. Once defined, these boxes are updated together
791 with the global bounding box starting with the first character
792 that follows the definition. Thus, the local boxes can be used
793 to compute the extent of parts of the page. This is useful for
794 scenarios where the generated SVG file is post-processed. In
795 conjunction with special dvisvgm:raw, the macro {?bbox name}
796 expands to the four values x, y, w, and h (separated by spaces)
797 specifying the coordinates of the upper left corner, width, and
798 height of the local box name. If box name wasn’t previously
799 defined, all four values equal to zero.
800
801 dvisvgm:bbox width height [depth]
802 Updates the bounding box of the current page by embedding a
803 virtual rectangle (x, y, width, height) where the lower left
804 corner is located at the current DVI drawing position (x,y). If
805 the optional parameter depth is specified, dvisvgm embeds a
806 second rectangle (x, y, width, -depth). The lengths width,
807 height, and depth can be given together with a unit specifier
808 (see option --bbox) or as plain floating point numbers. In the
809 latter case, TeX point units are assumed (1in = 72.27pt).
810 Depending on size and position of the virtual rectangle, this
811 command either enlarges the overall bounding box or leaves it
812 as is. It’s not possible to reduce its extent. This special
813 should be used together with dvisvgm:raw in order to update the
814 viewport of the page properly.
815
816 dvisvgm:bbox a[bs] x1 y1 x2 y2
817 This variant of the bbox special updates the bounding box by
818 embedding a virtual rectangle (x1,y1,x2,y2). The points (x1,y1)
819 and (x2,y2) denote the absolute coordinates of two diagonal
820 corners of the rectangle.
821
822 dvisvgm:bbox f[ix] x1 y1 x2 y2
823 This variant of the bbox special assigns an absolute (final)
824 bounding box to the resulting SVG. After executing this
825 command, dvisvgm doesn’t further alter the bounding box
826 coordinates, except this special is called again later. The
827 points (x1,y1) and (x2,y2) denote the absolute coordinates of
828 two diagonal corners of the rectangle.
829
830 The following TeX snippet adds two raw SVG elements to the
831 output and updates the bounding box accordingly:
832
833 \special{dvisvgm:raw <circle cx='{?x}' cy='{?y}' r='10' stroke='black' fill='red'/>}%
834 \special{dvisvgm:bbox 10bp 10bp 10bp}%
835 \special{dvisvgm:bbox -10bp 10bp 10bp}
836
837 \special{dvisvgm:raw <path d='M50 200 L10 250 H100 Z' stroke='black' fill='blue'/>}
838 \special{dvisvgm:bbox abs 10bp 200bp 100bp 250bp}
839
840 em
841 These specials were introduced with the emTeX distribution by
842 Eberhard Mattes. They provide line drawing statements, instructions
843 for embedding MSP, PCX, and BMP image files, as well as two PCL
844 commands. dvisvgm supports only the line drawing statements and
845 ignores all other em specials silently. A description of the
846 command syntax can be found in the DVI driver documentation coming
847 with emTeX (https://ctan.org/pkg/emtex).
848
849 html
850 The hyperref specification defines several variants on how to mark
851 hyperlinked areas in a DVI file. dvisvgm supports the plain
852 HyperTeX special constructs as created with hyperref package option
853 hypertex. By default, all linked areas of the document are marked
854 by a rectangle. Option --linkmark allows to change this behavior.
855 See above for further details. Information on syntax and semantics
856 of the HyperTeX specials can be found in the hyperref manual
857 (https://ctan.org/pkg/hyperref).
858
859 papersize
860 The papersize special, which is an extension introduced by dvips,
861 can be used to specify the widths and heights of the pages in the
862 DVI file. It affects the page it appears on as well as all
863 following pages until another papersize special is found. If there
864 is more than one papersize special present on a page, dvisvgm
865 applies the last one. However, in order to stay compatible with
866 previous versions of dvisvgm that did not evaluate these specials,
867 their processing must be explicitly enabled by adding option
868 --bbox=papersize on the command-line. Otherwise, dvisvgm ignores
869 them and computes tight bounding boxes.
870
871 pdf
872 pdfTeX and dvipdfmx introduced several special commands related to
873 the generation of PDF files. Currently, only pdf:mapfile,
874 pdf:mapline, pdf:pagesize, and PDF hyperlink specials are supported
875 by dvisvgm. The latter are the PDF pendants to the HTML HyperTeX
876 specials generated by the hyperref package in PDF mode.
877
878 pdf:pagesize is similar to the papersize special (see above) which
879 specifies the size of the current and all folowing pages. In order
880 to actually apply the extents to the generated SVG files, option
881 --bbox=papersize must be given.
882
883 pdf:mapfile and pdf:mapline allow for modifying the font map tree
884 while processing the DVI file. They are used by CTeX, for example.
885 dvisvgm supports both, the dvips and dvipdfm font map format. For
886 further information on the command syntax and semantics, see the
887 documentation of \pdfmapfile in the pdfTeX user manual
888 (https://ctan.org/pkg/pdftex).
889
890 ps
891 The famous DVI driver dvips introduced its own set of specials in
892 order to embed PostScript code into DVI files, which greatly
893 improves the capabilities of DVI documents. One aim of dvisvgm is
894 to completely evaluate all PostScript snippets and to convert as
895 many of them as possible to SVG. In contrast to dvips, dvisvgm uses
896 floating point arithmetics to compute the precise position of each
897 graphic element, i.e. it doesn’t round the coordinates. Therefore,
898 the relative locations of the graphic elements may slightly differ
899 from those computed by dvips.
900
901 Since PostScript is a rather complex language, dvisvgm does not
902 implement its own PostScript interpreter but relies on Ghostscript
903 (https://ghostscript.com) instead. If the Ghostscript library was
904 not linked to the dvisvgm binary, it is looked up and loaded
905 dynamically during runtime. In this case, dvisvgm looks for
906 libgs.so.X on Unix-like systems (supported ABI versions: 7,8,9),
907 for libgs.X.dylib on macOS, and for gsdll32.dll or gsdll64.dll on
908 Windows. You can override the default file names with environment
909 variable LIBGS or the command-line option --libgs. The library must
910 be reachable through the ld search path (*nix) or the PATH
911 environment variable (Windows). Alternatively, the absolute file
912 path can be specified. If the library cannot be found, dvisvgm
913 disables the processing of PostScript specials and prints a warning
914 message. Use option --list-specials to check whether PostScript
915 support is available, i.e. entry ps is present.
916
917 The PostScript handler also recognizes and evaluates bounding box
918 data generated by the preview package
919 (https://ctan.org/pkg/preview) with option tightpage. If such data
920 is present in the DVI file and if dvisvgm is called with option
921 --bbox=preview, dvisvgm sets the width and total height of the SVG
922 file to the values derived from the preview data. Additionally, it
923 prints a message showing the width, height, and depth of the box in
924 TeX point units to the console. Especially, the depth value can be
925 read by a post-processor to vertically align the SVG graphics with
926 the baseline of surrounding text in HTML or XSL-FO documents, for
927 example. Please note that SVG bounding boxes are defined by a width
928 and (total) height. In contrast to TeX, SVG provides no means to
929 differentiate between height and depth, i.e. the vertical extents
930 above and below the baseline, respectively. Therefore, it is
931 generally not possible to retrieve the depth value from the SVG
932 file itself.
933
934 If you call dvisvgm with option --bbox=min (the default) and
935 preview data is present in the DVI file, dvisvgm doesn’t apply the
936 preview extents but computes a bounding box that tightly encloses
937 the page contents. The height, depth and width values written to
938 console are adapted accordingly.
939
940 tpic
941 The TPIC special set defines instructions for drawing simple
942 geometric objects. Some LaTeX packages, like eepic and tplot, use
943 these specials to describe graphics.
944
946 dvisvgm file
947
948 Converts the first page of file.dvi to file.svg.
949
950 dvisvgm - < file.dvi
951
952 Converts the first page of file.dvi to stdin.svg where the contents of
953 file.dvi is read from stdin.
954
955 dvisvgm -z file
956
957 Converts the first page of file.dvi to file.svgz with default
958 compression level 9.
959
960 dvisvgm -p5 -z3 -ba4-l -onewfile file
961
962 Converts the fifth page of file.dvi to newfile.svgz with compression
963 level 3. The bounding box is set to DIN/ISO A4 in landscape format.
964
965 dvisvgm --transform="R20,w/3,2h/5 T1cm,1cm S2,3" file
966
967 Converts the first page of file.dvi to file.svg where three
968 transformations are applied.
969
971 dvisvgm uses the kpathsea library for locating the files that it opens.
972 Hence, the environment variables described in the library’s
973 documentation influence the converter.
974
975 If dvisvgm was linked without the Ghostscript library, and if
976 PostScript support has not been disabled, the shared Ghostscript
977 library is looked up during runtime via dlopen(). The environment
978 variable LIBGS can be used to specify path and file name of the
979 library.
980
981 The pre-compiled Windows versions of dvisvgm require a working
982 installation of MiKTeX 2.9 or above. dvisvgm does not work together
983 with the portable edition of MiKTeX because it relies on MiKTeX’s COM
984 interface that is only accessible in a local installation. To enable
985 the evaluation of PostScript specials, the original Ghostscript DLL
986 gsdll32.dll must be present and reachable through the search path.
987 64-bit Windows builds require the 64-bit Ghostscript DLL gsdll64.dll.
988 Both DLLs come with the corresponding Ghostscript installers available
989 from https://ghostscript.com.
990
991 The environment variable DVISVGM_COLORS specifies the colors used to
992 highlight various parts of dvisvgm’s message output. It is only
993 evaluated if option --color is given. The value of DVISVGM_COLORS is a
994 list of colon-separated entries of the form gg=BF, where gg denotes one
995 of the color group indicators listed below, and BF are two hexadecimal
996 digits specifying the background (first digit) and foreground/text
997 color (second digit). The color values are defined as follows: 0=black,
998 1=red, 2=green, 3=yellow, 4=blue, 5=magenta, 6=cyan, 7=gray, 8=bright
999 red, 9=bright green, A=bright yellow, B=bright blue, C=bright magenta,
1000 D=bright cyan, E=bright gray, F=white. Depending on the terminal, the
1001 colors may differ. Rather than changing both the text and background
1002 color, it’s also possible to change only one of them: An asterisk (*)
1003 in place of a hexadecimal digit indicates the default text or
1004 background color of the terminal.
1005
1006 All malformed entries in the list are silently ignored.
1007
1008
1009 er error messages
1010
1011 wn warning messages
1012
1013 pn messages about page
1014 numbers
1015
1016 ps page size messages
1017
1018 fw information about the
1019 files written
1020
1021 sm state messages
1022
1023 tr messages of the glyph
1024 tracer
1025
1026 pi progress indicator
1027
1028
1029 Example: er=01:pi=*5 sets the colors of error messages (er) to red (1)
1030 on black (0), and those of progress indicators (pi) to cyan (5) on
1031 default background (*).
1032
1034 The location of the following files is determined by the kpathsea
1035 library. To check the actual kpathsea configuration you can use the
1036 kpsewhich utility.
1037
1038
1039 *.enc Font encoding files
1040
1041 *.fgd Font glyph data files
1042 (cache files created by
1043 dvisvgm)
1044
1045 *.map Font map files
1046
1047 *.mf Metafont input files
1048
1049 *.pfb PostScript Type 1 font
1050 files
1051
1052 *.pro PostScript header/prologue
1053 files
1054
1055 *.tfm TeX font metric files
1056
1057
1058 *.ttf TrueType font files
1059
1060 *.vf Virtual font files
1061
1062
1064 tex(1), mf(1), mktexmf(1), grodvi(1), potrace(1), and the kpathsea
1065 library info documentation.
1066
1068 Project home page
1069 https://dvisvgm.de
1070
1071 Code repository
1072 https://github.com/mgieseki/dvisvgm
1073
1075 Please report bugs using the bug tracker at GitHub
1076 (https://github.com/mgieseki/dvisvgm/issues).
1077
1079 Written by Martin Gieseking <martin.gieseking@uos.de>
1080
1082 Copyright © 2005-2019 Martin Gieseking. Free use of this software is
1083 granted under the terms of the GNU General Public License (GPL) version
1084 3 or, (at your option) any later version.
1085
1086
1087
1088dvisvgm 2.6.3 03/09/2019 DVISVGM(1)