獨立類別:使用 dvisvgm 進行轉換 - 啟動所有頁面選項

獨立類別:使用 dvisvgm 進行轉換 - 啟動所有頁面選項

如果我想將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}

相關內容