您的位置:首页 > 其它

如何让latex表格中一个单元格的文字换行(转)

2010-09-07 17:32 826 查看
问题:如何同时让表格同一行一个单元格的文字能垂直居中?比如说文字超长超出页面范围需要分行显示
答:(来源于smth)
方案一:
/newcommand{/tabincell}[2]{/begin{tabular}{@{}#1@{}}#2/end{tabular}}

%然后使用&/tabincell{c}{}&就可以在表格中自动换行

%比如这么用

/begin{tabular}{|c|c|}

/hline

1 & the first line //

/hline

2 & /tabincell{c}{haha// heihei//zeze} //

/hline

/end{tabular}
注:好用,已试过,以下为一例子,可直接存为.tex文件编译运行
/documentclass[a4paper,12pt]{article}

/usepackage{CJK}

/begin{document}

/begin{CJK*}{GBK}{song}
/newcommand{/tabincell}[2]{/begin{tabular}{@{}#1@{}}#2/end{tabular}}

%然后使用&/tabincell{c}{}&就可以在表格中自动换行
%比如这么用

/begin{tabular}{|c|c|}

/hline

1 & the first line //

/hline

2 & /tabincell{c}{haha// heihei//zeze //fgf
//asgr
} //

/hline

/end{tabular}

/end{CJK*}

/end{document}
方案二:
/usepackage{longtable}

转自:http://raulbatigoal.blog.hexun.com/5505084_d.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: