\includesvg 未检测 SVG 文件

\includesvg 未检测 SVG 文件

输入

test.tex

\documentclass{article}
\usepackage{svg}

\begin{document}

    \includesvg{my-svg-file}

\end{document}

my-svg-file.svg(在同一文件夹中):http://ftp.gwdg.de/pub/ctan/info/svg-inkscape/image.svg

错误输出

Process started: "C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\lualatex.exe"  -synctex=1 -interaction=nonstopmode "test".tex

Process exited with error(s)


This is LuaTeX, Version beta-0.70.2-2012060719 (MiKTeX 2.9)  (format=lualatex 2014.1.21)  4 FEB 2014 19:27
**test.tex
(D:/Desktop/TEST/test.tex
LaTeX2e <2011/06/27>
LuaTeX adaptation of babel <v3.8m-luatex-1.5> and hyphenation patterns for engl
ish, loaded.
("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/base/article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/base/size10.clo"
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/svg/svg.sty"
Package: svg 2012/09/05 v1.0 SVG inclusion and extraction

("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/xkeyval/xkeyval.sty"
Package: xkeyval 2012/10/14 v2.6b package option processing (HA)

("C:/Program Files (x86)/MiKTeX 2.9/tex/generic/xkeyval/xkeyval.tex"
\XKV@toks=\toks14
\XKV@tempa@toks=\toks15
\XKV@depth=\count87
File: xkeyval.tex 2012/10/14 v2.6b key=value parser (HA)

("C:/Program Files (x86)/MiKTeX 2.9/tex/generic/xkeyval/keyval.tex")))
("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/subfig/subfig.sty"
Package: subfig 2005/06/28 ver: 1.3 subfig package

("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/caption/caption.sty"
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR)

("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/caption/caption3.sty"
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR)
Package caption3 Info: TeX engine: e-TeX on input line 57.
\captionmargin=\dimen103
\captionmargin@=\dimen104
\captionwidth=\dimen105
\caption@tempdima=\dimen106
\caption@indent=\dimen107
\caption@parindent=\dimen108
\caption@hangindent=\dimen109
)
\c@ContinuedFloat=\count88
)
\c@KVtest=\count89
\sf@farskip=\skip43
\sf@captopadj=\dimen110
\sf@capskip=\skip44
\sf@nearskip=\skip45
\c@subfigure=\count90
\c@subfigure@save=\count91
\c@lofdepth=\count92
\c@subtable=\count93
\c@subtable@save=\count94
\c@lotdepth=\count95
\sf@top=\skip46
\sf@bottom=\skip47
)
("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/import/import.sty"
Package: import 2009/03/23  v 5.1
)
("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/graphics/graphicx.sty"
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)

("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/graphics/graphics.sty"
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)

("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/graphics/trig.sty"
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
)
("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/00miktex/graphics.cfg"
File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
)
Package graphics Info: Driver file: pdftex.def on input line 91.

("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/pdftex-def/pdftex.def"
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX

("C:/Program Files (x86)/MiKTeX 2.9/tex/generic/oberdiek/infwarerr.sty"
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
)
("C:/Program Files (x86)/MiKTeX 2.9/tex/generic/oberdiek/ltxcmds.sty"
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
)
("C:/Program Files (x86)/MiKTeX 2.9/tex/generic/oberdiek/pdftexcmds.sty"
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO
)

("C:/Program Files (x86)/MiKTeX 2.9/tex/generic/oberdiek/ifluatex.sty"
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX detected.
)
("C:/Program Files (x86)/MiKTeX 2.9/tex/generic/oberdiek/ifpdf.sty"
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO)
Package ifpdf Info: pdfTeX in PDF mode is detected.
)
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.

