3

In my master's thesis I have a lot of tables, large and long; what's the best practice to fit them ?

It would be fine split the longer table in multiple pages?

what about the larger ones?

any advice will be appreciated

UPDATE

here an example of a large table

\begin{table}[H] 
    \centering
    \begin{tabular}{|l|r|r|r|}
\hline HTTP Date & Time zone & Time shift & Timestamp \\
\hline Tue, 02 Jun 2015 20:33:31 GMT & America/Chicago & -6 & June 2nd 2015, 22:19:31.929 \\
\hline Sun, 14 Jun 2015 11:33:46 GMT & America/Denver & -7 & June 14th 2015, 13:19:07.193 \\
\hline Sun, 14 Jun 2015 11:34:01 GMT & America/Los\_Angeles & -8 & June 14th 2015, 13:19:21.755 \\
\hline Sun, 14 Jun 2015 11:33:46 GMT & America/New\_York & -5 & June 14th 2015, 13:19:07.417 \\
\hline Sun, 14 Jun 2015 12:19:18 GMT & America/Phoenix & -7 & June 14th 2015, 14:04:38.980 \\
\hline Sun, 14 Jun 2015 11:33:59 GMT & America/Toronto & -5 & June 14th 2015, 13:19:19.881 \\
\hline Fri, 12 Jun 2015 05:53:03 GMT & Asia/Shanghai & 8 & June 12th 2015, 07:38:31.238 \\
\hline Sun, 14 Jun 2015 11:33:56 GMT & Europe/Amsterdam & 1 & June 14th 2015, 13:19:17.290 \\
...
        \hline      
    \end{tabular}   

enter image description here

  • @Mico, question updated, however the biggest issue is if it is right to split a table in multiple pages – CDominik Oct 10 '15 at 17:08
  • Is rotate table for 90 degree an acceptable option? – Zarko Oct 10 '15 at 17:32
  • @Zarko, it could be, I must find out how do it – CDominik Oct 10 '15 at 17:35
2

You can use the ltablex package, which loads both tabularx and longtable. What makes the table a little too wide is the head of the 3th column, which I circumvent with a \makebox[0pt] command.

\documentclass{article}
\usepackage{booktabs, ltablex}
\usepackage{siunitx}
\sisetup{table-format=-2.0, table-number-alignment=center}

\usepackage[showframe]{geometry}

\begin{document}

\renewcommand{\arraystretch}{1.2}%
\begin{tabularx}{\linewidth}{@{\,}X@{\enspace}l r SX@{\enspace}l@{\,}}
  \toprule
  \multicolumn{2}{c}{HTTP Date}
  & \multicolumn{1}{c}{Time zone}
  & {\makebox[0pt]{Time shift}}
  & \multicolumn{2}{c}{Timestamp} \\
  \midrule
  Tue, 02 Jun 2015, & 20:33:31 GMT
    & America/Chicago & -6 & June 2nd 2015, & 22:19:31.92 \\
  Sun, 14 Jun 2015, & 11:33:46 GMT
    & America/Denver & -7 & June 14th 2015, & 13:19:07.193 \\
  % \hline
  Sun, 14 Jun 2015, & 11:34:01 GMT
    & America/Los\_Angeles & -8 & June 14th 2015, & 13:19:21.755 \\
  Sun, 14 Jun 2015, & 11:33:46 GMT
    & America/New\_York & -5 & June 14th 2015, & 13:19:07.417 \\
  Sun, 14 Jun 2015, & 12:19:18 GMT
    & America/Phoenix & -7 & June 14th 2015, & 14:04:38.980 \\
  Sun, 14 Jun 2015, & 11:33:59 GMT
    & America/Toronto & -5 & June 14th 2015, & 13:19:19.881 \\
  % \hline
  Fri, 12 Jun 2015, & 05:53:03 GMT
    & Asia/Shanghai & 8 & June 12th 2015, & 07:38:31.238 \\
  Sun, 14 Jun 2015, & 11:33:56 GMT
    & Europe/Amsterdam & 1 & June 14th 2015, & 13:19:17.290 \\
  \bottomrule
\end{tabularx}

\end{document} 

enter image description here

  • I very liked your solution for third column :-) – Zarko Oct 10 '15 at 19:38
