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