如何跳过表格行

如何跳过表格行

在我的代码中,我希望“if 以元音开头”在一行,else 在下面一行。我该怎么做才能不让 Else 在上面一行,而让其余部分在其他行?(这只发生在女性身上)

\begin{center}
    \begin{tabular}{c|m{5cm}}
         G.Gender & Present \\
         \hline
         Masculine & If ends with vowel: Suffix -nt 
         Else: Suffix -aent \\
         \hline
         Feminine & If ends  with  vowel: Suffix -n  
         Else: Suffix -en \\
         \hline
         Neuter & If starts with vowel: Prefix s-
         Else: Prefix sa-\\
    \end{tabular}
\end{center}

答案1

这里有三种获得预期输出的可能性,基于更窄的、左对齐的m类型列、makecellmultirow包装,以及第四种略有不同的布局,使用 3 列而不是 2 列:

前三个示例的结果是

在此处输入图片描述

最后一个例子的输出如下:

在此处输入图片描述

\documentclass{article}
\usepackage{array}

\usepackage{makecell}
\usepackage{multirow}
\begin{document}

\begin{center}
    \begin{tabular}{c|>{\raggedright\arraybackslash}m{4.75cm}}
         G.Gender & Present \\
         \hline
         Masculine & If ends with vowel: Suffix -nt 
         Else: Suffix -aent \\
         \hline
         Feminine & If ends  with  vowel: Suffix -n  
         Else: Suffix -en \\
         \hline
         Neuter & If starts with vowel: Prefix s-
         Else: Prefix sa-\\
    \end{tabular}
\end{center}


\begin{center}
    \begin{tabular}{c|l}
         G.Gender & Present \\
         \hline
         \multirow{2}{*}{Masculine} & If ends with vowel: Suffix -nt \\ 
                                    & Else: Suffix -aent \\
         \hline
         \multirow{2}{*}{Feminine} & If ends  with  vowel: Suffix -n \\ 
                                   & Else: Suffix -en \\
         \hline
         \multirow{2}{*}{Neuter} & If starts with vowel: Prefix s- \\
                                 &  Else: Prefix sa-\\
    \end{tabular}
\end{center}

\begin{center}
    \begin{tabular}{c|l}
         G.Gender & Present \\
         \hline
         Masculine & \makecell[cl]{If ends with vowel: Suffix -nt \\ Else: Suffix -aent} \\
         \hline
         Feminine & \makecell[cl]{If ends  with  vowel: Suffix -n \\ Else: Suffix -en} \\
         \hline
         Neuter & \makecell[cl]{If starts with vowel: Prefix s- \\ Else: Prefix sa-} \\
    \end{tabular}
\end{center}


\begin{center}
    \begin{tabular}{c|l@{~}l}
         G.Gender & Present \\
         \hline
         \multirow{2}{*}{Masculine} & If ends with vowel: & Suffix -nt \\ 
                                    & Else:               & Suffix -aent \\
         \hline
         \multirow{2}{*}{Feminine} & If ends  with  vowel: & Suffix -n \\ 
                                   & Else:                 & Suffix -en \\
         \hline
         \multirow{2}{*}{Neuter} & If starts with vowel: & Prefix s- \\
                                 &  Else:                & Prefix sa-\\
    \end{tabular}
\end{center}

\end{document}

答案2

在段落类型的列中,您可以使用\break

\documentclass{article}
\usepackage{array}
\newcommand{\nl}{\break}

\begin{document}

\begin{center}
    \begin{tabular}{c|m{5cm}}
         G.Gender & Present \\
         \hline
         Masculine & If ends with vowel: Suffix -nt\nl
         Else: Suffix -aent \\
         \hline
         Feminine & If ends with vowel: Suffix -n\nl
         Else: Suffix -en \\
         \hline
         Neuter & If starts with vowel: Prefix s- \nl
         Else: Prefix sa-
    \end{tabular}
\end{center}

\end{document} 

在此处输入图片描述

相关内容