1

I have the following tex file:

\providecommand{\pgfsyspdfmark}[3]{}

\documentclass[convert]{standalone}

\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{array}
\usepackage{textgreek}
\usepackage{xcolor}
\usepackage{fixltx2e}
\usepackage{booktabs}
\usepackage{xfrac}

\usetikzlibrary{shapes,arrows,chains}
\usepgfplotslibrary{external}
\usetikzlibrary{pgfplots.external}

\pgfplotsset{compat=newest}

\begin{document}
\begin{tabular}{>{\small}l >{\small}r >{\small}r >{\small}r >{\small}r} 
    \toprule
    Gas & $\sigma / \text{\AA}$ & $\sfrac{\varepsilon}{\kappa} /  \text{K} $ & $\sfrac{\kappa T}{\varepsilon}$ / \text{-} & $\Omega_ \mu / \text{-} $ \\
    \midrule
    H\textsubscript{2} & $2.915$ & $ 38$ & $7.77$ & $0.86$ \\
    N\textsubscript{2} & $3.667$ & $100$ & $2.96$ & $1.04$ \\
    O\textsubscript{2} & $3.433$ & $113$ & $2.61$ & $1.08$ \\
    \bottomrule
\end{tabular}
\end{document}

Whenever I run it, I read in the log file the following:

runsystem(imgconvert -density 300 Table_1.pdf -quality 90 Table_1.png)...executed.

What I guess happened during compilation is that the command "imgconvert etc etc" was ran on Windows to convert the pdf to a png.

What I would like to do now is add a command in my tex file that outputs:

runsystem(pdftops -eps Table_1.pdf Table_1.eps)...executed.

Here's how standalone implements it:

\sa@convertoption{imagemagick}[]{%
\def\sa@convert@command{\convertexe\space -density \density\space \infile\space \ifx\size\empty\else -resize \size\fi\space -quality 90 \outfile}%
\let\sa@convert@pageoffset\m@ne
}

Any ideas?

1

So far I've found a workaround in the standalone package that can be implemented in one of two ways:

  • Modify the standalone.cls file between lines 394 and 395 to include the following:

    \sa@convertoption{eps}[]{%
        \def\sa@convert@command{pdftops\space -eps\space \infile\space\outfile}%
        \sa@convertvar{outext}{.eps}
    }
    

and then make the document class look like \documentclass[convert=eps]{standalone}.

  • Modify the document class line to look like

    \documentclass[convert={command=\unexpanded{pdftops\space -eps\space \jobname.pdf\space \jobname.eps},imagemagick}]{standalone}
    

My issue now is that I want standalone to convert the PDF file to both PNG and EPS but I think that standalone was made to do only one conversion. The only solution to this is to run the file twice, once with convert=eps and once with convert=imagemagick.

  • You are on the right track. If you compile using command line, you can write a script that will first do the conversion (assuming you know the image names), then proceed to process your tex file. In other words, you would do the conversion outside of TeX. – user139954 Apr 10 '18 at 15:19
  • Is there a way to run the complete file twice? Once with convert=imagemagick and once with convert=eps. The pdf will be rewritten but it produces the same image so there shouldn't be any problem. @RobtAll – elporsche Apr 11 '18 at 9:08
  • Probably yes, using batch (shell) script. Outside my expertise. – user139954 Apr 11 '18 at 14:16
1

You can adapt https://tex.stackexchange.com/a/413764/4427

\documentclass[
  convert={
    convertexe=pdftops -eps,
    outext=.eps,
    command=\unexpanded{%
      \convertexe\space
      \infile\space
      \outfile
    },
  }
]{standalone}

\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{array}
\usepackage{textgreek}
\usepackage{xcolor}
\usepackage{fixltx2e}
\usepackage{booktabs}
\usepackage{xfrac}

\usetikzlibrary{shapes,arrows,chains}
\usepgfplotslibrary{external}
\usetikzlibrary{pgfplots.external}

\pgfplotsset{compat=newest}

\begin{document}
\small
\begin{tabular}{ lrrrr }
    \toprule
    Gas & $\sigma / \text{\AA}$ & $\sfrac{\varepsilon}{\kappa} /  \text{K} $ & $\sfrac{\kappa T}{\varepsilon}$ / \text{-} & $\Omega_ \mu / \text{-} $ \\
    \midrule
    H\textsubscript{2} & $2.915$ & $ 38$ & $7.77$ & $0.86$ \\
    N\textsubscript{2} & $3.667$ & $100$ & $2.96$ & $1.04$ \\
    O\textsubscript{2} & $3.433$ & $113$ & $2.61$ & $1.08$ \\
    \bottomrule
\end{tabular}
\end{document}
  • Thanks! I kind of figured that out on my own but it's better the way you wrote it. – elporsche May 11 '18 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.