Latex 表格內文字過長自動換行


法一:

  1. \begin{tabular}{m{5cm}}  

法二:

  1. \begin{tabular}{p{0.9\columnwidth}}  
 法三:multirow  宏包
 
  \multirow{nrows}[bigstructs]{width}[fixup]{text}  

 

  1.  nrows      設定所占用的行數。
  2. bigstructs      此為可選項,主要是在你使用了 bigstruct 宏包時使用。
  3. width      設定該欄文本的寬度。如果想讓 LaTeX 自行決定文本的寬度,則用 * 即可。
  4. fixup      此為可選項,主要用來調整文本的垂直位置。
  5. text      所要排版的文本。可用 \\ 來強迫換行。

 

法四:

 

 
  1. /newcommand{/tabincell}[2]{/begin{tabular}{@{}#1@{}}#2/end{tabular}}  
然后使用&/tabincell{c}{}&就可以在表格中自動換行

 

比如這么用

 

  1. /begin{tabular}{|c|c|}  
  2. /hline  
  3.  1 & the first line //  
  4. /hline  
  5.  2 & /tabincell{c}{haha// heihei//zeze} //  
  6. /hline  
  7. /end{tabular}  
 
  1. /begin{tabular}{|c|c|}  
  2. /hline  
  3.  1 & the first line //  
  4. /hline  
  5.  2 & /tabincell{c}{haha// heihei//zeze} //  
  6. /hline  
  7. /end{tabular}  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM