I have an algorithm and a table. I want to display them like this for clarity (algorithm uses some notations defined in the table):
----
TABLE
----
ALGO
----
I'm using the IEEEtrans class, packages: threeparttable, booktabs, multirow, algorithm2e.
My document:
\documentclass[journal]{IEEEtran}
\usepackage{lipsum}
\usepackage{threeparttable, booktabs}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage[ruled, noline, noend, linesnumbered]{algorithm2e}
\begin{document}
\lipsum[1-4]
\begin{table}[!h]
\begin{threeparttable}
\caption{Example table }
\begin{tabular}{l|l|l|l|l}
\toprule
\multirow{2}{*} & \multicolumn{2}{c|}{Description} & \multicolumn{2}{c}{Test} \\
& Test & Test & Test & Test \\
\midrule
Test & Test & Test & Test & Test \\
\end{tabular}
\begin{tablenotes}
\item[\textdagger] Test
\end{tablenotes}
\end{threeparttable}
\end{table}
\begin{algorithm}[!h]
\caption{Test}
\For{Test}{
Test
}
\end{algorithm}
\lipsum[1-4]
\end{document}
I tried
Dirty hack:
\documentclass[journal]{IEEEtran}
\usepackage{lipsum}
\usepackage{threeparttable, booktabs}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage[ruled, noline, noend, linesnumbered]{algorithm2e}
\begin{document}
\lipsum[1-4]
\begin{table}[!h]
\centering
\begin{threeparttable}
\caption{Example table }
\begin{tabular}{l|l|l|l|l}
\toprule
\multirow{2}{*} & \multicolumn{2}{c|}{Description} & \multicolumn{2}{c}{Test} \\
& Test & Test & Test & Test \\
\midrule
Test & Test & Test & Test & Test \\
\end{tabular}
\begin{tablenotes}
\item[\textdagger] Test
\end{tablenotes}
\end{threeparttable}
\medskip
\begin{minipage}{\linewidth}
\makeatletter
\@twocolumnfalse
\makeatother
\begin{algorithm}[H]
\caption{Test}
\For{Test}{
Test
}
\end{algorithm}
\end{minipage}
\end{table}
\lipsum[1-8]
\end{document}