空白 PDF 文档

空白 PDF 文档

gnuplot我按照此网站所述输入了 LaTeX代码,它应该使用 TeXworks 编译器在输出文档上输出正弦曲线。它编译成功但生成了一个空文档。建议尝试一下-shell-escape

我这样做了,-shell-escape但没有成功。我还应该尝试什么?

这是我在 TexWorks 中输入的代码。使用 pdfLaTex 和 pdflatex+makeIndex+Bibtex 编译

\documentclass{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[miktex]{gnuplottex} % for MiKTeX,`pdflatex -shell-escape` enabled 
%\usepackage{gnuplottex} I have used this line to compile on TeXLive 2013
\usepackage{graphicx}
%\usepackage{epstopdf} % for MiKTeX,`pdflatex -shell-escape` enabled
\begin{document}
\begin{figure}[htbp]
\centering
\begin{gnuplot}[terminal=epslatex,terminaloptions=color]
plot [0:2*pi] sin(x) title 'Sine', cos(x) title 'Cosine'
\end{gnuplot}
\end{figure}
\end{document}

答案1

上面提供的代码来自 2013 使用 gnuplottex 的 latex 终端创建彩色图?
答案在 TeXworks 中应该看起来像这样

在此处输入图片描述

实际上,与其他 gnuplot 调用相比,它有一些 gnuplottex 奇怪之处。我会将序言改为这样的内容。

\documentclass{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

% gnuplot functions may not work if -aux-directory or  a /sub dir is set.
% The ".gnuplot" file(s) may be correctly written in the aux directory,
% but may not correctly pass through gnuplot to generate the ".table" file(s).
% there are some env vars for subdirectories read all the gnuplot docs

% WINDOWS TeX USERS need this option to pass `pdflatex -shell-escape` test (TeX Live & W32TeX not just MiKTeX)
\usepackage[miktex]{gnuplottex} 

% a Linux / Mac entry for Tex Live or even MiKTeX on NON windows ?
%\usepackage{gnuplottex}  

% Gnuplottex example could do with an update to define use of gnuplot.exe (i.e. you must RENAME wgnuplot or pgnuplot)
% also how to \def\gnuplotexe{/opt/local/bin/gnuplot} for me on windows this worked just as well as using a script or path or editor setting
%\def\gnuplotexe{H:/gnuplot/gp530-20190105-win32-mingw/gnuplot/bin/gnuplot.exe}

\usepackage{graphicx}
%\usepackage{epstopdf} % MiKTeX,`pdflatex -shell-escape` enabled (unknown if still needed in Windows ?)

\begin{document}
\begin{figure}[htbp]
\centering
\begin{gnuplot}[terminal=epslatex,terminaloptions=color]
plot [0:2*pi] sin(x) title 'Sine', cos(x) title 'Cosine'
\end{gnuplot}
\end{figure}
\end{document}

归根结底,空白页通常意味着 gnuplot 不是通过使用 \def\gnuplotexe{…} 或默认情况下在 shell 中通过系统路径调用的。解决此问题的最佳方法是确保您拥有最新的 gnuplothttp://www.gnuplot.info/(我这次运行使用的是 v 5.3,但今年的最新版本是 5.2.6。)安装完成后,在 TeXworks 中确保 gnuplotexe 文件夹(.../gnuplot/bin)包含在排版首选项路径中,如下所示:-

在此处输入图片描述

相关内容