如何使用 gnuplottex?

如何使用 gnuplottex?

我想使用 gnuplottex,但甚至文档中的示例都不起作用。

\documentclass[a4paper]{article}

    \usepackage{gnuplottex}
    \begin{document}
    \begin{figure}%
        \centering%
        \begin{gnuplot}[terminal=latex, terminaloptions=rotate]
            set key box top left
            set key width 4
            set sample 1000
            set xr [-5:5]
            set yr [-1:1]
            set xlabel ’$x$-label’
            set ylabel ’$y$-label’
            plot sin(x) w l lc 1 t ’$\sin(x)$’,\cos(x) w l lc 2 t ’$\cos(x)$’,\
            tan(x) w l lc 3 t ’$\tan(x)$’,\
            tanh(x) w l lc 4 t ’$\tanh(x)$’
        \end{gnuplot}
        \caption{This is a simple example using the latex-terminal.}%
        \label{pic:latex}%
    \end{figure}%
    \end{document}

使用 [miktex]{gnuplottex} 的日志文件

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9) (preloaded format=pdflatex 2016.4.25)  26 MAY 2016 15:17
entering extended mode
**234234.tex
(C:\Users\MASAMUTRE\Documents\texi\234234.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for loaded.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size10.clo"
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\gnuplottex\gnuplottex.sty"
Package: gnuplottex 2015/12/13 v0.9.1 gnuplot graphs in LaTeX

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks14
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg"
File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
)
Package graphics Info: Driver file: pdftex.def on input line 91.

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX

("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty"
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
)
\Gread@gobject=\count87
))
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\moreverb\moreverb.sty"
Package: moreverb 2008/06/03 v2.3a `more' verbatim facilities

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\tools\verbatim.sty"
Package: verbatim 2003/08/22 v1.5q LaTeX2e package for verbatim enhancements
\every@verbatim=\toks15
\verbatim@line=\toks16
\verbatim@in@stream=\read1
)
\tab@position=\count88
\tab@size=\count89
\listing@line=\count90
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\ifthen.sty"
Package: ifthen 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\catchfile.sty"
Package: catchfile 2011/03/01 v1.6 Catch the contents of a file (HO)

("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\etexcmds.sty"
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)

("C:\Program Files (x86)\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.
)
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.
))
\verbatim@out=\write3
runsystem(echo t > "w18-test-2016526917.tex")...executed.

runsystem(del "w18-test-2016526917.tex")...executed.

Package gnuplottex Info: Automatically converting gnuplot files. on input line 
110.
\c@fignum=\count91
)
(C:\Users\MASAMUTRE\Documents\texi\234234.aux)
LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.

("C:\Program Files (x86)\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count92
\scratchdimen=\dimen105
\scratchbox=\box26
\nofMPsegments=\count93
\nofMParguments=\count94
\everyMPshowfont=\toks17
\MPscratchCnt=\count95
\MPscratchDim=\dimen106
\MPnumerator=\count96
\makeMPintoPDFobject=\count97
\everyMPtoPDFconversion=\toks18
) Opening gnuplot stream 234234-gnuplottex-fig1.gnuplot
runsystem(gnuplot 234234-gnuplottex-fig1.gnuplot)...executed.



Package gnuplottex Warning: Conversion of 234234-gnuplottex-fig1.gnuplot failed
.


Package gnuplottex Warning: Please convert 234234-gnuplottex-fig1.gnuplot manua
lly.

Opening gnuplot stream 234234-gnuplottex-fig2.gnuplot
runsystem(gnuplot 234234-gnuplottex-fig2.gnuplot)...executed.



Package gnuplottex Warning: Conversion of 234234-gnuplottex-fig2.gnuplot failed
.


Package gnuplottex Warning: Please convert 234234-gnuplottex-fig2.gnuplot manua
lly.

(C:\Users\MASAMUTRE\Documents\texi\234234.aux) ) 
Here is how much of TeX's memory you used:
 1349 strings out of 495352
 18819 string characters out of 3182689
 66498 words of memory out of 3000000
 4548 multiletter control sequences out of 15000+200000
 3640 words of font info for 14 fonts, out of 3000000 for 9000
 14 hyphenation exceptions out of 8191
 34i,1n,21p,255b,69s 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)

给出日志文件

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9) (preloaded format=pdflatex 2016.4.25)  26 MAY 2016 08:57
entering extended mode
**234234.tex
(C:\Users\MASAMUTRE\Documents\texi\234234.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for loaded.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size10.clo"
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\gnuplottex\gnuplottex.sty"
Package: gnuplottex 2015/12/13 v0.9.1 gnuplot graphs in LaTeX

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks14
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg"
File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
)
Package graphics Info: Driver file: pdftex.def on input line 91.

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX

("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty"
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
)
\Gread@gobject=\count87
))
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\moreverb\moreverb.sty"
Package: moreverb 2008/06/03 v2.3a `more' verbatim facilities

