表格不适合列

表格不适合列

我编写了三列表格代码,但它超出了列边距。我该如何将其放入文档的双列设置中。

\begin{table}
\centering
\begin{tabular}{|c|c|c| }
\hline
\textbf{Original Pair }&\textbf{ Mapped  Pair}&
\textbf{Favourable/Alternative}\\
\hline
 a,a & e,g & Favourable \\
 \hline
 b,b & e,c & Favourable\\
\hline
c,c & g,e & Favourable  \\ 
\hline 
d,d & h,f   & Favourable\\ 
\hline 
a,c & a,c & Favourable\\
\hline
c,a & c,a  & Favourable\\ 
\hline 
b,d & b,d & Favourable  \\
\hline 
d,b & d,b & Favourable   \\ 
\hline 
a,b & e,c & Alternative\\
\hline
a,d & a,g & Alternative  \\
\hline
 b,a & e,g & Alternative \\
\hline
b,c & a,c & Alternative\\
\hline
c,b & g,a  & Alternative \\ 
\hline 
c,d & c,e   & Alternative \\ 
\hline 
d,a & d,f  & Alternative  \\ 
\hline 
d,c & h,b  & Alternative \\ 
\hline 
\end{tabular}
\end{table}

答案1

您可以使用\begin{table*}...\end{table*}(请注意*)让浮动元素占据两列,或者使用 将浮动元素放在一列中tabulary。例如:

在此处输入图片描述

\documentclass[twocolumn]{article}
\usepackage[tmargin=1cm]{geometry}
\usepackage{lipsum}
\usepackage{tabulary,booktabs}
\begin{document}
\lipsum[1]

\begin{table}[b]
\begin{tabulary}{\linewidth}{CCC}
\toprule
\textbf{Original Pair }&\textbf{ Mapped  Pair}&
\textbf{Favourable / Alternative}\\
\midrule
a,a & e,g & Favourable \\
a,b & e,c & Alternative\\
c,d & c,e   & Alternative \\ 
\bottomrule
\end{tabulary}
\end{table}

\begin{table*}
\centering
\begin{tabular}{ccc}
\toprule
\textbf{Original Pair }&\textbf{ Mapped  Pair}&
\textbf{Favourable/Alternative}\\
\midrule
a,a & e,g & Favourable \\
a,b & e,c & Alternative\\
c,d & c,e   & Alternative \\ 
\bottomrule
\end{tabular}
\end{table*}
\lipsum[2-50]

\end{document}

答案2

\documentclass{article}
\begin{document}
\begin{minipage}{0.4\textwidth}
\begin{tabular}{|p{1.5cm}|p{1.5cm}|p{2.5cm}|}
\hline
\textbf{Original Pair }&\textbf{Mapped  Pair}&\textbf{Favourable}\\
\hline
 a,a & e,g & Favourable \\
\hline
b,b & e,c & Favourable\\
\hline
c,c & g,e & Favourable  \\ 
\hline
d,d & h,f   & Favourable\\ 
\hline
a,c & a,c & Favourable\\
\hline
c,a & c,a  & Favourable\\ 
\hline
b,d & b,d & Favourable  \\
\hline
d,b & d,b & Favourable   \\ 
\hline
\end{tabular}
\end{minipage}
\hspace{2cm}
\begin{minipage}{0.4\textwidth}
\begin{tabular}{|p{1.5cm}|p{1.5cm}|p{2.5cm}|}
\hline
\textbf{Original Pair }&\textbf{Mapped  Pair}&\textbf{Alternative}\\
\hline
a,b & e,c & Alternative\\
\hline
a,d & a,g & Alternative  \\
\hline    
b,a & e,g & Alternative \\
\hline
b,c & a,c & Alternative\\
\hline
c,b & g,a  & Alternative \\ 
\hline
c,d & c,e   & Alternative \\ 
\hline
d,a & d,f  & Alternative  \\ 
\hline
d,c & h,b  & Alternative \\ 
\hline
\end{tabular}
\end{minipage}
\end{document}

小型的

相关内容