![獨立類別:使用 dvisvgm 進行轉換 - 啟動所有頁面選項](https://rvso.com/image/475744/%E7%8D%A8%E7%AB%8B%E9%A1%9E%E5%88%A5%EF%BC%9A%E4%BD%BF%E7%94%A8%20dvisvgm%20%E9%80%B2%E8%A1%8C%E8%BD%89%E6%8F%9B%20-%20%E5%95%9F%E5%8B%95%E6%89%80%E6%9C%89%E9%A0%81%E9%9D%A2%E9%81%B8%E9%A0%85.png)
如果我想將pdf
文件的每一頁轉換為相同數量的單一svg
文件,則工作命令是:
dvisvgm --pdf --page=1- in.pdf out.svg
但是如果我將其設置為standalone.cls
-optionconvert
\documentclass[crop,tikz,
convert={outext=.svg,
command=\unexpanded{dvisvgm --pdf --page=1- \infile}},
%multi=true, % ?
]{standalone}
我明白了
Class standalone Warning: Conversion unsuccessful!
(standalone) There might be something wrong with your
(standalone) conversation software or the file permissions!
暗示:如果沒有“所有頁面選項”,--page=1-
它也可以工作;但隨後他只產生了第 1 頁的一個 svg 檔。
我需要做什麼?
完整的 MWE:
% arara: pdflatex: { shell: yes }
\documentclass[crop,tikz,
convert={outext=.svg,
command=\unexpanded{dvisvgm --pdf --page=1- \infile}},
%multi=true,
]{standalone}
\begin{document}
\foreach \Letter in {A,2,3,...,10,J,Q,K}{%%
\begin{tikzpicture}% Example:
\node[align=center, draw, rounded corners=1pt, inner sep=1pt,
minimum width=0.5*6ex, minimum height=0.5*9ex,
]{\Letter \\ $\clubsuit$};
\end{tikzpicture}
}%%
\end{document}
答案1
我建議讓 arara 致電 dvisvgm。對我來說,它看起來更乾淨,因為它將 LaTeX 程式碼與處理它的 shell 命令分開。此外,當使用 DVI 而不是 PDF 檔案時,dvisvgm 通常會產生更好的結果:
% arara: latex
% arara: dvisvgm: { options: [--page=1-] }
\documentclass[crop,tikz]{standalone}
\begin{document}
\foreach \Letter in {A,2,3,...,10,J,Q,K}{
\begin{tikzpicture}
\node[align=center, draw, rounded corners=1pt, inner sep=1pt,
minimum width=0.5*6ex, minimum height=0.5*9ex,
]{\Letter \\ $\clubsuit$};
\end{tikzpicture}
}
\end{document}