0

I have the following table that I want to reproduce:

enter image description here

So far, my best attempt is the following:

enter image description here

The table goes beyond page margins, and I have been trying to adjust the width and height of the cells manually to make it fit.

Is there a way that the cells will auto-adjust on the multirows, like in the rest of the cells?

My MWE is the following:

  \documentclass[a4paper,12pt,twoside,openany]{book}
  \usepackage{xltabular}
  \usepackage{float}
  \usepackage{tabu}

 \begin{document}
 \begin{longtable}{@{}| l | c | *{5}{c|} @{}}
 \hline
 \textbf{Set} & \textbf{Condition} & \textbf{Load [N]} & \textbf{Max. Speed 
 [mm/s]} & \textbf{Trapezoidal Motion Profil}\\ \hline
 \endfirsthead
 \multicolumn{5}{c}{\textbf{\tablename\ \thetable, continued from previous page}} 
 \\ \hline
 \textbf{Set} & \textbf{Condition} & \textbf{Load [N]} & \textbf{Max. Speed 
 [mm/s]} & \textbf{Trapezoidal Motion Profil}\\ \hline
 \endhead
 \multicolumn{5}{r@{}}{Continued on next page} \\ 
 \endfoot
 \endlastfoot
 \hline
1 & \multirow{5}{*}{Fault-free} & -44 & 40 & \multirow{2}{*}{40 mm, 1 s (10 
+ 10 seconds hold)} \\ \cline{1-1} \cline{3-4}
2 &   & 0 & 40 &    \\ \cline{1-1} \cline{3-5}
3 & & 0 & 80 & \multirow{2}{*}{40 mm, 21 s (0.5 + 0.5 seconds motion, 10 + 10 seconds hold)} \\ \cline{1-1} \cline{3-4}
4 &  & 44 & 80 &  \\ \cline{1-1} \cline{3-5}
5 & & 0 & 40 & 80 mm, 24 s (2+2 seconds motion, 10 + 10 seconds hold)  \\ \hline
6 & \multirow{5}{2cm}{Partial jam in screw return channel} &  -44 & 40 & 
\multirow{2}{3cm}{40 mm, 22 s (1+1 seconds motion, 10 + 10 seconds hold)} \\ 
[60pt] \cline{1-1} \cline{3-4}
7 &  & 0 & 40 &  \\  \cline{1-1} \cline{3-5}
8 &  & 0 & 80 & \multirow{2}{4cm}{40 mm, 21 s (0.5 + 0.5 seconds motion, 10+10 
seconds hold)}  \\[60pt] \cline{1-1} \cline{3-4}
9 &  & 44 & 80 &  \\ \cline{1-1} \cline{3-5}
10 &  & 0 & 40 & 80 mm, 24 s (2 + 2 seconds motion, 10 + 10 seconds hold) \\ 
\hline
\end{longtable}

\end{document}

Could someone help me please?

2 Answers 2

1

