0

I want to make a tabular 3D figure with tikz. Tikz works fine, tabular environment works fine, but when I put a tikz figure into a tabular environment, compilation hangs. Do I wrong something?

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{fillbetween}

\begin{document}

\begin{tabular}{cc} 
\begin{tikzpicture}[scale=1.,axis/.style={->,blue,thick}, 
/pgfplots/view={25}{25},
vector/.style={-stealth,red,very thick}, 
vector guide/.style={dashed,red,thick}]
\begin{axis}[
axis lines=center,
axis on top,
every inner z axis line/.append style={opacity=0},
xlabel={$x$}, ylabel={$y$}, zlabel={$z$},
domain=0:1,
y domain=0:2*pi,
xmin=-0.6, xmax=.6,
ymin=-0.6, ymax=1.5, zmin=0.0,zmax=2.5,ztick={1},
every axis x label/.style={at={(rel axis cs:0,0.5,0)},anchor=south},
every axis y label/.style={at={(rel axis cs:0.5,0,0)},anchor=north},
every axis z label/.style={at={(rel axis cs:0.5,0.5,0.9)},anchor=west},
samples=30]

\addplot3 [domain=0:360,samples y=1,name path=top,draw=none] ({1*cos(deg(x))},{1*sin(deg(x))},{1});
\path[name path=zline] (0,0,0) -- (0,0,1.5) coordinate(ztop);
\path[name intersections={of=top and zline,by={aux1}}];
\draw[-latex] (aux1) -- (ztop);

\end{axis}
\end{tikzpicture}
&a
\end{tabular}
\end{document}
katang
  • 1,429
  • The problem is that [tikz] option not only loads tikz, it starts a new page for every tikzxpicture (same as [multi=tikzpicture]) which can cause all sorts of problems – John Kormylo May 29 '20 at 13:31

1 Answers1

2

Change the options of the documentclass to preview. See here why.

Switch your documentclass from standalone to anything else, like article and the compilation succeeds.

I don't post the full code because the only required change is

\documentclass[preview]{standalone}

The output is the following (I added the borders just to highlight the table):

enter image description here