2

I have been trying to create a (simple) table via tablesgenerator with unsatisfying output so far. I would like to create the following table (Table 4. Summary of Selected....) but it wont fit into my page. Either it is too big or it becomes too small when I use \resizebox function or adjustbox. table wanted I have looked a lot in this forum and tried many options without success so far. enter image description here The following code plots the table above (Table 3.1). I hope somebody can help me out! Thanks a lot!

\documentclass{article}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{tabularx}
\begin{document}


       \begin{table}[]
    \centering
    \caption{My caption}
    \label{my-label}
    \resizebox{\textwidth}{!}{%
    \begin{tabular}{@{}lllllll@{}}
    \toprule
    \textbf{Model}          & \textbf{Breach morphology}                    & \textbf{Flow}                               & \textbf{Sediment transport capacity}         & \textbf{Geomechanics}                                  & \textbf{Solution method}                         & \textbf{Remarks}                          \\ \midrule
                            & 1D Exner equation                             & 1D St.Venant equations                      & Multiple formulas                            & Longitudinal slope stability                           & Fine difference,uncoupled                        & Overtopping, no lateral erosion           \\
    DEICH\_N1 and DEICH\_N2 & Evolution from 1D/2D Exner quation            & Shallo water equations                      & Nine different formulas availabe             &                                                        & 1D/2D numerical model, uncoupled                 &                                           \\
                            & 2D Exner equation                             & 2D shallow water equations                  & Erosion formula from WEPP, USDA              &                                                        & 2D numerical model, uncoupled                    & Validated with Norweigian field tests     \\
                            & Clear-water scour                             & 2D shallow water equations                  & Chen and Anderson's formula for erosion rate & 3D slope stability                                     & 2D TVD finite differnce, uncoupled               & Noncohesive dam, overtopping              \\
                            & 2D Exner equation                             & 2D shallow water equations                  & Formulas for bed-load and suspended load     & Lateral erosion, vertical erosion, and slope stability & 2D finite volume ( Roe and HLL), uncoupled       & Noncohesive levee, overtopping            \\
                            & 2D nonequilibrium sediment transport equation & 2D shallow water equations                  & Formula for bed-load                         & Lateral erosion,vertical erosion, and slope stability  & 2D finite volume (Roe's Riemann solver), coupled & Noncohesive overtopping                   \\
                            & 2D nonequilibrium sediment transport equation & 2D shallow water equations with wave-action & Soulsby formula                              & Bed avalanching                                        & 2D finite difference, uncoupled                  & Noncohesive dune and barrier, overtopping \\
                            & 1D/2D Nonequilibrium total-load tranport      & Generelized shallow water equations         & Wu etal. total-load capacity formula         & Lateral erosion and slope stability ( repose angle)    & 1D/2D finite volume (HLL) scheme, coupled        & Noncohesive dam and levee, overtopping    \\
                            & 2D nonequilirbium sediment transport          & Generalized shallow water equations         & Modified Meyer-Peter and Müller bed-load     & Slope stability (repose angle)                         & Finite volume (HLLC) scheme, coupled             & Landslide dam, overtopping                \\ \bottomrule
    \end{tabular}%
    }
    \end{table}

\end{document}
  • Welcome to TeX.SE! (i) we can't help you if don't know anything about your document. Please extend code snippet to complete small document with this table only beginning with \documentclass{...} and ending with \end{document} and only necessary packages in preamble. (ii) if table is to large to fit in text width, you have only few options: split table, consider to rotating it, locally extend text width (if this is sufficient for table size) ... – Zarko May 19 '17 at 21:11
  • Thank you for that info i extended my code i hope its fine now.. – Christian Robledo May 19 '17 at 21:20
  • it's hard to help really. If you put that much data on a page it's either going to be too small to read or you need a larger page. You have the subject knowledge about the table content, can't you split it into two tables, on two pages. (or even more than two) – David Carlisle May 19 '17 at 21:28
  • hmm it just wonders me that this table appears like this in a pdf so basically it should be possible to obtain the same table in my document as well.. I have also tried rotating or landscape mode... but the table was always not like it is supposed to be... Im probably missing something really basic... – Christian Robledo May 19 '17 at 21:33
  • perhaps you are just looking for p{3cm} instead of l for your column specifications, so that you get line breaking in the cells? – David Carlisle May 19 '17 at 21:42
2

First of all, the data of your table appears huge and putting this into one table might sacrifice readability of your work. It would be a great thing to do if you can shrink the content of the table a bit or redesign the table. Other than that, I've made a bunch of improvements:

  1. I used the sidewaystable environment from the rotating package; this will make more room for the table columns.
  2. I removed the \resizebox{\textwidth}{!} and used tabularx instead.
  3. To avoid too much weird hyphens with full justification, I used \raggedright.
  4. To gain more space, I changed the default tabcolsep from 4pt to 2pt.
  5. Using \sffamily gives also some more space.
  6. Finally, using \small will save some extra space without sacrificing readability.

The above, as I said before, should be your last resort after both shrinking of content and table redesign fail.

\documentclass{article}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{tabularx,rotating}
\usepackage[margin=1in]{geometry}
\usepackage{ragged2e}
\begin{document}

    \setlength{\tabcolsep}{2pt}
    \begin{sidewaystable}
    \small\sffamily\centering
    \caption{My caption}
    \label{my-label}
    \begin{tabularx}{\textwidth}{@{}*7{>{\raggedright\arraybackslash}X}@{}}
    \toprule
    \textbf{Model}          & \textbf{Breach morphology}                    & \textbf{Flow}                               & \textbf{Sediment transport capacity}         & \textbf{Geomechanics}                                  & \textbf{Solution method}                         & \textbf{Remarks}                          \\ \midrule
                            & 1D Exner equation                             & 1D St.Venant equations                      & Multiple formulas                            & Longitudinal slope stability                           & Fine difference,uncoupled                        & Overtopping, no lateral erosion           \\
    DEICH\_N1 and DEICH\_N2 & Evolution from 1D/2D Exner quation            & Shallo water equations                      & Nine different formulas availabe             &                                                        & 1D/2D numerical model, uncoupled                 &                                           \\
                            & 2D Exner equation                             & 2D shallow water equations                  & Erosion formula from WEPP, USDA              &                                                        & 2D numerical model, uncoupled                    & Validated with Norweigian field tests     \\
                            & Clear-water scour                             & 2D shallow water equations                  & Chen and Anderson's formula for erosion rate & 3D slope stability                                     & 2D TVD finite differnce, uncoupled               & Noncohesive dam, overtopping              \\
                            & 2D Exner equation                             & 2D shallow water equations                  & Formulas for bed-load and suspended load     & Lateral erosion, vertical erosion, and slope stability & 2D finite volume ( Roe and HLL), uncoupled       & Noncohesive levee, overtopping            \\
                            & 2D nonequilibrium sediment transport equation & 2D shallow water equations                  & Formula for bed-load                         & Lateral erosion,vertical erosion, and slope stability  & 2D finite volume (Roe's Riemann solver), coupled & Noncohesive overtopping                   \\
                            & 2D nonequilibrium sediment transport equation & 2D shallow water equations with wave-action & Soulsby formula                              & Bed avalanching                                        & 2D finite difference, uncoupled                  & Noncohesive dune and barrier, overtopping \\
                            & 1D/2D Nonequilibrium total-load tranport      & Generelized shallow water equations         & Wu etal. total-load capacity formula         & Lateral erosion and slope stability ( repose angle)    & 1D/2D finite volume (HLL) scheme, coupled        & Noncohesive dam and levee, overtopping    \\
                            & 2D nonequilirbium sediment transport          & Generalized shallow water equations         & Modified Meyer-Peter and Müller bed-load     & Slope stability (repose angle)                         & Finite volume (HLLC) scheme, coupled             & Landslide dam, overtopping                \\ \bottomrule
    \end{tabularx}%
    \end{sidewaystable}

\end{document}

enter image description here

  • Thanks a lot to everyone. The posts were really helpfull ! – Christian Robledo May 19 '17 at 22:18
2

Assuming that:

  • text width can be increased (by use \usepackage[margin=25mm]{geometry})
  • the cell contents can be broken into more lines
  • font size of table content is \footnotesize

then you obtain:

enter image description here

if this is not satisfactory, than you should consider above comments.

edit: i recognise that to the first version of answer i forgot add code example (mwe). it is:

\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{graphicx}
\usepackage{booktabs, tabularx}
\newcolumntype{R}{>{\raggedright\arraybackslash}X}

%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{table}
\caption{My caption}
    \label{my-label}
\footnotesize\sffamily
\setlength{\tabcolsep}{2pt}
\begin{tabularx}{\textwidth}{@{}*7{R}@{}}
    \toprule
\textbf{Model}
    & \textbf{Breach morphology}
        & \textbf{Flow}
            & \textbf{Sediment transport capacity}
                & \textbf{Geomechanics}
                    & \textbf{Solution method}
                        & \textbf{Remarks}                                          \\
    \midrule
    & 1D Exner equation                     & 1D St.Venant equations
    & Multiple formulas                     & Longitudinal slope stability
    & Fine difference,uncoupled             & Overtopping, no lateral erosion       \\
    \addlinespace
DEICH\_N1 and DEICH\_N2
    & Evolution from 1D/2D Exner quation    & Shallo water equations
    & Nine different formulas availabe      &                                                        & 1D/2D numerical model, uncoupled      &                                       \\
    \addlinespace
    & 2D Exner equation                     & 2D shallow water equations
    & Erosion formula from WEPP, USDA       &
    & 2D numerical model, uncoupled         & Validated with Norweigian field tests \\
    \addlinespace
    & Clear-water scour                     & 2D shallow water equations
    & Chen and Anderson's formula for erosion rate
                                            & 3D slope stability                                    
    & 2D TVD finite differnce, uncoupled    & Noncohesive dam, overtopping          \\
    \addlinespace
    & 2D Exner equation                     & 2D shallow water equations
    & Formulas for bed-load and suspended load
                                    & Lateral erosion, vertical erosion, and slope stability
    & 2D finite volume ( Roe and HLL), uncoupled
                                    & Noncohesive levee, overtopping                \\
    \addlinespace
    & 2D nonequilibrium sediment transport equation
                                    & 2D shallow water equations
    & Formula for bed-load          & Lateral erosion,vertical erosion, and slope stability
    & 2D finite volume (Roe's Riemann solver), coupled
                                    & Noncohesive overtopping                       \\
    \addlinespace
    & 2D nonequilibrium sediment transport equation
                                    & 2D shallow water equations with wave-action
    & Soulsby formula               & Bed avalanching
    & 2D finite difference, uncoupled       & Noncohesive dune and barrier, overtopping \\
    \addlinespace
    & 1D/2D Nonequilibrium total-load tranport
                                    & Generelized shallow water equations
    & Wu etal. total-load capacity formula
                                    & Lateral erosion and slope stability ( repose angle)
    & 1D/2D finite volume (HLL) scheme, coupled
                                    & Noncohesive dam and levee, overtopping    \\
    \addlinespace
    & 2D nonequilirbium sediment transport
                                    & Generalized shallow water equations
    & Modified Meyer-Peter and Müller bed-load
                                    & Slope stability (repose angle)
    & Finite volume (HLLC) scheme, coupled
                                    & Landslide dam, overtopping                \\
    \bottomrule
\end{tabularx}
    \end{table}

\end{document}
1

If you can't widen the text block substantially and if you don't want to (or aren't allowed to) switch to a much smaller font size, you will have to switch to a longtable environment, as the material simply won't fit on a single page.

enter image description here


enter image description here

\documentclass{article}
\usepackage{booktabs,longtable,array,ragged2e}
\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash\hspace{0pt}}p{#1}}

\newlength\firstcolwidth
\settowidth\firstcolwidth{DEICH\_N1}
\setlength\tabcolsep{4pt} % default: 6pt
\newlength\othercolwidth
\setlength\othercolwidth{\dimexpr\textwidth-\firstcolwidth-12\tabcolsep\relax}
\setlength\othercolwidth{\dimexpr\othercolwidth/6\relax}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}

\begin{longtable}{@{} p{\firstcolwidth} 
    *{6}{P{\othercolwidth}} @{}}
    \caption{My caption} \label{tab:my-label}\\
    \toprule
Model & Breach morphology & Flow & Sediment transport capacity & Geomechanics & Solution method & Remarks \\ 
\midrule
\endfirsthead
\multicolumn{7}{@{}l@{}}{Table \ref{tab:my-label}, continued}\\ \addlinespace
\toprule
Model & Breach morphology & Flow & Sediment transport capacity & Geo\-mechanics & Solution method & Remarks \\ 
\midrule
\endhead

\midrule
\multicolumn{7}{@{}r@{}}{continued on following page}\\
\endfoot
\bottomrule
\endlastfoot

                            & 1D Exner equation                             & 1D St. Venant equations                      & Multiple formulas                            & Longitudinal slope stability                           & Fine difference, uncoupled                        & Overtopping, no lateral erosion           \\ \addlinespace
DEICH\_N1 and DEICH\_N2     & Evolution from 1D/2D Exner equation            & Shallow water equations                      & Nine different formulas available             &                                                        & 1D/2D numerical model, uncoupled                 &                                           \\ \addlinespace
                            & 2D Exner equation                             & 2D shallow water equations                  & Erosion formula from WEPP, USDA              &                                                        & 2D numerical model, uncoupled                    & Validated with Norwegian field tests     \\ \addlinespace
                            & Clear-water scour                             & 2D shallow water equations                  & Chen and Anderson's formula for erosion rate & 3D slope stability                                     & 2D TVD finite differnce, uncoupled               & Noncohesive dam, overtopping              \\ \addlinespace
                            & 2D Exner equation                             & 2D shallow water equations                  & Formulas for bed-load and suspended load     & Lateral erosion,  vertical erosion, and slope stability & 2D finite volume (Roe and HLL), uncoupled       & Noncohesive levee, overtopping            \\ \addlinespace
                            & 2D nonequilibrium sediment transport equation & 2D shallow water equations                  & Formula for bed-load                         & Lateral erosion, vertical erosion, and slope stability  & 2D finite volume (Roe's Riemann solver), coupled & Noncohesive overtopping                   \\ %\addlinespace
                            & 2D nonequilibrium sediment transport equation & 2D shallow water equations with wave-action & Soulsby formula                              & Bed avalanching                                        & 2D finite difference, uncoupled                  & Noncohesive dune and barrier, overtopping \\ \addlinespace
                            & 1D/2D Nonequilibrium total-load tranport      & Generalized shallow water equations         & Wu et~al.\ total-load capacity formula         & Lateral erosion and slope stability (repose angle)    & 1D/2D finite volume (HLL) scheme, coupled        & Noncohesive dam and levee, overtopping    \\ \addlinespace
                            & 2D non\-equilib\-rium sediment transport          & Generalized shallow water equations         & Modified Meyer-Peter and Müller bed-load     & Slope stability (repose angle)                         & Finite volume (HLLC) scheme, coupled             & Landslide dam, overtopping                \\ 
\end{longtable}

\end{document}

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.