How to code tables with multi-line cells

前端 未结 4 1654
萌比男神i
萌比男神i 2021-01-30 10:25

I am trying to write a short paper with LaTeX and need to add a table with 3 columns.

+-------------+-----------------+--------------------------------------+
|          


        
4条回答
  •  说谎
    说谎 (楼主)
    2021-01-30 10:55

    As @aioobe wrote in his answer, in this case one can switch from the left alignment

    \begin{tabular}{lll}
    

    to the paragraph alignment, at least in the third column where the custom linebreak must be inserted manually:

    \begin{tabular}{llp{.5\textwidth}}
    

    After this edit, one can use the command \par (instead of \newline) to implement the linebreak within the cell.

    This code:

    \documentclass{article}
    
    \begin{document}
    
    \begin{tabular}{llp{.5\textwidth}}
    AAAAAAAAAA & BBBBBBBBBBBBBBB & Betty Botter Bought a Bit of Butter \par but the Butter's Bitter\\
    CCCCCCCC & DDDD & Betty Botter Thought: \par If I Put This Bitter Butter in My \par Batter it Will Make My Batter Bitter\\
    \end{tabular}
    
    \end{document}
    

    produces the output requested:

提交回复
热议问题