2

Conversion of pdf to png and whitespace elimination is completely applicable on my machine by following commands from command line:

convert -density 300 labels.pdf -quality 90 labels.png convert -trim labels.png file-trimmed.png

Now, I'd like to do it automatically from compilation process within my editor (Tex Maker). Here is my approach to do it:

\documentclass[convert]{standalone}

\usepackage{amsmath}
\usepackage{mathrsfs}

\begin{document}

$\mathscr{C}_{\hat{x}}$

\end{document}

As I compiled my *.tex file with LaTeX, conversion failed and compiler throw a warning:

Conversion failed! Please ensure that shell escape(standalone) is enabled (e.g. use '-shell-escape').

So, I did add -shell-escape to LaTeX command:

latex -interaction=nonstopmode --shell-escape %.tex

The conversion failed again, this time with a new warning:

Conversion unsuccessful!(standalone) There might be something wrong with your(standalone) conversation software or the file permissions!) ("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsmath.sty"Package: amsmath 2013/01/14 v2.14 AMS math features\@mathmargin=\skip43For additional information on amsmath, use the `?' option.

Then, I thought the issue might be resolved if I add the required option to amsmath as \usepackage[?]{amsmath}. But another warning just appeared, as following:

Conversion unsuccessful!(standalone) There might be something wrong with your(standalone) conversation software or the file permissions!) ("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsmath.sty"Package: amsmath 2013/01/14 v2.14 AMS math features\@mathmargin=\skip44Documentation for the amsmath package is found in amsldoc.dvi(or .pdf or .tex).

And I'm stuck on the problem at this point...

could you give my some advice about it?!

Update 1: pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex leads to following warning (with no generated png):

Conversion unsuccessful!(standalone) There might be something wrong with your(standalone) conversation software or the file permissions!) ) Here is how much of TeX's memory you used:693 strings out of 49392110613 string characters out of 314727358258 words of memory out of 30000004047 multiletter control sequences out of 15000+2000003640 words of font info for 14 fonts, out of 3000000 for 9000841 hyphenation exceptions out of 819134i,1n,56p,169b,48s stack positions out of 5000i,500n, 10000p,200000b,50000sNo pages of output.

Update 2: pdflatex --shell-escape %.tex leads to the error reflecting in Update 1. And here is the log file:

> This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9) (preloaded
> format=pdflatex 2016.5.13)  17 JAN 2017 21:41 entering extended mode
> **labels.tex (C:\MyTEMP\labels.tex LaTeX2e <2011/06/27> Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
> abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan,
> coptic,  croatian, czech, danish, dutch, esperanto, estonian, farsi,
> finnish, french, ga lician, german, german-x-2013-05-26, greek,
> gujarati, hindi, hungarian, iceland ic, indonesian, interlingua,
> irish, italian, kannada, kurmanji, latin, latvian,  lithuanian,
> malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerman, n
> german-x-2013-05-26, nynorsk, oriya, panjabi, pinyin, polish,
> portuguese, roman ian, russian, sanskrit, serbian, slovak, slovenian,
> spanish, swedish, swissgerm an, tamil, telugu, turkish, turkmen,
> ukenglish, ukrainian, uppersorbian, usengl ishmax, welsh, loaded.
> ("C:\Program Files\MiKTeX 2.9\tex\latex\standalone\standalone.cls"
> Document Class: standalone 2015/07/15 v1.2 Class to compile TeX
> sub-files stand alone ("C:\Program Files\MiKTeX
> 2.9\tex\generic\oberdiek\ifluatex.sty" Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) Package ifluatex Info: LuaTeX
> not detected. ) ("C:\Program Files\MiKTeX
> 2.9\tex\generic\oberdiek\ifpdf.sty" Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) Package ifpdf Info: pdfTeX in PDF mode
> is detected. ) ("C:\Program Files\MiKTeX
> 2.9\tex\generic\ifxetex\ifxetex.sty" Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional ) ("C:\Program Files\MiKTeX
> 2.9\tex\latex\xkeyval\xkeyval.sty" Package: xkeyval 2012/10/14 v2.6b package option processing (HA)
> 
> ("C:\Program Files\MiKTeX 2.9\tex\generic\xkeyval\xkeyval.tex"
> \XKV@toks=\toks14 \XKV@tempa@toks=\toks15 \XKV@depth=\count79 File:
> xkeyval.tex 2012/10/14 v2.6b key=value parser (HA)
> 
> ("C:\Program Files\MiKTeX 2.9\tex\generic\xkeyval\keyval.tex")))
> \sa@internal=\count80 \c@sapage=\count81
> 
> ("C:\Program Files\MiKTeX 2.9\tex\latex\standalone\standalone.cfg"
> File: standalone.cfg 2015/07/15 v1.2 Default configuration file for
> 'standalone ' class ) ("C:\Program Files\MiKTeX
> 2.9\tex\latex\base\article.cls" Document Class: article 2007/10/19 v1.4h Standard LaTeX document class ("C:\Program Files\MiKTeX
> 2.9\tex\latex\base\size10.clo" File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option) ) \c@part=\count82
> \c@section=\count83 \c@subsection=\count84 \c@subsubsection=\count85
> \c@paragraph=\count86 \c@subparagraph=\count87 \c@figure=\count88
> \c@table=\count89 \abovecaptionskip=\skip41 \belowcaptionskip=\skip42
> \bibindent=\dimen102 ) \sa@box=\box26 runsystem(pdflatex 
> -shell-escape  -jobname "labels" "\expandafter\def\csname s a@internal@run\endcsname{1}\input{labels}")...executed.
> 
> 
> (C:\MyTEMP\labels.aux) runsystem(imgconvert -density 300 labels.pdf 
> -quality 90 labels.png)...execute d.
> 
> 
> 
> Class standalone Warning: Conversion unsuccessful! (standalone)       
> There might be something wrong with your (standalone)             
> conversation software or the file permissions!
> 
>  ) )  Here is how much of TeX's memory you used:  691 strings out of
> 493921  10597 string characters out of 3147273  58409 words of memory
> out of 3000000  4047 multiletter control sequences out of 15000+200000
> 3640 words of font info for 14 fonts, out of 3000000 for 9000  841
> hyphenation exceptions out of 8191  34i,1n,56p,169b,51s stack
> positions out of 5000i,500n,10000p,200000b,50000s
> 
> No pages of output. PDF statistics:  0 PDF objects out of 1000 (max.
> 8388607)  0 named destinations out of 1000 (max. 500000)  1 words of
> extra memory for PDF output out of 10000 (max. 10000000)
> 
> 
> \@envbody=\toks19 \multlinegap=\skip44 \multlinetaggap=\skip45
> \mathdisplay@stack=\toks20 LaTeX Info: Redefining \[ on input line
> 2665. LaTeX Info: Redefining \] on input line 2666. ) ("C:\Program Files\MiKTeX 2.9\tex\latex\jknappen\mathrsfs.sty" Package: mathrsfs
> 1996/01/01 Math RSFS package v1.0 (jk) \symrsfs=\mathgroup4 )
> (C:\MyTEMP\labels.aux) LaTeX Font Info:    Checking defaults for
> OML/cmm/m/it on input line 6. LaTeX Font Info:    ... okay on input
> line 6. LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input
> line 6. LaTeX Font Info:    ... okay on input line 6. LaTeX Font Info:
> Checking defaults for OT1/cmr/m/n on input line 6. LaTeX Font Info:   
> ... okay on input line 6. LaTeX Font Info:    Checking defaults for
> OMS/cmsy/m/n on input line 6. LaTeX Font Info:    ... okay on input
> line 6. LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on
> input line 6. LaTeX Font Info:    ... okay on input line 6. LaTeX Font
> Info:    Checking defaults for U/cmr/m/n on input line 6. LaTeX Font
> Info:    ... okay on input line 6. LaTeX Font Info:    Try loading
> font information for U+rsfs on input line 8.  ("C:\Program
> Files\MiKTeX 2.9\tex\latex\jknappen\ursfs.fd" File: ursfs.fd
> 1998/03/24 rsfs font definition file (jk) ) [1
> 
> {C:/Users/Matiking/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]
> (C:\MyTEMP\labels.aux) )  Here is how much of TeX's memory you used: 
> 1317 strings out of 493921  17907 string characters out of 3147273 
> 67358 words of memory out of 3000000  4643 multiletter control
> sequences out of 15000+200000  4589 words of font info for 19 fonts,
> out of 3000000 for 9000  841 hyphenation exceptions out of 8191 
> 35i,4n,56p,279b,106s stack positions out of
> 5000i,500n,10000p,200000b,50000s <C:/Program Files/MiKTeX
> 2.9/fonts/type1/public/amsfont s/cm/cmmi7.pfb><C:/Program Files/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr7 .pfb><C:/Program Files/MiKTeX 2.9/fonts/type1/hoekwater/rsfs/rsfs10.pfb> Output written on labels.pdf (1 page, 18693 bytes). PDF statistics:  18 PDF objects out
> of 1000 (max. 8388607)  0 named destinations out of 1000 (max. 500000)
> 1 words of extra memory for PDF output out of 10000 (max. 10000000)

Update 3:

Here is the standalone.cfg file's content:

\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{standalone.cfg}[%
    2015/07/15
    v1.2
    Default configuration file for 'standalone' class]%
%% Enabled the "varwidth" option if the "varwidth" package is available:
%%\IfFileExists{varwidth.sty}{%
%%    \standaloneconfig{varwidth}%
%%}{}%

%% Default options:
\standaloneconfig{crop}

%% Option which 'preview' should be loaded with
\PassOptionsToPackage{active,tightpage}{preview}%

%% Enable 'preview' option by default:
%%\standaloneconfig{preview}

%% Remove the border:
\standaloneconfig{border=0pt}

%% Default preview border (used by standalone v0.x):
%%\standaloneconfig{border=0.50001bp}

%% Disable navigation symbols in beamer.
%% This must be done AtEndOfClass because the options are not processed yet,
%% so "beamer" mode is not enabled yet.
\AtEndOfClass{%
\ifstandalonebeamer
  \setbeamertemplate{navigation symbols}{}%
\fi
}
%% vim: ft=tex

closed as off-topic by barbara beeton, egreg, Stefan Pinnow, Kurt, Mico Feb 4 '17 at 22:26

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Works fine for me with pdflatex --shell-escape. Why are you using latex? Although I get a PNG with latex, it is definitely not the way to go here .... You would need to convert the DVI first as I doubt convert can manage DVI. – cfr Jan 18 '17 at 2:16
  • 1
    imgconvert is the name used in some windows applications of imgemagic to avoid a clash with the system convert command (which will reformat your disk) but your question is very hard to read as you have used quote > instead of code (four spaces) and line wrapped the error and log messages. it would be easier if you reposted them with teh original line endings in code sections. – David Carlisle Jan 18 '17 at 7:57
  • 1
    @cfr: I found another way, than editing standalone.cfg. I'd just copied convert.exe and remained the copy to imgconvert.exe. Now there's no error. Thanks for your helps. – Roboticist Jan 19 '17 at 0:17
  • 1
    @Roboticist You should look at the docs anyway, because the quality of the default conversion is probably awful. At least, it was for me. Definitely need higher DPI than I got by default. – cfr Jan 19 '17 at 0:22
  • 4
    I'm voting to close this question as off-topic because the op found a workable solution and noted it in a comment. – barbara beeton Feb 4 '17 at 21:54

Browse other questions tagged or ask your own question.