使用 Latex 和 TeXnicCenter 的 Asymptote

使用 Latex 和 TeXnicCenter 的 Asymptote

我使用 miktex 和 TeXnicCenter,想用 Asymptote 在 .tex 文件中制作图形。但是以下代码

\documentclass[a4paper]{article}
\usepackage{asymptote}
\begin{document}
\begin{asy}
draw((0,0) -- (2,0));
\end{asy}
\end{document}

产生零失败,但没有图片。

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6745 64-bit) (preloaded format=pdflatex 2018.8.6)  7 AUG 2019 13:18
entering extended mode
**./VAsymptote.tex
(VAsymptote.tex
LaTeX2e <2018-04-01> patch level 5
("C:\Program Files\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex\latex\base\size10.clo"
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("C:\Program Files\MiKTeX 2.9\tex\latex\asymptote\asymptote.sty"
Package: asymptote 2016/11/26 v1.33 Asymptote style file for LaTeX
\ASYbox=\box26
\ASYdimen=\dimen103
\c@asy=\count88
\AsyStream=\write3
\AsyPreStream=\write4

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
) ("C:\Program Files\MiKTeX 2.9\tex\latex\base\ifthen.sty"
Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\color.sty"
Package: color 2016/07/10 v1.1e Standard LaTeX Color (DPC)

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics-cfg\color.cfg"
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package color Info: Driver file: pdftex.def on input line 147.

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics-def\pdftex.def"
File: pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
))
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
Package: graphicx 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
 ("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
) ("C:\Program Files\MiKTeX 2.9\tex\latex\graphics-cfg\graphics.cfg"
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 99.
)
\Gin@req@height=\dimen104
\Gin@req@width=\dimen105
)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifpdf.sty"
Package: ifpdf 2017/03/15 v3.2 Provides the ifpdf switch
)
("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\generic\oberdiek\catchfile.sty"
Package: catchfile 2016/05/16 v1.7 Catch the contents of a file (HO)

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty"
Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO)
)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"
Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\etexcmds.sty"
Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifluatex.sty"
Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
)
Package etexcmds Info: Could not find \expanded.
(etexcmds)             That can mean that you are not using pdfTeX 1.50 or
(etexcmds)             that some package has redefined \expanded.
(etexcmds)             In the latter case, load this package earlier.
))
\openout4 = `VAsymptote.pre'.

)
No file VAsymptote.aux.
\openout1 = `VAsymptote.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
("C:\Program Files\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count89
\scratchdimen=\dimen106
\scratchbox=\box27
\nofMPsegments=\count90
\nofMParguments=\count91
\everyMPshowfont=\toks15
\MPscratchCnt=\count92
\MPscratchDim=\dimen107
\MPnumerator=\count93
\makeMPintoPDFobject=\count94
\everyMPtoPDFconversion=\toks16
) ("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\epstopdf-base.sty"
Package: epstopdf-base 2016/05/15 v2.6 Base part for package epstopdf

("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\grfext.sty"
Package: grfext 2016/05/16 v1.2 Manage graphics extensions (HO)

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\kvdefinekeys.sty"
Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO)
))
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\kvoptions.sty"
Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO)

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\kvsetkeys.sty"
Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO)
))
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\pdftexcmds.sty"
Package: pdftexcmds 2018/01/30 v0.27 Utility functions of pdfTeX for LuaTeX (HO)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
)
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 438.
Package grfext Info: Graphics extension search list:
(grfext)             [.pdf,.png,.jpg,.mps,.jpeg,.jbig2,.jb2,.PDF,.PNG,.JPG,.JPEG,.JBIG2,.JB2,.eps]
(grfext)             \AppendGraphicsExtensions on input line 456.
)
\openout3 = `VAsymptote-1.asy'.



Package asymptote Warning: file `VAsymptote-1.pdf' not found on input line 8.

(VAsymptote.aux) ) 
Here is how much of TeX's memory you used:
 1620 strings out of 492973
 23271 string characters out of 3135936
 84532 words of memory out of 3000000
 5496 multiletter control sequences out of 15000+200000
 3640 words of font info for 14 fonts, out of 3000000 for 9000
 1141 hyphenation exceptions out of 8191
 34i,1n,25p,215b,70s 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)

谢谢并致以最诚挚的问候

答案1

我按照@Mensch 的解释去做了。但是,通配符似乎有问题;asy 必须被覆盖jobname-*.asy,而通配符会造成麻烦。

为了最终解决方案,我在 Asymptote 的目录中创建了一个批处理文件

@ECHO OFF
cd %1
"C:\Program Files (x86)\Asymptote\asy.exe" %2-*.asy
echo.

然后我将后期处理设置为C:\Program Files (x86)\Asymptote\asy-custom.bat带有参数%dm %tm(含义:文件路径+不带扩展名的文件名)。

最后我添加了再次调用的第二个后处理器pdflatex

答案2

嗯,我不知道渐近线,你也没有告诉我们运行这个软件需要哪个命令,所以我只能帮助你展示你必须添加所需命令的正确位置。

有两种可能性,取决于渐近线运行的需要:

  1. 编译 tex 文件或
  2. 编译 tex 文件。

打开 TeXnicCenter,然后按alt+F7打开profile菜单。现在选择要复制的配置文件以创建一个新的配置文件来运行 asymptote,添加它并将其重命名为(asymptote例如;参见左侧屏幕截图底部的按钮)并单击Kopieren(德语:Vorbearbeitung)(如果您需要点 1)或(德语:Nachbearbeitung)(如果您需要点 2)。Hinzufügenpreprocessorpostprocessor

轮廓

根据您现在需要运行 asymptote 的命令,请在打开的窗口中填写正确的数据(在我的屏幕截图中,您可以看到德语版本,在文档中您可以找到英文版本,但请注意预处理器是未描述那里!看文档,转到后处理器选项卡)

请注意文档中的此备注:

文件中的备注

添加运行 asymptote 所需的所有信息后,单击Ok以存储新的配置文件。

asymptote现在您可以使用在 TeXnicCenter 中运行 asymptote 的新配置文件...

相关内容