LaTeX forum ⇒ Graphics, Figures & TablesLongtable 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

Postby and_mue » Fri Jun 19, 2015 10:10 am

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

  1. \begin{center}
  2. \begin{longtable}{ccrr}
  3. \caption[Descriptive statistics]{Descriptive statistics} \label{tab:Descriptive statistics} \\
  4.  
  5. [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]
  6.  
  7. \multicolumn{4}{l}{Panel A: XXX} \\
  8. \hline
  9. \rule{0pt}{3ex}
  10. \multirow{2}{*}{XXX} &
  11. \multirow{2}{*}{XXX} &
  12. \multicolumn{2}{c}{XXX)} \\
  13. & & \multicolumn{1}{c}{XXX} & \multicolumn{1}{r}{XX} \\
  14. \hline \\ [-2ex]
  15. \endfirsthead
  16. \multicolumn{4}{c}%
  17. {\small{{\bfseries \tablename\ \thetable.{}} XXX (continued)}} \\ [1ex]
  18. \hline \\ [-2ex]
  19. \endhead
  20. \hline \multicolumn{4}{r}{{Continued on next page}} \\
  21. \endfoot
  22. \endlastfoot
  23. XXX & XXX & XXX & XXX \\
  24. \multicolumn{4}{l}{Panel B: XXX}\\
  25. \hline
  26. & & \multicolumn{1}{c}{XXX} & \multicolumn{1}{r}{XXX} \\
  27. \hline
  28. \end{longtable}
  29. \end{center}

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Fri Jun 19, 2015 11:21 am

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.

  1. \documentclass{article}
  2. \usepackage{showframe}
  3. \usepackage{multirow}
  4. \usepackage{longtable}
  5. \begin{document}
  6. %\begin{center}% JB: No
  7. \begin{longtable}{ccrr}
  8. \caption[Descriptive statistics]{Descriptive statistics} \label{tab:Descriptive statistics} \\
  9. \multicolumn{4}{p{.9\linewidth}}{Panel A: XXX
  10. Here I want a text that goes across the four columns and is wrapped at the
  11. end on new rows. If possible, this should appear on each page.
  12. Alternatively, this can be put at the end of the table.
  13. } \\
  14. \multicolumn{4}{l}{Panel A: XXX} \\
  15. \hline
  16. \rule{0pt}{3ex}
  17. \multirow{2}{*}{XXX} &
  18. \multirow{2}{*}{XXX} &
  19. \multicolumn{2}{c}{XXX)} \\
  20. & & \multicolumn{1}{c}{XXX} & \multicolumn{1}{r}{XX} \\
  21. \hline \\ [-2ex]
  22. \endfirsthead
  23. \multicolumn{4}{c}%
  24. {\small{{\bfseries \tablename\ \thetable.{}} XXX (continued)}} \\ [1ex]
  25. \hline \\ [-2ex]
  26. \endhead
  27. \hline \multicolumn{4}{r}{{Continued on next page}} \\
  28. \endfoot
  29. \endlastfoot
  30. XXX & XXX & XXX & XXX \\
  31. \multicolumn{4}{l}{Panel B: XXX}\\
  32. \hline
  33. & & \multicolumn{1}{c}{XXX} & \multicolumn{1}{r}{XXX} \\
  34. \hline
  35. \end{longtable}
  36. %\end{center}
  37. \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.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 3 guests