无法在 Latex 中创建平行表 - LNCS 格式

无法在 Latex 中创建平行表 - LNCS 格式

我正在尝试在 latex 中并行保留两个 LNCS 格式的表格。还尝试按照这个答案。但我得到的表格格式非常糟糕。代码和结果如下:

\begin{table}
\parbox{.4\linewidth}{
\centering
\begin{tabular}{l}
\hline
\textbf{Eliminate($D_s$):}\\
\textbf{Input:} ~Subspace $D_s \subseteq D$\\
\textbf{Output:} None\\
\hline
1.~\textbf{if} $D_s$ is not marked as \textbf{\textit{eliminated}} \textbf{then}\\
2.~~~~~Mark $D_s$ as \textbf{\textit{eliminated}}\\
3.~~~~~\textbf{for each} $D'_s \subset D_s$ such that $|D_s|-|D'_s|=1$ \textbf{do}\\
4.~~~~~~~~~$Eliminate(D'_s)$\\
5.~~~~~\textbf{end for}\\
6.~\textbf{end if}\\
\hline
\end{tabular}
\caption{Eliminate Function}
\label{topdown_2}
}
\hfill
\parbox{.4\linewidth}{
\centering
\begin{tabular}{l}
\hline
\textbf{NonISQ($D_1$, $D_2$):}\\
\textbf{Input:} ~Subspaces $D_1, D_2 \subseteq D$\\
\textbf{Output:} None\\
\hline
1.~Let $D_s = D_1 \cup D_2$\\
2.~\textbf{if} $D_s$ is not marked as \textbf{\textit{eliminated}} \textbf{then}\\
2.~~~~~Mark $D_s$ as \textbf{\textit{non-ISQ}}\\
3.~~~~~\textbf{for each} $D'_s \subset D_s$ such that\\
~~~~~~~~~~~~~~$\exists q \in D_2$ and $q \in D_s$ \textbf{do}\\
4.~~~~~~~~~$NonISQ(D'_s)$\\
5.~~~~~\textbf{end for}\\
6.~\textbf{end if}\\
\hline
\end{tabular}
\caption{NonISQ Function}
\label{topdown_3}
}
\end{table}

输出: 在此处输入图片描述

答案1

如果您想将这些表并排放置,我认为有必要对它们进行缩放。

\documentclass{book}
\usepackage{graphicx}

\begin{document}
\begin{table}
    \parbox{.45\linewidth}{
        \centering
        \scalebox{.6}{%
        \begin{tabular}{l}
            \hline
            \textbf{Eliminate($D_s$):}\\
            \textbf{Input:} ~Subspace $D_s \subseteq D$\\
            \textbf{Output:} None\\
            \hline
            1.~\textbf{if} $D_s$ is not marked as \textbf{\textit{eliminated}} \textbf{then}\\
            2.~~~~~Mark $D_s$ as \textbf{\textit{eliminated}}\\
            3.~~~~~\textbf{for each} $D'_s \subset D_s$ such that $|D_s|-|D'_s|=1$ \textbf{do}\\
            4.~~~~~~~~~$Eliminate(D'_s)$\\
            5.~~~~~\textbf{end for}\\
            6.~\textbf{end if}\\
            \hline
        \end{tabular}
        }
        \caption{Eliminate Function}
        \label{topdown_2}
    }
    \hfill
    \parbox{.45\linewidth}{
        \centering
        \scalebox{.6}{%
        \begin{tabular}{l}
            \hline
            \textbf{NonISQ($D_1$, $D_2$):}\\
            \textbf{Input:} ~Subspaces $D_1, D_2 \subseteq D$\\
            \textbf{Output:} None\\
            \hline
            1.~Let $D_s = D_1 \cup D_2$\\
            2.~\textbf{if} $D_s$ is not marked as \textbf{\textit{eliminated}} \textbf{then}\\
            2.~~~~~Mark $D_s$ as \textbf{\textit{non-ISQ}}\\
            3.~~~~~\textbf{for each} $D'_s \subset D_s$ such that\\
            ~~~~~~~~~~~~~~$\exists q \in D_2$ and $q \in D_s$ \textbf{do}\\
            4.~~~~~~~~~$NonISQ(D'_s)$\\
            5.~~~~~\textbf{end for}\\
            6.~\textbf{end if}\\
            \hline
        \end{tabular}
        }
        \caption{NonISQ Function}
        \label{topdown_3}
    }
\end{table}
\end{document}

在此处输入图片描述

相关内容