## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Longtable and wrapping

Information and discussion about graphics, figures & tables in LaTeX documents.
and_mue
Posts: 1
Joined: Fri Jun 19, 2015 10:00 am

### Longtable and wrapping

Dear Latex Community,

I am relatively new to Latex and I have currently a problem when generating a longtable that spans across multiple pages and the wrapping of a footnote and or other text within the table. Please find my example code below. I tried to use the \multicolumn command as I want that the text goes across all four columns, however, this does not work properly i.e. no wrapping. Furthermore, I tried to use \caption*, did not work either. Has somebody any suggestions on how I can do this?

Thank you and kind regards
Andreas

\begin{center}\begin{longtable}{ccrr}\caption[Descriptive statistics]{Descriptive statistics} \label{tab:Descriptive statistics} \\ [b]Here I want a text that goes across the four columns and is wrapped at the end on new rows. If possible, this should appear on each page. Alternatively, this can be put at the end of the table. [/b] \multicolumn{4}{l}{Panel A: XXX} \\\hline\rule{0pt}{3ex}  \multirow{2}{*}{XXX} & \multirow{2}{*}{XXX} & \multicolumn{2}{c}{XXX)} \\  & & \multicolumn{1}{c}{XXX} & \multicolumn{1}{r}{XX} \\\hline \\ [-2ex]\endfirsthead\multicolumn{4}{c}%{\small{{\bfseries \tablename\ \thetable.{}} XXX (continued)}} \\ [1ex]\hline \\ [-2ex]\endhead\hline \multicolumn{4}{r}{{Continued on next page}} \\\endfoot\endlastfoot     XXX  & XXX   & XXX & XXX \\\multicolumn{4}{l}{Panel B: XXX}\\\hline& & \multicolumn{1}{c}{XXX} & \multicolumn{1}{r}{XXX} \\\hline\end{longtable}\end{center}

Tags:

Johannes_B
Site Moderator
Posts: 4116
Joined: Thu Nov 01, 2012 4:08 pm
Hi and welcome,

i am not quite sure what you are trying to achieve. Always hard to guess when a table only contains XXX. Using standard article, the table perfectly fits on one page as well. Put some funny animals in the table, or fruit, or vegetable or ... be a bit creative. Helping is more fun that way

By the way, you adjusted spacing after rules, you might be interested in package booktabs.

\documentclass{article}\usepackage{showframe}\usepackage{multirow}\usepackage{longtable}\begin{document}%\begin{center}% JB: No	\begin{longtable}{ccrr}		\caption[Descriptive statistics]{Descriptive statistics} \label{tab:Descriptive statistics} \\		\multicolumn{4}{p{.9\linewidth}}{Panel A: XXX		Here I want a text that goes across the four columns and is wrapped at the		end on new rows. If possible, this should appear on each page.		Alternatively, this can be put at the end of the table. 		} \\		\multicolumn{4}{l}{Panel A: XXX} \\		\hline		\rule{0pt}{3ex}  		\multirow{2}{*}{XXX} &		\multirow{2}{*}{XXX} &		\multicolumn{2}{c}{XXX)} \\		& & \multicolumn{1}{c}{XXX} & \multicolumn{1}{r}{XX} \\		\hline \\ [-2ex]	\endfirsthead	\multicolumn{4}{c}%	{\small{{\bfseries \tablename\ \thetable.{}} XXX (continued)}} \\ [1ex]	\hline \\ [-2ex]\endhead\hline \multicolumn{4}{r}{{Continued on next page}} \\\endfoot\endlastfootXXX  & XXX   & XXX & XXX \\\multicolumn{4}{l}{Panel B: XXX}\\\hline& & \multicolumn{1}{c}{XXX} & \multicolumn{1}{r}{XXX} \\\hline\end{longtable}%\end{center}\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.