("C:/Program Files (x86)/MiKTeX 2.9/tex/generic/oberdiek/luatex-loader.sty"
Package: luatex-loader 2010/03/09 v0.4 Lua module loader (HO)

(C:/Program Files (x86)/MiKTeX 2.9/scripts/oberdiek/oberdiek.luatex.lua))
\pdftexcmds@toks=\toks16
)
\Gread@gobject=\count96
))
\Gin@req@height=\dimen111
\Gin@req@width=\dimen112
)
("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/oberdiek/transparent.sty"
Package: transparent 2007/01/08 v1.0 Transparency via pdfTeX's color stack (HO)


("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/oberdiek/auxhook.sty"
Package: auxhook 2011/03/04 v1.3 Hooks for auxiliary files (HO)
))
("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/xcolor/xcolor.sty"
Package: xcolor 2007/01/21 v2.11 LaTeX color extensions (UK)

("C:/Program Files (x86)/MiKTeX 2.9/tex/latex/00miktex/color.cfg"
File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
)
Package xcolor Info: Driver file: pdftex.def on input line 225.
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1337.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1341.
Package xcolor Info: Model `RGB' extended on input line 1353.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1355.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1356.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1357.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1358.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1359.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1360.
)
\SVG@out@width=\skip48
\SVG@out@height=\skip49
\c@svgfigure=\count97
)
(D:/Desktop/TEST/test.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 T1/cmr/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 OMS/cmsy/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.
Package caption Info: Begin \AtBeginDocument code.
Package caption Info: subfig package v1.3 is loaded.
Package caption Info: End \AtBeginDocument code.

("C:/Program Files (x86)/MiKTeX 2.9/tex/context/base/supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count98
\scratchdimen=\dimen113
\scratchbox=\box26
\nofMPsegments=\count99
\nofMParguments=\count100
\everyMPshowfont=\toks17
\MPscratchCnt=\count101
\MPscratchDim=\dimen114
\MPnumerator=\count102
\makeMPintoPDFobject=\count103
\everyMPtoPDFconversion=\toks18
)

See the next code block, please.


相关部分可能从这一行开始:

! Undefined control sequence.
\@includesvg ...extracttrue \fi \ifnum \pdfstrcmp 
                                                  {\pdffilemoddate {\SVG@in@...
l.6     \includesvg{my-svg-file}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing number, treated as zero.
<to be read again> 
                   {
l.6     \includesvg{my-svg-file}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Missing = inserted for \ifnum.
<to be read again> 
                   {
l.6     \includesvg{my-svg-file}

I was expecting to see `<', `=', or `>'. Didn't.

! Missing number, treated as zero.
<to be read again> 
                   {
l.6     \includesvg{my-svg-file}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Undefined control sequence.
\@includesvg ...ifnum \pdfstrcmp {\pdffilemoddate 
                                                  {\SVG@in@path #2.svg}}{\pd...
l.6     \includesvg{my-svg-file}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\@includesvg ...@in@path #2.svg}}{\pdffilemoddate 
                                                  {\SVG@in@path #2.pdf}}>0\i...
l.6     \includesvg{my-svg-file}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

runsystem(inkscape -z -C -f./my-svg-file.svg -A./my-svg-file.pdf --export-latex
)...disabled.


! LaTeX Error: File `./my-svg-file' not found.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.6     \includesvg{my-svg-file}

I could not locate the file with any of these extensions:
.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2
Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.


! LaTeX Error: File `./my-svg-file' not found.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.6     \includesvg{my-svg-file}

I could not locate the file with any of these extensions:
.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2
Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.


! LaTeX Error: File `my-svg-file.pdf_tex' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: pdf_tex)

Enter file name: 
! Emergency stop.
<read *> 

l.6     \includesvg{my-svg-file}


*** (cannot \read from terminal in nonstop modes)



Here is how much of LuaTeX's memory you used:
 3383 strings out of 495011
 100000,128383 words of node,token memory allocated 482 words of node memory still in use:
    nodes
   avail lists: 1:1,2:26,3:1,4:2,6:2,7:1,9:2
 6764 multiletter control sequences out of 65536+200000
 15 fonts using 431807 bytes
 68i,1n,98p,308b,87s stack positions out of 5000i,500n,10000p,200000b,50000s
!  ==> Fatal error occurred, no output PDF file produced!

系统

  • Windows 8 专业版 64 位
  • Inkscape 已安装并添加到 PATH(已验证)
  • MiKTeX pdfTeX2.9.4535 (1.40.13) (MiKTeX 2.9)
  • LuaTeXbeta-0.70.2-2012060719

很抱歉无法进一步分析错误。我已经通过 Google 进行了一些研究,但尚未找到任何可用的结果。我非常感谢您的每条提示!


加入后Heiko Oberdiek 的代码,在这种情况下,我得到了LaTeX Error: File./my-svg-file' not found. . Changing the relative path to an absolute one (D:\Desktop\TEST\my-svg-file`),这会导致完全不同的错误:

Log file
...
! Undefined control sequence.
\\  ->\let \reserved@e 
                       \relax \let \reserved@f \relax \@ifstar {\let \reserv...
l.15    \includesvg{D:\\Desktop\\TEST\\my-svg-file}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\\  ->\let \reserved@e \relax \let \reserved@f 
                                               \relax \@ifstar {\let \reserv...
l.15    \includesvg{D:\\Desktop\\TEST\\my-svg-file}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\in@ #1#2->\begingroup \def \in@@ 
                                  ##1#1{}\toks@ \expandafter {\in@@ #2{}{}#1...
l.15    \includesvg{D:\\Desktop\\TEST\\my-svg-file}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\in@ ...f \in@@ ##1#1{}\toks@ \expandafter {\in@@ 
                                                  #2{}{}#1}\edef \in@@ {\the...
l.15    \includesvg{D:\\Desktop\\TEST\\my-svg-file}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\in@ ... \expandafter {\in@@ #2{}{}#1}\edef \in@@ 
                                                  {\the \toks@ }\expandafter...
l.15    \includesvg{D:\\Desktop\\TEST\\my-svg-file}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\in@ #1#2->\begingroup \def \in@@ 
                                  ##1#1{}\toks@ \expandafter {\in@@ #2{}{}#1...
l.15    \includesvg{D:\\Desktop\\TEST\\my-svg-file}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\in@ ...f \in@@ ##1#1{}\toks@ \expandafter {\in@@ 
                                                  #2{}{}#1}\edef \in@@ {\the...
l.15    \includesvg{D:\\Desktop\\TEST\\my-svg-file}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\in@ ... \expandafter {\in@@ #2{}{}#1}\edef \in@@ 
                                                  {\the \toks@ }\expandafter...
l.15    \includesvg{D:\\Desktop\\TEST\\my-svg-file}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
<argument> \ifSVG@in@read 

l.15    \includesvg{D:\\Desktop\\TEST\\my-svg-file}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

)
! Incomplete \iffalse; all text was ignored after line 15.
<inserted text> 
                \fi 
<*> test.tex

The file ended while I was skipping conditional text.
This kind of error happens when you say `\if...' and forget
the matching `\fi'. I've inserted a `\fi'; this might work.

答案1

LuaTeX 并未提供 pdfTeX 的所有原语。许多缺失的原语由pdftexcmdsLua 代码通过软件包实现。因此,以下示例使\pdfstrcmpLuaTeX\pdffilemoddate可用:

% test.tex
\documentclass{article}

\usepackage{ifluatex}
\ifluatex
  \usepackage{pdftexcmds}
  \makeatletter
  \let\pdfstrcmp\pdf@strcmp
  \let\pdffilemoddate\pdf@filemoddate
  \makeatother
\fi
\usepackage{svg}

\begin{document}
  \includesvg{my-svg-file}
\end{document}

针对 Windows 的进一步说明和修改:

  • 软件包svg需要 shell 转义功能。如果未启用,则错误将为“./my-svg-file未找到”。可以在命令行中启用此功能,例如:

    lualatex --shell-escape test
    

    在 MiKTeX 中,该选项也称为--enable-write18

  • 还有安装inkscape是必需的。如果inkscape不在 中PATH,则可以指定绝对文件名:

    \setsvg{inkscape={"C:/Program Files/Inkscape/inkscape.exe"= -z -C}}
    
  • 需要使用 ImageMagick 来convert在 中进行 PNG 输出PATH。或者可以尝试绝对文件名,例如:

    \setsvg{convert={"C:/Program Files/ImageMagick-6.8.0-Q16/convert.exe" -density 300}}
    
  • 包装svg用途pdftopsxpdf对于 EPS 输出; the program can be specified in keypdftops`:

    \setsvg{pdftops={"C:/Program Files/.../pdftops.exe" -eps}}
    
  • Windows 的下一个问题是,该软件包使用移动文件和删除文件的svg程序。要么需要修补该软件包,要么提出功能请求,因为这些程序是硬编码的,无法通过选项进行配置。mvrmsvgsvg.sty

    或者赛格威可以安装这些程序附带的程序。

  • 然后希望 Windows 的所有障碍都能成功解决,并且文档中的注释被证明是错误的:

    此软件包无法在 Windows 上运行

  • 免责声明:我没有在 Windows 上尝试过这个,因为我使用的是 Linux。

相关内容