2009-07-10 17 views
6

Ho una tabella molto lunga in LaTeX che si estende su diverse pagine ed è (come è ora) anche troppo ampia per la pagina.Come posso limitare la dimensione delle mie celle multicolumn in una tavola lunga?

Sto utilizzando il pacchetto longtable con ogni larghezza di colonna specificata con il comando p{width}.

Il problema è che la maggior parte delle righe contiene una chiamata a più colonne e pertanto non aderisce al preambolo p{width}, il che causa la larghezza totale della tabella troppo grande.

Esempio minimo:

\begin{longtable}{|p{1in}|p{0.75in}|p{0.5in}|p{0.5in}|>{p{1in}|p{1in}|} 
\caption{some cap} \label{somelable}\\ 
\hline 
\multicolumn{2}{|c|}{\textbf{Text Header One}} & \multicolumn{2}{|c|}{\textbf{Text Header Two}} & \multirow{2}{*}{\textbf{Three}} & \multirow{2}{*}{\textbf{Four}} \tabularnewline \cline{1-4} 
\textbf{Five} & \textbf{Six} & \textbf{Seven} & \textbf{Eight} & & \tabularnewline \hline 
Some Text String & Longer Text String Here & More Text Here & Text Example & Text & Text \tabularnewline \hline 
Example Text String Two & Longer Text String Example Two & \multicolumn{2}{|l|}{Multi-column Text String that doesn't fit column width} & Text & Text \tabularnewline \hline 
Example Text String Two & Longer Text String Example Two & \multicolumn{2}{|l|}{Multi-column Text String that doesn't fit column width} & Text & Text \tabularnewline \hline 
Example Text String Two & Longer Text String Example Two & \multicolumn{2}{|l|}{Multi-column Text String that doesn't fit column width} & Text & Text \tabularnewline \hline 
Example Text String Two & Longer Text String Example Two & \multicolumn{2}{|l|}{Multi-column Text String that doesn't fit column width} & Text & Text \tabularnewline \hline 
Example Text String Two & Longer Text String Example Two & \multicolumn{2}{|l|}{Multi-column Text String that doesn't fit column width} & Text & Text \tabularnewline \hline 
Example Text String Two & Longer Text String Example Two & \multicolumn{2}{|l|}{Multi-column Text String that doesn't fit column width} & Text & Text \tabularnewline \hline 
Example Text String Two & Longer Text String Example Two & \multicolumn{2}{|l|}{Multi-column Text String that doesn't fit column width} & Text & Text \tabularnewline \hline 
Example Text String Two & Longer Text String Example Two & \multicolumn{2}{|l|}{Multi-column Text String that doesn't fit column width} & Text & Text \tabularnewline \hline 
Example Text String Two & Longer Text String Example Two & \multicolumn{2}{|l|}{Multi-column Text String that doesn't fit column width} & Text & Text \tabularnewline \hline 
Example Text String Two & Longer Text String Example Two & \multicolumn{2}{|l|}{Multi-column Text String that doesn't fit column width} & Text & Text \tabularnewline \hlineExample Text String Two & Longer Text String Example Two & \multicolumn{2}{|l|}{Multi-column Text String that doesn't fit column width} & Text & Text \tabularnewline \hline 
Example Text String Two & Longer Text String Example Two & \multicolumn{2}{|l|}{Multi-column Text String that doesn't fit column width} & Text & Text \tabularnewline \hline 
Example Text String Two & Longer Text String Example Two & width of box & text & Text & Text \tabularnewline \hline 
\end{longtable} 

Sto caricando longtable nel mio preambolo, e l'esecuzione di pdflatex più volte (come descritto nella documentazione longtable). Compilano con 0 avvisi e 0 errori.

Come posso ottenere normali celle "strette"?

risposta

6

Hai provato a utilizzare |p{<sum of widths>}| per l'opzione di formattazione su \multicolumn?

Solo indovinando qui.

+0

Ha funzionato come un fascino. Grazie per la pronta risposta! – Mica

+0

esempio per noobs? – IRus

+1

@IRus Il secondo argomento di '\ multicolumn' è un identificatore di formato che assume lo stesso significato del secondo argomento di un ambiente' tabulare'. Vedi http://stackoverflow.com/questions/440228/how-can-i-combine-cells-in-a-row-in-a-latex-table per un riassunto su come usarlo. La situazione di Mica qui è un caso d'angolo interessante in cui si basava su larghezze di colonne fisse e la multicornalità che apriva troppo le cose. – dmckee

1

\ begin {longtable} {p {} P {2,8 centimetri 2,8 centimetri} lavorato per me ..

1

devi dare un parametro di dimensione per multicolumns anche se c'è una dimensione preambolo. L'esempio successivo è una cella a più colonne della larghezza della tabella:

\begin{tabular}{p{0.3\textwidth} p{0.7\textwidth}} 
\multicolumn{2}{ p{\textwidth}} {YOUR TEXT HERE} 
\end{tabular} 
Problemi correlati