1

Well, rotating table for 90 degrees is simple:

\documentclass{article}
    \usepackage{rotating}
    \usepackage{booktabs}
    \usepackage{siunitx}

\usepackage{showframe}

    \begin{document}
\begin{sidewaystable}[p]
    \renewcommand{\arraystretch}{1.2}
    \centering
    \begin{tabular}{ r@{\ }l r S r@{\ }l }
        \toprule
\multicolumn{2}{c}{HTTP Date} 
    &   \multicolumn{1}{c}{Time zone}
        &   \multicolumn{1}{c}{Time shift} 
            &   \multicolumn{2}{c}{Timestamp}                           \\
        \midrule
Tue, 02 Jun 2015,  &   20:33:31 GMT 
    &   America/Chicago         & -6    &   June 2nd 2015,  &   22:19:31.92  \\
Sun, 14 Jun 2015,  &   11:33:46 GMT 
    &   America/Denver          & -7    &   June 14th 2015,  &   13:19:07.193 \\
%        \hline 
Sun, 14 Jun 2015,  &   11:34:01 GMT 
    &   America/Los\_Angeles    & -8    &   June 14th 2015,  &   13:19:21.755 \\
Sun, 14 Jun 2015,  &   11:33:46 GMT 
    &   America/New\_York       & -5    &   June 14th 2015,  &   13:19:07.417 \\
Sun, 14 Jun 2015,  &   12:19:18 GMT 
    &   America/Phoenix         & -7    &   June 14th 2015,  &   14:04:38.980 \\
Sun, 14 Jun 2015,  &   11:33:59 GMT 
    &   America/Toronto         & -5    &   June 14th 2015,  &   13:19:19.881 \\
%        \hline 
Fri, 12 Jun 2015,  &   05:53:03 GMT 
    &   Asia/Shanghai           & 8     &   June 12th 2015,  &   07:38:31.238 \\
Sun, 14 Jun 2015,  &   11:33:56 GMT 
    &   Europe/Amsterdam        & 1     &   June 14th 2015,  &   13:19:17.290 \\
        \bottomrule
    \end{tabular}
\end{sidewaystable}
    \end{document}

but then the page looks very empty:

enter image description here

For above image I slightly reformat your table (introduced two additional column). In it I add siunitx package for better formatting "time shift, and booktabs for nicer rulers. In table, as you can see, I omit vertical lines. Maybe the solution in which you split text in the long cells into shorter two lines will be better solution:

\documentclass{article}
    \usepackage[margin=30mm,showframe]{geometry}
    \usepackage{booktabs,tabularx}
    \usepackage{siunitx}

    \begin{document}
    \begin{table}[h]
    \renewcommand{\arraystretch}{1.3}
    \centering
    \begin{tabularx}{\textwidth}{ X r S X }
        \toprule
\multicolumn{1}{c}{HTTP Date} 
    &   \multicolumn{1}{c}{Time zone}
        &   \multicolumn{1}{c}{Time shift} 
            &   \multicolumn{1}{c}{Timestamp}                   \\
        \midrule
Tue, 02 Jun 2015,\newline  
20:33:31 GMT 
    &   America/Chicago & -6    &   June 2nd 2015,\newline   
                                    22:19:31.92                 \\
Sun, 14 Jun 2015,\newline   
11:33:46 GMT
    &   America/Denver          & -7    &   June 14th 2015,\newline
                                            13:19:07.193        \\
        \bottomrule
    \end{tabularx}
\end{table}
    \end{document}

which gives:

enter image description here

For above MWE I add two packages: geometry (because I haven't a clue, how your page is set up) by which I defined page, and tabularx, which fit table into text width and make multi line cells possible. Option showframe in geometry package serves only to show text borders. In normal circumstances it should be omit.

If you like to extend this table over more page, than you need select a table environment, which support this. One possible solution is in Bernard answer.

  • option showframe for geometry would avoid loading showframe. – Bernard Oct 10 '15 at 18:18
  • @Bernard, thank you for this information. I use geometry occasionally (only in answers/questions for SE) so I'm still not very familiar with it. I will correct my answer. – Zarko Oct 10 '15 at 19:25

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.