Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to use the gnuplot's tikz terminal to create good looking graphs in pdf format. However, I have trouble compiling the resulting .tex file. My plot.gp file looks like:

clear
reset
set terminal tikz color standalone size 5in,3in
set output 'plot.tex'
plot  sin(x)

I compile the resulting plot.tex file with:

pdflatex -shell-escape plot.tex

Then, the compilation halts at the following output:

Overfull \hbox (16.34975pt too wide) in paragraph at lines 96--96
[][] 
Preview: Tightpage 0 0 0 0
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}])
*

At this point it leaves me the possibility to interact. Typing \end and then twice <RET> and then x seemingly aborts the process but the produces a working .pdf:

*\end
*
Runaway argument?
! Paragraph ended before \end was complete.
<to be read again> 
               \par 
<*> 
? x
</home/christian/.texmf-var/fonts/pk/ljfour/jknappen/ec/ecrm1000.600pk>
Output written on plot.pdf (1 page, 7343 bytes).
Transcript written on plot.log.

How could I compile the file without errors? Thanks a lot in advance!

P.S.: I am running Linux Mint 14 and TexLive 2012 from the official repositories.

share|improve this question
1  
I'm not sure how this works. But try writing set output 'plot2.tex' after plot sin(x). In my case gnuplot doesn't end my files until I change the output. –  Manuel Nov 26 '12 at 21:50
1  
You can just say set out, without a file name, to close the file properly. –  Jake Nov 26 '12 at 21:52
    
With my version of gnuplot (version 4.6 patchlevel 0), the output produced by the tikz driver uses lualatex... –  Paul Gaborit Nov 26 '12 at 23:37
    
using set out as the last comment in the script did the trick, thank you very much! Newbie question: how can I mark this thread as answered? –  user8878 Nov 27 '12 at 0:11
1  
Someone has to add an answer, and then you click the green tickmark next to the answer. @Jake, would you like to add an answer? –  Torbjørn T. Nov 27 '12 at 0:31
add comment

1 Answer

up vote 4 down vote accepted

After the plot command, the output file isn't yet complete. You need to say set out to finish the file. This is also true for similar terminals like the epslatex one.

When you use the TikZ terminal, the command set out 'plot.tex' creates the output file, which is empty for the time being. The first plot command adds the preamble, \begin{document}, and a tikzpicture containting the first plot. However, no \end{document} is added yet, because you might want to add more plots. Each additional plot command adds another tikzpicture that is plotted on top of the earlier ones. In order to get a complete .tex file, \end{document} has to be added at the end. This happens when you say set output (or set out for short) without a file name (or with a different file name, but that would also create a new file).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.