在我的计算机上,通过命令行中的以下命令,完全可以实现转换pdf
为png
空格消除:
convert -density 300 labels.pdf -quality 90 labels.png convert -trim labels.png file-trimmed.png
现在,我想在编辑器 (Tex Maker) 中的编译过程中自动执行此操作。这是我的方法:
\documentclass[convert]{standalone}
\usepackage{amsmath}
\usepackage{mathrsfs}
\begin{document}
$\mathscr{C}_{\hat{x}}$
\end{document}
当我用编译我的 *.tex 文件时LaTeX
,转换失败并且编译器抛出警告:
转换失败!请确保已启用 shell escape(standalone)(例如使用“-shell-escape”)。
因此,我确实添加了-shell-escape
命令LaTeX
:
latex -interaction=nonstopmode --shell-escape %.tex
转换再次失败,这次出现了新的警告:
转换失败!(独立)您的(独立)对话软件或文件权限可能有问题!)(“C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsmath.sty”包:amsmath 2013/01/14 v2.14 AMS math features\@mathmargin=\skip43有关 amsmath 的更多信息,请使用“?”选项。
amsmath
然后,我想如果我将必需的选项添加到as中,问题可能会得到解决\usepackage[?]{amsmath}
。 但是又出现了另一个警告,如下所示:
转换失败!(独立)您的(独立)对话软件或文件权限可能有问题!)(“C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsmath.sty”包:amsmath 2013/01/14 v2.14 AMS math features\@mathmargin=\skip44amsmath 包的文档位于 amsldoc.dvi(或 .pdf 或 .tex)中。
我现在被这个问题难住了......
你能给我一些建议吗?!
更新 1:pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex
导致以下警告(没有生成png
):
转换失败!(独立)您的(独立)对话软件或文件权限可能有问题!))您使用了多少 TeX 内存:49392110613 个字符串,共 314727358258 个字符串字符,共 3000000 个字内存,共 4047 个多字母控制序列,共 15000+200000 个多字母控制序列,14 种字体的 3640 个字字体信息,共 9000 个字字体信息,共 3000000 个字,共 8191 个连字异常,共 34i、1n、56p、169b、48s 个堆栈位置,共 5000i、500n、10000p、200000b、50000s 个,无输出页面。
更新 2:pdflatex --shell-escape %.tex
导致错误反映在更新 1。以下是日志文件:
> 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)
更新 3:
以下是standalone.cfg
文件的内容:
\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