我正在使用LuaLatex文件中的tikz图。在演讲中,我想使用同样的情节。理论上,我可以将它们添加为pdf对象。虽然质量很差。因此,我想出口他们作为巴布亚新几内亚。我找到了几个应该可以工作的代码示例。但我不能让他们去工作。他们只是输出pdf,没有png。
我已经尝试过跟踪线程/代码片段。
https://www.latex4technics.com/?note=3p2n http://users.cecs.anu.edu.au/~rod/resources/p-tikz-external-png.html
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{external}
%\tikzexternalize[mode=list and make]
\tikzset{
png export/.style={
% First we call ImageMagick; change settings to requirements
external/system call/.add={}{; convert -density 300 -transparent white "\image.pdf" "\image.png"},
% Now we force the PNG figure to be used instead of the PDF
/pgf/images/external info,
/pgf/images/include external/.code={
\includegraphics[width=\pgfexternalwidth,height=\pgfexternalheight]{##1.png}
},
}
}
\begin{document}
{
% Here we specify the figure will be converted and inserted as PNG
\tikzset{png export}
\begin{tikzpicture}
\draw (0,0) circle (1) ;
\end{tikzpicture}
}
% This figure will be inserted as PDF
\begin{tikzpicture}
\draw (0,0) circle (1) ;
\end{tikzpicture}
\end{document}我查过convert -version了
版本: ImageMagick 7.0.8-49 Q16 x64 2019-06-08 http://www.imagemagick.org版权:版权(C) 1999-2018 ImageMagick Studio许可证:http://www.imagemagick.org/script/license.php VisualC++:180040629功能:密码DPC模块OpenMP(2.0)代表(内置):bzlib cairo flif freetype gslib jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps原始rsvg tiff webp xml zlib‘
如果我检查where convert我得到
C:\Program \ImageMagick-7.0.8-Q16\Transt.exe C:\Windows\System32\convert.exe`
在我看来,有两个来自不同地点的皈依者是可疑的。
编辑:现在已经改变了。我可以称convert.exe乙醚为不变或魔法。这是在控制台上完成的。不过,它不适用于“胶乳”(文本制造者)。
预期是一个png和pdf输出。实际是一个pdf输出。
发布于 2022-11-03 15:21:07
正如一些注释中提到的,如果使用external/system call/.add:多个命令在Linux上使用&而不是;分隔,则;中的命令有所不同。另外,为了避免与系统工具convert混淆,请使用magick.exe:
\tikzset{
png export/.style={
% First we call ImageMagick; change settings to requirements
external/system call/.add={}{& magick.exe -density 300 "\image.pdf" "\image.png"},
% Now we force the PNG figure to be used instead of the PDF
/pgf/images/external info,
/pgf/images/include external/.code={
\includegraphics[width=\pgfexternalwidth,height=\pgfexternalheight]{##1.png}
},
}
}对于PowerPoint导出图像的完全相同的用例(甚至是光束动画步骤),您实际上可以让LaTeX正常使用缓存的PDF,如果需要的话还可以导出PNG,如果需要使用白色而不是透明的背景:
\tikzset{external/system call/.add={}{& magick.exe -density 300 "\image.pdf" -alpha remove "\image.png"}}注意,光束中的\uncover可能需要\begin{frame}<1-n>,其中n是您想要的动画步骤数。\only可能会破坏节点引用并导致文件名冲突,这些冲突可以通过appending the overlay number解决。后者可与selective export of named figures only相结合。
https://stackoverflow.com/questions/56708895
复制相似问题