Debian Codegraph @

texmf-dist/doc/man/man1/dvisvgm.1

raw
1 '\" t
2 .\" Title: dvisvgm
3 .\" Author: Martin Gieseking <[email protected]>
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\" Date: 2025-10-28
6 .\" Manual: dvisvgm Manual
7 .\" Source: dvisvgm 3.6
8 .\" Language: English
9 .\"
10 .TH "DVISVGM" "1" "2025\-10\-28" "dvisvgm 3\&.6" "dvisvgm Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 dvisvgm \- converts DVI, EPS, and PDF files to the XML\-based SVG format
32 .SH "SYNOPSIS"
33 .sp
34 \fBdvisvgm\fR [\fIoptions\fR] \fIfile\fR[\&.dvi]
35 .sp
36 \fBdvisvgm\fR \-\-eps [\fIoptions\fR] \fIfile1\fR[\&.eps] \fIfile2\fR[\&.eps] \&...
37 .sp
38 \fBdvisvgm\fR \-\-pdf [\fIoptions\fR] \fIfile\fR[\&.pdf]
39 .SH "DESCRIPTION"
40 .sp
41 The command\-line utility \fBdvisvgm\fR converts DVI files, as generated by TeX/LaTeX, to the XML\-based scalable vector graphics format SVG\&. It supports the classic DVI version 2 as well as version 3 (created by pTeX in vertical mode), and the XeTeX versions 5 to 7 which are also known as XDV\&. Besides the basic DVI commands, dvisvgm also evaluates many so\-called \fIspecials\fR which heavily extend the capabilities of the plain DVI format\&. For a more detailed overview, see section \fBSupported Specials\fR below\&.
42 .sp
43 Since the current SVG standard 1\&.1 doesn\(cqt specify multi\-page graphics, dvisvgm creates separate SVG files for each DVI page\&. Because of compatibility reasons, only the first page is converted by default\&. In order to select a different page or arbitrary page sequences, use option \fB\-p\fR which is described below\&.
44 .sp
45 SVG is a vector\-based graphics format and therefore dvisvgm tries to convert the glyph outlines of all fonts referenced in a DVI page section to scalable path descriptions\&. The fastest way to achieve this is to extract the path information from vector\-based font files available in PFB, TTF, or OTF format\&. If dvisvgm is able to find such a file, it extracts all necessary outline information about the glyphs from it\&.
46 .sp
47 However, TeX\(cqs former main source for font descriptions is Metafont, which produces bitmap output in terms of GF files\&. That\(cqs why not all obtainable TeX fonts are available in a scalable format\&. In these cases, dvisvgm tries to vectorize Metafont\(cqs output by tracing the glyph bitmaps\&. The results are not as perfect as most (manually optimized) PFB or OTF counterparts, but are nonetheless really nice in most cases\&.
48 .sp
49 When running dvisvgm without option \fB\-\-no\-fonts\fR, it creates \fIfont\fR elements (\fB<font>\fR\&...\fB</font>\fR) to embed the font data into the SVG files\&. Unfortunately, only few SVG renderers support these elements\&. Most web browsers and vector graphics applications don\(cqt evaluate them properly so that the text components of the resulting graphics might look strange\&. In order to create more compatible SVG files, command\-line option \fB\-\-no\-fonts\fR can be given to replace the font elements by plain graphics paths\&. Most web browsers (but only few external SVG renderers) also support WOFF and WOFF2 fonts that can be used instead of the default SVG fonts\&. Option \fB\-\-font\-format\fR offers the functionality to change the format applied to the fonts being embedded\&. This, however, only works when converting DVI files\&. Text present in PDF and PostScript files is always converted to path elements\&.
50 .SH "OPTIONS"
51 .sp
52 dvisvgm provides a POSIX\-compliant command\-line interface with short and long option names\&. They may be given before and/or after the name of the file to be converted\&. Also, the order of specifying the options is not significant, i\&.e\&. you can add them in any order without changing dvisvgm\(cqs behavior\&. Certain options accept or require additional parameters which are directly appended to or separated by whitespace from a short option (e\&.g\&. \fB\-v0\fR or \fB\-v 0\fR)\&. Long options require an additional equals sign (\fB=\fR) between option name and argument but without any surrounding whitespace (e\&.g\&. \fB\-\-verbosity=0\fR)\&. Multiple short options that don\(cqt expect further parameters can be combined after a single dash (e\&.g\&. \fB\-ejs\fR rather than \fB\-e \-j \-s\fR)\&.
53 .sp
54 Long option names may also be shortened by omitting trailing characters as long as the shortened name is still unambiguous\&. For example, option \fB\-\-exact\-bbox\fR can be shortened to \fB\-\-exact\fR, \fB\-\-exa\fR, or \fB\-\-ex\fR\&. In case of ambiguous abbreviations, dvisvgm prints an error message together with all matching option names\&.
55 .PP
56 \fB\-b, \-\-bbox\fR=\fIfmt\fR
57 .RS 4
58 Sets the bounding box of the generated SVG graphic to the specified format\&. This option only affects the conversion of DVI files\&. SVG documents generated from PDF and PostScript always inherit the bounding boxes of the input files\&.
59 .sp
60 Parameter
61 \fIfmt\fR
62 takes either one of the format specifiers listed below, or a sequence of four comma\- or whitespace\-separated length values
63 \fIx1\fR,
64 \fIy1\fR,
65 \fIx2\fR
66 and
67 \fIy2\fR\&. The latter define the absolute coordinates of two diagonal corners of the bounding box\&. Each length value consists of a floating point number and an optional length unit (pt, bp, cm, mm, in, pc, dd, cc, or sp)\&. If the unit is omitted, TeX points (pt) are assumed\&.
68 .sp
69 It\(cqs also possible to give only one length value
70 \fIl\fR\&. In this case, the minimal bounding box is computed and enlarged by adding (\-\fIl\fR,\-\fIl\fR) to the upper left and (\fIl\fR,\fIl\fR) to the lower right corner\&.
71 .sp
72 Additionally, dvisvgm also supports the following format specifiers:
73 .PP
74 \fBInternational DIN/ISO paper sizes\fR
75 .RS 4
76 A\fIn\fR, B\fIn\fR, C\fIn\fR, D\fIn\fR, where
77 \fIn\fR
78 is a non\-negative integer, e\&.g\&. A4 or a4 for DIN/ISO A4 format (210mm \(mu 297mm)\&.
79 .RE
80 .PP
81 \fBNorth American paper sizes\fR
82 .RS 4
83 invoice, executive, legal, letter, ledger
84 .RE
85 .PP
86 \fBSpecial bounding box sizes\fR
87 .RS 4
88 .TS
89 tab(:);
90 lt ltx
91 lt ltx
92 lt ltx
93 lt ltx
94 lt ltx.
95 T{
96 \fBdvi\fR
97 T}:T{
98 page size stored in the DVI file
99 T}
100 T{
101 \fBmin\fR
102 T}:T{
103 computes the minimal/tightest bounding box
104 T}
105 T{
106 \fBnone\fR
107 T}:T{
108 no bounding box is assigned
109 T}
110 T{
111 \fBpapersize\fR
112 T}:T{
113 box sizes specified by
114 \fIpapersize\fR
115 specials present in the DVI file
116 T}
117 T{
118 \fBpreview\fR
119 T}:T{
120 bounding box data computed by the preview package (if present in the DVI file)
121 T}
122 .TE
123 .sp 1
124 .RE
125 .PP
126 \fBPage orientation\fR
127 .RS 4
128 The default page orientation for DIN/ISO and American paper sizes is
129 \fIportrait\fR, i\&.e\&.
130 \fIwidth\fR
131 <
132 \fIheight\fR\&. Appending
133 \fB\-landscape\fR
134 or simply
135 \fB\-l\fR
136 to the format string switches to
137 \fIlandscape\fR
138 mode (\fIwidth\fR
139 >
140 \fIheight\fR)\&. For symmetry reasons you can also explicitly add
141 \fB\-portrait\fR
142 or
143 \fB\-p\fR
144 to indicate the default portrait format\&. Note that these suffixes are part of the size string and not separate options\&. Thus, they must directly follow the size specifier without additional blanks\&. Furthermore, the orientation suffixes can\(cqt be used with
145 \fBdvi\fR,
146 \fBmin\fR, and
147 \fBnone\fR\&.
148 .if n \{\
149 .sp
150 .\}
151 .RS 4
152 .it 1 an-trap
153 .nr an-no-space-flag 1
154 .nr an-break-flag 1
155 .br
156 .ps +1
157 \fBNote\fR
158 .ps -1
159 .br
160 Option
161 \fB\-b, \-\-bbox\fR
162 only affects the bounding box and does not transform the page content\&. Hence, if you choose a landscape format, the page won\(cqt be rotated\&.
163 .sp .5v
164 .RE
165 .RE
166 .RE
167 .PP
168 \fB\-B, \-\-bitmap\-format\fR=\fIfmt\fR
169 .RS 4
170 This option sets the image format used to embed bitmaps that are extracted from PostScript or PDF data\&. By default, dvisvgm embeds all bitmaps as JPEG images because it\(cqs the most compact of the two formats supported by SVG\&. To select the alternative lossless PNG format,
171 \fB\-\-bitmap\-format=png\fR
172 can be used\&. There are some more format variants dvisvgm currently supports even though
173 \fBjpeg\fR
174 and
175 \fBpng\fR
176 should be sufficient in most cases\&. The following list gives an overview of the known format names which correspond to names of Ghostscript output devices\&.
177 .TS
178 tab(:);
179 lt ltx
180 lt ltx
181 lt ltx
182 lt ltx
183 lt ltx
184 lt ltx
185 lt ltx
186 lt ltx
187 lt ltx
188 lt ltx.
189 T{
190 \fBnone\fR
191 T}:T{
192 disable processing of bitmap images
193 T}
194 T{
195 \fBjpeg\fR
196 T}:T{
197 color JPEG format
198 T}
199 T{
200 \fBjpeggray\fR
201 T}:T{
202 grayscale JPEG format
203 T}
204 T{
205 \fBpng\fR
206 T}:T{
207 grayscale or 24\-bit color PNG format depending on current color space
208 T}
209 T{
210 \fBpnggray\fR
211 T}:T{
212 grayscale PNG format
213 T}
214 T{
215 \fBpngmono\fR
216 T}:T{
217 black\-and\-white PNG format
218 T}
219 T{
220 \fBpngmonod\fR
221 T}:T{
222 dithered black\-and\-white PNG format
223 T}
224 T{
225 \fBpng16\fR
226 T}:T{
227 4\-bit color PNG format
228 T}
229 T{
230 \fBpng256\fR
231 T}:T{
232 8\-bit color PNG format
233 T}
234 T{
235 \fBpng16m\fR
236 T}:T{
237 24\-bit color PNG format
238 T}
239 .TE
240 .sp 1
241 Since the collection of supported output devices can vary among local Ghostscript installations, not all formats may be available in some environments\&. dvisvgm quits with a PostScript error message if the selected output format requires a locally unsupported output device\&.
242 .sp
243 The two JPEG format specifiers accept an optional parameter to set the IJG quality level which must directly follow the format specifier separated by a colon, e\&.g\&.
244 \fB\-\-bitmap\-format=jpeg:50\fR\&. The quality value is an integer between 0 and 100\&. Higher values result in better image quality but lower compression rates and therefore larger files\&. The default quality level is 75 which is applied if no quality parameter is given or if it\(cqs set to 0\&.
245 .RE
246 .PP
247 \fB\-C, \-\-cache\fR[=\fIdir\fR]
248 .RS 4
249 To speed up the conversion process of bitmap fonts, dvisvgm saves intermediate conversion information in cache files\&. By default, these files are stored in
250 \fB$XDG_CACHE_HOME/dvisvgm/\fR
251 or
252 \fB$HOME/\&.cache/dvisvgm\fR
253 if
254 \fBXDG_CACHE_HOME\fR
255 is not set\&. If you prefer a different location, use option
256 \fB\-\-cache\fR
257 to overwrite the default\&. Furthermore, it is also possible to disable the font caching mechanism completely with option
258 \fB\-\-cache=none\fR\&. If argument
259 \fIdir\fR
260 is omitted, dvisvgm prints the path of the default cache directory together with further information about the stored fonts\&. Additionally, outdated and corrupted cache files are removed\&.
261 .RE
262 .PP
263 \fB\-j, \-\-clipjoin\fR
264 .RS 4
265 This option tells dvisvgm to compute all intersections of clipping paths itself rather than delegating this task to the SVG renderer\&. The resulting SVG files are more portable because some SVG viewers don\(cqt support intersecting clipping paths which are defined by
266 \fIclipPath\fR
267 elements containing a
268 \fIclip\-path\fR
269 attribute\&.
270 .RE
271 .PP
272 \fB\-\-color\fR
273 .RS 4
274 Enables colorization of messages printed during the conversion process\&. The colors can be customized via environment variable
275 \fBDVISVGM_COLORS\fR\&. See the
276 Environment section
277 below for further information\&.
278 .RE
279 .PP
280 \fB\-\-colornames\fR
281 .RS 4
282 By default, dvisvgm exclusively uses RGB values of the form
283 \fI#RRGGBB\fR
284 or
285 \fI#RGB\fR
286 to represent colors in the SVG file\&. The latter is a short form for colors whose RGB components each consist of two identical hex digits, e\&.g\&.
287 \fB#123\fR
288 equals
289 \fB#112233\fR\&. According to the SVG standard, it\(cqs also possible to use color names (like
290 \fBblack\fR
291 and
292 \fBdarkblue\fR) for a limited number of
293 predefined colors (\m[blue]https://www.w3.org/TR/SVG11/types.html#ColorKeywords\m[])\&. In order to apply these color names rather than their RGB values, call dvisvgm with option
294 \fB\-\-colornames\fR\&. All colors without an SVG color name will still be represented by RGB values\&.
295 .RE
296 .PP
297 \fB\-\-comments\fR
298 .RS 4
299 Adds comments with further information about selected data to the SVG file\&. Currently, only font elements and font CSS rules related to native fonts are annotated\&.
300 .RE
301 .PP
302 \fB\-\-currentcolor\fR[=\fIcolor\fR]
303 .RS 4
304 This option tells dvisvgm to replace the specified color with CSS variable
305 \fBcurrentColor\fR
306 which holds the current foreground color set by CSS property
307 \fBcolor\fR\&. This way an application or website can change the color via CSS without the need to modify the SVG code\&.
308 .sp
309 The optional argument of
310 \fB\-\-currentcolor\fR
311 specifies the RGB color value to be replaced and must be given as either
312 six or three digit hex color value (\m[blue]https://www.w3.org/TR/css-color/#typedef-hex-color\m[])
313 preceded by character
314 \fB#\fR, e\&.g\&.
315 \fB#0000ff\fR
316 or
317 \fB#00f\fR
318 for blue\&. If the optional argument is omitted, black is assumed\&.
319 .RE
320 .PP
321 \fB\-\-embed\-bitmaps\fR
322 .RS 4
323 Embeds the contents of bitmap files into the generated SVG files instead of adding file references\&. Because of the base64\-encoded data, the SVG files are usually much bigger but at the same time more portable because they don\(cqt rely on external bitmap files\&.
324 .sp
325 This option only affects bitmaps referenced in DVI/XDV files, e\&.g\&. by
326 \fB\eincludegraphics\fR
327 or special command
328 \fBdvisvgm:img\fR
329 (see below)\&. Bitmaps present in PostScript or PDF files are always embedded\&. Also see option
330 \fBbitmap\-format\fR\&.
331 .RE
332 .PP
333 \fB\-E, \-\-eps\fR
334 .RS 4
335 If this option is given, dvisvgm does not expect a DVI but a single or multiple EPS input files, and tries to convert them to SVG\&. In order to do so, a single
336 \fIpsfile\fR
337 special command is created and forwarded to the PostScript special handler\&. This option is only available if dvisvgm was built with PostScript support enabled, and requires Ghostscript to be available\&. See option
338 \fB\-\-libgs\fR
339 for further information\&.
340 .RE
341 .PP
342 \fB\-e, \-\-exact\-bbox\fR
343 .RS 4
344 This option tells dvisvgm to compute the precise bounding box of each character\&. By default, the values stored in a font\(cqs TFM file are used to determine a glyph\(cqs extent\&. As these values are intended to implement optimal character placements and are not designed to represent the exact dimensions, they don\(cqt necessarily correspond with the bounds of the visual glyphs\&. Thus, width and/or height of some glyphs may be larger (or smaller) than the respective TFM values\&. As a result, this can lead to clipped characters at the bounds of the SVG graphics\&. With option
345 \fB\-\-exact\-bbox\fR
346 given, dvisvgm analyzes the actual shape of each character and derives a usually tight bounding box\&.
347 .sp
348 This option only affects the processing of DVI files\&. When converting EPS or PDF files, the bounding box information stored in these files are used to derive the SVG bounding box\&.
349 .RE
350 .PP
351 \fB\-f, \-\-font\-format\fR=\fIformat\fR
352 .RS 4
353 Selects the file format used to embed font data into the generated SVG output when converting DVI or PDF files\&. The latter require the new mutool\-based PDF handler introduced with dvisvgm 3\&.0 (also see option
354 \fB\-\-pdf\fR)\&. Option
355 \fB\-\-font\-format\fR
356 has no effect when converting PDF or PostScript files using Ghostscript\&. Text fragments present in these files are then always converted to path elements\&.
357 .sp
358 Following formats are supported:
359 \fBSVG\fR
360 (that\(cqs the default),
361 \fBTTF\fR
362 (TrueType),
363 \fBWOFF\fR, and
364 \fBWOFF2\fR
365 (Web Open Font Format version 1 and 2)\&. By default, dvisvgm creates unhinted fonts that might look bad on low\-resolution devices\&. In order to improve the display quality, the generated TrueType, WOFF, or WOFF2 fonts can be autohinted\&. The autohinter is enabled by appending
366 \fB,autohint\fR
367 or
368 \fB,ah\fR
369 to the font format, e\&.g\&.
370 \fB\-\-font\-format=woff,autohint\fR
371 or
372 \fB\-\-fwoff,ah\fR\&. This functionality requires the
373 ttfautohint library (\m[blue]https://freetype.org/ttfautohint\m[])\&. If it\(cqs not available or can\(cqt be found, dvisvgm issues a corresponding warning message\&.
374 .sp
375 Option
376 \fB\-\-font\-format\fR
377 is only available if dvisvgm was built with WOFF support enabled\&.
378 .RE
379 .PP
380 \fB\-m, \-\-fontmap\fR=\fIfilenames\fR
381 .RS 4
382 Loads and evaluates a single font map file or a sequence of font map files\&. These files are required to resolve font file names and encodings\&. dvisvgm does not provide its own map files but tries to read available ones coming with dvips or dvipdfm\&. If option
383 \fB\-\-fontmap\fR
384 is omitted, dvisvgm looks for the default map files
385 \fIdvisvgm\&.map\fR,
386 \fIps2pk\&.map\fR,
387 \fIpdftex\&.map\fR,
388 \fIdvipdfm\&.map\fR, and
389 \fIpsfonts\&.map\fR
390 (in this order)\&. Otherwise, the files given as option arguments are evaluated in the given order\&. Multiple filenames must be separated by commas without leading and/or trailing whitespace\&.
391 .sp
392 By default, redefined mappings do not replace previous ones\&. However, each filename can be preceded by an optional mode specifier (\fB+\fR,
393 \fB\-\fR, or
394 \fB=\fR) to change this behavior:
395 .PP
396 +mapfile
397 .RS 4
398 Only those entries in the given map file that don\(cqt redefine a font mapping are applied, i\&.e\&. fonts already mapped keep untouched\&. That\(cqs also the default mode if no mode specifier is given\&.
399 .RE
400 .PP
401 \-mapfile
402 .RS 4
403 Ensures that none of the font mappings defined in the given map file are used, i\&.e\&. previously defined mappings for the specified fonts are removed\&.
404 .RE
405 .PP
406 =mapfile
407 .RS 4
408 All mappings defined in the map file are applied\&. Previously defined settings for the same fonts are replaced\&.
409 .sp
410 If the first filename in the filename sequence is preceded by a mode specifier, dvisvgm loads the default font map (see above) and applies the other map files afterwards\&. Otherwise, none of default map files will be loaded automatically\&.
411 .sp
412 Examples:
413 \fB\-\-fontmap=myfile1\&.map,+myfile2\&.map\fR
414 loads
415 \fImyfile1\&.map\fR
416 followed by
417 \fImyfile2\&.map\fR
418 where all redefinitions of
419 \fBmyfile2\&.map\fR
420 are ignored\&.
421 \fB\-\-fontmap==myfile1\&.map,\-myfile2\&.map\fR
422 loads the default map file followed by
423 \fImyfile1\&.map\fR
424 and
425 \fImyfile2\&.map\fR
426 where all redefinitions of
427 \fImyfile1\&.map\fR
428 replace previous entries\&. Afterwards, all definitions for the fonts given in
429 \fImyfile2\&.map\fR
430 are removed from the font map tree\&.
431 .sp
432 For further information about the map file formats and the mode specifiers, see the manuals of
433 dvips (\m[blue]https://tug.org/texinfohtml/dvips.html\m[])
434 and
435 dvipdfm (\m[blue]https://ctan.org/tex-archive/dviware/dvipdfm\m[])\&.
436 .sp
437 dvisvgm supports both the
438 \fIdvips\fR
439 and the
440 \fIdvipdfm\fR
441 map file formats\&. It extends both variants by two include statements that allow for loading other map files inside a map file\&. The syntax is as follows:
442 .sp
443 .if n \{\
444 .RS 4
445 .\}
446 .nf
447 #include [<modechar>] <filename|filepath>
448 #includefirst [<modechar>] <filename|filepath>
449 .fi
450 .if n \{\
451 .RE
452 .\}
453 .sp
454 They must be placed on a separate line and start at the first column of that line\&. Otherwise, they are ignored\&. While the first variant always tries to include the specified file,
455 \fB#includefirst\fR
456 is only executed once, i\&.e\&. once a file was successfully included by this statement, all subsequent
457 \fB#includefirst\fR
458 lines are skipped\&. This can be used to include one of several alternative files, whereby the first one found is loaded and all others are ignored\&.
459 .sp
460 The optional parameter
461 \fI<modechar>\fR
462 (which can be
463 \fB+\fR,
464 \fB\-\fR, or
465 \fB=\fR) determines how to integrate the data read from the included file into the already present mapping data\&. They work the same way as the mode specifiers described above\&. If
466 \fI<modechar>\fR
467 parameter is omitted, it defaults to
468 \fB+\fR\&.
469 .sp
470 The following filename or file path specifies the file to include\&. In case of plain filenames (without path indicators), the files are looked up using the TeX file search functionality, i\&.e\&. files in the TeX directory tree can easily be added\&. Relative paths are relative to the location of the file containing the
471 \fB#include\fR
472 statement\&. Path components must be separated by forward slashes (\fB/\fR), also on Windows systems\&.
473 .sp
474 Examples:
475 \fB#include pdftex\&.map\fR
476 looks for
477 \fIpdftex\&.map\fR
478 in the current working directory and in the TeX directory tree\&.
479 \fB#include \&./pdftex\&.map\fR, on the other hand, looks for
480 \fIpdftex\&.map\fR
481 only in the directory where the including file is located\&.
482 .RE
483 .RE
484 .PP
485 \fB\-\-grad\-overlap\fR
486 .RS 4
487 Tells dvisvgm to create overlapping grid segments when approximating color gradient fills (also see option
488 \fB\-\-grad\-segments\fR
489 below)\&. By default, adjacent segments don\(cqt overlap but only touch each other like separate tiles\&. However, this alignment can lead to visible gaps between the segments because the background color usually influences the color at the boundary of the segments if the SVG renderer uses anti\-aliasing to create smooth contours\&. One way to avoid this and to create seamlessly touching color regions is to enlarge the segments so that they extend into the area of their right and bottom neighbors\&. Since the latter are drawn on top of the overlapping parts, the visible size of all segments keeps unchanged\&. Just the former gaps disappear as the background is now completely covered by the correct colors\&. Currently, dvisvgm computes the overlapping segments separately for each patch of the mesh (a patch mesh may consist of multiple patches of the same type)\&. Therefore, there still might be visible gaps at the seam of two adjacent patches\&.
490 .RE
491 .PP
492 \fB\-\-grad\-segments\fR=\fInumber\fR
493 .RS 4
494 Determines the maximum number of segments per column and row used to approximate gradient color fills\&. Since SVG 1\&.1 only supports a small subset of the shading algorithms available in PostScript, dvisvgm approximates some of them by subdividing the area to be filled into smaller, monochromatic segments\&. Each of these segments gets the average color of the region it covers\&. Thus, increasing the number of segments leads to smaller monochromatic areas and therefore a better approximation of the actual color gradient\&. As a drawback, more segments imply bigger SVG files because every segment is represented by a separate path element\&.
495 .sp
496 Currently, dvisvgm supports free\- and lattice\-form triangular patch meshes as well as Coons and tensor\-product patch meshes\&. They are approximated by subdividing the area of each patch into a
497 \fIn\fR\(mu\fIn\fR
498 grid of smaller segments\&. The maximum number of segments per column and row can be changed with option
499 \fB\-\-grad\-segments\fR\&.
500 .RE
501 .PP
502 \fB\-\-grad\-simplify\fR=\fIdelta\fR
503 .RS 4
504 If the size of the segments created to approximate gradient color fills falls below the given delta value, dvisvgm reduces their level of detail\&. For example, B\('ezier curves are replaced by straight lines, and triangular segments are combined to tetragons\&. For a small
505 \fIdelta\fR, these simplifications are usually not noticeable but reduce the size of the generated SVG files significantly\&.
506 .RE
507 .PP
508 \fB\-h, \-\-help\fR[=\fImode\fR]
509 .RS 4
510 Prints a short summary of all available command\-line options\&. The optional
511 \fImode\fR
512 parameter is an integer value between 0 and 2\&. It selects the display variant of the help text\&. Mode 0 lists all options divided into categories with section headers\&. This is also the default if dvisvgm is called without parameters\&. Mode 1 lists all options ordered by the short option names, while mode 2 sorts the lines by the long option names\&.
513 .sp
514 A values in brackets after the description text indicate the default parameter of the option\&. They are applied if an option with a mandatory parameter is not used or if an optional parameter is omitted\&. For example, option
515 \fB\-\-bbox\fR
516 requires a size parameter which defaults to
517 \fBmin\fR
518 if
519 \fB\-\-bbox\fR
520 is not used\&. Option
521 \fB\-\-zip\fR, which isn\(cqt applied by default, accepts an optional compression level parameter\&. If it\(cqs omitted, the stated default value 9 is used\&.
522 .RE
523 .PP
524 \fB\-\-keep\fR
525 .RS 4
526 Disables the removal of temporary files as created by Metafont (usually \&.gf, \&.tfm, and \&.log files) or the TrueType/WOFF module\&.
527 .RE
528 .PP
529 \fB\-\-libgs\fR=\fIpath\fR
530 .RS 4
531 This option is only available if the Ghostscript library is not directly linked to dvisvgm and if PostScript support was not completely disabled during compilation\&. In this case, dvisvgm tries to load the shared GS library dynamically during runtime\&. By default, it expects the library\(cqs name to be
532 \fBlibgs\&.so\&.X\fR
533 (on Unix\-like systems, where
534 \fBX\fR
535 is the ABI version of the library) or
536 \fBgsdll32\&.dll\fR/\fBgsdll64\&.dll\fR
537 (Windows)\&. If dvisvgm doesn\(cqt find the library, option
538 \fB\-\-libgs\fR
539 can be used to specify the correct path and filename, e\&.g\&.
540 \fB\-\-libgs=/usr/local/lib/libgs\&.so\&.9\fR
541 or
542 \fB\-\-libgs=\egs\egs9\&.25\ebin\egsdll64\&.dll\fR\&.
543 .sp
544 Alternatively, it\(cqs also possible to assign the path to environment variable
545 \fBLIBGS\fR, e\&.g\&.
546 \fBexport LIBGS=/usr/local/lib/libgs\&.so\&.9\fR
547 or
548 \fBset LIBGS=\egs\egs9\&.25\ebin\egsdll63\&.dll\fR\&.
549 \fBLIBGS\fR
550 has less precedence than the command\-line option, i\&.e\&. dvisvgm ignores variable
551 \fBLIBGS\fR
552 if
553 \fB\-\-libgs\fR
554 is given\&.
555 .RE
556 .PP
557 \fB\-L, \-\-linkmark\fR=\fIstyle\fR
558 .RS 4
559 Selects the method how to mark hyperlinked areas\&. The
560 \fIstyle\fR
561 argument can take one of the values
562 \fInone\fR,
563 \fIbox\fR, and
564 \fIline\fR, where
565 \fIbox\fR
566 is the default, i\&.e\&. a rectangle is drawn around the linked region if option
567 \fB\-\-linkmark\fR
568 is omitted\&. Style argument
569 \fIline\fR
570 just draws the lower edge of the bounding rectangle, and
571 \fInone\fR
572 tells dvisvgm not to add any visible objects to hyperlinks\&. The lines and boxes get the current text color selected\&. In order to apply a different, constant color, a colon followed by a color specifier can be appended to the style string\&. A
573 \fIcolor specifier\fR
574 is either a hexadecimal RGB value of the form
575 \fI#RRGGBB\fR, or a
576 dvips color name (\m[blue]https://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips\m[])\&.
577 .sp
578 Moreover, argument
579 \fIstyle\fR
580 can take a single color specifier to highlight the linked region by a frameless box filled with that color\&. An optional second color specifier separated by a colon selects the frame color\&.
581 .sp
582 Examples:
583 \fBbox:red\fR
584 or
585 \fBbox:#ff0000\fR
586 draws red boxes around the linked areas\&.
587 \fByellow:blue\fR
588 creates yellow filled rectangles with blue frames\&.
589 .RE
590 .PP
591 \fB\-l, \-\-list\-specials\fR
592 .RS 4
593 Prints a list of registered special handlers and exits\&. Each handler processes a set of special statements belonging to the same category\&. In most cases, these categories are identified by the prefix of the special statements which is usually a leading string followed by a colon or a blank, e\&.g\&.
594 \fIcolor\fR
595 or
596 \fIps\fR\&. The listed handler names, however, don\(cqt need to match these prefixes, e\&.g\&. if there is no common prefix or if functionality is split into separate handlers in order to allow them to be disabled separately using option
597 \fB\-\-no\-specials\fR\&. All special statements not covered by one of the special handlers are silently ignored\&.
598 .RE
599 .PP
600 \fB\-M, \-\-mag\fR=\fIfactor\fR
601 .RS 4
602 Sets the magnification factor applied in conjunction with Metafont calls prior tracing the glyphs\&. The larger this value, the better the tracing results\&. Nevertheless, large magnification values can cause Metafont arithmetic errors due to number overflows\&. So, use this option with care\&. The default setting usually produces nice results\&.
603 .RE
604 .PP
605 \fB\-\-message\fR=\fItext\fR
606 .RS 4
607 Prints a given message to the console after an SVG file has been written\&. Argument
608 \fItext\fR
609 may consist of static text as well as the macros listed below in the description of special command
610 \fBdvisvgm:raw\fR\&. For example,
611 \fB\-\-message="page {?pageno} written to {?svgfile}"\fR
612 prints the message with the macros expanded after the conversion of each page of a DVI or PDF file or after processing an EPS file\&.
613 .sp
614 The output of option
615 \fB\-\-message\fR
616 is not affected by a specified verbosity level, i\&.e\&. dvisvgm prints the text even with
617 \fB\-\-verbosity=0\fR\&.
618 .RE
619 .PP
620 \fB\-\-no\-merge\fR
621 .RS 4
622 Puts every single character in a separate
623 \fItext\fR
624 element with corresponding
625 \fIx\fR
626 and
627 \fIy\fR
628 attributes\&. By default, new
629 \fItext\fR
630 or
631 \fItspan\fR
632 elements are only created if a string starts at a location that differs from the regular position defined by the characters\*(Aq advance values\&.
633 .RE
634 .PP
635 \fB\-\-no\-mktexmf\fR
636 .RS 4
637 Suppresses the generation of missing font files\&. If dvisvgm can\(cqt find a font file through the kpathsea lookup mechanism, it calls the external tools
638 \fImktextfm\fR
639 or
640 \fImktexmf\fR\&. This option disables these calls\&.
641 .RE
642 .PP
643 \fB\-n, \-\-no\-fonts\fR[=\fIvariant\fR]
644 .RS 4
645 If this option is given, dvisvgm doesn\(cqt create SVG
646 \fIfont\fR
647 elements but uses
648 \fIpaths\fR
649 instead\&. The resulting SVG files tend to be larger but are concurrently more compatible with most applications that don\(cqt support SVG fonts\&. The optional argument
650 \fIvariant\fR
651 selects the method how to substitute fonts by paths\&. Variant 0 creates
652 \fIpath\fR
653 and
654 \fIuse\fR
655 elements in order to avoid lengthy duplicates\&. Variant 1 creates
656 \fIpath\fR
657 elements only\&. Option
658 \fB\-\-no\-fonts\fR
659 implies
660 \fB\-\-no\-styles\fR\&.
661 .RE
662 .PP
663 \fB\-c, \-\-scale\fR=\fIsx\fR[,\fIsy\fR]
664 .RS 4
665 Scales the page content horizontally by
666 \fIsx\fR
667 and vertically by
668 \fIsy\fR\&. This option is equivalent to
669 \fB\-TS\fR\fIsx\fR,\fIsy\fR\&.
670 .RE
671 .PP
672 \fB\-S, \-\-no\-specials\fR[=\fInames\fR]
673 .RS 4
674 Disable processing of special commands embedded in the DVI file\&. If no further parameter is given, all specials are ignored\&. To disable a selected set of specials, an optional comma\-separated list of names can be appended to this option\&. A
675 \fIname\fR
676 is the unique identifier referencing the intended special handler as listed by option
677 \fB\-\-list\-specials\fR\&.
678 .RE
679 .PP
680 \fB\-\-no\-styles\fR
681 .RS 4
682 By default, dvisvgm creates CSS styles and class attributes to reference fonts\&. This variant is more compact than adding the complete font information to each text element over and over again\&. However, if you prefer direct font references, the default behavior can be disabled with option
683 \fB\-\-no\-styles\fR\&.
684 .RE
685 .PP
686 \fB\-O, \-\-optimize\fR[=\fImodules\fR]
687 .RS 4
688 Applies several optimizations on the generated SVG tree to reduce the file size\&. The optimizations are performed by running separate optimizer modules specified by optional argument
689 \fImodules\fR\&. It may consist of a single module name or a comma\-separated list of several module names\&. The corresponding modules are executed one by one in the given order and thus transform the XML tree gradually\&. A leading hyphen (\fB\-\fR) can be used to exclude a module from processing\&. For example
690 \fB\-Oall,\-collapse\-groups\fR
691 performs all optimizations except
692 \fBcollapse\-groups\fR\&. If the first module name in the list starts with a hyphen, dvisvgm automatically inserts
693 \fBall\fR
694 at the beginning, i\&.e\&.
695 \fB\-O\-collapse\-groups\fR
696 is identical to
697 \fB\-Oall,\-collapse\-groups\fR\&.
698 .sp
699 The following list describes the currently available optimizer modules\&.
700 .PP
701 \fBlist\fR
702 .RS 4
703 Lists all available optimizer modules and exits\&.
704 .RE
705 .PP
706 \fBnone\fR
707 .RS 4
708 If this argument is given, dvisvgm doesn\(cqt apply any optimization\&.
709 \fBnone\fR
710 can\(cqt be combined with other module names\&.
711 .RE
712 .PP
713 \fBall\fR
714 .RS 4
715 Performs all optimizations listed below\&. This is also the default if option
716 \fB\-\-optimize\fR
717 is used without any arguments\&. The modules are executed in a predefined order that usually leads to the best results\&.
718 \fBall\fR
719 must be the only or the first entry in the list of module names\&.
720 .RE
721 .PP
722 \fBcollapse\-groups\fR
723 .RS 4
724 Combines nested group elements (\fB<g>\fR\&...\fB</g>\fR) that contain only a single attribute each\&. If possible, the group attributes are moved to the outermost element of the processed subtree\&. This module also unwraps group elements that have no attributes at all\&.
725 .RE
726 .PP
727 \fBgroup\-attributes\fR
728 .RS 4
729 Creates groups (\fB<g>\fR\&...\fB</g>\fR) for common attributes around adjacent elements\&. Each attribute is moved to a separate group so that multiple common attributes lead to nested groups\&. They can be combined by applying optimizer module
730 \fIcollapse\-groups\fR
731 afterwards\&. The algorithm only takes inheritable properties, such as
732 \fBfill\fR
733 or
734 \fBstroke\-width\fR, into account and only removes them from an element if none of the other attributes, like
735 \fBid\fR, prevents this\&.
736 .RE
737 .PP
738 \fBreassign\-clippaths\fR
739 .RS 4
740 Collects all
741 \fBclipPath\fR
742 elements that differ only by their IDs\&. Afterwards, the duplicates are removed so that only one remains\&. All
743 \fBclip\-path\fR
744 attributes referencing one of the duplicates are updated accordingly\&.
745 .RE
746 .PP
747 \fBremove\-clippaths\fR
748 .RS 4
749 Removes all redundant
750 \fIclipPath\fR
751 elements\&. This optimization was already present in former versions of dvisvgm and was always applied by default\&. This behavior is retained, i\&.e\&. dvisvgm executes this module even if option
752 \fB\-\-optimize\fR
753 is not given\&. You can use argument
754 \fInone\fR
755 to prevent that\&.
756 .RE
757 .PP
758 \fBsimplify\-text\fR
759 .RS 4
760 If a
761 \fBtext\fR
762 element only contains whitespace nodes and
763 \fBtspan\fR
764 elements, all common inheritable attributes of the latter are moved to the enclosing text element\&. All
765 \fBtspan\fR
766 elements without further attributes are unwrapped, i\&.e\&. the
767 \fBtspan\fR
768 tags are removed\&.
769 .RE
770 .PP
771 \fBsimplify\-transform\fR
772 .RS 4
773 Tries to shorten all
774 \fItransform\fR
775 attributes\&. This module combines the transformation commands of each attribute and decomposes the resulting transformation matrix into a sequence of basic transformations, i\&.e\&. translation, scaling, rotation, and skewing\&. If this sequence is shorter than the equivalent
776 \fImatrix\fR
777 expression, it\(cqs assigned to the attribute\&. Otherwise, the matrix expression is used\&.
778 .RE
779 .RE
780 .PP
781 \fB\-o, \-\-output\fR=\fIpattern\fR
782 .RS 4
783 Sets the pattern that determines the names of the generated SVG files, optionally including the file path\&. The required parameter
784 \fIpattern\fR
785 may consist of an arbitrary sequence of characters which make up the filenames or file paths relative to the current working directory\&. With the exception of the following mentioned variables and expressions, all characters are treated as static parts of the filenames/folders and are therefore identical for all pages processed during a run of dvisvgm\&. The strings
786 \fB%f\fR,
787 \fB%p\fR,
788 \fB%P\fR,
789 \fB%n\fR,
790 \fB%N\fR,
791 \fB%hd\fR,
792 \fB%ho\fR, and
793 \fB%hc\fR
794 are variables that can be used as part of the pattern\&.
795 \fB%f\fR
796 expands to the base name of the DVI file, i\&.e\&. the filename without suffix,
797 \fB%p\fR
798 is the current page number, and
799 \fB%P\fR
800 the total number of pages in the DVI file\&. The variables
801 \fB%n\fR
802 and
803 \fB%N\fR
804 expand to the number of the current file being converted (starting at 1) and the total number of files given, respectively\&.
805 .sp
806 An optional number (0\-9) specified directly after the percent sign of a variable holding a numeric value denotes the minimal number of digits to be created\&. If a particular value consists of less digits, the number is padded with leading zeros\&. Example:
807 \fB%3p\fR
808 enforces 3 digits for the current page number (001, 002, etc\&.)\&. Without an explicit width specifier,
809 \fB%p\fR
810 gets the same number of digits as
811 \fB%P\fR\&.
812 .sp
813 If you need more control over the numbering, you can use arithmetic expressions as part of the pattern\&. The syntax is
814 \fB%(\fR\fIexpr\fR\fB)\fR
815 where
816 \fIexpr\fR
817 may contain additions, subtractions, multiplications, and integer divisions with common precedence\&. The variables
818 \fBp\fR
819 and
820 \fBP\fR
821 contain the current page number and the total number of pages, respectively\&. For example,
822 \fB\-\-output="%f\-%(p\-1)"\fR
823 creates filenames where the numbering starts with 0 rather than 1\&.
824 .sp
825 The variables
826 \fB%hX\fR
827 contain different hash values computed from the DVI page data and the options given on the command\-line\&.
828 \fB%hd\fR
829 and
830 \fB%hc\fR
831 are only set if option
832 \fB\-\-page\-hashes\fR
833 is present\&. Otherwise, they are empty\&. For further information, see the description of option
834 \fB\-\-page\-hashes\fR
835 below\&.
836 .sp
837 The default pattern is
838 \fB%f\-%p\&.svg\fR
839 if the DVI file consists of more than one page, and
840 \fB%f\&.svg\fR
841 otherwise\&. That means, a DVI file
842 \fIfoo\&.dvi\fR
843 is converted to
844 \fIfoo\&.svg\fR
845 if
846 \fIfoo\&.dvi\fR
847 is a single\-page document\&. Otherwise, multiple SVG files
848 \fIfoo\-01\&.svg\fR,
849 \fIfoo\-02\&.svg\fR, etc\&. are produced\&. In Windows environments, the percent sign indicates dereferenced environment variables, and must therefore be protected by a second percent sign, e\&.g\&.
850 \fB\-\-output=%%f\-%%p\fR\&.
851 .RE
852 .PP
853 \fB\-p, \-\-page\fR=\fIranges\fR
854 .RS 4
855 This option selects the pages to be processed\&. Parameter
856 \fIranges\fR
857 consists of a comma\-separated list of single page numbers and/or page ranges\&. A page range is a pair of numbers separated by a hyphen, e\&.g\&. 5\-12\&. Thus, a page sequence might look like this: 2\-4,6,9\-12,15\&. It doesn\(cqt matter if a page is given more than once or if page ranges overlap\&. dvisvgm always extracts the page numbers in ascending order and converts them only once\&.
858 .sp
859 In order to stay compatible with previous versions, the default page sequence is
860 \fB1\fR\&. dvisvgm therefore converts only the first page and not the whole document if option
861 \fB\-\-page\fR
862 is omitted\&. Usually, page ranges consist of two numbers denoting the first and last page to be converted\&. If the conversion should start at page 1, or if it should continue up to the last DVI page, the first or second range number can be omitted, respectively\&. Example:
863 \fB\-\-page=\-10\fR
864 converts all pages up to page 10,
865 \fB\-\-page=10\-\fR
866 converts all pages starting with page 10\&. Please consider that the page values don\(cqt refer to the page numbers printed on the corresponding page\&. Instead, the physical page count is expected, where the first page always gets number 1\&.
867 .sp
868 To select the last page, expression
869 \fB%P\fR
870 can be used instead of an explicit page number\&. It\(cqs replaced by the number of the last page\&. For example,
871 \fB\-\-page=1,%P\fR
872 converts the first and the last page of the document\&.
873 .sp
874 Additionally, arithmetic expressions of the form
875 \fB%(\fR\fIexpr\fR\fB)\fR
876 in place of numbers are valid too\&. The resulting values are always rounded down to the nearest integer\&. See option
877 \fB\-\-output\fR
878 for more information about the syntax and the supported arithmetic operators\&. Example:
879 \fB\-\-page=%(P\-2)\-\fR
880 converts the last three pages\&.
881 .sp
882 At the end of the range sequence an optional filter specifier can be appended in order to remove certain page numbers from the sequence\&. Currently, the two filters
883 \fB:even\fR
884 and
885 \fB:odd\fR
886 are supported which restrict the preceding values to even and odd numbers, respectively\&. For example,
887 \fB\-\-page=1\-11,20:even\fR
888 is equivalent to
889 \fB\-\-page=2,4,6,8,10,20\fR\&.
890 .RE
891 .PP
892 \fB\-H, \-\-page\-hashes\fR[=\fIparams\fR]
893 .RS 4
894 If this option is given, dvisvgm computes hash values of all pages to be processed\&. As long as the page contents don\(cqt change, the hash value of that page stays the same\&. This property can be used to determine whether a DVI page must be converted again or can be skipped in consecutive runs of dvisvgm\&. This is done by propagating the hash value to variable
895 \fB%hd\fR
896 which can be accessed in the output pattern (see option
897 \fB\-\-output\fR)\&. By default, dvisvgm changes the output pattern to
898 \fB%f\-%hd\fR
899 if option
900 \fB\-\-page\-hashes\fR
901 is given\&. As a result, all SVG file names contain the hash value instead of the page number\&. When calling dvisvgm again with option
902 \fB\-\-page\-hashes\fR
903 with the same output pattern, it checks the existence of the SVG file to be created and skips the conversion if it\(cqs already present\&. This also applies for consecutive calls of dvisvgm with different command\-line parameters\&. If you want to force another conversion of a DVI file that hasn\(cqt changed, you must remove the corresponding SVG files beforehand or add the parameter
904 \fBreplace\fR
905 (see below)\&. If you manually set the output pattern to not contain a hash value, the conversion won\(cqt be skipped\&.
906 .sp
907 Alternatively, the output pattern may contain the variables
908 \fB%ho\fR
909 and
910 \fB%hc\fR\&.
911 \fB%ho\fR
912 expands to a 32\-bit hash representing the given command\-line options that affect the generated SVG output, like
913 \fB\-\-no\-fonts\fR
914 and
915 \fB\-\-precision\fR\&. Different combinations of options and parameters lead to different hashes\&. Thus pattern
916 \fB%f\-%hd\-%ho\fR
917 creates filenames that change depending on the DVI data and the given command\-line options\&. Variable
918 \fB%hc\fR
919 provides a combined hash computed from the DVI data and the command\-line options\&. It has the same length as
920 \fB%hd\fR\&.
921 .sp
922 Since the page number isn\(cqt part of the file name by default, different DVI pages with identical contents get the same file name\&. Therefore, only the first one is converted while the others are skipped\&. To create separate files for each page, you can add the page number to the output pattern, e\&.g\&.
923 \fB\-\-output="%f\-%p\-%hc"\fR\&.
924 .sp
925 By default, dvisvgm uses the fast XXH64 hash algorithm to compute the values provided through
926 \fB%hd\fR
927 and
928 \fB%hc\fR\&. 64\-bit hashes should be sufficient for most documents with an average size of pages\&. Alternatively, XXH32 and MD5 can be used as well\&. The desired algorithm is specified by argument
929 \fIparams\fR
930 of option
931 \fB\-\-page\-hashes\fR\&. It takes one of the strings
932 \fBMD5\fR,
933 \fBXXH32\fR, and
934 \fBXXH64\fR, where the names can be given in lower case too, like
935 \fB\-\-page\-hashes=md5\fR\&. Since version 0\&.7\&.1, xxHash provides an experimental 128\-bit hash function whose algorithm has been stabilized as of version 0\&.8\&. When using a version prior to 0\&.8, the 128\-bit hash values can vary depending on the used xxHash version\&. If the corresponding API is available, dvisvgm supports the new hash function, and option
936 \fB\-\-page\-hashes\fR
937 additionally accepts the algorithm specifier
938 \fBXXH128\fR\&.
939 .sp
940 Finally, option
941 \fB\-\-page\-hashes\fR
942 can take a second argument that must be separated by a comma\&. Currently, only the two parameters
943 \fIlist\fR
944 and
945 \fIreplace\fR
946 are evaluated, e\&.g\&.
947 \fB\-\-page\-hashes=md5,list\fR
948 or
949 \fB\-\-page\-hashes=replace\fR\&. When
950 \fIlist\fR
951 is present, dvisvgm doesn\(cqt perform any conversion but just lists the hash values
952 \fB%hd\fR
953 and
954 \fB%hc\fR
955 of the pages specified by option
956 \fB\-\-page\fR\&. Parameter
957 \fIreplace\fR
958 forces dvisvgm to convert a DVI page even if a file with the target name already exists\&.
959 .RE
960 .PP
961 \fB\-P, \-\-pdf\fR
962 .RS 4
963 If this option is given, dvisvgm does not expect a DVI but a PDF input file, and tries to convert it to SVG\&. Similar to the conversion of DVI files, only the first page is processed by default\&. Option
964 \fB\-\-page\fR
965 can be used to select different pages, page ranges, and/or page sequences\&.
966 .sp
967 If a Ghostscript version < 10\&.01\&.0 is found, dvisvgm uses Ghostscript to process the PDF file\&. In this case, the conversion is realized by creating a single
968 \fIpdffile\fR
969 special command which is forwarded to dvisvgm\(cqs PostScript special handler\&. Therefore, this option is only available if dvisvgm was built with PostScript support enabled, and requires Ghostscript to be accessible\&. See option
970 \fB\-\-libgs\fR
971 for further information\&.
972 .sp
973 As of Ghostscript 10\&.01\&.0, this will no longer work due to the introduction of a new PDF interpreter\&. Therefore, an alternative conversion module based on
974 \fImutool\fR, a utility which is part of the
975 MuPDF (\m[blue]https://mupdf.com\m[])
976 package, has been introduced\&. It\(cqs automatically invoked if Ghostscript can\(cqt be used and if a working
977 \fBmutool\fR
978 executable is present in a directory which is part of the system\(cqs search path\&.
979 .sp
980 Alternatively, environment variable
981 \fBDVISVGM_PDF_PROC\fR
982 can be used to select the PDF processor\&. The currently supported values are
983 \fBgs\fR
984 and
985 \fBmutool\fR\&.
986 .RE
987 .PP
988 \fB\-d, \-\-precision\fR=\fIdigits\fR
989 .RS 4
990 Specifies the maximum number of decimal places applied to floating\-point attribute values\&. All attribute values written to the generated SVG file(s) are rounded accordingly\&. The parameter
991 \fIdigits\fR
992 accepts integer values from 0 to 6, where 0 enables the automatic selection of significant decimal places\&. This is also the default value if dvisvgm is called without option
993 \fB\-\-precision\fR\&.
994 .RE
995 .PP
996 \fB\-\-progress\fR[=\fIdelay\fR]
997 .RS 4
998 Enables a simple progress indicator shown when time\-consuming operations like PostScript specials are processed\&. The indicator doesn\(cqt appear before the given delay (in seconds) has elapsed\&. The default delay value is 0\&.5 seconds\&.
999 .RE
1000 .PP
1001 \fB\-r, \-\-rotate\fR=\fIangle\fR
1002 .RS 4
1003 Rotates the page content clockwise by
1004 \fIangle\fR
1005 degrees around the page center\&. This option is equivalent to
1006 \fB\-TR\fR\fIangle\fR\&.
1007 .RE
1008 .PP
1009 \fB\-R, \-\-relative\fR
1010 .RS 4
1011 SVG allows you to define graphics paths by a sequence of absolute and/or relative path commands, i\&.e\&. each command expects either absolute coordinates or coordinates relative to the current drawing position\&. By default, dvisvgm creates paths made up of absolute commands\&. If option
1012 \fB\-\-relative\fR
1013 is given, relative commands are created instead\&. This slightly reduces the size of the SVG files in most cases\&.
1014 .RE
1015 .PP
1016 \fB\-\-stdin\fR
1017 .RS 4
1018 Tells dvisvgm to read the DVI or EPS input data from
1019 \fBstdin\fR
1020 instead from a file\&. Alternatively to option
1021 \fB\-\-stdin\fR, a single dash (\-) can be given\&. The default name of the generated SVG file is
1022 \fIstdin\&.svg\fR
1023 which can be changed with option
1024 \fB\-\-output\fR\&.
1025 .RE
1026 .PP
1027 \fB\-s, \-\-stdout\fR
1028 .RS 4
1029 Don\(cqt write the SVG output to a file but redirect it to
1030 \fBstdout\fR\&.
1031 .RE
1032 .PP
1033 \fB\-\-tmpdir\fR[=\fIpath\fR]
1034 .RS 4
1035 In some cases, dvisvgm needs to create temporary files to work properly\&. These files go to the system\(cqs temporary folder by default, e\&.g\&.
1036 \fB/tmp\fR
1037 on Linux systems\&. Option
1038 \fB\-\-tmpdir\fR
1039 can be used to specify a different location\&. Please note that dvisvgm does not create this folder if it doesn\(cqt exist\&. Therefore, you must ensure that it\(cqs actually present before running dvisvgm\&.
1040 .sp
1041 In order to prevent colliding files caused by parallel calls of dvisvgm, the program doesn\(cqt write the files directly in the specified directory but furthermore creates a uniquely named subfolder in there, where the temporary files will be placed\&. This can be prevented by appending
1042 \fB//\fR
1043 or
1044 \fB\e\e\fR
1045 (on Windows) to the specified directory name\&. For example,
1046 \fB\-\-tmpdir=\&.//\fR
1047 creates the temporary files directly in the current working directory, while
1048 \fB\-\-tmpdir=\&.\fR
1049 places them in a dedicated subfolder of the current working directory\&.
1050 .sp
1051 If the optional parameter
1052 \fIpath\fR
1053 of option
1054 \fB\-\-tmpdir\fR
1055 is omitted, dvisvgm prints the location of the system\(cqs temp folder and exits\&.
1056 .RE
1057 .PP
1058 \fB\-a, \-\-trace\-all\fR=[\fIretrace\fR]
1059 .RS 4
1060 This option forces dvisvgm to vectorize not only the glyphs actually required to render the SVG file correctly \(en which is the default \(en, but processes all glyphs of all fonts referenced in the DVI file\&. Because dvisvgm stores the tracing results in a font cache, all following conversions of these fonts will speed up significantly\&. The boolean option
1061 \fIretrace\fR
1062 determines how to handle glyphs already stored in the cache\&. By default, these glyphs are skipped\&. Setting argument
1063 \fIretrace\fR
1064 to
1065 \fIyes\fR
1066 or
1067 \fItrue\fR
1068 forces dvisvgm to retrace the corresponding bitmaps again\&.
1069 .if n \{\
1070 .sp
1071 .\}
1072 .RS 4
1073 .it 1 an-trap
1074 .nr an-no-space-flag 1
1075 .nr an-break-flag 1
1076 .br
1077 .ps +1
1078 \fBNote\fR
1079 .ps -1
1080 .br
1081 This option only takes effect if font caching is active\&. Therefore,
1082 \fB\-\-trace\-all\fR
1083 cannot be combined with option
1084 \fB\-\-cache=none\fR\&.
1085 .sp .5v
1086 .RE
1087 .RE
1088 .PP
1089 \fB\-T, \-\-transform\fR=\fIcommands\fR
1090 .RS 4
1091 Applies a sequence of transformations to the SVG content\&. Each transformation is described by a
1092 \fIcommand\fR
1093 beginning with a capital letter followed by a list of comma\-separated parameters\&. Following transformation commands are supported:
1094 .PP
1095 \fBT\fR \fItx\fR[,\fIty\fR]
1096 .RS 4
1097 Translates (moves/shifts) the page in direction of vector (\fItx\fR,\fIty\fR)\&. If
1098 \fIty\fR
1099 is omitted,
1100 \fIty\fR=0 is assumed\&. The expected unit length of
1101 \fItx\fR
1102 and
1103 \fIty\fR
1104 are TeX points (1pt = 1/72\&.27in)\&. However, there are several constants defined to simplify the unit conversion (see below)\&.
1105 .RE
1106 .PP
1107 \fBS\fR \fIsx\fR[,\fIsy\fR]
1108 .RS 4
1109 Scales the page horizontally by
1110 \fIsx\fR
1111 and vertically by
1112 \fIsy\fR\&. If
1113 \fIsy\fR
1114 is omitted,
1115 \fIsy\fR=\fIsx\fR
1116 is assumed\&.
1117 .RE
1118 .PP
1119 \fBR\fR \fIangle\fR[,\fIx\fR,\fIy\fR]
1120 .RS 4
1121 Rotates the page clockwise by
1122 \fIangle\fR
1123 degrees around point (\fIx\fR,\fIy\fR)\&. If the optional arguments
1124 \fIx\fR
1125 and
1126 \fIy\fR
1127 are omitted, the page will be rotated around its center depending on the chosen page format\&. When option
1128 \fB\-bnone\fR
1129 is given, the rotation center is origin (0,0)\&.
1130 .RE
1131 .PP
1132 \fBKX\fR \fIangle\fR
1133 .RS 4
1134 Skews the page along the
1135 \fIx\fR\-axis by
1136 \fIangle\fR
1137 degrees\&. Argument
1138 \fIangle\fR
1139 can take any value except 90+180\fIk\fR, where
1140 \fIk\fR
1141 is an integer\&.
1142 .RE
1143 .PP
1144 \fBKY\fR \fIangle\fR
1145 .RS 4
1146 Skews the page along the
1147 \fIy\fR\-axis by
1148 \fIangle\fR
1149 degrees\&. Argument
1150 \fIangle\fR
1151 can take any value except 90+180\fIk\fR, where
1152 \fIk\fR
1153 is an integer\&.
1154 .RE
1155 .PP
1156 \fBFH\fR [\fIy\fR]
1157 .RS 4
1158 Mirrors (flips) the page at the horizontal line through point (0,\fIy\fR)\&. Omitting the optional argument leads to
1159 \fIy\fR=\fIh\fR/2, where
1160 \fIh\fR
1161 denotes the page height (see
1162 \fIpre\-defined constants\fR
1163 below)\&.
1164 .RE
1165 .PP
1166 \fBFV\fR [\fIx\fR]
1167 .RS 4
1168 Mirrors (flips) the page at the vertical line through point (\fIx\fR,0)\&. Omitting the optional argument leads to
1169 \fIx\fR=\fIw\fR/2, where
1170 \fIw\fR
1171 denotes the page width (see
1172 \fIpre\-defined constants\fR
1173 below)\&.
1174 .RE
1175 .PP
1176 \fBM\fR \fIm1\fR,\&...,\fIm6\fR
1177 .RS 4
1178 Applies a transformation described by the 3\(mu3 matrix ((\fIm1\fR,\fIm2\fR,\fIm3\fR),(\fIm4\fR,\fIm5\fR,\fIm6\fR),(0,0,1)), where the inner triples denote the rows\&.
1179 .if n \{\
1180 .sp
1181 .\}
1182 .RS 4
1183 .it 1 an-trap
1184 .nr an-no-space-flag 1
1185 .nr an-break-flag 1
1186 .br
1187 .ps +1
1188 \fBNote\fR
1189 .ps -1
1190 .br
1191 All transformation commands of option
1192 \fB\-T, \-\-transform\fR
1193 are applied in the order of their appearance\&. Multiple commands can optionally be separated by spaces\&. In this case the whole transformation string has to be enclosed in double quotes to keep them together\&. All parameters are expressions of floating point type\&. You can either give plain numbers or arithmetic terms combined by the operators
1194 \fB+\fR
1195 (addition),
1196 \fB\-\fR
1197 (subtraction),
1198 \fB*\fR
1199 (multiplication),
1200 \fB/\fR
1201 (division) or
1202 \fB%\fR
1203 (modulo) with common associativity and precedence rules\&. Parentheses may be used as well\&.
1204 .sp
1205 Additionally, some pre\-defined constants are provided:
1206 .TS
1207 tab(:);
1208 lt ltx
1209 lt ltx
1210 lt ltx
1211 lt ltx.
1212 T{
1213 \fBux\fR
1214 T}:T{
1215 horizontal position of upper left page corner in TeX point units
1216 T}
1217 T{
1218 \fBuy\fR
1219 T}:T{
1220 vertical position of upper left page corner in TeX point units
1221 T}
1222 T{
1223 \fBh\fR
1224 T}:T{
1225 page height in TeX point units (0 in case of
1226 \fB\-bnone\fR)
1227 T}
1228 T{
1229 \fBw\fR
1230 T}:T{
1231 page width in TeX point units (0 in case of
1232 \fB\-bnone\fR)
1233 T}
1234 .TE
1235 .sp 1
1236 Furthermore, you can use the 9 length constants
1237 \fBpt\fR,
1238 \fBbp\fR,
1239 \fBcm\fR,
1240 \fBmm\fR,
1241 \fBin\fR,
1242 \fBpc\fR,
1243 \fBdd\fR,
1244 \fBcc\fR, and
1245 \fBsp\fR, e\&.g\&.
1246 \fB2cm\fR
1247 or
1248 \fB1\&.6in\fR\&. Thus, option
1249 \fB\-TT1in,0R45\fR
1250 moves the page content 1 inch to the right and rotates it by 45 degrees around the page center afterwards\&.
1251 .sp
1252 For single transformations, there are also the short\-hand options
1253 \fB\-c\fR,
1254 \fB\-t\fR
1255 and
1256 \fB\-r\fR
1257 available\&. In contrast to the
1258 \fB\-\-transform\fR
1259 commands, the order of these options is not significant, so that it\(cqs not possible to describe transformation sequences with them\&.
1260 .sp .5v
1261 .RE
1262 .RE
1263 .RE
1264 .PP
1265 \fB\-t, \-\-translate\fR=\fItx\fR[,\fIty\fR]
1266 .RS 4
1267 Translates (moves) the page content in direction of vector (\fItx\fR,\fIty\fR)\&. This option is equivalent to
1268 \fB\-TT\fR\fItx\fR,\fIty\fR\&.
1269 .RE
1270 .PP
1271 \fB\-v, \-\-verbosity\fR=\fIlevel\fR
1272 .RS 4
1273 Controls the type of messages printed during a dvisvgm run:
1274 .TS
1275 tab(:);
1276 lt ltx
1277 lt ltx
1278 lt ltx
1279 lt ltx
1280 lt ltx.
1281 T{
1282 \fB0\fR
1283 T}:T{
1284 no message output at all
1285 T}
1286 T{
1287 \fB1\fR
1288 T}:T{
1289 error messages only
1290 T}
1291 T{
1292 \fB2\fR
1293 T}:T{
1294 warning messages only
1295 T}
1296 T{
1297 \fB4\fR
1298 T}:T{
1299 informational messages only
1300 T}
1301 T{
1302 \fB8\fR
1303 T}:T{
1304 user messages only (e\&.g\&. created by special
1305 \fBdvisvgm:message\fR)
1306 T}
1307 .TE
1308 .sp 1
1309 .if n \{\
1310 .sp
1311 .\}
1312 .RS 4
1313 .it 1 an-trap
1314 .nr an-no-space-flag 1
1315 .nr an-break-flag 1
1316 .br
1317 .ps +1
1318 \fBNote\fR
1319 .ps -1
1320 .br
1321 By adding these values you can combine the categories\&. The default level is 15, i\&.e\&. all messages are printed\&.
1322 .sp .5v
1323 .RE
1324 .RE
1325 .PP
1326 \fB\-V, \-\-version\fR[=\fIextended\fR]
1327 .RS 4
1328 Prints the version of dvisvgm and exits\&. If the optional argument is set to
1329 \fIyes\fR, the version numbers of the linked libraries are printed as well\&.
1330 .RE
1331 .PP
1332 \fB\-z, \-\-zip\fR[=\fIlevel\fR]
1333 .RS 4
1334 Creates a compressed SVG file with suffix \&.svgz\&. The optional argument specifies the compression level\&. Valid values are in the range of 1 to 9 (default value is 9)\&. Larger values cause better compression results but may take slightly more computation time\&.
1335 .RE
1336 .PP
1337 \fB\-Z, \-\-zoom\fR=\fIfactor\fR
1338 .RS 4
1339 Multiplies the values of the
1340 \fIwidth\fR
1341 and
1342 \fIheight\fR
1343 attributes of the SVG root element by argument
1344 \fIfactor\fR
1345 while the coordinate system of the graphic content is retained\&. As a result, most SVG viewers zoom the graphics accordingly\&. If a negative zoom factor is given, the
1346 \fIwidth\fR
1347 and
1348 \fIheight\fR
1349 attributes are omitted\&.
1350 .RE
1351 .SH "SUPPORTED SPECIALS"
1352 .sp
1353 dvisvgm supports several \fIspecial commands\fR that enrich the DVI command set with additional instructions for features, like color, graphics, and hyperlinks\&. The term \fIspecial command\fR, or just \fIspecial\fR, originates from the TeX command \fB\especial{\&...}\fR which does almost nothing\&. TeX only forwards the argument of this command to the DVI file using the corresponding \fIxxx\fR opcode, thus delegating its execution to the DVI driver\&. The driver can then decide to either process or ignore it, depending on the supported statements\&. The parameter of TeX\(cqs \fB\especial\fR command is given in curly braces and may consist of an arbitrary character sequence representing the actual instruction, for example \fBcolor Red\fR\&.
1354 .sp
1355 It might be worth mentioning that specials are only evaluated when processing DVI files\&. PS/EPS and PDF don\(cqt know anything about the concept of specials and therefore don\(cqt provide means to represent them\&.
1356 .sp
1357 In order to evaluate the special commands, dvisvgm implements several dedicated handlers\&. Each handler is responsible for all special statements belonging to the same command set, i\&.e\&. commands usually \(en but not necessarily \(en beginning with a common prefix\&. For example, all PDF specials start with the prefix \fBpdf:\fR, while the TPIC special set consists of 13 different commands without common identifier\&. The PDF specials are processed by dvisvgm\(cqs \fIpdf\fR handler, the TPIC ones by the \fItpic\fR handler\&. To get a list of the actually provided special handlers, use option \fB\-\-list\-specials\fR (see above)\&. The following list gives an overview of the special sets currently supported\&. The names of the handlers can also be used to disable the processing of individual sets of specials\&. For further information on this, see option \fB\-\-no\-specials\fR\&.
1358 .PP
1359 \fBbgcolor\fR
1360 .RS 4
1361 Special statements for changing the background/page color\&. Currently, dvisvgm only supports the
1362 \fBbackground\fR
1363 statement as specified in the
1364 dvips manual (\m[blue]https://tug.org/texinfohtml/dvips.html#Color-specifications\m[])\&. Since SVG 1\&.1 doesn\(cqt support background colors, dvisvgm inserts a rectangle of the chosen color into the generated SVG document\&. This rectangle always gets the same size as the selected or computed bounding box\&. This background color command is part of the color special set but is handled separately in order to let the user turn it off\&.
1365 .RE
1366 .PP
1367 \fBcolor\fR
1368 .RS 4
1369 Statements of this command set provide instructions to change the text/paint color\&. For an overview of the exact syntax, see the documentation of dvips, for instance\&.
1370 .sp
1371 dvisvgm extends the dvips syntax of the color specials by two optional modifiers to enable the differentiation between fill and stroke colors, i\&.e\&. colors used to fill enclosed areas and to draw lines, respectively\&. If one of the color specifiers, like a color name or a color model followed by a sequence of color components, is preceded by
1372 \fBfill\fR
1373 or
1374 \fBstroke\fR, only the corresponding color is changed\&. Without these modifiers both colors are affected\&. Example:
1375 \fBcolor push fill rgb 1 0 1\fR
1376 pushes a new color pair onto the color stack whereby the fill color is set to magenta and the stroke color retains its current value\&.
1377 \fBcolor push rgb 1 0 1\fR
1378 pushes a color pair with both colors set to magenta\&.
1379 .sp
1380 Additionally, the new special
1381 \fBcolor set\fR
1382 is introduced\&. Its syntax is the same as the one of
1383 \fBcolor push\fR
1384 including the optional
1385 \fBfill\fR
1386 and
1387 \fBstroke\fR
1388 modifiers\&. Instead of pushing a new color pair it modifies the topmost one on the stack\&. If the color stack is empty, the default (black) fill/stroke color is changed\&.
1389 .RE
1390 .PP
1391 \fBdvisvgm\fR
1392 .RS 4
1393 The following list gives a brief overview of dvisvgm\(cqs own set of currently supported specials\&.
1394 .PP
1395 \fBdvisvgm:raw\fR \fItext\fR
1396 .RS 4
1397 Adds an arbitrary sequence of XML nodes to the page section of the SVG document\&. dvisvgm checks syntax and proper nesting of the inserted elements but does not perform any validation, thus the user has to ensure that the resulting SVG is still valid\&. Opening and closing tags may be distributed among different
1398 \fIraw\fR
1399 specials\&. The tags themselves can also be split but must be continued with the immediately following
1400 \fIraw\fR
1401 special\&. Both syntactically incorrect and wrongly nested tags lead to error messages\&.
1402 .sp
1403 Parameter
1404 \fItext\fR
1405 may also contain the expressions
1406 \fB{?x}\fR,
1407 \fB{?y}\fR,
1408 \fB{?color}\fR,
1409 \fB{?fillcolor}\fR,
1410 \fB{?strokecolor}\fR,
1411 \fB{?matrix}\fR,
1412 \fB{?pageno}\fR,
1413 \fB{?svgfile}\fR, and
1414 \fB{?svgpath}\fR
1415 that respectively expand to the current
1416 \fIx\fR
1417 and
1418 \fIy\fR
1419 coordinate, an RGB hex string of the current active fill and stroke color, the current transformation matrix, the current page number, and the relative and absolute path of the SVG file being created\&.
1420 \fB{?color}\fR
1421 expands to the same string as
1422 \fB{?fillcolor}\fR
1423 and is still available for compatibility with older dvisvgm versions that didn\(cqt distinguish between fill and stroke colors (see information about color specials below)\&.
1424 .sp
1425 As SVG doesn\(cqt support CMYK colors, for example in
1426 \fBfill\fR
1427 and
1428 \fBstroke\fR
1429 attributes, dvisvgm provides macro
1430 \fB{?cmyk(\fR\fB\fIc\fR\fR\fB,\fR\fB\fIm\fR\fR\fB,\fR\fB\fIy\fR\fR\fB,\fR\fB\fIk\fR\fR\fB)}\fR
1431 to create an RGB hex string from a CMYK color\&. It can be used instead of a combination of color/PostScript specials and color macros to directly insert a CMYK color value\&.
1432 .sp
1433 Character sequence
1434 \fB{?nl}\fR
1435 expands to a newline character\&. Finally, constructions of the form
1436 \fB{?(\fR\fB\fIexpr\fR\fR\fB)}\fR
1437 enable the evaluation of mathematical expressions which may consist of basic arithmetic operations including modulo\&. As above, the variables
1438 \fIx\fR
1439 and
1440 \fIy\fR
1441 represent the current coordinates\&. Invalid operations, like divisions by zero, lead to an error message on the console\&. Example:
1442 \fB{?(\-10*(x+2y)\-5)}\fR
1443 is a valid expression and expands to the corresponding numeric string\&.
1444 .RE
1445 .PP
1446 \fBdvisvgm:rawdef\fR \fItext\fR
1447 .RS 4
1448 This command is similar to
1449 \fBdvisvgm:raw\fR, but puts the XML nodes into the <defs> section of the SVG document currently being generated\&.
1450 .RE
1451 .PP
1452 \fBdvisvgm:rawset\fR \fIname\fR \&... \fBdvisvgm:endrawset\fR
1453 .RS 4
1454 This pair of specials marks the begin and end of a definition of a named raw SVG fragment\&. All
1455 \fBdvisvgm:raw\fR
1456 and
1457 \fBdvisvgm:rawdef\fR
1458 specials enclosed by
1459 \fBdvisvgm:rawset\fR
1460 and
1461 \fBdvisvgm:endrawset\fR
1462 are not evaluated immediately but stored together under the given
1463 \fIname\fR
1464 for later use\&. Once defined, the named fragment can be referenced throughout the DVI file by
1465 \fBdvisvgm:rawput\fR
1466 (see below)\&. The two commands
1467 \fBdvisvgm:rawset\fR
1468 and
1469 \fBdvisvgm:endrawset\fR
1470 must not be nested, i\&.e\&. each call of
1471 \fBdvisvgm:rawset\fR
1472 has to be followed by a corresponding call of
1473 \fBdvisvgm:endrawset\fR
1474 before another
1475 \fBdvisvgm:rawset\fR
1476 may occur\&. Also, the identifier
1477 \fIname\fR
1478 must be unique throughout the DVI file\&. Using
1479 \fBdvisvgm:rawset\fR
1480 multiple times together with the same
1481 \fIname\fR
1482 leads to warning messages\&.
1483 .RE
1484 .PP
1485 \fBdvisvgm:rawput\fR \fIname\fR
1486 .RS 4
1487 Inserts raw SVG fragments previously stored under the given
1488 \fIname\fR\&. dvisvgm distinguishes between fragments that were specified with
1489 \fBdvisvgm:raw\fR
1490 or
1491 \fBdvisvgm:rawdef\fR, and handles them differently: It inserts all
1492 \fBdvisvgm:raw\fR
1493 parts every time
1494 \fBdvisvgm:rawput\fR
1495 is called, whereas the
1496 \fBdvisvgm:rawdef\fR
1497 portions go to the <defs> section of the current SVG document only once\&.
1498 .RE
1499 .PP
1500 \fBdvisvgm:img\fR \fIwidth\fR \fIheight\fR \fIfile\fR
1501 .RS 4
1502 Creates an
1503 \fBimage\fR
1504 element using the current graphic position, transformation matrix, the specified extents, and the given filename\&. This special command also updates the bounding box of the resulting SVG to entirely enclose the transformed image\&. The image itself is positioned such that the lower left corner of the untransformed image lies at the current graphic position\&. The length
1505 \fIwidth\fR
1506 and
1507 \fIheight\fR
1508 specify the extents of the untransformed image\&. For a list of supported length units see option
1509 \fB\-\-bbox\fR\&. Plain numbers without an appended unit specifier imply TeX points (1in = 72\&.27pt)\&.
1510 .sp
1511 Parameter
1512 \fIfile\fR
1513 can be a plain filename or a relative or absolute path of a file\&. By default, dvisvgm just creates links referencing the image file so that the SVG renderer will evaluate the filename or path relative to the location of the generated SVG file\&. If option
1514 \fB\-\-embed\-bitmaps\fR
1515 is given, JPEG and PNG images are embedded into the SVG document\&. As this requires base64\-encoding of the image data, the resulting SVG files can become quite big\&.
1516 .RE
1517 .PP
1518 \fBdvisvgm:bbox\fR lock
1519 .RS 4
1520 Locks the bounding box of the current page and prevents it from further updating, i\&.e\&. graphics elements added after calling this special are not taken into account in determining the extent of the bounding box\&.
1521 .RE
1522 .PP
1523 \fBdvisvgm:bbox\fR unlock
1524 .RS 4
1525 Unlocks the previously locked bounding box of the current page so that it gets updated again when adding graphics elements to the page\&.
1526 .RE
1527 .PP
1528 \fBdvisvgm:bbox\fR n[ew] \fIname\fR
1529 .RS 4
1530 Defines or resets a local bounding box called
1531 \fIname\fR\&. The name may consist of letters and digits\&. While processing a DVI page, dvisvgm continuously updates the (global) bounding box of the current page in order to determine the minimal rectangle containing all visible page components (characters, images, drawing elements etc\&.) Additionally to the global bounding box, the user can request an arbitrary number of named local bounding boxes\&. Once defined, these boxes are updated together with the global bounding box starting with the first character that follows the definition\&. Thus, the local boxes can be used to compute the extent of parts of the page\&. This is useful for scenarios where the generated SVG file is post\-processed\&.
1532 .sp
1533 In conjunction with special
1534 \fBdvisvgm:raw\fR, the macro
1535 \fB{?bbox \fR\fB\fIname\fR\fR\fB}\fR
1536 expands to the four values
1537 \fIx\fR,
1538 \fIy\fR,
1539 \fIw\fR, and
1540 \fIh\fR
1541 (separated by spaces) specifying the coordinates of the upper left corner, width, and height of the local box
1542 \fIname\fR\&. If box
1543 \fIname\fR
1544 wasn\(cqt previously defined, all four values equal to zero\&.
1545 .RE
1546 .PP
1547 \fBdvisvgm:bbox\fR \fIwidth\fR \fIheight\fR [\fIdepth\fR] [\fBtransform\fR]
1548 .RS 4
1549 Updates the bounding box of the current page by embedding a virtual rectangle (\fIx\fR,
1550 \fIy\fR,
1551 \fIwidth\fR,
1552 \fIheight\fR) where the lower left corner is located at the current DVI drawing position (\fIx\fR,\fIy\fR)\&. If the optional parameter
1553 \fIdepth\fR
1554 is specified, dvisvgm embeds a second rectangle (\fIx\fR,
1555 \fIy\fR,
1556 \fIwidth\fR, \-\fIdepth\fR)\&. The lengths
1557 \fIwidth\fR,
1558 \fIheight\fR, and
1559 \fIdepth\fR
1560 can be given together with a unit specifier (see option
1561 \fB\-\-bbox\fR) or as plain floating point numbers\&. In the latter case, TeX point units are assumed (1in = 72\&.27pt)\&. Depending on size and position of the virtual rectangle, this command either enlarges the overall bounding box or leaves it as is\&. So, it\(cqs not possible to reduce its extent\&.
1562 .sp
1563 This special is supposed to be used together with
1564 \fBdvisvgm:raw\fR
1565 in order to update the viewport of the page properly\&. By default, the box extents are assigned unchanged and, in particular, are not altered by transformation commands\&. In order to apply the current transformation matrix, the optional modifier
1566 \fBtransform\fR
1567 can be added at the end of the special statement\&.
1568 .RE
1569 .PP
1570 \fBdvisvgm:bbox\fR a[bs] \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fR [\fBtransform\fR]
1571 .RS 4
1572 This variant of the bbox special updates the bounding box by embedding a virtual rectangle (\fIx1\fR,\fIy1\fR,\fIx2\fR,\fIy2\fR)\&. The points (\fIx1\fR,\fIy1\fR) and (\fIx2\fR,\fIy2\fR) denote the absolute coordinates of two diagonal corners of the rectangle\&. As with the relative special variant described above, the optional modifier
1573 \fBtransform\fR
1574 allows for applying the current transformation matrix to the bounding box\&.
1575 .RE
1576 .PP
1577 \fBdvisvgm:bbox\fR f[ix] \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fR [\fBtransform\fR]
1578 .RS 4
1579 This variant of the bbox special assigns an absolute (final) bounding box to the resulting SVG\&. After executing this command, dvisvgm doesn\(cqt further alter the bounding box coordinates, except this special is called again later\&. The points (\fIx1\fR,\fIy1\fR) and (\fIx2\fR,\fIy2\fR) denote the absolute coordinates of two diagonal corners of the rectangle\&. As with the relative special variant described above, the optional modifier
1580 \fBtransform\fR
1581 allows for applying the current transformation matrix to the bounding box\&.
1582 .sp
1583 The following TeX fragment adds two raw SVG elements to the output and updates the bounding box accordingly:
1584 .sp
1585 .if n \{\
1586 .RS 4
1587 .\}
1588 .nf
1589 \especial{dvisvgm:raw <circle cx=\*(Aq{?x}\*(Aq cy=\*(Aq{?y}\*(Aq r=\*(Aq10\*(Aq stroke=\*(Aqblack\*(Aq fill=\*(Aqred\*(Aq/>}%
1590 \especial{dvisvgm:bbox 10bp 10bp 10bp transform}%
1591 \especial{dvisvgm:bbox \-10bp 10bp 10bp transform}
1592
1593 \especial{dvisvgm:raw <path d=\*(AqM50 200 L10 250 H100 Z\*(Aq stroke=\*(Aqblack\*(Aq fill=\*(Aqblue\*(Aq/>}%
1594 \especial{dvisvgm:bbox abs 10bp 200bp 100bp 250bp transform}
1595 .fi
1596 .if n \{\
1597 .RE
1598 .\}
1599 .RE
1600 .PP
1601 \fBdvisvgm:currentcolor\fR [on|off]
1602 .RS 4
1603 This special works similar to option
1604 \fB\-\-currentcolor\fR
1605 but doesn\(cqt require an explicit color argument\&. Instead, it takes the currently active color and replaces it with
1606 \fBcurrentColor\fR\&. Therefore, the result depends on both the placement of the special and the preceding color changes\&. Argument
1607 \fBon\fR
1608 \(en which activates the
1609 \fIcurrentColor\fR
1610 functionality \(en can be omitted\&. When called with argument
1611 \fBoff\fR, the functionality is deactivated again\&.
1612 .RE
1613 .PP
1614 \fBdvisvgm:message\fR \fImsg\fR
1615 .RS 4
1616 Prints the given text
1617 \fImsg\fR
1618 to the console\&. Besides static text it may also contain the macros
1619 \fB{?\&...}\fR
1620 mentioned in the description of
1621 \fBdvisvgm:raw\fR\&. The messages created by this special can be suppressed with option
1622 \fB\-\-verbosity\fR
1623 (see above)\&.
1624 .RE
1625 .RE
1626 .PP
1627 \fBem\fR
1628 .RS 4
1629 These specials were introduced with the
1630 \fIemTeX\fR
1631 distribution by Eberhard Mattes\&. They provide line drawing statements, instructions for embedding MSP, PCX, and BMP image files, as well as two PCL commands\&. dvisvgm supports only the line drawing statements and ignores all other em specials silently\&. A description of the command syntax can be found in the DVI driver documentation coming with
1632 emTeX (\m[blue]https://ctan.org/pkg/emtex\m[])\&.
1633 .RE
1634 .PP
1635 \fBhtml\fR
1636 .RS 4
1637 The hyperref specification defines several variants on how to mark hyperlinked areas in a DVI file\&. dvisvgm supports the plain HyperTeX special constructs as created with hyperref package option
1638 \fIhypertex\fR\&. By default, all linked areas of the document are marked by a rectangle\&. Option
1639 \fB\-\-linkmark\fR
1640 allows you to change this behavior\&. See above for further details\&. Information on syntax and semantics of the HyperTeX specials can be found in the
1641 hyperref manual (\m[blue]https://ctan.org/pkg/hyperref\m[])\&.
1642 .RE
1643 .PP
1644 \fBpapersize\fR
1645 .RS 4
1646 The
1647 \fIpapersize\fR
1648 special, which is an extension introduced by dvips, can be used to specify the widths and heights of the pages in the DVI file\&. It affects the page it appears on as well as all following pages until another papersize special is found\&. If there is more than one papersize special present on a page, dvisvgm applies the last one\&. However, in order to stay compatible with previous versions of dvisvgm that did not evaluate these specials, their processing must be explicitly enabled by adding option
1649 \fB\-\-bbox=papersize\fR
1650 on the command\-line\&. Otherwise, dvisvgm ignores them and computes tight bounding boxes\&.
1651 .RE
1652 .PP
1653 \fBpdf\fR
1654 .RS 4
1655 pdfTeX and dvipdfmx introduced several special commands related to the generation of PDF files\&. Currently, only
1656 \fIpdf:mapfile\fR,
1657 \fIpdf:mapline\fR,
1658 \fIpdf:pagesize\fR, and PDF hyperlink specials are supported by dvisvgm\&. The latter are the PDF pendants to the HTML HyperTeX specials\&. They are generated by the hyperref package in PDF mode, for example\&. If a DVI page contains unsupported PDF specials, dvisvgm prints a warning message showing the number of ignored special commands\&.
1659 .sp
1660 \fIpdf:pagesize\fR
1661 is similar to the
1662 \fIpapersize\fR
1663 special (see above) which specifies the size of the current and all following pages\&. In order to actually apply the extents to the generated SVG files, option
1664 \fB\-\-bbox=papersize\fR
1665 must be given\&.
1666 .sp
1667 \fIpdf:mapfile\fR
1668 and
1669 \fIpdf:mapline\fR
1670 allow for modifying the font map tree while processing the DVI file\&. They are used by CTeX, for example\&. dvisvgm supports both, the dvips and dvipdfm font map format\&. For further information on the command syntax and semantics, see the documentation of
1671 \fB\epdfmapfile\fR
1672 in the
1673 pdfTeX user manual (\m[blue]https://ctan.org/pkg/pdftex\m[])\&.
1674 .RE
1675 .PP
1676 \fBps\fR
1677 .RS 4
1678 The famous DVI driver
1679 \fIdvips\fR (\m[blue]https://www.tug.org/texinfohtml/dvips.html\m[])
1680 introduced its own set of specials in order to embed PostScript code into DVI files, which greatly improves the capabilities of DVI documents\&. One aim of dvisvgm is to completely evaluate all PostScript fragments and to convert as many of them as possible to SVG\&. In contrast to dvips, dvisvgm uses floating point arithmetic to compute the precise position of each graphic element, i\&.e\&. it doesn\(cqt round the coordinates\&. Therefore, the relative locations of the graphic elements may slightly differ from those computed by dvips\&.
1681 .sp
1682 Since PostScript is a rather complex language, dvisvgm does not implement its own PostScript interpreter but relies on
1683 Ghostscript (\m[blue]https://ghostscript.com\m[])
1684 instead\&. If the Ghostscript library was not linked to the dvisvgm binary, it is looked up and loaded dynamically during runtime\&. In this case, dvisvgm looks for
1685 \fIlibgs\&.so\&.X\fR
1686 on Unix\-like systems (supported ABI versions: 7,8,9), for
1687 \fIlibgs\&.X\&.dylib\fR
1688 on macOS, and for
1689 \fIgsdll32\&.dll\fR
1690 or
1691 \fIgsdll64\&.dll\fR
1692 on Windows\&. You can override the default file names with environment variable
1693 \fBLIBGS\fR
1694 or the command\-line option
1695 \fB\-\-libgs\fR\&. The library must be reachable through the ld search path (*nix) or the PATH environment variable (Windows)\&. Alternatively, the absolute file path can be specified\&. If the library cannot be found, dvisvgm disables the processing of PostScript specials and prints a warning message\&. Use option
1696 \fB\-\-list\-specials\fR
1697 to check whether PostScript support is available, i\&.e\&. entry
1698 \fIps\fR
1699 is present\&.
1700 .sp
1701 The PostScript handler also recognizes and evaluates bounding box data generated by the
1702 preview package (\m[blue]https://ctan.org/pkg/preview\m[])
1703 with option
1704 \fItightpage\fR\&. If such data is present in the DVI file and if dvisvgm is called with option
1705 \fB\-\-bbox=preview\fR, dvisvgm sets the width and total height of the SVG file to the values derived from the preview data\&. Additionally, it prints a message showing the width, height, and depth of the box in TeX point units to the console\&. Especially, the depth value can be read by a post\-processor to vertically align the SVG graphics with the baseline of surrounding text in HTML or XSL\-FO documents, for example\&. Please note that SVG bounding boxes are defined by a width and (total) height\&. In contrast to TeX, SVG provides no means to differentiate between height and depth, i\&.e\&. the vertical extents above and below the baseline, respectively\&. Therefore, it is generally not possible to retrieve the depth value from the SVG file itself\&.
1706 .sp
1707 If you call dvisvgm with option
1708 \fB\-\-bbox=min\fR
1709 (the default) and preview data is present in the DVI file, dvisvgm doesn\(cqt apply the preview extents but computes a bounding box that tightly encloses the page contents\&. The height, depth and width values written to console are adapted accordingly\&.
1710 .RE
1711 .PP
1712 \fBtpic\fR
1713 .RS 4
1714 The TPIC special set defines instructions for drawing simple geometric objects\&. Some LaTeX packages, like eepic and tplot, use these specials to describe graphics\&.
1715 .RE
1716 .SH "EXAMPLES"
1717 .PP
1718 \fBdvisvgm file\fR
1719 .RS 4
1720 Converts the first page of
1721 \fIfile\&.dvi\fR
1722 to
1723 \fIfile\&.svg\fR\&.
1724 .RE
1725 .PP
1726 \fBdvisvgm \-p1\-5 file\fR
1727 .RS 4
1728 Converts the first five pages of
1729 \fIfile\&.dvi\fR
1730 to
1731 \fIfile\-1\&.svg\fR,\&...,\fIfile\-5\&.svg\fR\&.
1732 .RE
1733 .PP
1734 \fBdvisvgm \-p1\- file\fR
1735 .RS 4
1736 Converts all pages of
1737 \fIfile\&.dvi\fR
1738 to separate SVG files\&.
1739 .RE
1740 .PP
1741 \fBdvisvgm \-p1,3 \-O file\fR
1742 .RS 4
1743 Converts the first and third page of
1744 \fIfile\&.dvi\fR
1745 to optimized SVG files\&.
1746 .RE
1747 .PP
1748 \fBdvisvgm \- < file\&.dvi\fR
1749 .RS 4
1750 Converts the first page of
1751 \fIfile\&.dvi\fR
1752 to
1753 \fIstdin\&.svg\fR
1754 where the contents of
1755 \fIfile\&.dvi\fR
1756 is read from
1757 \fBstdin\fR\&.
1758 .RE
1759 .PP
1760 \fBdvisvgm \-z file\fR
1761 .RS 4
1762 Converts the first page of
1763 \fIfile\&.dvi\fR
1764 to
1765 \fIfile\&.svgz\fR
1766 with default compression level 9\&.
1767 .RE
1768 .PP
1769 \fBdvisvgm \-p5 \-z3 \-ba4\-l \-o newfile file\fR
1770 .RS 4
1771 Converts the fifth page of
1772 \fIfile\&.dvi\fR
1773 to
1774 \fInewfile\&.svgz\fR
1775 with compression level 3\&. The bounding box is set to DIN/ISO A4 in landscape format\&.
1776 .RE
1777 .PP
1778 \fBdvisvgm \-\-transform="R20,w/3,2h/5 T1cm,1cm S2,3" file\fR
1779 .RS 4
1780 Converts the first page of
1781 \fIfile\&.dvi\fR
1782 to
1783 \fIfile\&.svg\fR
1784 where three transformations are applied\&.
1785 .RE
1786 .SH "ENVIRONMENT"
1787 .sp
1788 dvisvgm uses the \fBkpathsea\fR library for locating the files that it opens\&. Hence, the environment variables described in the library\(cqs documentation influence the converter\&.
1789 .sp
1790 If dvisvgm was linked without the Ghostscript library, and if PostScript support has not been disabled, the shared Ghostscript library is looked up during runtime via dlopen()\&. The environment variable \fBLIBGS\fR can be used to specify path and file name of the library\&.
1791 .sp
1792 The pre\-compiled Windows versions of dvisvgm require a working installation of MiKTeX 2\&.9 or above\&. dvisvgm does not work together with the portable edition of MiKTeX because it relies on MiKTeX\(cqs COM interface that is only accessible in a local installation\&. To enable the evaluation of PostScript specials, the original Ghostscript DLL \fIgsdll32\&.dll\fR must be present and reachable through the search path\&. 64\-bit Windows builds require the 64\-bit Ghostscript DLL \fIgsdll64\&.dll\fR\&. Both DLLs come with the corresponding Ghostscript installers available from \m[blue]\fBhttps://ghostscript\&.com\fR\m[]\&.
1793 .sp
1794 The environment variable \fBDVISVGM_COLORS\fR specifies the colors used to highlight various parts of dvisvgm\(cqs message output\&. It is only evaluated if option \fB\-\-color\fR is given\&. The value of \fBDVISVGM_COLORS\fR is a list of colon\-separated entries of the form \fIgg\fR=\fIBF\fR, where \fIgg\fR denotes one of the color group indicators listed below, and \fIBF\fR are two hexadecimal digits specifying the background (first digit) and foreground/text color (second digit)\&. The color values are defined as follows: 0=black, 1=red, 2=green, 3=yellow, 4=blue, 5=magenta, 6=cyan, 7=gray, 8=bright red, 9=bright green, A=bright yellow, B=bright blue, C=bright magenta, D=bright cyan, E=bright gray, F=white\&. Depending on the terminal, the colors may differ\&. Rather than changing both the text and background color, it\(cqs also possible to change only one of them: An asterisk (*) in place of a hexadecimal digit indicates the default text or background color of the terminal\&.
1795 .sp
1796 All malformed entries in the list are silently ignored\&.
1797 .TS
1798 tab(:);
1799 lt ltx
1800 lt ltx
1801 lt ltx
1802 lt ltx
1803 lt ltx
1804 lt ltx
1805 lt ltx
1806 lt ltx.
1807 T{
1808 .sp
1809 \fBer\fR
1810 T}:T{
1811 .sp
1812 error messages
1813 T}
1814 T{
1815 .sp
1816 \fBwn\fR
1817 T}:T{
1818 .sp
1819 warning messages
1820 T}
1821 T{
1822 .sp
1823 \fBpn\fR
1824 T}:T{
1825 .sp
1826 messages about page numbers
1827 T}
1828 T{
1829 .sp
1830 \fBps\fR
1831 T}:T{
1832 .sp
1833 page size messages
1834 T}
1835 T{
1836 .sp
1837 \fBfw\fR
1838 T}:T{
1839 .sp
1840 information about the files written
1841 T}
1842 T{
1843 .sp
1844 \fBsm\fR
1845 T}:T{
1846 .sp
1847 state messages
1848 T}
1849 T{
1850 .sp
1851 \fBtr\fR
1852 T}:T{
1853 .sp
1854 messages of the glyph tracer
1855 T}
1856 T{
1857 .sp
1858 \fBpi\fR
1859 T}:T{
1860 .sp
1861 progress indicator
1862 T}
1863 .TE
1864 .sp 1
1865 .sp
1866 \fBExample:\fR \fBer=01:pi=*5\fR sets the colors of error messages (\fBer\fR) to red (\fB1\fR) on black (\fB0\fR), and those of progress indicators (\fBpi\fR) to cyan (\fB5\fR) on default background (\fB*\fR)\&.
1867 .sp
1868 Variable \fBDVISVGM_PDF_PROC\fR allows you to select the desired PDF processor\&. dvisvgm requires either Ghostscript (version < 10\&.01\&.0) or mutool to process PDF files\&. IF \fBDVISVGM_PDF_PROC\fR is not set, dvisvgm tries to detect the available processors\&. See option \fB\-\-pdf\fR for further information\&. To select a specific PDF processor, you can set \fBDVISVGM_PDF_PROC\fR to \fBgs\fR or \fBmutool\fR which forces the use of Ghostscript and mutool respectively\&.
1869 .SH "FILES"
1870 .sp
1871 The location of the following files is determined by the kpathsea library\&. To check the actual kpathsea configuration you can use the \fBkpsewhich\fR utility\&.
1872 .TS
1873 tab(:);
1874 lt ltx
1875 lt ltx
1876 lt ltx
1877 lt ltx
1878 lt ltx
1879 lt ltx
1880 lt ltx
1881 lt ltx
1882 lt ltx.
1883 T{
1884 .sp
1885 \fB*\&.enc\fR
1886 T}:T{
1887 .sp
1888 Font encoding files
1889 T}
1890 T{
1891 .sp
1892 \fB*\&.fgd\fR
1893 T}:T{
1894 .sp
1895 Font glyph data files (cache files created by dvisvgm)
1896 T}
1897 T{
1898 .sp
1899 \fB*\&.map\fR
1900 T}:T{
1901 .sp
1902 Font map files
1903 T}
1904 T{
1905 .sp
1906 \fB*\&.mf\fR
1907 T}:T{
1908 .sp
1909 Metafont input files
1910 T}
1911 T{
1912 .sp
1913 \fB*\&.pfb\fR
1914 T}:T{
1915 .sp
1916 PostScript Type 1 font files
1917 T}
1918 T{
1919 .sp
1920 \fB*\&.pro\fR
1921 T}:T{
1922 .sp
1923 PostScript header/prologue files
1924 T}
1925 T{
1926 .sp
1927 \fB*\&.tfm\fR
1928 T}:T{
1929 .sp
1930 TeX font metric files
1931 T}
1932 T{
1933 .sp
1934 \fB*\&.ttf\fR
1935 T}:T{
1936 .sp
1937 TrueType font files
1938 T}
1939 T{
1940 .sp
1941 \fB*\&.vf\fR
1942 T}:T{
1943 .sp
1944 Virtual font files
1945 T}
1946 .TE
1947 .sp 1
1948 .SH "SEE ALSO"
1949 .sp
1950 \fBtex(1), mf(1), mktexmf(1), grodvi(1), potrace(1)\fR, and the \fBkpathsea library\fR info documentation\&.
1951 .SH "RESOURCES"
1952 .PP
1953 Project home page
1954 .RS 4
1955 \m[blue]\fBhttps://dvisvgm\&.de\fR\m[]
1956 .RE
1957 .PP
1958 Code repository
1959 .RS 4
1960 \m[blue]\fBhttps://github\&.com/mgieseki/dvisvgm\fR\m[]
1961 .RE
1962 .SH "BUGS"
1963 .sp
1964 Please report bugs using the bug tracker at GitHub (\m[blue]https://github.com/mgieseki/dvisvgm/issues\m[])\&.
1965 .SH "AUTHOR"
1966 .sp
1967 Written by Martin Gieseking <\m[blue]\fBmartin\&.gieseking@uos\&.de\fR\m[]>
1968 .SH "COPYING"
1969 .sp
1970 Copyright \(co 2005\-2025 Martin Gieseking\&. Free use of this software is granted under the terms of the GNU General Public License (GPL) version 3 or, (at your option) any later version\&.