TeXnicCenter 和 svg

TeXnicCenter 和 svg

我想知道为什么我不能将 svg 包与 teXnicCenter 一起使用。我已经看到必须使用 shell escape 才能使其运行。我还下载了最新版本的 inkscape 和 ImageMagick。所以我在我的构建配置文件中写了:

--shell-escape -synctex=-1 -max-print-line=120 -interaction=nonstopmode "%wm"

我把 shell 放在第一位,因为我发现有时它会工作得更好。

这是我的最小代码:

\documentclass{article}
\usepackage{svg}
\usepackage{amsmath}

\title{Inkscape package on Overleaf }
\begin{document}
\begin{figure}[htbp]
  \centering
  \includesvg[inkscapelatex=false,width=\linewidth]{test}
  \caption{svg image}
\end{figure}

\end{document}

我检查了我的日志文件。以下是 escape 所涉及的部分:

软件包 svg 信息:在输入行 9 上调用 Inkscape。runsystem(inkscape -z -D --file="test.svg" --export-pdf="test_svg-raw.pdf" )...已执行。

Package svg Warning: The export with Inkscape failed for file
(svg)                `test.svg'
(svg)                Troubleshooting: Please check in the log file how
(svg)                the invocation of Inkscape took place and try to
(svg)                execute it yourself in the terminal on input line 9.


! Package svg Error: File `test_svg-raw.pdf' is missing.

See the svg package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.9 ...inkscapelatex=false,width=\linewidth]{test}

Did you run the export with Inkscape? There's no file
`./svg-inkscape/test_svg-raw.pdf'
although `test.svg' was found.

[1

所以,我真的不明白这里出了什么问题。如果你能给我指明正确的方向,让它正常工作,我将不胜感激。

答案1

要实现你的目标,有几个步骤是必要的

1) 启用 shell 转义,您必须这样做,否则您将报告日志错误 Package svg 警告:您没有启用“shell 转义”(或“write18”),!Package svg 错误:文件test_svg-raw.pdf丢失。

2) 在目录中有一个有效的 svg 文件,您可以向其中写入子目录,您似乎没有遇到该问题,否则如果丢失,您会看到! Package svg Error: File 'test.svg' is missing.但是如果找到该文件并产生无效结果或子目录 ./svg-inkscape 无法在包含 tex 和 svg 的文件夹中写入,那么在这种情况下的消息可能就是您看到的消息。假设您的 test.svg 文件有效,您可以在主 tex 文件夹下添加一个文件夹(确保主文件夹没有空格或重音符号等)。

3) 您必须在路径上安装 Inkscape,否则您将收到报告的消息。因此,通过尝试> inkscape -version 转到命令提示符检查,如果 Inkscape 不在路径上,您应该会看到以下内容

在此处输入图片描述

你似乎已经检查过第 3 步所以我们剩下第 2 步中的问题因此您需要重新检查您的 test.svg 或您正在运行的文件夹是否有问题。

相关内容