("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\tools\verbatim.sty"
Package: verbatim 2003/08/22 v1.5q LaTeX2e package for verbatim enhancements
\every@verbatim=\toks15
\verbatim@line=\toks16
\verbatim@in@stream=\read1
)
\tab@position=\count88
\tab@size=\count89
\listing@line=\count90
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\ifthen.sty"
Package: ifthen 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
)
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\catchfile.sty"
Package: catchfile 2011/03/01 v1.6 Catch the contents of a file (HO)

("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\etexcmds.sty"
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)

("C:\Program Files (x86)\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.
)
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.
))
\verbatim@out=\write3
runsystem(touch w18-test-2016526537.tex)...executed.

runsystem(rm -f w18-test-2016526537.tex)...executed.

runsystem(rm -f "234234.gnuploterrors")...executed.



Package gnuplottex Warning: Shell escape not enabled.
(gnuplottex)                You'll need to convert the graphs yourself..

\c@fignum=\count91
) (C:\Users\MASAMUTRE\Documents\texi\234234.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 (x86)\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count92
\scratchdimen=\dimen105
\scratchbox=\box26
\nofMPsegments=\count93
\nofMParguments=\count94
\everyMPshowfont=\toks17
\MPscratchCnt=\count95
\MPscratchDim=\dimen106
\MPnumerator=\count96
\makeMPintoPDFobject=\count97
\everyMPtoPDFconversion=\toks18
) Opening gnuplot stream 234234-gnuplottex-fig1.gnuplot

Package gnuplottex Warning: Please convert 234234-gnuplottex-fig1.gnuplot manua
lly.

Opening gnuplot stream 234234-gnuplottex-fig2.gnuplot

Package gnuplottex Warning: Please convert 234234-gnuplottex-fig2.gnuplot manua
lly.


! Package catchfile Error: File `234234.gnuploterrors' not found.

See the catchfile package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.16 \end{document}

Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.

)
Runaway argument?
\ifx \gnuploterrors@ \@empty \else \PackageWarningNoLine {gnuplottex}\ETC.
! File ended while scanning use of \gnuploterrors@eatpar.
<inserted text> 
                \par 
<*> 234234.tex

I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.

! Emergency stop.
<*> 234234.tex

*** (job aborted, no legal \end found)


Here is how much of TeX's memory you used:
 1347 strings out of 495352
 18740 string characters out of 3182689
 66486 words of memory out of 3000000
 4548 multiletter control sequences out of 15000+200000
 3640 words of font info for 14 fonts, out of 3000000 for 9000
 14 hyphenation exceptions out of 8191
 34i,0n,21p,255b,67s stack positions out of 5000i,500n,10000p,200000b,50000s
!  ==> Fatal error occurred, no output PDF file produced!

我写了pdflatex.exe --shell-escape foo.tex并使用了真实的例子,但是存在错误 在此处输入图片描述 我收到了该错误。即使什么都没写,我也收到了有关 .gnuploterrors 的错误。 在此处输入图片描述

我输入了--shell-escape但没有任何效果。 塞尔盖尔什德赫特

答案1

检查'原帖中的引号,它们似乎是错误的。我使用普通的 ASCII'引号字符替换了它们。

此外,--shell-escape必须启用,即运行pdflatex --shell-escape foo.tex

% arara: pdflatex: { shell: yes }
\documentclass[a4paper]{article}

    \usepackage{gnuplottex}
    \begin{document}
    \begin{figure}%
        \centering%
        \begin{gnuplot}[terminal=latex, terminaloptions=rotate]
            set key box top left
            set key width 4
            set sample 1000
            set xr [-5:5]
            set yr [-1:1]
            set xlabel '$x$'
            set ylabel '$y$'
            plot sin(x) w l lc 1 t '$\sin(x)$',\
            cos(x) w l lc 2 t '$\cos(x)$',\
            tan(x) w l lc 3 t '$\tan(x)$',\
            tanh(x) w l lc 4 t '$\tanh(x)$'
        \end{gnuplot}
        \caption{This is a simple example using the latex-terminal.}%
        \label{pic:latex}%
    \end{figure}%
    \end{document}

在此处输入图片描述

笔记

\usepackage[utf8]{inputenc}不能解决问题。

相关内容