TransWikia.com

How to skip lines for tables

TeX - LaTeX Asked by SeveronS on June 7, 2021

in my code I want the "if starts with a vowel" to be on one line, and the else in the line under. how do I do that without the Else being on the top line and the rest being on the other lines? ( this is only happening for the feminine)

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}

2 Answers

Here are three possibilities to get the expected output, based on a narrower, left aligned m type column, the makecell or the multirow package, as well as a fourth, slightly different layout using 3 columns instead of just two:

The first three examples result in

enter image description here

while the last example's output is the following:

enter image description here

documentclass{article}
usepackage{array}

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

begin{center}
    begin{tabular}{c|>{raggedrightarraybackslash}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}

Correct answer by leandriis on June 7, 2021

In a paragraph-type column, you can use 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 -ntnl
         Else: Suffix -aent 
         hline
         Feminine & If ends with vowel: Suffix -nnl
         Else: Suffix -en 
         hline
         Neuter & If starts with vowel: Prefix s- nl
         Else: Prefix sa-
    end{tabular}
end{center}

end{document} 

enter image description here

Answered by Bernard on June 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP