0

I have a really wide table that I want to split into proper amount of pages (I have no clue whether 2 pages is enough). I've researched for quite some time and found that the command longtable should be sufficient. However that is not the case and I can't get it to work.

Furthermore I want the table to be vertical instead of horizontal. To do this, I've tried using landscape in the code and admittedly it does change it to vertical, however it just does not look right.

I've tried sidewaystable as well as rotating package manually (I believe the command sideways table is part of rotating) but to no avail.. The end result just.. sucks.

Here's my "test" code (it needs to go into a bigger document, however I want this to work on it's own before I try that).

Thanks in advance!

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{longtable}
\usepackage{adjustbox}
\usepackage{rotating}
\usepackage{lscape}

\begin{document}

\begin{landscape}
\begin{longtable}{rllllllllllllll}
\multicolumn{1}{l}{T (C)} & Ammonia & Trimethylamine & n-hexane & Pyridine & p-xylene (24.85 °C - 59.85 °C) & p-xylene (13.28 °C - 179.23 °C) & p-xylene (58.29 °C - 139.29 °C) & 2,6-dimethylpyridine & 1,3,5-trimethylbenzene & 1,2,4-trimethylbenzene & 3,5-dimethylpyridine & Isodurene & Durene & 4-methylquinoline \\ 
0 & 3193.85 & 680.67 & 45.32 & 4.46 & 1.84 & 1.78 & 1.73 & 0.98 & 0.39 & 0.32 & 0.3 & 0.02 & 0.01 & 0.00 \\ 
5 & 3832.56 & 824.26 & 58.89 & 6.23 & 2.59 & 2.52 & 2.47 & 1.43 & 0.58 & 0.48 & 0.45 & 0.04 & 0.01 & 0.00 \\ 
10 & 4568.36 & 990.51 & 75.69 & 8.58 & 3.59 & 3.53 & 3.46 & 2.06 & 0.84 & 0.7 & 0.66 & 0.06 & 0.02 & 0.00 \\ 
15 & 5411.1 & 1181.72 & 96.26 & 11.65 & 4.92 & 4.86 & 4.77 & 2.92 & 1.22 & 1.02 & 0.94 & 0.11 & 0.05 & 0.00 \\ 
20 & 6371.04 & 1400.26 & 121.23 & 15.62 & 6.65 & 6.6 & 6.5 & 4.08 & 1.73 & 1.45 & 1.33 & 0.17 & 0.09 & 0.00 \\ 
25 & 7458.82 & 1648.59 & 151.26 & 20.68 & 8.89 & 8.86 & 8.74 & 5.6 & 2.42 & 2.03 & 1.86 & 0.27 & 0.16 & 0.00 \\ 
30 & 8685.43 & 1929.22 & 187.1 & 27.07 & 11.76 & 11.75 & 11.62 & 7.6 & 3.34 & 2.81 & 2.56 & 0.41 & 0.27 & 0.01 \\ 
35 & 10062.18 & 2244.71 & 229.54 & 35.06 & 15.38 & 15.41 & 15.26 & 10.18 & 4.54 & 3.84 & 3.48 & 0.62 & 0.44 & 0.01 \\ 
40 & 11600.64 & 2597.65 & 279.44 & 44.94 & 19.93 & 19.99 & 19.83 & 13.48 & 6.11 & 5.18 & 4.67 & 0.92 & 0.7 & 0.02 \\ 
45 & 13312.63 & 2990.68 & 337.71 & 57.06 & 25.58 & 25.69 & 25.51 & 17.64 & 8.12 & 6.91 & 6.21 & 1.33 & 1.09 & 0.03 \\ 
50 & 15210.18 & 3426.44 & 405.33 & 71.8 & 32.54 & 32.69 & 32.51 & 22.86 & 10.67 & 9.1 & 8.16 & 1.9 & 1.63 & 0.05 \\ 
55 & 17305.47 & 3907.57 & 483.31 & 89.58 & 41.05 & 41.25 & 41.05 & 29.33 & 13.88 & 11.87 & 10.63 & 2.65 & 2.4 & 0.07 \\ 
60 & 19610.83 & 4436.73 & 572.74 & 110.86 & 51.38 & 51.6 & 51.41 & 37.29 & 17.89 & 15.34 & 13.71 & 3.66 & 3.44 & 0.11 \\ 
65 & 22138.65 & 5016.55 & 674.76 & 136.16 & 63.83 & 64.05 & 63.87 & 46.99 & 22.83 & 19.63 & 17.53 & 4.97 & 4.83 & 0.16 \\ 
70 & 24901.42 & 5649.65 & 790.52 & 166.03 & 78.73 & 78.91 & 78.73 & 58.72 & 28.89 & 24.89 & 22.22 & 6.67 & 6.67 & 0.24 \\ 
75 & 27911.6 & 6338.62 & 921.27 & 201.07 & 96.44 & 96.52 & 96.37 & 72.81 & 36.26 & 31.31 & 27.94 & 8.83 & 9.05 & 0.34 \\ 
80 & 31181.67 & 7086.01 & 1068.25 & 241.93 & 117.38 & 117.27 & 117.15 & 89.6 & 45.15 & 39.06 & 34.87 & 11.56 & 12.08 & 0.48 \\ 
85 & 34724.05 & 7894.32 & 1232.77 & 289.3 & 141.98 & 141.57 & 141.48 & 109.49 & 55.8 & 48.38 & 43.2 & 14.97 & 15.9 & 0.68 \\ 
90 & 38551.08 & 8766.02 & 1416.16 & 343.92 & 170.72 & 169.85 & 169.81 & 132.91 & 68.48 & 59.48 & 53.16 & 19.19 & 20.64 & 0.94 \\ 
95 & \multicolumn{1}{r}{42675} & 9703.51 & 1619.79 & 406.57 & 204.14 & 202.61 & 202.62 & 160.3 & 83.48 & 72.64 & 64.99 & 24.36 & 26.46 & 1.29 \\ 
100 & 47107.9 & 10709.12 & 1845.03 & 478.09 & 242.79 & 240.34 & 240.42 & 192.16 & 101.12 & 88.14 & 78.95 & 30.64 & 33.53 & 1.74 \\ 
\caption{Dadada}
\label{vaporpressure}
\end{longtable}
\end{landscape}


\end{document}
1
  • 1
    If I run your example the table is landscape but because of the wide headings in row 1 still too wide even for the landscape, you need to allow your headings to linebreak Commented Oct 21, 2020 at 16:36

1 Answer 1

1

With the following modifications, you can squeeze the table onto a single page:

enter image description here

\documentclass{article}
\usepackage{pdflscape}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{siunitx}

\begin{document}

\begin{landscape}
\begin{table}
\caption{Dadada}
\label{vaporpressure}
\footnotesize
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}r
                S[table-format=5.2]
                *{2}{S[table-format=4.2]}
                *{6}{S[table-format=3.2]}
                *{4}{S[table-format=2.2]}
                S[table-format=1.2]@{}}
\toprule
\thead{T\\ (C)}
  & {\thead{Ammonia}} 
    & {\thead{Tri-\\methyl-\\amine}} 
      & {\thead{n-hexane} }
        & {\thead{Pyri-\\dine} }
          & {\thead{p-xylene\\ \textsuperscript{[a]}}} 
            & {\thead{p-xylene\\ \textsuperscript{[b]}} }
              & {\thead{p-xylene\\ \textsuperscript{[c]}} }
                & {\thead{2,6-di-\\methyl-\\pyridine} }
                  & {\thead{1,3,5-tri-\\methyl-\\benzene} }
                    & {\thead{1,2,4-tri-\\methyl-\\benzene}} 
                      & {\thead{3,5-di-\\methyl-\\pyridine} }
                        & {\thead{Iso-\\durene} }
                          & {\thead{Durene} }
                            & {\thead{4-methyl-\\quinoline}} \\ 
