失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > 【写博客常用】latex表格详细教程(table tabular multirow multicolumn)latex表格内如何自动换行

【写博客常用】latex表格详细教程(table tabular multirow multicolumn)latex表格内如何自动换行

时间:2018-08-12 18:55:43

相关推荐

【写博客常用】latex表格详细教程(table  tabular  multirow  multicolumn)latex表格内如何自动换行

【写博客常用】latex表格详细教程(table, tabular, multirow, multicolumn)&latex表格内如何自动换行

看本文先看,本文是基于此篇做表格方法上加了换行的改进,原文有教表格怎么做,两篇都看了你就能做成下面👇这样

我们用了上文链接制作出了表格之后,我们发现无法换行,文字可能会超出表格,这里笔者研究了很多方式最后发现:

首先加上这个包

\usepackage{multirow}\usepackage{makecell}\usepackage{hyperref}

接着在要换行的地方

\makecell[c]{内容\\内容}

\\代表要换行部分,最后全部代码如下,表格如下,可自己进行对照调试:

\usepackage{multirow}\usepackage{makecell}\usepackage{hyperref}%%%%%%%%%%%%%%%%%%%%%中间无关代码部分%%%%%%%%%%%%%%%%%%%%%\setlength{\tabcolsep}{1.5mm}{\begin{tabular}{|c|c|c|c|c|}\hline\multicolumn{2}{|c|}{\textbf{Product}} & \textbf{microwave} & \textbf{baby pacifier} & \textbf{Hair dryer} \\\hline\multicolumn{2}{|c|}{\textbf{Number\_of\_data}}&18939 & 1615& 11470\\\hline\multicolumn{2}{|c|}{\textbf{Number\_of\_brands}}&5464 &57 &499 \\\hline\multirow{10}{*}{Features}&Customer\_id&\multicolumn{3}{|c|}{\makecell[c]{Random identifier that can be used \\to aggregate reviews written by a single author}}\\\cline{2-5}\multirow{10}{*}{}&Review\_id&\multicolumn{3}{|c|}{The unique ID of the review}\\\cline{2-5}\multirow{10}{*}{}&Product\_id&\multicolumn{3}{|c|}{The unique Product ID the review pertains to}\\\cline{2-5}\multirow{10}{*}{}&Star\_rating&\multicolumn{3}{|c|}{The 1-5 star rating of the review}\\\cline{2-5}\multirow{10}{*}{}&Helpful\_votes&\multicolumn{3}{|c|}{Number of helpful votes}\\\cline{2-5}\multirow{10}{*}{}&Total\_votes&\multicolumn{3}{|c|}{Number of total votes the review received}\\\cline{2-5}\multirow{10}{*}{}&Vine&\multicolumn{3}{|c|}{\makecell[c]{Customers are invited to become Amazon\\ Vine Voices based on the trust that they\\ have earned in the Amazon community\\ for writing accurate and insightful reviews.\\ Amazon provides Amazon Vine members \\with free copies of products that have been\\ submitted to the program by vendors. Amazon\\ doesn’t influence the opinions of Amazon Vine\\ members, nor do they modify or edit reviews}}\\\cline{2-5}\multirow{10}{*}{}&{{Verified\_purchase}}&\multicolumn{3}{|c|}{\makecell[c]{A “Y” indicates Amazon verified that the person\\ writing the review purchased the product at \\Amazon and didn’t receive the product at a\\ deep discount}}\\\cline{2-5}\multirow{10}{*}{}&Review\_date&\multicolumn{3}{|c|}{The date the review was written}\\\cline{2-5}\multirow{10}{*}{}&Review\_title&\multicolumn{3}{|c|}{The title of the review}\\\cline{2-5}\multirow{10}{*}{}&Review\_body&\multicolumn{3}{|c|}{The review text}\\\hline\end{tabular}}

效果图如下:

如果觉得《【写博客常用】latex表格详细教程(table tabular multirow multicolumn)latex表格内如何自动换行》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。