TransWikia.com

When I use longtable, the table can't fit the whole text, is there any solution? Or is there a suitable way to change the page?

TeX - LaTeX Asked by ms ms on August 8, 2021

Is there an effective way to automatically display text that cannot be accommodated to the next page?

For example, the code is

documentclass{article}
usepackage{longtable,lipsum}
begin{document}

begin{longtable}{|l|c|c|c|c|c|}
    hline
    multicolumn{6}{|p{10cm}|}{lipsum }  hline
end{longtable}

end{document}

The compilation result is as follows:
enter image description here

One Answer

You have to add a pagebreak from time to time.

x

documentclass{article}
usepackage{longtable,lipsum}
begin{document}

begin{longtable}{|l|c|c|c|c|c|}
    hline
    multicolumn{6}{|p{10cm}|}{1. lipsum[1-4] }  hline
    pagebreak
    hline
    multicolumn{6}{|p{10cm}|}{5. lipsum[5-8] }  hline
end{longtable}

end{document}

With longtable you can run headers and footers that link the partial tables page by page.

b

documentclass{article}
usepackage{longtable,lipsum}

begin{document}

begin{longtable}{|l|c|c|c|c|c|}        
    hline      
    multicolumn{6}{|p{10cm}|}{Large Main heading }  
    hline
    endfirsthead
    
    multicolumn{3}{l} {footnotesize emph{ ldots{} from previous page.}} 
    hline
    multicolumn{6}{|p{10cm}|}{ Large Main heading }  
    hline
    endhead
    
    multicolumn{6}{r}{footnotesize emph{to be continued in the next page ldots{} }}  
    endfoot            

    endlastfoot            

    multicolumn{6}{|p{10cm}|}{1. lipsum[1-4] }  hline
    pagebreak
    multicolumn{6}{|p{10cm}|}{5. lipsum[5-8] }  hline
end{longtable}

end{document}

Correct answer by Simon Dispa on August 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP