2016-04-03 109 views
1

早些时候,我使用了Gnuplot并创建了一个pdf-文件,然后我通过includegraphics执行了我的Latex-文档。如何用Gnuplot绘制乳胶图?

是不是有更好的方法直接从Latex打印 - 文档是Gnuplot

+0

如果你想完全在你的乳胶文件处理您的图表,'pgfplots'可能提供了更好的乳胶整合比的gnuplot。 – Miguel

回答

1

基本上U可以只关注该Youtube-Tutorial

因此,这里的步骤是:

第1步:设置环境变量

已经安装完毕后MikTexTexStudioGnuplot点击Start - >右击Computer - >Settings - >Advanced Systemsettings - >Environment variables

在这里,你必须创建3个新变量:

► PATH 
C:\Program Files (x86)\MiKTeX 2.9\miktex\bin;C:\Program Files (x86)\gnuplot\bin 

► gnuplot 
C:\Program Files (x86)\gnuplot\bin 

► GNUPLOT_LIB 
C:\Program Files (x86)\gnuplot\demo 

第2步:编辑TexStudio 转到TexStudio并点击Options - >Configure TexStudio - >Commands

在这里你需要更新上面两个命令

► LaTeX 
"C:/Program Files (x86)/MiKTeX 2.9/miktex/bin/latex.exe" -src -interaction=nonstopmode %.tex 

► PdfLaTeX 
pdflatex.exe -synctex=1 -shell-escape -enable-write18 -interaction=nonstopmode %.tex 

S TEP 3:代码中的Gnuplot乳胶

\documentclass[a4paper]{scrartcl} 
\usepackage[miktex]{gnuplottex} 

\begin{document} 
\begin{figure}[H] 
    \centering 
    \begin{gnuplot}[terminal=pdf] 
     set terminal pdf enhanced size 14.5cm, 4cm 
     set key top left 
     set xlabel 'x [1]' 
     set ylabel 'y [1]' 

     f1(x)=sin(x**2) 

     plot f1(x) title 'y_1 = sin(x^2)' 
    \end{gnuplot} 
    \caption{Plot} 
\end{figure} 
\end{document}