2010-06-17 83 views
6

問題與此類似:How to display a content in two-column layout in LaTeX? 但是關於將兩張桌子並排放置。在一列LaTeX環境中並排放置兩張桌子

我有兩個小桌子看起來就像是:

\begin{table}[t] 
\begin{tabular}{|c|l||r|r||r|r|} 
%content goes here 
\end{tabular} 
\caption{some caption} 
\end{table} 

\begin{table}[t] 
\begin{tabular}{|c|l||r|r||r|r|} 
%content goes here 
\end{tabular} 
\caption{some caption for second table} 
\end{table} 

我有一列的文檔,並且這些表是真的狹窄,所以我想顯示他們並排(帶獨立字幕)insted的的一個在另一個下面有很多未使用的白色空間。

我試圖用這個\multicols做到這一點,但似乎浮動(表格在這裏)不能放在裏面。

任何想法?

編輯
OK,我已經做了這樣的事情:

\begin{table}[h] 
\begin{minipage}[b]{80mm} 
\begin{tabular}{|c|l||r|r||r|r|} 
%//first table goes here 
\end{tabular} 
    \caption{some caption for first table} 
\end{minipage} 

\begin{minipage}[b]{80mm} 
\begin{tabular}{|c|l||r|r||r|r|} 
%//second table goes here 
\end{tabular} 
    \caption{some caption for second table} 
\end{minipage} 

\end{table} 

,但該表總是使用盡可能多的空間,因爲它需要,不管我會成立什麼尺寸minipage的。例如,如果我有80毫米的小型文件夾,標題將限制在這80毫米,但表格會更寬。

如果我有兩張桌子,一張桌子太寬了,它不會在第一張桌子旁邊,而是在下面。

有沒有辦法將表限制到指定的寬度?或者強迫他們一個接一個出現?或者,也許如何改變其中一個表的字體大小?

回答

5

在同一個表格環境中使用兩個小片段或兩個表格環境(但是如果需要的話,您必須對標題做些什麼)。

+0

謝謝,我創建了兩個minipages。但我仍然有一些問題。我編輯了我的問題。 – Gacek 2010-06-20 08:59:06

3

使用subfig package這樣的:

\documentclass{article} 
\usepackage[latin1]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage[bf,small,tableposition=top]{caption} 
\usepackage{subfig} 
\begin{document} 

\begin{table} 
\centering 
\subfloat[First table.]{% 
\begin{tabular}{|c|l||r|r||r|r|} 
a & b & c & d & e & f \\ 
a & b & c & d & e & f \\ 
\end{tabular}}% 
\qquad\qquad% --- set horizontal distance between tables here 
\subfloat[Second table.]{% 
\begin{tabular}{|c|l||r|r||r|r|} 
a & b & c & d & e & f \\ 
a & b & c & d & e & f \\ 
a & b & c & d & e & f \\ 
a & b & c & d & e & f \\ 
\end{tabular}} 
\end{table} 

\end{document} 

時,他們有不同的行數就像這個例子這會照顧表的垂直對齊的。另請注意,表格上方有標題,而數字的標題在下方。優秀的caption package可以幫助你改變,如果你想。

最後,你應該看看booktabs package專業質量排版表。它會要求您避免使用垂直線,而使用水平線。結果通常好得多,恕我直言。

+0

不錯,但有一個問題 - 我需要使用自定義樣式(來自IEEE),當我使用subfloats時,它會銷燬此自定義樣式並使用表格的默認樣式。 – Gacek 2010-06-20 14:17:22

+0

有沒有辦法讓字幕放在桌子上而不是在桌子下面? – misha 2014-02-26 10:24:45

9

您的第二張桌子低於第一張桌子而不是旁邊的原因是由於兩個小片段之間的空間。你必須把這些陳述正確地放在另一個下面,否則膠乳就會把它看成是一條終點線。花了我一個星期來弄清楚我自己的桌子。

\end{minipage} 
\begin{minipage}[b]{80mm} 

相反的:

\end{minipage} 

\begin{minipage}[b]{80mm} 
+0

我一直有這個問題與表年齡和永遠不知道問題是什麼。謝謝! – Danny 2014-09-15 11:51:11

相關問題