5

I need to create .png files of graphs that I create. Specifically, the graphs need to have a transparent background.

I have been using LaTeXIt to compile my tikz code, and it has worked well. However, I then ran into the trouble of graphing implicit curves. Doing some research, I came across the idea of calling gnuplot with the "raw gnuplot" option within the tikz code (Note: This means I'm an extreme gnuplot newbie).

This works when I compile the code normally with TeXShop---beautiful implicit curves.

However, the same code put into LaTeXIt fails to produce the curve at all. I assume this is because LaTeXIt is not finding/reading/understanding the .table file that is created.

Does anyone know of a way to get LaTeXIt to work well with tikz code that calls gnuplot?

Below is an MWE of the code that works correctly with TeXShop.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw plot[id=question1, raw gnuplot, smooth] function{
  f(x,y) = x**4+8*y*y*y-21;
  set xrange [-4:4];
  set yrange [-4:4];
  set view 0,0;
  set isosample 1000,1000;
  set size square;
  set cont base;
  set cntrparam levels incre 0,0.1,0;
  unset surface;
  splot f(x,y)
};
\end{tikzpicture}
\end{document}

2 Answers 2

7

In order to run gnuplot from within pdflatex, you have to pass the -shell-escape option.

Go to the preferences of LaTeXIt and choose the “Typesetting” tab; next to the pdflatex box there's the icon

enter image description here

Click over it and a window to be filled appears; press the “+” button and complete as in the picture below:

enter image description here

Press “OK” and then all should go well. I defined a template for TikZ and compiled the code:

enter image description here

6

run with xelatex:

\documentclass{article}
\usepackage{pst-func}
\begin{document}
\begin{pspicture*}(-5,-4.5)(5,2.9)
\psaxes[labelFontSize=\scriptstyle,
     linewidth=0.4pt]{->}(0,0)(-4.2,-4.2)(4.5,2.5)[$x$,0][$y$,90]    
\psplotImp[algebraic,linecolor=red,linewidth=1.5pt,
     stepFactor=0.2](-5.5,-5.5)(5.5,3){x^4+8*y^3-21}
\end{pspicture*}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .