如何阻止多行文本与下一行重叠?

如何阻止多行文本与下一行重叠?

我想要创建一个像下面这样的表格。 在此处输入图片描述

但是第三行的第二列溢出了下一列。我该如何修复它?这是代码。

\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}

答案1

水平多行单元格的行数应该相等。因此,您需要查看最高单元格的行数,并相应地调整所有相邻单元格。

\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}

在此处输入图片描述

答案2

单元格中的行数multirow大于跨越行中的行数。您有两种可能性:

  • 增加跨单元格的行高
  • 增加支出单元的行数

对于第一种情况,尝试

\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}

在此处输入图片描述

对于第二种情况,解决方案可以是:

\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}

在此处输入图片描述

相关内容