我一直在使用 LaTeX、Ti钾Z 和 MiKTeX 自 2015 年起在 Windows 10 Pro 上成功制作 PDF 文件。
当前版本的钛钾Z 手册 3.1.9a在部分中有一个简单的例子10.2.4 生成 SVG 输出(第页121) 对我来说不起作用。
只需创建一个 TeX 文件(如手册中所述),其中包含:
% example.tex
\documentclass[dvisvgm]{minimal}
\usepackage{tikz}
\begin{document}
Hello \tikz [baseline] \fill [fill=blue!80!black] (0,.75ex) circle[radius=.75ex];
\end{document}
然后运行:
latex example
dvisvgm example
latex example
创建文件:example.aux,example.dvi 和 example.log,这些文件看起来都没问题。
dvisvgm example
报告以下错误:
D:\_DEVelopment\z_svg1>dvisvgm example
pre-processing DVI file (format version 2)
processing page 1
ERROR: error in special: '>' or '/>' expected at end of opening tag <g
ERROR: error in special: '>' or '/>' expected at end of opening tag <g
ERROR: error in special: '>' or '/>' expected at end of opening tag <g
ERROR: error in special: '>' or '/>' expected at end of opening tag <g
ERROR: error in special: '>' or '/>' expected at end of opening tag <g
ERROR: error in special: '>' or '/>' expected at end of opening tag <g
ERROR: error in special: '>' or '/>' expected at end of opening tag <g
ERROR: error in special: '>' or '/>' expected at end of opening tag <g
ERROR: error in special: '>' or '/>' expected at end of opening tag <g
ERROR: error in special: '>' or '/>' expected at end of opening tag <g
graphic size: 32.291705pt x 6.944447pt (11.349236mm x 2.440694mm)
output written to example.svg
1 of 1 page converted in 0.0900002 seconds
尝试下面首选的命令也给了我同样的错误:
lualatex --output-format=dvi example
dvisvgm example
所以我猜想 .dvi 文件创建不正确。你知道为什么吗?
更新: 我将 MiKTeX 升级到 21.10,错误仍然存在。创建的 .dvi 文件似乎所有“<g”部分都以“>”结束。我有一台装有 Ubuntu 20.04 和 TeX Live 的双启动 PC,所以我也可以在那里测试它。到目前为止,我在 MiKTeX(自 2015 年以来)中所做的一切在 TeX Live 中也能正常工作。
日志文件乍一看没什么问题。内容如下:
This is pdfTeX, Version 3.141592653-2.6-1.40.23 (MiKTeX 21.10) (preloaded format=latex 2021.11.25) 25 NOV 2021 18:28
entering extended mode
**./example.tex
(example.tex
LaTeX2e <2021-11-15>
L3 programming layer <2021-11-22>
(C:\Program Files\MiKTeX\tex/latex/base\minimal.cls
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
) (C:\Program Files\MiKTeX\tex/latex/pgf/frontendlayer\tikz.sty
(C:\Program Files\MiKTeX\tex/latex/pgf/basiclayer\pgf.sty
(C:\Program Files\MiKTeX\tex/latex/pgf/utilities\pgfrcs.sty
(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfutil-common.tex
\pgfutil@everybye=\toks16
\pgfutil@tempdima=\dimen138
\pgfutil@tempdimb=\dimen139
(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfutil-common-lists.tex))
(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfutil-latex.def
\pgfutil@abb=\box50
)
(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfrcs.code.tex
(C:\Program Files\MiKTeX\tex/generic/pgf\pgf.revision.tex)
Package: pgfrcs 2021/05/15 v3.1.9a (3.1.9a)
))
Package: pgf 2021/05/15 v3.1.9a (3.1.9a)
(C:\Program Files\MiKTeX\tex/latex/pgf/basiclayer\pgfcore.sty
(C:\Program Files\MiKTeX\tex/latex/graphics\graphicx.sty
Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
(C:\Program Files\MiKTeX\tex/latex/graphics\keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks17
)
(C:\Program Files\MiKTeX\tex/latex/graphics\graphics.sty
Package: graphics 2021/03/04 v1.4d Standard LaTeX Graphics (DPC,SPQR)
(C:\Program Files\MiKTeX\tex/latex/graphics\trig.sty
Package: trig 2021/08/11 v1.11 sin cos tan (DPC)
)
(C:\Program Files\MiKTeX\tex/latex/graphics-cfg\graphics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: dvisvgm.def on input line 107.
(C:\Program Files\MiKTeX\tex/latex/graphics-def\dvisvgm.def
File: dvisvgm.def 2021/11/21 v1.3 dvisvgm graphics driver for latex
))
\Gin@req@height=\dimen140
\Gin@req@width=\dimen141
)
(C:\Program Files\MiKTeX\tex/latex/pgf/systemlayer\pgfsys.sty
(C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsys.code.tex
Package: pgfsys 2021/05/15 v3.1.9a (3.1.9a)
(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfkeys.code.tex
\pgfkeys@pathtoks=\toks18
\pgfkeys@temptoks=\toks19
(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfkeysfiltered.code.tex
\pgfkeys@tmptoks=\toks20
))
\pgf@x=\dimen142
\pgf@y=\dimen143
\pgf@xa=\dimen144
\pgf@ya=\dimen145
\pgf@xb=\dimen146
\pgf@yb=\dimen147
\pgf@xc=\dimen148
\pgf@yc=\dimen149
\pgf@xd=\dimen150
\pgf@yd=\dimen151
\w@pgf@writea=\write3
\r@pgf@reada=\read2
\c@pgf@counta=\count183
\c@pgf@countb=\count184
\c@pgf@countc=\count185
\c@pgf@countd=\count186
\t@pgf@toka=\toks21
\t@pgf@tokb=\toks22
\t@pgf@tokc=\toks23
\pgf@sys@id@count=\count187
(C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgf.cfg
File: pgf.cfg 2021/05/15 v3.1.9a (3.1.9a)
)
Driver file for pgf: pgfsys-dvisvgm.def
(C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsys-dvisvgm.def
File: pgfsys-dvisvgm.def 2021/05/15 v3.1.9a (3.1.9a)
(C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsys-common-svg.def
File: pgfsys-common-svg.def 2021/05/15 v3.1.9a (3.1.9a)
\pgf@sys@svg@objectcount=\count188
\pgf@sys@svg@scopecount=\count189
\pgf@sys@svg@type@count=\count190
\pgf@sys@svg@canvascount=\count191
)))
(C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsyssoftpath.code.tex
File: pgfsyssoftpath.code.tex 2021/05/15 v3.1.9a (3.1.9a)
\pgfsyssoftpath@smallbuffer@items=\count192
\pgfsyssoftpath@bigbuffer@items=\count193
)
(C:\Program Files\MiKTeX\tex/generic/pgf/systemlayer\pgfsysprotocol.code.tex
File: pgfsysprotocol.code.tex 2021/05/15 v3.1.9a (3.1.9a)
))
(C:\Program Files\MiKTeX\tex/latex/xcolor\xcolor.sty
Package: xcolor 2021/10/31 v2.13 LaTeX color extensions (UK)
(C:\Program Files\MiKTeX\tex/latex/graphics-cfg\color.cfg
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package xcolor Info: Driver file: dvisvgm.def on input line 227.
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1352.
Package xcolor Info: Model `RGB' extended on input line 1368.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1370.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1371.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1372.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1373.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1374.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1375.
)
(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcore.code.tex
Package: pgfcore 2021/05/15 v3.1.9a (3.1.9a)
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmath.code.tex
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathcalc.code.tex
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathutil.code.tex)
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathparser.code.tex
\pgfmath@dimen=\dimen152
\pgfmath@count=\count194
\pgfmath@box=\box51
\pgfmath@toks=\toks24
\pgfmath@stack@operand=\toks25
\pgfmath@stack@operation=\toks26
)
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.code.tex
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.basic.code.tex)
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.trigonometric.co
de.tex)
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.random.code.tex)
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.comparison.code.
tex)
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.base.code.tex)
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.round.code.tex)
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.misc.code.tex)
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.integerarithmeti
cs.code.tex)))
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfloat.code.tex
\c@pgfmathroundto@lastzeros=\count195
))
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfint.code.tex)
(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepoints.code.tex
File: pgfcorepoints.code.tex 2021/05/15 v3.1.9a (3.1.9a)
\pgf@picminx=\dimen153
\pgf@picmaxx=\dimen154
\pgf@picminy=\dimen155
\pgf@picmaxy=\dimen156
\pgf@pathminx=\dimen157
\pgf@pathmaxx=\dimen158
\pgf@pathminy=\dimen159
\pgf@pathmaxy=\dimen160
\pgf@xx=\dimen161
\pgf@xy=\dimen162
\pgf@yx=\dimen163
\pgf@yy=\dimen164
\pgf@zx=\dimen165
\pgf@zy=\dimen166
)
(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepathconstruct.code.t
ex
File: pgfcorepathconstruct.code.tex 2021/05/15 v3.1.9a (3.1.9a)
\pgf@path@lastx=\dimen167
\pgf@path@lasty=\dimen168
)
(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepathusage.code.tex
File: pgfcorepathusage.code.tex 2021/05/15 v3.1.9a (3.1.9a)
\pgf@shorten@end@additional=\dimen169
\pgf@shorten@start@additional=\dimen170
)
(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorescopes.code.tex
File: pgfcorescopes.code.tex 2021/05/15 v3.1.9a (3.1.9a)
\pgfpic=\box52
\pgf@hbox=\box53
\pgf@layerbox@main=\box54
\pgf@picture@serial@count=\count196
)
(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoregraphicstate.code.te
x
File: pgfcoregraphicstate.code.tex 2021/05/15 v3.1.9a (3.1.9a)
\pgflinewidth=\dimen171
)
(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoretransformations.code
.tex
File: pgfcoretransformations.code.tex 2021/05/15 v3.1.9a (3.1.9a)
\pgf@pt@x=\dimen172
\pgf@pt@y=\dimen173
\pgf@pt@temp=\dimen174
) (C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorequick.code.tex
File: pgfcorequick.code.tex 2021/05/15 v3.1.9a (3.1.9a)
) (C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoreobjects.code.tex
File: pgfcoreobjects.code.tex 2021/05/15 v3.1.9a (3.1.9a)
)
(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepathprocessing.code.
tex
File: pgfcorepathprocessing.code.tex 2021/05/15 v3.1.9a (3.1.9a)
) (C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorearrows.code.tex
File: pgfcorearrows.code.tex 2021/05/15 v3.1.9a (3.1.9a)
\pgfarrowsep=\dimen175
) (C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoreshade.code.tex
File: pgfcoreshade.code.tex 2021/05/15 v3.1.9a (3.1.9a)
\pgf@max=\dimen176
\pgf@sys@shading@range@num=\count197
\pgf@shadingcount=\count198
)
(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoreimage.code.tex
File: pgfcoreimage.code.tex 2021/05/15 v3.1.9a (3.1.9a)
(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoreexternal.code.tex
File: pgfcoreexternal.code.tex 2021/05/15 v3.1.9a (3.1.9a)
\pgfexternal@startupbox=\box55
))
(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorelayers.code.tex
File: pgfcorelayers.code.tex 2021/05/15 v3.1.9a (3.1.9a)
)
(C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcoretransparency.code.te
x
File: pgfcoretransparency.code.tex 2021/05/15 v3.1.9a (3.1.9a)
) (C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorepatterns.code.tex
File: pgfcorepatterns.code.tex 2021/05/15 v3.1.9a (3.1.9a)
) (C:\Program Files\MiKTeX\tex/generic/pgf/basiclayer\pgfcorerdf.code.tex
File: pgfcorerdf.code.tex 2021/05/15 v3.1.9a (3.1.9a)
)))
(C:\Program Files\MiKTeX\tex/generic/pgf/modules\pgfmoduleshapes.code.tex
File: pgfmoduleshapes.code.tex 2021/05/15 v3.1.9a (3.1.9a)
\pgfnodeparttextbox=\box56
)
(C:\Program Files\MiKTeX\tex/generic/pgf/modules\pgfmoduleplot.code.tex
File: pgfmoduleplot.code.tex 2021/05/15 v3.1.9a (3.1.9a)
)
(C:\Program Files\MiKTeX\tex/latex/pgf/compatibility\pgfcomp-version-0-65.sty
Package: pgfcomp-version-0-65 2021/05/15 v3.1.9a (3.1.9a)
\pgf@nodesepstart=\dimen177
\pgf@nodesepend=\dimen178
)
(C:\Program Files\MiKTeX\tex/latex/pgf/compatibility\pgfcomp-version-1-18.sty
Package: pgfcomp-version-1-18 2021/05/15 v3.1.9a (3.1.9a)
)) (C:\Program Files\MiKTeX\tex/latex/pgf/utilities\pgffor.sty
(C:\Program Files\MiKTeX\tex/latex/pgf/utilities\pgfkeys.sty
(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfkeys.code.tex))
(C:\Program Files\MiKTeX\tex/latex/pgf/math\pgfmath.sty
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmath.code.tex))
(C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgffor.code.tex
Package: pgffor 2021/05/15 v3.1.9a (3.1.9a)
(C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmath.code.tex)
\pgffor@iter=\dimen179
\pgffor@skip=\dimen180
\pgffor@stack=\toks27
\pgffor@toks=\toks28
))
(C:\Program Files\MiKTeX\tex/generic/pgf/frontendlayer/tikz\tikz.code.tex
Package: tikz 2021/05/15 v3.1.9a (3.1.9a)
(C:\Program Files\MiKTeX\tex/generic/pgf/libraries\pgflibraryplothandlers.code.
tex
File: pgflibraryplothandlers.code.tex 2021/05/15 v3.1.9a (3.1.9a)
\pgf@plot@mark@count=\count199
\pgfplotmarksize=\dimen181
)
\tikz@lastx=\dimen182
\tikz@lasty=\dimen183
\tikz@lastxsaved=\dimen184
\tikz@lastysaved=\dimen185
\tikz@lastmovetox=\dimen186
\tikz@lastmovetoy=\dimen187
\tikzleveldistance=\dimen188
\tikzsiblingdistance=\dimen189
\tikz@figbox=\box57
\tikz@figbox@bg=\box58
\tikz@tempbox=\box59
\tikz@tempbox@bg=\box60
\tikztreelevel=\count266
\tikznumberofchildren=\count267
\tikznumberofcurrentchild=\count268
\tikz@fig@count=\count269
(C:\Program Files\MiKTeX\tex/generic/pgf/modules\pgfmodulematrix.code.tex
File: pgfmodulematrix.code.tex 2021/05/15 v3.1.9a (3.1.9a)
\pgfmatrixcurrentrow=\count270
\pgfmatrixcurrentcolumn=\count271
\pgf@matrix@numberofcolumns=\count272
)
\tikz@expandcount=\count273
(C:\Program Files\MiKTeX\tex/generic/pgf/frontendlayer/tikz/libraries\tikzlibra
rytopaths.code.tex
File: tikzlibrarytopaths.code.tex 2021/05/15 v3.1.9a (3.1.9a)
)))
(C:\Program Files\MiKTeX\tex/latex/l3backend\l3backend-dvisvgm.def
File: l3backend-dvisvgm.def 2021-10-18 L3 backend support: dvisvgm
\g__kernel_backend_scope_int=\count274
\l__kernel_backend_scope_int=\count275
\g__box_clip_path_int=\count276
\g__draw_path_int=\count277
\l__pdf_internal_box=\box61
)
(example.aux)
\openout1 = `example.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
[1] (example.aux) )
Here is how much of TeX's memory you used:
11318 strings out of 478682
240806 string characters out of 2856414
508681 words of memory out of 3000000
29276 multiletter control sequences out of 15000+600000
403430 words of font info for 27 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
100i,5n,104p,424b,424s stack positions out of 5000i,500n,10000p,200000b,80000s
Output written on example.dvi (1 page, 1004 bytes).
答案1
我也遇到了同样的问题。更新 MikTeX 彻底解决了这个问题。
升级前错误信息摘录:
C:\temp>dvisvgm --no-fonts svgout
pre-processing DVI file (format version 2)
processing page 1
ERROR: error in special: '>' or '/>' expected at end of opening tag <g
ERROR: error in special: '>' or '/>' expected at end of opening tag <g
...
ERROR: error in special: '>' or '/>' expected at end of opening tag <g
graphic size: 449.754997pt x 87.610598pt (158.070803mm x 30.791604mm)
output written to svgout.svg
1 of 1 page converted in 0.123 seconds
该命令确实生成了一个 SVG 文件,但其中缺少图形的组件。
升级后结果:
C:\temp>dvisvgm --no-fonts svgout
pre-processing DVI file (format version 2)
processing page 1
graphic size: 449.754997pt x 94.555042pt (158.070803mm x 33.232297mm)
output written to svgout.svg
1 of 1 page converted in 0.101 seconds