导入 .svg 文件时出错

导入 .svg 文件时出错

我想将 .svg 文件包含到我的文档中。我有一个名为 .svg 的文件test.svg

这是文档:

\documentclass[12pt,leqno,a4paper]{article}

\usepackage{graphicx}
\usepackage{svg}

\begin{document}

\begin{figure}[htbp]
\centering
  \includesvg{test}
  \caption{svg image}
\end{figure} 

\end{document}

尽管我基本上只是做了我发现的事情这里,我收到以下错误信息:

LOG FILE :
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex 2015.10.22) 16 FEB 2016 22:39
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**filename.tex
(./filename.tex
LaTeX2e <2015/01/01>
Babel <3.9l> and hyphenation patterns for 79 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/leqno.clo
File: leqno.clo 2015/03/31 v1.1i Standard LaTeX option (left equation numbers)
)
(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo
File: size12.clo 2014/09/29 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
)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
Package: graphics 2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
)
Package graphics Info: Driver file: pdftex.def on input line 94.
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
)
\Gread@gobject=\count87
))
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
)
(/usr/share/texlive/texmf-dist/tex/latex/svg/svg.sty
Package: svg 2012/09/05 v1.0 SVG inclusion and extraction
(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/xkeyval.sty
Package: xkeyval 2014/12/03 v2.7a package option processing (HA)
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkvutils.tex
\XKV@toks=\toks15
\XKV@tempa@toks=\toks16
)
\XKV@depth=\count88
File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
))
(/usr/share/texlive/texmf-dist/tex/latex/subfig/subfig.sty
Package: subfig 2005/06/28 ver: 1.3 subfig package
(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR)
(/usr/share/texlive/texmf-dist/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=\dimen105
\captionmargin@=\dimen106
\captionwidth=\dimen107
\caption@tempdima=\dimen108
\caption@indent=\dimen109
\caption@parindent=\dimen110
\caption@hangindent=\dimen111
)
\c@ContinuedFloat=\count89
)
\c@KVtest=\count90
\sf@farskip=\skip43
\sf@captopadj=\dimen112
\sf@capskip=\skip44
\sf@nearskip=\skip45
\c@subfigure=\count91
\c@subfigure@save=\count92
\c@lofdepth=\count93
\c@subtable=\count94
\c@subtable@save=\count95
\c@lotdepth=\count96
\sf@top=\skip46
\sf@bottom=\skip47
)
(/usr/share/texlive/texmf-dist/tex/latex/import/import.sty
Package: import 2009/03/23 v 5.1
)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/transparent.sty
Package: transparent 2007/01/08 v1.0 Transparency via pdfTeX's color stack (HO)
(/usr/share/texlive/texmf-dist/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.
)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty
Package: auxhook 2011/03/04 v1.3 Hooks for auxiliary files (HO)
))
(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty
Package: xcolor 2007/01/21 v2.11 LaTeX color extensions (UK)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/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
)
(./Yanick_Nedderhoff_MA-proposal.aux)
\openout1 = `Yanick_Nedderhoff_MA-proposal.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
(/usr/share/texlive/texmf-dist/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
) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO
)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO)
))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
Package etexcmds Info: Could not find \expanded.
(etexcmds) That can mean that you are not using pdfTeX 1.50 or
(etexcmds) that some package has redefined \expanded.
(etexcmds) In the latter case, load this package earlier.
)))
Package grfext Info: Graphics extension search list:
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE
G,.JBIG2,.JB2,.eps]
(grfext) \AppendGraphicsExtensions on input line 452.
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
Package caption Info: Begin \AtBeginDocument code.
Package caption Info: subfig package v1.3 is loaded.
Package caption Info: End \AtBeginDocument code.
runsystem(inkscape -z -C -f./test.svg -A./test.pdf --export-latex)...disabled (
restricted).
! LaTeX Error: File `./test' not found.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.14 \includesvg{test}
I could not locate the file with any of these extensions:
.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2,.eps
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: File `./test' not found.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.14 \includesvg{test}
I could not locate the file with any of these extensions:
.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2,.eps
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: File `test.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.14 \includesvg{test}
^^M
*** (cannot \read from terminal in nonstop modes)
Here is how much of TeX's memory you used:
3476 strings out of 493085
53156 string characters out of 6136916
118399 words of memory out of 5000000
6931 multiletter control sequences out of 15000+600000
3938 words of font info for 15 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
68i,2n,98p,269b,235s stack positions out of 5000i,500n,10000p,200000b,80000s
! ==> Fatal error occurred, no output PDF file produced!

找不到文件。问题:

I could not locate the file with any of these extensions:
.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2,.eps

但具体来说这里不应使用 .svg 扩展名。另外,当我尝试使用它时,也会收到错误。

inkscapetexlive-latex-extra安装完毕。你对此有什么想法吗?

答案1

您需要在启用 shell-escape 的情况下进行编译。输出清楚地显示您没有这样做,但除非您知道要查找什么,否则从控制台输出或日志中不太可能明显看出这一点。

输出的关键部分就在开头附近,上面写着restricted \write18 enabled。这意味着编译器只允许restricted使用严格限制()列表中的外部程序。

由于它不包含在该模式inkscape下允许的合理安全程序列表中,因此需要 Shell 逃逸才能真正作为外部程序运行。restricted

(当然,这并不是因为inkscape它被认为不安全。这个列表必然仅限于少数程序,这些程序的行为被认为即使在有点恶劣的环境中也是安全的。)

相关内容