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.

I want to use the conversion options of the standalone package to produce a PNG image file from a LaTeX source file. The package documentation lists two tables with options for conversion. The normal options are usable inside the convert class options, the advanced options are usable inside ... that's the question now. From the documentation examples and experiments I know that they are usable within a standalone.cfg file. But, my question is, if I could use them inside my source files directly somehow.

Here is a MWE of something I tried:

\documentclass[convert={density=600,size=400x400,outext=.png},crop,border=0mm]{standalone}
\usepackage{tikz}

% The following options are ignored at this place.
% It works if this is put inside a 'standalone.cfg' file
\standaloneconfig{convert={command={\convertexe\space -density \density\space
  \infile\space
  \ifx\size\empty\else -resize \size\fi\space
  -quality 100\space
  -define png:format=png32\space
  -define png:compression-filter=4\space
  \outfile}}}

\begin{document}
\begin{tikzpicture}
\shadedraw [shading=ball] (0,0) circle (2cm);
\end{tikzpicture}
\end{document}

enter image description here

  • Putting the options inside the \standaloneconfig macro of the given MWE is ignored.
  • Putting the options inside the class options (I tried several things) leads to compilation errors.

Is there a solution where and how to put the options inside my source file or am I forced to use the standalone.cfg file? I would consider to have all options in one file a very desirable feature. Maybe, I'm just applying things wrong?

Update: Since nobody answered or commented my question the last two days, I guess it's not possible to use the advanced conversion options inside the source file (?). I would appreciate any comment ... can't imagine nobody tried this before ...

share|improve this question
    
I just guess @MartinScharrer is kind of busy these days. I am pretty sure he will provide a definite answer, eventually. –  Daniel Nov 28 '13 at 8:20
    
@Daniel @MartinScharrer If it is not possible with the current version of standalone, I would like to file it as feature request :-) –  Thomas F. Sturm Nov 28 '13 at 14:05
add comment

1 Answer 1

up vote 1 down vote accepted

According to the documentation, is only possible if you set it within "standalone.cfg" not within the document, however, is more like using:

\documentclass[convert={density=600,size=400x400,outext=.png},crop,border=0mm]{standalone}
\usepackage{filecontents}
\begin{filecontents}{standalone.cfg}
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{standalone.cfg}[2012/09/15 v1.1b Default configuration file for 'standalone' class]%
% The following options are ignored at this place.
% It works if this is put inside a 'standalone.cfg' file
    \standaloneconfig{convert={command={\convertexe\space -density \density\space
      \infile\space
      \ifx\size\empty\else -resize \size\fi\space
      -quality 100\space
      -define png:format=png32\space
      -define png:compression-filter=4\space
      \outfile}}}
\end{filecontents}
\usepackage{tikz}
\usepackage{bashful}
\begin{document}
\begin{tikzpicture}
\shadedraw [shading=ball] (0,0) circle (2cm);
\end{tikzpicture}
\end{document}

the log :

 runsystem(convert -density 600 uno.pdf -resize 400x400 -quality 100 -define png
:format=png32 -define png:compression-filter=4 uno.png)...executed.

or

mogrify -resize 400x400 -quality 100  -define png:format=png32 -define png:compression-filter=4 -format png *.png

after compiled document (mogrify prserve name of the image files :). regards

share|improve this answer
    
I had hoped for a solution with standalone directly but your approach gives a good sideway solution. Nevertheless, in the meantime I found a more direct way here: tex.stackexchange.com/questions/22982/… This seems to be the method standalone uses. I tested it and it works. –  Thomas F. Sturm Nov 28 '13 at 14:03
    
If I agree, but converting images is not like latex, I think it is good to subdivide tasks, so there is no need to compile again and again document to obtain the desired image is only done once and then play with mogrify (or convert) until you need. If you use an IDE is easy to create a profile for this, so the (and latex) system does not become overloaded in a single process. –  Pablo González L Nov 28 '13 at 14:34
    
A couple of queries for you: Does using windows or linux?, Have installed GS or pdftk? and Have a recent version perl? then you might like this (in this beta version) dropbox.com/s/jg0e6pezrxiahuu/ltximage.zip –  Pablo González L Nov 30 '13 at 7:51
    
I'm using Windows and I do not have pdftk (I think...) or perl (I'm sure). Nevertheless, thank you for your help. Now, I use the (La)-TeX-only solution of Ulrike Fischer from tex.stackexchange.com/questions/22982/… which works very good. –  Thomas F. Sturm Nov 30 '13 at 8:51
add comment

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.