TeX - LaTeX Asked by user183391 on January 19, 2021
I entered the LaTeX gnuplot
code exactly as stated in this site, which should output the sine curve on the output document using TeXworks compiler. It compiles but produces an empty document. An advice was to try -shell-escape
.
I did the -shell-escape
with no luck. What else should I try?
This is the code that I entered in TexWorks. Compiled with both pdfLaTex and 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}
The code provide above is from 2013 Creating colourful plot using latex terminal of gnuplottex ?
Answer and should look like this in TeXworks
Actually its got some gnuplottex oddities compared to some other gnuplot calls. and I would change the Preamble to read something like this.
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 defgnuplotexe{/opt/local/bin/gnuplot} for me on windows this worked just as well as using a script or path or editor setting
%defgnuplotexe{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}
The bottom line is that a blank page usually means gnuplot was not invoked by the use of defgnuplotexe{…} or by default in the shell to system paths. The best way to resolve this is ensure you have the latest gnuplot from http://www.gnuplot.info/ (I used v 5.3 for this run but the current release this year is 5.2.6.) Once installed then in TeXworks ensure that the gnuplotexe folder (. . ./gnuplot/bin) is included in the Typesetting Preference paths like this :-
Answered by user170109 on January 19, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP