2

I have the following table and want to display it on a full page. The table has quite a lot columns and some of which are very long -- so my idea was to rotate it, therefore I'm using adjustbox. But this didn't help much. So I searched for some further improvements and found tabularx. But yet, it's far from looking good. The table is flowing over the edges of the page.

\documentclass[a4paper,12pt,parskip=half]{report}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage[table]{xcolor}
\usepackage{array,hhline}
\setlength\extrarowheight{2.5pt}

\begin{document}

\begin{adjustbox}{angle=90}
\begin{tabularx}{\textwidth}{lrXllrlrrlXrl}
\toprule
{} &  ProjectID & ProjectName &                                                                                                              ProjectURL &         BranchName &  CommitterID &        CommitterName &  CommitterNumOfCommits &  CommitID &                                 CommitKey &                                                                                                                                                              CommitMessage &  CommitNumOfFiles &  CommitDate \\
\midrule
0 &          1 &      kotlin &  C:\textbackslash Users\textbackslash NAME32\textbackslash Downloads\textbackslash SomeDirectory\textbackslash kotlin &  refs/heads/master &            1 &  Evgeny Gerashchenko &                     76 &         1 &  04a6b10f7a7fcb6daee5963ff4cdec3010b20f8c &                                                                                                     Minor. Renamed annotationDeserializer -> deserializers.\textbackslash n &                 5 &  2014-03-31 \\
1 &          1 &      kotlin &  C:\textbackslash Users\textbackslash NAME32\textbackslash Downloads\textbackslash SomeDirectory\textbackslash kotlin &  refs/heads/master &            1 &  Evgeny Gerashchenko &                     76 &         2 &  dadc8351b61be2c0f8f85f45f85799fa6d340c8e &                                                                                    Added tests for compiling Java against TraitImpl and extension members.\textbackslash n &                 7 &  2014-03-31 \\
2 &          1 &      kotlin &  C:\textbackslash Users\textbackslash NAME32\textbackslash Downloads\textbackslash SomeDirectory\textbackslash kotlin &  refs/heads/master &            1 &  Evgeny Gerashchenko &                     76 &         3 &  93dfc00880377c4a76e15e15c6a1fd89da86eeb3 &                                                                                                           Minor. Renamed enum constants for clarification.\textbackslash n &                 4 &  2014-03-31 \\
3 &          1 &      kotlin &  C:\textbackslash Users\textbackslash NAME32\textbackslash Downloads\textbackslash SomeDirectory\textbackslash kotlin &  refs/heads/master &            2 &   Natalia Ukhorskaya &                     55 &         4 &  4a79bfa16dc4224260e1acec5b498fe2f13a93d7 &                                                     Generate static accessors fro protected functions in different packages\textbackslash n \#KT-4617 Fixed\textbackslash n &                 7 &  2014-03-31 \\
4 &          1 &      kotlin &  C:\textbackslash Users\textbackslash NAME32\textbackslash Downloads\textbackslash SomeDirectory\textbackslash kotlin &  refs/heads/master &            3 &     Mikhael Bogdanov &                     89 &         5 &  5b5ecca12ae85060e1900e67a3dd2590d7305eb4 &                                                                                            Inline test: check that no any inline method is called directly\textbackslash n &                 8 &  2014-03-31 \\
5 &          1 &      kotlin &  C:\textbackslash Users\textbackslash NAME32\textbackslash Downloads\textbackslash SomeDirectory\textbackslash kotlin &  refs/heads/master &            3 &     Mikhael Bogdanov &                     89 &         6 &  0d239a3e0e047efff470235ddf5cd28f0024a39f &                                                                                                         Moving local fun callee generation to CallReceiver\textbackslash n &                 6 &  2014-03-31 \\
6 &          1 &      kotlin &  C:\textbackslash Users\textbackslash NAME32\textbackslash Downloads\textbackslash SomeDirectory\textbackslash kotlin &  refs/heads/master &            3 &     Mikhael Bogdanov &                     89 &         7 &  7dc662f6132fef321a5881a9d8d8477f75581e20 &                                                                                                   Optimization for const closures: access it via GETSTATIC\textbackslash n &                 5 &  2014-03-31 \\
7 &          1 &      kotlin &  C:\textbackslash Users\textbackslash NAME32\textbackslash Downloads\textbackslash SomeDirectory\textbackslash kotlin &  refs/heads/master &            3 &     Mikhael Bogdanov &                     89 &         8 &  c7c1e3365524dc63dd5e5e720e5f817dc4705c0f &  Move local fun callee generation to pushArgumentsWithCallReceiver.\textbackslash n\textbackslash nLocal fun callee generation via resolvedCall.resultingDescriptor not... &                 3 &  2014-03-31 \\
8 &          1 &      kotlin &  C:\textbackslash Users\textbackslash NAME32\textbackslash Downloads\textbackslash SomeDirectory\textbackslash kotlin &  refs/heads/master &            3 &     Mikhael Bogdanov &                     89 &         9 &  94e4c2f0c1fcba83dfa9088e2b39aeb64e3ad9de &                                                                                Move call receiver wrapping and generation to pushArgumentsWithCallReceiver\textbackslash n &                 2 &  2014-03-31 \\
9 &          1 &      kotlin &  C:\textbackslash Users\textbackslash NAME32\textbackslash Downloads\textbackslash SomeDirectory\textbackslash kotlin &  refs/heads/master &            3 &     Mikhael Bogdanov &                     89 &        10 &  e1e28558876ba6e9426cfc72840e4898114fc1f1 &                                                                                                                             Removed obsolete pop operation\textbackslash n &                 1 &  2014-03-31 \\
\bottomrule
\end{tabularx}
\end{adjustbox}

\end{document}

Any suggestions to overcome these limitations?

  • 1
    (i) from code sniped is only possible to see, that it is very huge and that you need to consider to redesign it, (ii) for more help you should help us: extend your code snippet to full, small document beginning with \documentclass{...} and ending with \end{document} with loaded only to table relevant packages in preamble. – Zarko Jul 26 '17 at 9:13
  • can you put MWE of your work instead of just some parts of code? – Prelude Jul 26 '17 at 9:24
2

I would implement it as a sequence of tables:

\documentclass[a4paper]{report}
\usepackage{geometry}
\usepackage{xparse,url,booktabs,tabularx,array}

\ExplSyntaxOn
\NewDocumentCommand{\entry}{m}
 {
  \prop_clear:N \l_scientiaetveritas_entry_prop
  \keys_set:nn { scientiaetveritas/entries } { #1 }
  \seq_clear:N \l_scientiaetveritas_entry_seq
  \scientiaetveritas_make_entry:nnn { SerialNumber } { } { }
  \scientiaetveritas_make_entry:nnn { ProjectID } { } { }
  \scientiaetveritas_make_entry:nnn { ProjectName } { } { }
  \scientiaetveritas_make_entry:nnn { ProjectURL } { \url } { }
  \scientiaetveritas_make_entry:nnn { BranchName } { \texttt } { }
  \scientiaetveritas_make_entry:nnn { CommitterID } { } { }
  \scientiaetveritas_make_entry:nnn { CommitterName } { } { }
  \scientiaetveritas_make_entry:nnn { CommitterNumOfCommits } { } { }
  \scientiaetveritas_make_entry:nnn { CommitID } { } { }
  \scientiaetveritas_make_entry:nnn { CommitKey } { \texttt } { }
  \scientiaetveritas_make_entry:nnn { CommitMessage } { \texttt } { \tl_to_str:n { \n } }
  \scientiaetveritas_make_entry:nnn { CommitNumOfFiles } { } { }
  \scientiaetveritas_make_entry:nnn { CommitDate } { } { }

  \par\addvspace{\bigskipamount}
  \noindent
  \begin{tabularx}{\textwidth}{@{}l>{\raggedright}X@{}}
  \seq_use:Nn \l_scientiaetveritas_entry_seq { \tabularnewline }
  \end{tabularx}
 }
\keys_define:nn { scientiaetveritas/entries }
 {
  unknown .code:n = \prop_put:NVn \l_scientiaetveritas_entry_prop \l_keys_key_tl { #1 },
 }
\prop_new:N \l_scientiaetveritas_entry_prop
\seq_new:N \l_scientiaetveritas_entry_seq
\cs_new_protected:Nn \scientiaetveritas_make_entry:nnn
 {
  \seq_put_right:Nx \l_scientiaetveritas_entry_seq
   { #1 & \exp_not:N #2 { \prop_item:Nn \l_scientiaetveritas_entry_prop { #1 } #3 } }
 }
\ExplSyntaxOff


\begin{document}

\entry{
  SerialNumber         = 0,
  ProjectID             = 1,
  ProjectName           = kotlin,
  ProjectURL            = C:\Users\NAME32\Downloads\SomeDirectory\kotlin,
  BranchName            = refs/heads/master,
  CommitterID           = 1,
  CommitterName         = Evgeny Gerashchenko,
  CommitterNumOfCommits = 76,
  CommitID              = 1,
  CommitKey             = 04a6b10f7a7fcb6daee5963ff4cdec3010b20f8c,
  CommitMessage         = Minor. Renamed annotationDeserializer -> deserializers.,
  CommitNumOfFiles      = 5,
  CommitDate            = 2014-03-31,
}

\entry{
  Serial Number         = 1,
  ProjectID             = 1,
  ProjectName           = kotlin,
  ProjectURL            = C:\Users\NAME32\Downloads\SomeDirectory\kotlin,
  BranchName            = refs/heads/master,
  CommitterID           = 1,
  CommitterName         = Evgeny Gerashchenko,
  CommitterNumOfCommits = 76,
  CommitID              = 2,
  CommitKey             = dadc8351b61be2c0f8f85f45f85799fa6d340c8e,
  CommitMessage         = Added tests for compiling Java against TraitImpl and extension members.,
  CommitNumOfFiles      = 5,
  CommitDate            = 2014-03-31,
}

\end{document}

You can prepare an \entry template and fill it with the data. The order of the keys is unimportant; empty items will be honored (but they could be omitted, if desired).

You have several advantages over a static table: as you see from the code it's possible to format each item as desired.

enter image description here

| improve this answer | |
2

Your table is so huge that doubt that it is possible to fit it on A3 paper size ... I strongly suggest you to reconsider its redesign. In it see:

  • if possible to remove columns with the same data to caption or legend to table, for example CommitDate & 2014-03-31 etc
  • transpose table, i.e. interchange columns and rows, as is shown in MWE below
  • use ltablex package, which alow, that the table is span over more pages

enter image description here

\documentclass{article}
\usepackage[margin=20mm]{geometry}
\usepackage[demo]{graphicx}
\usepackage[skip=1ex]{caption}
\usepackage{rotating}
\usepackage{booktabs, ltablex}

\begin{document}
\begin{tabularx}{\linewidth}{ @{} l X @{} }
\toprule
ID                      &   0                   \\
Project Name            &   1                   \\
Project URL             &   kotlin              \\
Branch Name             &   C:\textbackslash Users\textbackslash NAME32\textbackslash
                            Downloads\textbackslash SomeDirectory\textbackslash
                            kotlin              \\
Committer ID            &   Evgeny Gerashchenko \\
Committer Name          &   76                  \\
CommitterNumOfCommits   &   1                   \\
CommitID                &   04a6b10f7a7fcb6daee5963ff4cdec3010b20f8c   
                                                \\ 
CommitKey               &   Minor. Renamed annotationDeserializer 
                            -> deserializers.\textbackslash n
                                                \\
CommitMessage           &   1                   \\
CommitNumOfFiles        &   5                   \\
CommitDate              &  2014-03-31           \\
\midrule
ID                      &   1                   \\
Project Name            &   1                   \\
Project URL             &   kotlin              \\
Branch Name             &   C:\textbackslash Users\textbackslash NAME32\textbackslash
                            Downloads\textbackslash SomeDirectory\textbackslash
                            kotlin              \\
Committer ID            &   Evgeny Gerashchenko \\
Committer Name          &   76                  \\
CommitterNumOfCommits   &   2                   \\
CommitID                &   dadc8351b61be2c0f8f85f45f85799fa6d340c8e
                                                \\
CommitKey               &   Added tests for compiling Java against TraitImpl 
                            and extension members.\textbackslash n
                                                \\
CommitMessage           &   1                   \\
CommitNumOfFiles        &   7                   \\
CommitDate              &  2014-03-31           \\
\midrule
ID                      &   2                   \\
Project Name            &   1                   \\
Project URL             &   kotlin              \\
Branch Name             &   C:\textbackslash Users\textbackslash NAME32\textbackslash
                            Downloads\textbackslash SomeDirectory\textbackslash
                            kotlin              \\
Committer ID            &   Evgeny Gerashchenko \\
Committer Name          &   76                  \\
CommitterNumOfCommits   &   3                   \\
CommitID                &   93dfc00880377c4a76e15e15c6a1fd89da86eeb3
                                                \\
CommitKey               &   Minor. Renamed enum constants 
                            for clarification.\textbackslash n
                                                \\
CommitMessage           &   1                   \\
CommitNumOfFiles        &   4                   \\
CommitDate              &  2014-03-31           \\
\midrule
ID                      &   3                   \\
Project Name            &   1                   \\
Project URL             &   kotlin              \\
Branch Name             &   C:\textbackslash Users\textbackslash NAME32\textbackslash
                            Downloads\textbackslash SomeDirectory\textbackslash
                            kotlin              \\
Committer ID            &   Natalia Ukhorskaya  \\
Committer Name          &   55                  \\
CommitterNumOfCommits   &   3                   \\
CommitID                &   4a79bfa16dc4224260e1acec5b498fe2f13a93d7
                                                \\
CommitKey               &   Minor. Renamed enum constants
                            for clarification.\textbackslash n
                                                \\
CommitMessage           &   1                   \\
CommitNumOfFiles        &   7                   \\
CommitDate              &  2014-03-31           \\
\midrule
ID                      &   4                   \\
Project Name            &   1                   \\
Project URL             &   kotlin              \\
Branch Name             &   C:\textbackslash Users\textbackslash NAME32\textbackslash
                            Downloads\textbackslash SomeDirectory\textbackslash
                            kotlin              \\
Committer ID            &   Evgeny Gerashchenko \\
Committer Name          &   76                  \\
CommitterNumOfCommits   &   3                   \\
CommitID                &   93dfc00880377c4a76e15e15c6a1fd89da86eeb3
                                                \\
CommitKey               &   Minor. Renamed enum constants
                            for clarification.\textbackslash n
                                                \\
CommitMessage           &   1                   \\
CommitNumOfFiles        &   4                   \\
CommitDate              &  2014-03-31           \\
\midrule
ID                      &   5                   \\
Project Name            &   1                   \\
Project URL             &   kotlin              \\
Branch Name             &   C:\textbackslash Users\textbackslash NAME32\textbackslash
                            Downloads\textbackslash SomeDirectory\textbackslash
                            kotlin              \\
Committer ID            &   Natalia Ukhorskaya  \\
Committer Name          &   55                  \\
CommitterNumOfCommits   &   3                   \\
CommitID                &   4a79bfa16dc4224260e1acec5b498fe2f13a93d7
                                                \\
CommitKey               &   Minor. Renamed enum constants
                            for clarification.\textbackslash n
                                                \\
CommitMessage           &   1                   \\
CommitNumOfFiles        &   7                   \\
CommitDate              &  2014-03-31           \\
\bottomrule
\end{tabularx}
\end{document}

Note:

  • table is not complete
  • tit exist high probability that in my table transposition occur (many) errors
  • my intention was only to show one possible solution
| improve this answer | |

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.