\midrule
0 & 3193.85 & 680.67 & 45.32 & 4.46 & 1.84 & 1.78 & 1.73 & 0.98 & 0.39 & 0.32 & 0.3 & 0.02 & 0.01 & 0.00 \\ 
5 & 3832.56 & 824.26 & 58.89 & 6.23 & 2.59 & 2.52 & 2.47 & 1.43 & 0.58 & 0.48 & 0.45 & 0.04 & 0.01 & 0.00 \\ 
10 & 4568.36 & 990.51 & 75.69 & 8.58 & 3.59 & 3.53 & 3.46 & 2.06 & 0.84 & 0.7 & 0.66 & 0.06 & 0.02 & 0.00 \\ 
15 & 5411.1 & 1181.72 & 96.26 & 11.65 & 4.92 & 4.86 & 4.77 & 2.92 & 1.22 & 1.02 & 0.94 & 0.11 & 0.05 & 0.00 \\ 
20 & 6371.04 & 1400.26 & 121.23 & 15.62 & 6.65 & 6.6 & 6.5 & 4.08 & 1.73 & 1.45 & 1.33 & 0.17 & 0.09 & 0.00 \\ 
25 & 7458.82 & 1648.59 & 151.26 & 20.68 & 8.89 & 8.86 & 8.74 & 5.6 & 2.42 & 2.03 & 1.86 & 0.27 & 0.16 & 0.00 \\ 
30 & 8685.43 & 1929.22 & 187.1 & 27.07 & 11.76 & 11.75 & 11.62 & 7.6 & 3.34 & 2.81 & 2.56 & 0.41 & 0.27 & 0.01 \\ 
35 & 10062.18 & 2244.71 & 229.54 & 35.06 & 15.38 & 15.41 & 15.26 & 10.18 & 4.54 & 3.84 & 3.48 & 0.62 & 0.44 & 0.01 \\ 
40 & 11600.64 & 2597.65 & 279.44 & 44.94 & 19.93 & 19.99 & 19.83 & 13.48 & 6.11 & 5.18 & 4.67 & 0.92 & 0.7 & 0.02 \\ 
45 & 13312.63 & 2990.68 & 337.71 & 57.06 & 25.58 & 25.69 & 25.51 & 17.64 & 8.12 & 6.91 & 6.21 & 1.33 & 1.09 & 0.03 \\ 
50 & 15210.18 & 3426.44 & 405.33 & 71.8 & 32.54 & 32.69 & 32.51 & 22.86 & 10.67 & 9.1 & 8.16 & 1.9 & 1.63 & 0.05 \\ 
55 & 17305.47 & 3907.57 & 483.31 & 89.58 & 41.05 & 41.25 & 41.05 & 29.33 & 13.88 & 11.87 & 10.63 & 2.65 & 2.4 & 0.07 \\ 
60 & 19610.83 & 4436.73 & 572.74 & 110.86 & 51.38 & 51.6 & 51.41 & 37.29 & 17.89 & 15.34 & 13.71 & 3.66 & 3.44 & 0.11 \\ 
65 & 22138.65 & 5016.55 & 674.76 & 136.16 & 63.83 & 64.05 & 63.87 & 46.99 & 22.83 & 19.63 & 17.53 & 4.97 & 4.83 & 0.16 \\ 
70 & 24901.42 & 5649.65 & 790.52 & 166.03 & 78.73 & 78.91 & 78.73 & 58.72 & 28.89 & 24.89 & 22.22 & 6.67 & 6.67 & 0.24 \\ 
75 & 27911.6 & 6338.62 & 921.27 & 201.07 & 96.44 & 96.52 & 96.37 & 72.81 & 36.26 & 31.31 & 27.94 & 8.83 & 9.05 & 0.34 \\ 
80 & 31181.67 & 7086.01 & 1068.25 & 241.93 & 117.38 & 117.27 & 117.15 & 89.6 & 45.15 & 39.06 & 34.87 & 11.56 & 12.08 & 0.48 \\ 
85 & 34724.05 & 7894.32 & 1232.77 & 289.3 & 141.98 & 141.57 & 141.48 & 109.49 & 55.8 & 48.38 & 43.2 & 14.97 & 15.9 & 0.68 \\ 
90 & 38551.08 & 8766.02 & 1416.16 & 343.92 & 170.72 & 169.85 & 169.81 & 132.91 & 68.48 & 59.48 & 53.16 & 19.19 & 20.64 & 0.94 \\ 
95 & 42675 & 9703.51 & 1619.79 & 406.57 & 204.14 & 202.61 & 202.62 & 160.3 & 83.48 & 72.64 & 64.99 & 24.36 & 26.46 & 1.29 \\ 
100 & 47107.9 & 10709.12 & 1845.03 & 478.09 & 242.79 & 240.34 & 240.42 & 192.16 & 101.12 & 88.14 & 78.95 & 30.64 & 33.53 & 1.74 \\ 
\midrule
\multicolumn{15}{l}{\textsuperscript{[a]} (24.85 °C - 59.85 °C); \textsuperscript{[b]} (13.28 °C - 179.23 °C); \textsuperscript{[c]} (58.29 °C - 139.29 °C) }
\end{tabular*}
\end{table}
\end{landscape}


\end{document}
2
  • And if it were to be a subfile in a bigger .tex document? How would I incorporate this table :) Commented Oct 23, 2020 at 11:28
  • When I try to, I get the error "Misplaced alignment tab character &." for only the & {\thead{4-methyl-\\quinoline}} \\ row in the code. I am not sure what causes this error. The code works in a seperator document or .tex file, but when I compile the main file it does not. Commented Oct 23, 2020 at 11:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .