TransWikia.com

Creating a long table with large cells that wrap effectively

TeX - LaTeX Asked by tophodin on July 10, 2021

I want to create a table and place a large amount of text into a particular cell.

It needs to be possible to wrap the contents of that cell over multiple pages.

I found example code (Horizontal longtable is not splitting over multiple pages) that uses the xltabular package, however the cell contents overflow the hbox and only part of the text is displayed.

Would really appreciate some feedback on how to resolve this.

Thanks

Output

documentclass{article}
usepackage{pdflscape}
usepackage{booktabs, xltabular}
usepackage[table,xcdraw]{xcolor}

begin{document}
begin{landscape}
setlengthextrarowheight{3pt}
setlength{tabcolsep}{3pt}
footnotesize
begin{xltabular}{linewidth}{@{} *{12}{X} @{}}
    caption{On the first page}
label{tab:my-table}    
Loren Ipsum Dotem  &
Loren Ipsum Dotem  &
Loren Ipsum Dotem  &
Loren Ipsum Dotem  &
Loren Ipsum Dotem  &
Loren Ipsum Dotem  &
Loren Ipsum Dotem  &
Loren Ipsum Dotem  &
Loren Ipsum Dotem  &
Loren Ipsum Dotem  &
Loren Ipsum Dotem  &
Loren Ipsum Dotem       
endfirsthead
%
caption[]{continued from previous page}    
endhead
% table body
rowcolor[HTML]{D9D9D9}
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem   

rowcolor[HTML]{D9D9D9}
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem   

rowcolor[HTML]{D9D9D9}
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem   

rowcolor[HTML]{D9D9D9}
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem   

rowcolor[HTML]{D9D9D9}
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem   

Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem   

Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem   

Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem   

Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem   

Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem   

Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dote    

Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem   

Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem   

Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem   

Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  

Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  

Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem Ipsum Dotem  &
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc,   
end{xltabular}
end{landscape}

end{document}

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