LaTeX forum ⇒ Graphics, Figures & TablesTabulars float to next page

Information and discussion about graphics, figures & tables in LaTeX documents.
Notis
Posts: 4
Joined: Wed Nov 18, 2015 2:00 am

Tabulars float to next page

Postby Notis » Wed Nov 18, 2015 2:12 am

Hi all,

I'm working on a piece containing a series of sequential tables. Currently, if a table is going to run between pages it is floated to a new page.When one table ends, I want the next to begin, even if it has to run onto the next page.

Below is a an example. In my preferred scenario, the C | D column would start on the first page.

Thanks in advance.

-Nick


  1. \documentclass[11pt]{article}
  2. \begin{document}
  3.  
  4.  
  5. \begin{tabular}{ll}
  6. A & B \\
  7. A & B \\
  8. A & B \\
  9. A & B \\
  10. A & B \\
  11. A & B \\
  12. A & B \\
  13. A & B \\
  14. A & B \\
  15. A & B \\
  16. A & B \\
  17. A & B \\
  18. A & B \\
  19. A & B \\
  20. A & B \\
  21.  
  22. \end{tabular}
  23.  
  24. \begin{tabular}{ll}
  25. C & D \\
  26. C & D \\
  27. C & D \\
  28. C & D \\
  29. C & D \\
  30. C & D \\
  31. C & D \\
  32. C & D \\
  33. C & D \\
  34. C & D \\
  35. C & D \\
  36. C & D \\
  37. C & D \\
  38. C & D \\
  39. C & D \\
  40. C & D \\
  41. C & D \\
  42. C & D \\
  43. C & D \\
  44. C & D \\
  45. C & D \\
  46. C & D \\
  47. C & D \\
  48. C & D \\
  49. C & D \\
  50. C & D \\
  51. C & D \\
  52. C & D \\
  53. C & D \\
  54. C & D \\
  55. C & D \\
  56. C & D \\
  57. \end{tabular}
  58.  
  59.  
  60. \end{document}
Last edited by Notis on Wed Nov 18, 2015 9:26 pm, edited 1 time in total.

Tags:

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

Postby Johannes_B » Wed Nov 18, 2015 11:22 am

Welcome,

a tabular is a single box and LaTeX places it as such. The second tabular didn't fit the page and was pushed to the next. Exactly that is the reason, why floating environments like table where introduced.

Tables, that are longer than one page are usually split using package longtable:
  1. \documentclass[11pt]{article}
  2. \usepackage{longtable}
  3. \begin{document}
  4.  
  5.  
  6. \begin{tabular}{ll}
  7. A & B \\
  8. A & B \\
  9. A & B \\
  10. A & B \\
  11. A & B \\
  12. A & B \\
  13. A & B \\
  14. A & B \\
  15. A & B \\
  16. A & B \\
  17. A & B \\
  18. A & B \\
  19. A & B \\
  20. A & B \\
  21. A & B \\
  22.  
  23. \end{tabular}
  24.  
  25. \begin{longtable}{ll}
  26. C & D \\
  27. C & D \\
  28. C & D \\
  29. C & D \\
  30. C & D \\
  31. C & D \\
  32. C & D \\
  33. C & D \\
  34. C & D \\
  35. C & D \\
  36. C & D \\
  37. C & D \\
  38. C & D \\
  39. C & D \\
  40. C & D \\
  41. C & D \\
  42. C & D \\
  43. C & D \\
  44. C & D \\
  45. C & D \\
  46. C & D \\
  47. C & D \\
  48. C & D \\
  49. C & D \\
  50. C & D \\
  51. C & D \\
  52. C & D \\
  53. C & D \\
  54. C & D \\
  55. C & D \\
  56. C & D \\
  57. C & D \\
  58. \end{longtable}
  59.  
  60.  
  61. \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.

Notis
Posts: 4
Joined: Wed Nov 18, 2015 2:00 am

Postby Notis » Wed Nov 18, 2015 11:51 pm

Thanks for the suggestions, Johannes. longtable does seem to work with the MWE I initially posted. However, the tabular I'm actually working with is a little more complex, containing set column widths following a section title. Below is a marginally more sophisticated MWE. Within this example, I am no longer to use longtable in the way I could have in my previous example.
Any advice as to how I could use longtable with these restrictions would be appreciated.
-Nick


  1. \documentclass[11pt]{article}
  2. \usepackage{array}
  3. \newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
  4. \newcolumntype{C}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
  5.  
  6. \begin{document}
  7.  
  8. \begin{tabular}{L{2cm} C{13cm}}
  9. \vspace{5pt}
  10. NUMBERS & \textbf Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  11. \vspace{5pt}
  12. NUMBERS & \textbf Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  13. \vspace{5pt}
  14. NUMBERS & \textbf Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  15. \vspace{5pt}
  16. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  17. \vspace{5pt}
  18. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  19. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  20. \vspace{5pt}
  21. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  22. \vspace{5pt}
  23. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  24. \vspace{5pt}
  25. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  26. \vspace{5pt}
  27. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  28. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  29.  
  30. \end{tabular}
  31.  
  32. \begin{tabular}{L{2cm} C{13cm}}
  33. \vspace{5pt}
  34. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  35. \vspace{5pt}
  36. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  37. \vspace{5pt}
  38. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  39. \vspace{5pt}
  40. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  41. \vspace{5pt}
  42. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  43. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  44. \vspace{5pt}
  45. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  46. \vspace{5pt}
  47. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  48. \vspace{5pt}
  49. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  50. \vspace{5pt}
  51. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  52. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  53. \vspace{5pt}
  54. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  55. \vspace{5pt}
  56. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  57. \end{tabular}
  58.  
  59.  
  60. \end{document}

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

Postby Johannes_B » Thu Nov 19, 2015 12:36 am

What isn't working? Right now, the tabular is just too wide for the default margin settings of article. Making the second column narrower, i don't see any problem.
  1. \documentclass[11pt]{article}
  2. \usepackage{longtable}
  3. \usepackage{array}
  4. \newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
  5. \newcolumntype{C}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
  6.  
  7. \begin{document}
  8.  
  9. \begin{longtable}{L{2cm} C{9cm}}
  10. \vspace{5pt}
  11. NUMBERS & \textbf Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  12. \vspace{5pt}
  13. NUMBERS & \textbf Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  14. \vspace{5pt}
  15. NUMBERS & \textbf Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  16. \vspace{5pt}
  17. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  18. \vspace{5pt}
  19. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  20. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  21. \vspace{5pt}
  22. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  23. \vspace{5pt}
  24. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  25. \vspace{5pt}
  26. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  27. \vspace{5pt}
  28. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  29. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  30.  
  31. \end{longtable}
  32.  
  33. \begin{longtable}{L{2cm} C{9cm}}
  34. \vspace{5pt}
  35. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  36. \vspace{5pt}
  37. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  38. \vspace{5pt}
  39. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  40. \vspace{5pt}
  41. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  42. \vspace{5pt}
  43. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  44. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  45. \vspace{5pt}
  46. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  47. \vspace{5pt}
  48. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  49. \vspace{5pt}
  50. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  51. \vspace{5pt}
  52. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  53. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  54. \vspace{5pt}
  55. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  56. \vspace{5pt}
  57. NUMBERS & Lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots and lots of text \\
  58. \end{longtable}
  59. \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 12 guests