1

I want to create a table like the following one. enter image description here

But the second column of third row is overflowing the next one. How can I fix it? Here is the code.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{array}
\usepackage{multirow}


\title{Table}
\date{June 2018}
\begin{document}
\maketitle


\begin{table}[h]
\small
\begin{tabularx}{\linewidth}{|X|p{5cm}|X|}
\hline
One-step DA Approaches & Brief Description & Categories \\ 
\hline

\multirow{5}{\linewidth}{Discrepancy based}    & \multirow{5}{\linewidth}{ Fine tunes the deep network with labeled or unlabeled target data to reduce domain shift}           &  class criterion \cite{zhang2015deep}         \\ \cline{3-3} 
                                      &                    & Statistic criterion \cite{sun2016deep}           \\ \cline{3-3} 
                                      &                    &  architecture criterion \cite{rebuffi2017learning}   \\ \cline{3-3} 
                                      &                    & Geometric criterion \cite{chopra2013dlid}       \\

\hline



\multirow{5}{\linewidth}{Discrepancy based}    & \multirow{5}{\linewidth}{ F or unlabeled target data target data target data target data target data to reduce domain shift \newline \newline \hfill}           &  class criterion \cite{zhang2015deep}         \\ \cline{3-3} 
                                      &                    & Statistic criterion \cite{sun2016deep}            \\

\hline

\multirow{5}{\linewidth}{Discrepancy based}    & \multirow{5}{\linewidth}{ F or unlabeled target data target data target data target data target data to reduce domain shift \newline \newline \hfill}           &  class criterion \cite{zhang2015deep}         \\ \cline{3-3} 
                                      &                    & Statistic criterion \cite{sun2016deep}            \\

\hline



\end{tabularx}
\end{table}


\end{document}
2
  • Give it more space in multirow. – Johannes_B Jun 5 '18 at 6:30
  • You can use the shortest syntax \multirow{5}{=}{ ... }. – Bernard Jun 5 '18 at 9:17
2

The number of rows in horizontal multi-row cells should be equal. So, you need to look at the number of rows in the tallest cell and adjust all adjacent cells accordingly.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{array}
\usepackage{multirow}

\begin{document}

\begin{table}[!htb]
\small
\begin{tabularx}{\linewidth}{|X|p{5cm}|X|}
\hline
One-step DA Approaches & Brief Description & Categories \\ 
\hline
\multirow{6}{\linewidth}{Discrepancy based} & \multirow{6}{\linewidth}{Fine tunes the deep network with labeled or unlabeled target data to reduce domain shift}           &  class criterion \cite{zhang2015deep}         \\ \cline{3-3} 
                                      &                    & Statistic criterion \cite{sun2016deep}           \\ \cline{3-3} 
                                      &                    &  architecture criterion \cite{rebuffi2017learning}   \\ \cline{3-3} 
                                      &                    & Geometric criterion \cite{chopra2013dlid}       \\
\hline
\multirow{4}{\linewidth}{Discrepancy based}    & \multirow{4}{\linewidth}{F or unlabeled target data target data target data target data target data to reduce domain shift}           & \multirow{2}{*}{class criterion \cite{zhang2015deep}} \\
&&\\ \cline{3-3} 
                                      &                    & \multirow{2}{*}{Statistic criterion \cite{sun2016deep}} \\
&&\\
\hline
\multirow{4}{\linewidth}{Discrepancy based}    & \multirow{4}{\linewidth}{F or unlabeled target data target data target data target data target data to reduce domain shift}           & \multirow{2}{*}{class criterion \cite{zhang2015deep}} \\
&&\\ \cline{3-3} 
                                      &                    & \multirow{2}{*}{Statistic criterion \cite{sun2016deep}} \\
&&\\
\hline
\end{tabularx}
\end{table}


\end{document}

enter image description here

2

number of lines in multirow cells is bigger then their numbers in spanned rows. you have two possibilities:

  • increase height of rows in spanned cells
  • increase number of lines in spend cells

for the first case try

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{makecell}      % added
\setcellgapes{5pt}         % for increase vertical spaces in cells
\usepackage{multirow}
\usepackage{tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcommand\avs{\rule[-2ex]{0ex}{5ex}}

\title{Table}
\date{June 2018}

\begin{document}
\maketitle
    \begin{table}[h]
\makegapedcells            % activate cell gapes
\small
\begin{tabularx}{\linewidth}{|>{\hsize=0.18\hsize}L
                             |>{\hsize=0.48\hsize}L
                             |>{\hsize=0.34\hsize}L|}
    \hline
\makecell{One-step DA\\ Approaches}
    & Brief Description 
        & Categories                                            \\
    \hline
\multirow{6}{=}{Discrepancy based}
    & \multirow{6}{=}{ Fine tunes the deep network with labeled or unlabeled target data to reduce domain shift}
        & Class criterion \cite{zhang2015deep}                  \\  \cline{3-3}
    &   & Statistic criterion \cite{sun2016deep}                \\  \cline{3-3}
    &   & Architecture criterion \cite{rebuffi2017learning}     \\ \cline{3-3}
    &   & Geometric criterion \cite{chopra2013dlid}             \\
    \hline
\multirow{2}{=}{Discrepancy based}
    & \multirow{2}{=}{F or unlabeled target data target data target data target data target data to reduce domain shift}
        & Class criterion \cite{zhang2015deep}                  \\ \cline{3-3}
    &   & Statistic criterion \cite{sun2016deep}                \\
    \hline
\multirow{2}{=}{Discrepancy based}
    & \multirow{2}{=}{F or unlabeled target data target data target data target data target data to reduce domain shift}
        & Class criterion \cite{zhang2015deep}                  \\ \cline{3-3}
    &   & Statistic criterion \cite{sun2016deep}                \\
    \hline
\end{tabularx}
    \end{table}
\end{document}

enter image description here

for the second case the solution can be:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{multirow}
\usepackage{tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}

\title{Table}
\date{June 2018}

\begin{document}
\maketitle
    \begin{table}[h]
\small
\begin{tabularx}{\linewidth}{|>{\hsize=0.2\hsize}L
                             |>{\hsize=0.6\hsize}L
                             |>{\hsize=0.2\hsize}L|}
    \hline
One-step DA Approaches
    & \multirow{2}{=}{Brief Description}
        & \multirow{2}{=}{Categories}                           \\
    \hline
\multirow{8}{=}{Discrepancy based}
    & \multirow{8}{=}{ Fine tunes the deep network with labeled or unlabeled target data to reduce domain shift}
        & Class criterion \cite{zhang2015deep}                  \\  \cline{3-3}
    &   & Statistic criterion \cite{sun2016deep}                \\  \cline{3-3}
    &   & Architecture criterion \cite{rebuffi2017learning}     \\ \cline{3-3}
    &   & Geometric criterion \cite{chopra2013dlid}             \\
    \hline
\multirow{4}{=}{Discrepancy based}
    & \multirow{4}{=}{F or unlabeled target data target data target data target data target data to reduce domain shift}
        & Class criterion \cite{zhang2015deep}                  \\ \cline{3-3}
    &   & Statistic criterion \cite{sun2016deep}                \\
    \hline
\multirow{4}{=}{Discrepancy based}
    & \multirow{4}{=}{F or unlabeled target data target data target data target data target data to reduce domain shift}
        & Class criterion \cite{zhang2015deep}                  \\ \cline{3-3}
    &   & Statistic criterion \cite{sun2016deep}                \\
    \hline
\end{tabularx}
    \end{table}

enter image description here

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.