2009-07-10 12 views
6

Mam naprawdę długi stół w LaTeX, który obejmuje kilka stron i jest (jak jest teraz) również zbyt szeroki dla strony.Jak mogę ograniczyć rozmiar moich komórek wielokolumnowych w tabeli długiej?

Używam pakietu longtable o każdej szerokości kolumny określonej za pomocą polecenia p{width}.

Problem polega na tym, że większość wierszy zawiera wywołanie wielokolumnowe, a zatem nie są one zgodne z komendą preambuły p{width}, co powoduje, że całkowita szerokość tabeli jest zbyt duża.

Minimal przykład:

\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} 

wczytuję longtable w moim preambułą i działa pdflatex kilka razy (jak określono w longtable dokumentacji). Kompiluje się z 0 ostrzeżeniami i 0 błędami.

Jak mogę uzyskać normalne "wąskie" komórki?

Odpowiedz

6

Czy próbowałeś użyć |p{<sum of widths>}| dla opcji formatowania na \multicolumn?

Po prostu zgaduję.

+0

Pracowała jak urok. Dzięki za szybką odpowiedź! – Mica

+0

przykład dla noobów? – IRus

+1

@IRus Drugi argument do '\ multicolumn' jest specyfikatorem formatu, który ma takie samo znaczenie jak w drugim argumencie do środowiska" tabular ". Zobacz http://stackoverflow.com/questions/440228/how-can-i-combine-cells-in-a-row-in-a-latex-table, aby uzyskać podsumowanie, jak z niego korzystać. Sytuacja Miki tutaj jest interesującą narożną sytuacją, w której polegał na stałych szerokościach kolumn i wielokolumnowym otwieraniu rzeczy za dużo. – dmckee

1

\ begin {longtable} {} p {2.8cm} p {2.8cm pracował dla mnie ..

1

Trzeba dać parametr rozmiar do multicolumns chociaż nie jest preambuła rozmiar. Następnym przykładem jest komórka wielokolumnowa o rozmiarze o szerokości stołu:

\begin{tabular}{p{0.3\textwidth} p{0.7\textwidth}} 
\multicolumn{2}{ p{\textwidth}} {YOUR TEXT HERE} 
\end{tabular} 
Powiązane problemy