無法在 Latex 中建立平行表 - LNCS 格式

無法在 Latex 中建立平行表 - LNCS 格式

我試圖在乳膠中以 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}

在此輸入影像描述

相關內容