How can I restrict the size of my \multicolumn cells in a longtable?
I have a really long table in LaTeX that spans several pages and is (as it is now) also too wide for the page.
I am using the longtable package with every column width specified with the p{width}
command.
The problem is, that most of the rows contain a multicolumn call, and thus are not adhering to the preamble p{width}
command, which causes the total width of the table to be too large.
Minimal example:
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}
I am loading longtable in my preamble, and running pdflatex several times (as outlined in the longtable documentation). It compiles with 0 warnings and 0 errors.
How can I get normal "narrow" cells?
Have you tried using |p{<sum of widths>}|
for the formatting option to multicolumn
?
Just guessing here.
You have to give a size parameter to multicolumns even though there is a preamble size. The next example is a multicolumn cell of the size of the table width:
begin{tabular}{p{0.3textwidth} p{0.7textwidth}}
multicolumn{2}{ p{textwidth}} {YOUR TEXT HERE}
end{tabular}
begin {longtable} {p {2.8cm} p {2.8cm}为我工作。
链接地址: http://www.djcxy.com/p/33368.html上一篇: 包括胶乳中的图形文件
下一篇: 如何限制我的\多列单元格的长度?