Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In a standard TeX Live distribution Ghostscript is, to my knowledge, present; it is hidden, but it is there.

Edit: Yes, it is under

\Texlive\2013\tlpkg\tlgs 

So to my question:

How can I use arara, to activate the internal Ghostscript to get a graphics file as an output? For example mydocument.png (in addition to mydocument.pdf).

Note, that I do not ask, how can I convert a PDF to a PNG (we know there are 1000s of possibilities), I am interested to use only internal TeX Live tools (that means NO extra software) and let arara do the job.

share|improve this question
1  
Knowing how you would use ghostscript to make the PNG files from the PDF is better. Is it a single page PDF? Do you want to crop it to a minimal bounding box? However, as far as I know, ghostscript is not included in TeX Live. –  egreg May 11 at 19:59
    
Oh, that is a good question. For example: I create a TikZ-picture in the standalone-class, so I am interessted to have that as a png. I also thought about the preview-package, to get special parts of my document as a preview; and this I would like to have as a png too ;) –  cis May 11 at 20:02
    
Which platform are you on? MacTeX includes some extras although it did not used to provide ghostscript as far as I know. It did used to provide a stripped down convert independent of ImageMagick. No idea if I am misremembering or if, if not, it still does, though... –  cfr May 12 at 1:42
    
Ghostscript can be found under \Texlive\2013\tlpkg\tlgs in windows ;) –  cis May 12 at 13:58

1 Answer 1

Here's a simple way to get what you need with standalone:

% arara: pdflatex: { shell: yes }
\documentclass[
  convert,
  outext=.png,
  tikz,
]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\filldraw [red] (0,0) circle [radius=2pt]
(1,1) circle [radius=2pt] (2,1) circle [radius=2pt] (2,0) circle [radius=2pt];
  \draw (0,0) .. controls (1,1) and (2,1) .. (2,0);
\end{tikzpicture}
\end{document}

This will use convert and needs ImageMagick, which can be easily installed. Conversion using ghostscript is possible, but you need tweaking the parameters. With the default ones, the conversion with convert is good, with ghostscript (that you get by convert=ghostscript) is quite bad.

The conversion with ghostscript is obtained with

% arara: pdflatex: { shell: yes }
\documentclass[
  convert=ghostscript,
  tikz,
]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\filldraw [red] (0,0) circle [radius=2pt]
(1,1) circle [radius=2pt] (2,1) circle [radius=2pt] (2,0) circle [radius=2pt];
  \draw (0,0) .. controls (1,1) and (2,1) .. (2,0);
\end{tikzpicture}
\end{document}

Examining the .log file I see

runsystem(gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -r300 -sOutputFile=gsconv-%d.png gsconv.pdf)...executed.

which shows that ghostscript is called. You may need to do some adjustment to the internal parameters, in particular for helping standalone in finding the ghostscript executable. I can't be more precise, because I don't have Windows (and never will).

share|improve this answer
    
Thank you! So we have a solution with the extra-software ImageMagick. But I ask me, if there is a elementary solution with the ghostscript, wich you can found under \Texlive\2013\tlpkg\tlgs (in Windows)? –  cis May 12 at 14:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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