I want to make a table with three subtables horizontally aligned and each subtable consisting of two tables vertically aligned and text $x$-derivative and $y$-derivative which correspond to the two vertical tables. I have tried the subtable environment but my subtables goes in vertical direction and want them to go in the horizontal direction. Also I used a terrible solution to put in text in the table as a table itself without caption. Here is my working:
\documentclass{article}
\usepackage{subcaption}
\usepackage{color}
\begin{document}
\begin{table}
\caption{First-order operator masks}
\centering
\begin{subtable}{0.5\linewidth}
\begin{tabular}{cc}
$x$-derivative \\
\textcolor{white}{x}\\
\textcolor{white}{x}\\
$y$-derivative\\
\textcolor{white}{x}\\
\textcolor{white}{x}\\
\end{tabular}
\end{subtable}
\begin{subtable}{0.5\linewidth}
\caption{Roberts Operator}
\label{tab:roberts}
\centering
\label{tab:robert}
\begin{tabular}{|c|c|}
\hline
0 & -1 \\ \hline
1 & 0 \\ \hline
\end{tabular}\\
\begin{tabular}{|c|c|}
\hline
-1 & 0 \\ \hline
0 & 1 \\ \hline
\end{tabular}
\vspace{0.5cm}
\end{subtable}%
\vspace{0.2cm}
\begin{subtable}{0.5\linewidth}
\caption{Prewitt operator}
\label{tab:prewitt}
\begin{tabular}{|c|c|c|}
\hline
1 & 0 & -1 \\ \hline
1 & 0 & -1 \\ \hline
1 & 0 & -1 \\ \hline
\end{tabular}\\
\begin{tabular}{|c|c|c|}
\hline
1 & 1 & 1 \\ \hline
0 & 0 & 0 \\ \hline
-1 & -1 & -1 \\ \hline
\end{tabular}
\end{subtable}
\begin{subtable}{0.5\linewidth}
\caption{Sobel operator}
\label{tab:masks}
\begin{tabular}{|c|c|c|}
\hline
1 & 0 & -1 \\ \hline
2 & 0 & -2 \\ \hline
1 & 0 & -1 \\ \hline
\end{tabular}
\\
\begin{tabular}{|c|c|c|}
\hline
1 & 2 & 1 \\ \hline
0 & 0 & 0 \\ \hline
-1 & -2 & -1 \\ \hline
\end{tabular}
\end{subtable}
\end{table}
\end{document}
Best Answer
I understand question slightly different than Piet van Oostrum ...