3

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:

enter image description here

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.

  • you are only using ltxtable as a way of including longtable, you are not using any of the features of that package. (as you have no X columns) (which is fine, I'd normally recommend longtable rather than using tabularx features for such a table, but it would be less confusing to \usepackage{longtable} rather than ltxtable – David Carlisle Feb 27 '17 at 0:08
  • 1
    It's normally recommended to put captions for multi-page tables at the top not bottom so the reader has information about the table on the first page, the default spacing is better for that use. – David Carlisle Feb 27 '17 at 0:10
1

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.

enter image description here

\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+4\tabcolsep}@{}}{%
\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}
  • The use you make of the "p" columns is very clever. Works nicely. Thank you. – CyanideBaby Feb 27 '17 at 8:21
  • I have other tables in my document, with their own captions, of course. I'll move their captions at the top too, just like you're doing for this longtable, for the sake of consistency. – CyanideBaby Feb 27 '17 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.