small variation of nice Bernard answer. slightly differences are:

  • use of the siunitx package for values with units
  • different type of the second column
  • different formatting of cells contents in the last column
  • use of \caption for table captions

    \documentclass[a4paper,12pt,twoside,openany]{book}
     \usepackage[showframe]{geometry}
    \usepackage{makecell, multirow, ltablex}
    \renewcommand{\theadfont}{\small\bfseries}
    \usepackage{siunitx}
    \renewcommand\tabularxcolumn[1]{m{#1}}
    
     \begin{document}
    
    \begingroup
    \renewcommand\arraystretch{1.1}
    \begin{tabularx}{\linewidth}{@{}
                                |c|
                  >{\raggedright}m{25mm}
                                |S[table-format=-2.0]|
                                 S[table-format= 2.0]|
                                 X|
                                @{}}
    \caption{my table}
    \label{tab:longtable}                                   \\
        \Xhline{1pt}
    \thead{Set}
        &   \thead{Condition}
            &   {\thead{Load\\ {[N]}}}
                &   {\thead{Max.\\ Speed\\ {[mm/s]}}}
                    &   \thead{Trapezoidal Motion Profil}   \\
        \Xhline{0.5pt}
    \endfirsthead
    \caption{my table (cont.)}                     \\
        \Xhline{0.6pt}
    \thead{Set}
        &   \thead{Condition}
            &   {\thead{Load\\ {[N]}}}
                &   {\thead{Max.\\ Speed\\ {[mm/s]}}}
                    &   \thead{Trapezoidal Motion Profil}   \\
        \Xhline{0.3pt}
    \endhead
    \multicolumn{5}{r@{}}{\textit{Continued on next page}}  \\
    \endfoot
        \Xhline{0.6pt}
    \endlastfoot
    1 & \multirow{6}{=}{Fault-free}
            & -44   & 40 & \multirow{2.2}{=}{\SI{40}{mm}, \SI{21}{s}\newline
                           (\SI{0.5}{s} + \SI{0.5}{s} motion,
                            \SI{10}{s} + \SI{10}{s} hold)}  \\
        \cline{1-1}\cline{3-4}
    2 &     &   0   & 40 &                                  \\
        \cline{1-1}\cline{3-5}
    3 &     &   0   & 80 & \multirow{2.2}{=}{\SI{40}{mm}, \SI{21}{s}\newline
                           (\SI{0.5}{s} + \SI{0.5}{s} motion,
                            \SI{10}{s} + \SI{10}{s} hold)}  \\
        \cline{1-1}\cline{3-4}
    4   &   &  44   & 80 &                                  \\
        \cline{1-1}\cline{3-5}
    5   &   &   0   & 40 & \SI{80}{mm}, \SI{24}{s}\newline
                           (\SI{2}{s} + \SI{2}{s} motion,
                           \SI{10}{s} + \SI{10}{s} hold)   \\
        \hline
    6   & \multirow{6}{=}{Partial jam in screw return channel}
            & -44   & 40 & \multirow{2.2}{=}{\SI{40}{mm}, \SI{22}{s}\newline
                           (\SI{1}{s} + \SI{1}{s} motion,
                            \SI{10}{s} + \SI{10}{s} hold)}   \\
        \cline{1-1}\cline{3-4}
    7   &   &   0   & 40 &                                  \\
    \cline{1-1} \cline{3-5}
    8   &   &   0   & 80 & \multirow{2.2}{=}{\SI{40}{mm}, \SI{21}{s}\newline
                           (\SI{0.5}{s} + \SI{0.5}{s} motion,
                            \SI{10}{s} + \SI{10}{s} hold)}  \\
        \cline{1-1}\cline{3-4}
    9   &   &  44   & 80 &                                  \\
        \cline{1-1}\cline{3-5}
    10  &   &   0   & 40 & \SI{80}{mm}, \SI{24}{s}\newline
                           (\SI{2}{s} + \SI{2}{s} motion,
                           \SI{10}{s} + \SI{10}{s} hold)   \\
    \end{tabularx}
    \endgroup
    \end{document}
    

enter image description here

0
2

Here is a solution with \ltablex, makecell and siunitx:

 \documentclass[a4paper,12pt,twoside,openany]{book}
 \usepackage[showframe]{geometry}
\usepackage{ltablex}
\usepackage{multirow, makecell}
\renewcommand{\theadfont}{\normalsize\bfseries}
\usepackage{siunitx}
  \usepackage{float}
\renewcommand{\tabularxcolumn}[1]{>{\arraybackslash}m{#1}}

 \begin{document}

\noindent
\sisetup{detect-weight}
\setlength{\extrarowheight}{3pt}
\setlength{\tabcolsep}{4pt}
\begin{tabularx}{\linewidth}{@{}!{\vrule width 1pt}c!{\vrule width 1pt}c |S[table-format=-2.0]| S[table-format=2.0]|X!{\vrule width 1pt}@{}}
 \Xhline{1pt}
 \thead{Set} & \thead{Condition} & {\thead{Load [N]}} & {\thead{Max.\\ Speed\\ {[\si{mm/s}]}}} & \thead{Trapezoidal Motion Profil}\\ \Xhline{0.8pt}
 \endfirsthead
 \multicolumn{5}{c}{\textbf{\tablename \thetable} {continued from previous page}}
 \\ \Xhline{1pt}
 \thead{Set} & \thead{Condition} & {\thead{Load [N]}} & {\thead{Max. \\Speed\\
 {[\si{mm/s}]}}} & \thead{Trapezoidal Motion Profil}\\ \Xhline{0.8pt}
 \endhead
 \multicolumn{5}{r@{}}{Continued on next page} \\
 \Xhline{0.8pt}
 \endfoot
 \Xhline{1pt}
 \endlastfoot
1 & \multirow{6}{*}{Fault-free} & -44 & 40 & \multirow{2}{=}{40 mm, 1 s (10
+ 10 seconds hold)} \\
\cline{1-1} \cline{3-4}
2 & & 0 & 40 & \\
 \cline{1-1} \cline{3-5}
3 & & 0 & 80 & \multirow{2}{=}{40 mm, 21 s (0.5 + 0.5 seconds motion, 10 + 10 seconds hold)} \\ \cline{1-1} \cline{3-4}
4 & & 44 & 80 & \\ \cline{1-1} \cline{3-5}
5 & & 0 & 40 & 80 mm, 24 s (2+2 seconds motion, 10 + 10 seconds hold) \\ \hline
6 & \multirow{6}{2.5cm}{Partial jam in screw return channel} & -44 & 40 &
 \multirow{2}{=}{40 mm, 22 s (1+1 seconds motion, 10 + 10 seconds hold)} \\
 \cline{1-1} \cline{3-4}
7 & & 0 & 40 & \\
\cline{1-1} \cline{3-5}
8 & & 0 & 80 & \multirow{2}{=}{40 mm, 21 s (0.5 + 0.5 seconds motion, 10+10
seconds hold)} \\
\cline{1-1} \cline{3-4}
9 & & 44 & 80 & \\
\cline{1-1} \cline{3-5}
10 & & 0 & 40 & 80 mm, 24 s (2 + 2 seconds motion, 10 + 10 seconds hold)
\end{tabularx}

\end{document} 

enter image description here

You must log in to answer this question.

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