TeX - LaTeX Asked by CyanideBaby on December 21, 2020
I’ve got a very long table top create with, at times, lots of text to wrap around within it. I’d rather not use a landscape orientation.
So I created the following test, with the ltxtable package.
The core code is:
documentclass[a4paper,oneside,centered,noparindent,noparskip]{bookest}
%usepackage{showframe}
usepackage{booktabs}
usepackage{multirow}
usepackage{ltxtable}
usepackage{threeparttable}
usepackage{textcomp}
begin{document}
LTXtable{textwidth}{t3.tex}
end{document}
While the t3.tex file longtable code is:
begin{longtable}{lp{4.5cm}lp{6.5cm}} toprule
% header ------------------------
textnumero& Name & Title & Dates & Events midrule
endhead
1& King Soandso III & 2234 -- to date & This is some text
2& King Soandso III & 2234 -- 3456 & This is a lot of text that needs to be wrapped effectively
3& King Soandso III & 234 -- 134 (?)& This is some text
4& Queen Soandso III & 15thc -- 16thc (?) & This is a lot of text that needs to be wrapped effectively
5& King Soandso III ``The Radiant Light of the Sun over the Water of the Old Spring'' & 15thc -- 16thc (?) & This is a lot of text that needs to be wrapped effectively
6&&& This is some text
--&multicolumn{3}{p{14.5cm}}{textit{And what if there was a lot of text here that needed to be wrapped properly and elegantly to let the text breathe.}}
7&&& This is a lot of text that needs to be wrapped effectively
8&&& This is some text
9&&& This is a lot of text that needs to be wrapped effectively
10&&& This is some text bottomrule
caption{Kings & Queens.}
end{longtable}
The result is this:
Any suggestion on how I may improve it?
For instance, why is the caption appearing so close to the bottom of the table? It’s not like that with “regular” tables.
And the whole thing feels … “ugly” and awkward would be the terms.
Thanks.
It's easier, if you need spanning p
columns, to use p
everywhere as then you know the column width to span. I aligned the --
in the dates and moved the caption to the top.
documentclass[oneside,centered,noparindent,noparskip]{bookest}
%usepackage{showframe}
usepackage{booktabs}
usepackage{multirow}
usepackage{longtable}
usepackage{threeparttable}
usepackage{textcomp}
usepackage{array}
begin{document}
begin{longtable}{
@{}
>{raggedright}p{.5cm}
p{4.5cm}
>{raggedleft}p{1.5cm}@{}
>{raggedright}p{2cm}
p{6.5cm}
@{}}
% header ------------------------
caption{Kings & Queens.}
toprule
multicolumn{1}{c}{textnumero}&
multicolumn{1}{c}{Name & Title}&
multicolumn{2}{c}{Dates}&
multicolumn{1}{c}{Events} midrule
endfirsthead
caption[]{Kings & Queens.}
toprule
multicolumn{1}{c}{textnumero}&
multicolumn{1}{c}{Name & Title}&
multicolumn{2}{c}{Dates}&
multicolumn{1}{c}{Events} midrule
endhead
1& King Soandso III & 2234 &-- to date & This is some text
2& King Soandso III & 2234 &-- 3456 & This is a lot of text that needs to be wrapped effectively
3& King Soandso III & 234 &-- 134 (?)& This is some text
4& Queen Soandso III & 15thc &-- 16thc (?) & This is a lot of text that needs to be wrapped effectively
5& King Soandso III ``The Radiant Light of the Sun over the Water of the Old Spring'' & 15thc &-- 16thc (?) & This is a lot of text that needs to be wrapped effectively
6&&&& This is some text dotfill
--&multicolumn{4}{p{dimexpr14.5cm+4tabcolsep}@{}}{%
textit{And what if there was a lot of text here that needed to be wrapped properly and elegantly to let the text breathe.}}
7&&&& This is a lot of text that needs to be wrapped effectively
8&&&& This is some text
9&&&& This is a lot of text that needs to be wrapped effectively
10&&&& This is some text bottomrule
end{longtable}
end{document}
Correct answer by David Carlisle on December 21, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP