\begin{longtable}{|p{7cm}|p{10cm}|}
\hline
\begin{tikzpicture} %1
\coordinate[label = below:$A$] (A) at (0,0);
\coordinate[label = above:$B$] (B) at (0,3);
\coordinate[label = above:$C$] (C) at (6,3);
\coordinate[label = below:$D$] (D) at (6,0);
\draw[ultra thick] (A) -- (B) -- (C) -- (D) -- cycle;
\tkzLabelSegment[left](A,B){$3$};
\tkzLabelSegment[above](B,C){$6$};
\end{tikzpicture} & \\
\hline
\begin{center}
\begin{tikzpicture} %2
\coordinate[label = below:$A$] (A) at (0,0);
\coordinate[label = above:$B$] (B) at (0,3);
\coordinate[label = above:$C$] (C) at (3,3);
\coordinate[label = below:$D$] (D) at (3,0);
\draw[ultra thick] (A) -- (B) -- (C) -- (D) -- cycle;
\tkzMarkSegment[mark = |](A,B);
\tkzMarkSegment[mark = |](B,C);
\node at (1.5, 1.5){$P=36$};
\end{tikzpicture} \end{center}& \\
\hline
\end{longtable}
Respuesta1
Con {NiceTabular}
de nicematrix
.
He tomado su código (lo he puesto p{3cm}
en el preámbulo en lugar de p{10cm}
para que quepa en el ancho de la página).
Lo he reemplazado {longtable}
con {NiceTabular}
.
He añadido instrucciones de Tikz en el \CodeAfter
entorno {NiceTabular}
para dibujar los pequeños cuadrados con los números:
\begin{tikzpicture}
\node at (1-|1) [below right] { 1 } ;
\draw (1-|1) rectangle ++(5mm,-5mm) ;
\node at (2-|1) [below right] { 2 } ;
\draw (2-|1) rectangle ++(5mm,-5mm) ;
\end{tikzpicture}
Aquí está el código completo.
\documentclass{article}
\usepackage{geometry}
\usepackage{nicematrix}
\usepackage{tikz,tkz-euclide}
\begin{document}
\begin{NiceTabular}{|p{7cm}|p{3cm}|}
\hline
\begin{tikzpicture} %1
\coordinate[label = below:$A$] (A) at (0,0);
\coordinate[label = above:$B$] (B) at (0,3);
\coordinate[label = above:$C$] (C) at (6,3);
\coordinate[label = below:$D$] (D) at (6,0);
\draw[ultra thick] (A) -- (B) -- (C) -- (D) -- cycle;
\tkzLabelSegment[left](A,B){$3$};
\tkzLabelSegment[above](B,C){$6$};
\end{tikzpicture} & \\
\hline
\begin{center}
\begin{tikzpicture} %2
\coordinate[label = below:$A$] (A) at (0,0);
\coordinate[label = above:$B$] (B) at (0,3);
\coordinate[label = above:$C$] (C) at (3,3);
\coordinate[label = below:$D$] (D) at (3,0);
\draw[ultra thick] (A) -- (B) -- (C) -- (D) -- cycle;
\tkzMarkSegment[mark = |](A,B);
\tkzMarkSegment[mark = |](B,C);
\node at (1.5, 1.5){$P=36$};
\end{tikzpicture} \end{center}& \\
\hline
\CodeAfter
\begin{tikzpicture}
\node at (1-|1) [below right] { 1 } ;
\draw (1-|1) rectangle ++(5mm,-5mm) ;
\node at (2-|1) [below right] { 2 } ;
\draw (2-|1) rectangle ++(5mm,-5mm) ;
\end{tikzpicture}
\end{NiceTabular}
\end{document}
Respuesta2
Por lo que veo en tu foto, no creo que necesites una mesa, solo una tikzpicture
con un par de scopes
, y cada una scope
actuará como una celda.
Cambié tus coordenadas porque creo que es más sencillo poner el origen en el centro de cada 'celda'.
Esta es la idea:
\documentclass{article}
\usepackage{lipsum} % dummy text
\usepackage{tikz,tkz-euclide}
\begin{document}
\lipsum[1][1-2]
\begin{figure}[ht]\centering
\begin{tikzpicture}[scale=0.75]
\def\sepx{8}
\def\sepy{6}
\foreach\x in {1,2} \foreach\y in {1,2,3}
{
\pgfmathtruncatemacro\n{3*\x+\y-3}
\draw (\x*\sepx-\sepx+0.8,-\y*\sepy+\sepy) |-++ (-0.8,-0.8);
\node at (\x*\sepx-\sepx+0.4,-\y*\sepy+\sepy-0.4) {$\n$};
}
\draw (0,0) grid[xstep=\sepx,ystep=\sepy] (16,-18);
%1
\begin{scope}[shift={(0.5*\sepx,-0.5*\sepy)}]
\coordinate[label = below:$A$] (A) at (-3,-1.5);
\coordinate[label = above:$B$] (B) at (-3,1.5);
\coordinate[label = above:$C$] (C) at (3,1.5);
\coordinate[label = below:$D$] (D) at (3,-1.5);
\draw[ultra thick] (A) -- (B) -- (C) -- (D) -- cycle;
\tkzLabelSegment[left](A,B){$3$};
\tkzLabelSegment[above](B,C){$6$};
\end{scope}
%2
\begin{scope}[shift={(1.5*\sepx,-0.5*\sepy)}]
\coordinate[label = below:$A$] (A) at (-1.5,-1.5);
\coordinate[label = above:$B$] (B) at (-1.5,1.5);
\coordinate[label = above:$C$] (C) at (1.5,1.5);
\coordinate[label = below:$D$] (D) at (1.5,-1.5);
\draw[ultra thick] (A) -- (B) -- (C) -- (D) -- cycle;
\tkzMarkSegment[mark = |](A,B);
\tkzMarkSegment[mark = |](B,C);
\node at (0,0){$P=36$};
\end{scope}
%3
\begin{scope}[shift={(0.5*\sepx,-1.5*\sepy)}]
\draw[ultra thick] (0,0) circle (2);
\end{scope}
\end{tikzpicture}
\end{figure}
\lipsum[2][1-3]
\end{document}