Excel 转LaTex表格 与TeX表格的处理 总结

 

工具使用:一个Latex表格输入神器——Excel2Tex插件的安装过程。

首先下载插件http://www.ctan.org/tex-archive/support/excel2latex/

CTAN的下载界面如下:

然后打开excel程序,“文件”--“选项”--“加载项”--“转到”--“浏览”,找到刚才下载的插件文件选择安装即可


具体使用界面:

彩色表格

  1. \begin{table}
  2. \centering
  3. \caption{彩色的表格}
  4. \begin{tabular}
  5. {>{\columncolor{blue}}rccccc}
  6. \toprule[1pt]
  7. \rowcolor[gray]{0.9}    &1 &2   &3  &4  &5\\
  8. \midrule
  9. A   &\multicolumn{1}{>{\columncolor{green}[0pt][0pt]}c}{318.3}   &327.8  &152.0  &104.9  &135.8\\
  10. B   &&\multicolumn{1}{>{\columncolor{red}[0pt][0pt]}r}{335.5}    &137.7  &290.9  &198.6\\
  11. \bottomrule[1pt]
  12. \end{tabular}
  13. \end{table}
要记得引入包
  1. \usepackage{xcolor}%定义了一些颜色
  2. \usepackage{colortbl,booktabs}%第二个包定义了几个*rule
效果:


设置表格总长

  1. \begin{table}
  2. \caption{设置表格总长}
  3. \begin{tabular*}{12cm}{lll}
  4. \hline
  5. Start & End  & Character Block Name \\
  6. \hline
  7. 3400  & 4DB5 & CJK Unified Ideographs Extension A \\
  8. 4E00  & 9FFF & CJK Unified Ideographs \\
  9. \hline
  10. \end{tabular*}
  11. \end{table}

设置表格总长是12cm,前两行剩下的都是第三行的

效果图


 

表格内自动换行

  1. \begin{table}
  2. \Large
  3. \caption{自动换行}
  4. \begin{center}
  5. \begin{tabular}{|l|l|l|l| p{5cm}|}
  6. \hline
  7. Item & Name & Gender & Habit & Self-introduction \\ \hline
  8. 1 & Jimmy & Male & Badminton & Hi, everyone,my name is Jimmy. I come from Hamilton,
  9. and it's my great honour to give this example. My topic is about how to use p{width} command \\ \hline
  10. 2 & Jimmy & Male & Badminton & Hi, everyone,my name is Jimmy. I come from Hamilton,
  11. and it's my great honour to give this example. My topic is about how to use p{width} command \\
  12. \hline
  13. \end{tabular}
  14. \end{center}
  15. \end{table}
\begin{tabular}{|l|l|l|l| p{5cm}|}设置最后一列最大是5cm,超出部分要换行。
效果:


 

设置表格宽度

  1. \begin{table}
  2. \caption{表格宽度X}
  3. \begin{tabularx}{10cm}{llX}  % 10cm 減去前兩個欄位寬度後,剩下的通通給
  4. \hline                      % 第三欄位使用,文字超出的部份會自動折行
  5. Start & End  & Character Block Name  \\
  6. \hline
  7. 3400  & 4DB5 & CJK Unified Ideographs Extension A \\
  8. 4E00  & 9FFF & CJK Unified Ideographs \\
  9. \hline
  10. \end{tabularx}
  11. \end{table}

 

设置表格中间某列的宽度

  1. \begin{table}
  2. \caption{设置宽度}
  3. \begin{tabularx}{12cm}{lXl}
  4. \hline
  5. Start & End  & Character Block Name \\
  6. \hline
  7. 3400  & 4DB5 & CJK Unified Ideographs Extension A \\
  8. 4E00  & 9FFF & CJK Unified Ideographs \\
  9. \hline
  10. \end{tabularx}
  11. \end{table}

记得引入包

  1. \usepackage{tabularx}

改变任一列宽

  1. \begin{table}[h] %开始一个表格environment,表格的位置是h,here。
  2. \caption{改变表格任一列宽} %显示表格的标题
  3. \begin{tabular}{p{3.5cm}|p{2cm}|p{5cm}} %设置了每一列的宽度,强制转换。
  4. \hline
  5. \hline
  6. Format & Extension & Description \\ %用&来分隔单元格的内容 \\表示进入下一行
  7. \hline %画一个横线,下面的就都是一样了,这里一共有4行内容
  8. Bitmap & .bmp & Bitmap images are recommended because they offer the most control over the exact image and colors.\\
  9. \hline
  10. Graphics Interchange Format (GIF) & .gif & Compressed image format used for Web pages. Animated GIFs are supported.\\
  11. \hline
  12. Joint Photographic Experts Group (JPEG) & .jpeg, .jpg & Compressed image format used for Web pages.\\
  13. \hline
  14. Portable Network Graphics (PNG) & .png & Compressed image format used for Web pages.\\
  15. \hline
  16. \hline
  17. \end{tabular}
  18. \end{table}

效果:




tabu包用法

  1. \begin{table}
  2. \caption{tab包用法}
  3. \begin{center}
  4. \begin{tabu} to 0.8\textwidth{X[c]|X[3,b]|X[2,l]|X[c]|X[3,m]|X[1,c]}
  5. %0.8\textwidth   为设置表格宽度
  6. %X[c]      表示这一列居中,所占比例为1,相当于X[1,c]
  7. %X[3,c]   表示这一列居中,所占比例为3,这列的宽度是X[c]列的3倍
  8. \hline
  9. $i$  &$x_i$              &$n_i$      &$i$    &$x_i$               &$n_i$\\
  10. \hline
  11. 1    &0.5$\sim$0.64       &1           &8    &1.48$\sim$1.62      &53\\
  12. 2    &0.64$\sim$0.78      &2           &9    &1.62$\sim$1.76      &25\\
  13. 3    &0.78$\sim$0.92      &9           &10   &1.76$\sim$1.90      &19\\
  14. 4    &0.92$\sim$1.06      &26          &11   &1.90$\sim$2.04      &16\\
  15. 5    &1.06$\sim$1.20      &37          &12   &2.04$\sim$2.18      &3\\
  16. 6    &1.20$\sim$1.34      &53          &13   &2.18$\sim$2.38      &1\\
  17. 7    &1.34$\sim$1.48      &56          &     &                    & \\
  18. \hline
  19. \end{tabu}
  20. \end{center}
  21. \end{table}
 

不要忘记引入包

  1. \usepackage{tabu}

 

水平居中显示

  1. \newcommand{\tabincell}[2]{

    \begin{tabular}{@{}#1@{}}#2\end{tabular}

    }

  2. \begin{table}[!t]
  3. \centering
  4. \scriptsize
  5. \caption{NOTATIONS}
  6. \label{tab:notations}
  7. \begin{tabular}{ll}
  8. \\[-2mm]
  9. \hline
  10. \hline\\[-2mm]
  11. {\bf \small Symbol}&\qquad {\bf\small Meaning}\\
  12. \hline
  13. \vspace{1mm}\\[-3mm]
  14. $P\!M_i$      &   \tabincell{l}{The $i\,th$ physical machine or host server in the data \\center, i = 1, 2, ?-}\\
  15. \vspace{1mm}
  16. $C\!M$          &  \tabincell{l}{ Vector of maximum disk size; $CM[i]$ stores the maximum\\ disk size of $PM_i$}\\
  17. \vspace{1mm}
  18. $B\!M$          &  \tabincell{l}{Vector of remaining disk size; $BM[i]$ stores the remaining\\ disk size of $PM_i$}\\
  19. \vspace{1mm}
  20. $S\!P(P\!M_i)$  &   \tabincell{l}{Selection preference of $PM_i$  }\\
  21. \vspace{1mm}
  22. $N\!ode_m$    & \tabincell{l}{The m\,th node of the data center network. A node can be a  \\host server or a switch. m = 1, 2, ?-}\\
  23. \hline
  24. \hline
  25. \end{tabular}
  26. \end{table}



 
  1. \usepackage{multicol}
  2. \usepackage{multirow}

 
  1. \renewcommand{\arraystretch}{1.5} %¿ØÖƱí¸ñÐиߵÄËõ·Å±ÈÀý
  2. \begin{table}[tp]
  3. \centering
  4. \fontsize{6.5}{8}\selectfont
  5. \caption{Demographic Prediction performance comparison by three evaluation metrics.}
  6. \label{tab:performance_comparison}
  7. \begin{tabular}{|c|c|c|c|c|c|c|}
  8. \hline
  9. \multirow{2}{*}{Method}&
  10. \multicolumn{3}{c|}{C}&\multicolumn{3}{c|}{ D}\cr\cline{2-7}
  11. &Precision&Recall&F1-Measure&Precision&Recall&F1-Measure\cr
  12. \hline
  13. \hline
  14. A&0.7324&0.7388&0.7301&0.6371&0.6462&0.6568\cr\hline
  15. B&0.7321&0.7385&0.7323&0.6363&0.6462&0.6559\cr\hline
  16. C&0.7321&0.7222&0.7311&0.6243&0.6227&0.6570\cr\hline
  17. D&0.7654&0.7716&0.7699&0.6695&0.6684&0.6642\cr\hline
  18. E&0.7435&0.7317&0.7343&0.6386&0.6488&0.6435\cr\hline
  19. F&0.7667&0.7644&0.7646&0.6609&0.6687&0.6574\cr\hline
  20. G&{\bf 0.8189}&{\bf 0.8139}&{\bf 0.8146}&{\bf 0.6971}&{\bf 0.6904}&{\bf 0.6935}\cr
  21. \hline
  22. \end{tabular}
  23. \end{table}



 三线表法

  1. \usepackage{booktabs}
  2. \usepackage{threeparttable}
  3. \renewcommand{\arraystretch}{1.5} %控制行高
  4. \begin{table}[tp]
  5. \centering
  6. \fontsize{6.5}{8}\selectfont
  7. \begin{threeparttable}
  8. \caption{Demographic Prediction performance comparison by three evaluation metrics.}
  9. \label{tab:performance_comparison}
  10. \begin{tabular}{ccccccc}
  11. \toprule
  12. \multirow{2}{*}{Method}&
  13. \multicolumn{3}{c}{ G}&\multicolumn{3}{c}{ G}\cr
  14. \cmidrule(lr){2-4} \cmidrule(lr){5-7}
  15. &Precision&Recall&F1-Measure&Precision&Recall&F1-Measure\cr
  16. \midrule
  17. kNN&0.7324&0.7388&0.7301&0.6371&0.6462&0.6568\cr
  18. F&0.7321&0.7385&0.7323&0.6363&0.6462&0.6559\cr
  19. E&0.7321&0.7222&0.7311&0.6243&0.6227&0.6570\cr
  20. D&0.7654&0.7716&0.7699&0.6695&0.6684&0.6642\cr
  21. C&0.7435&0.7317&0.7343&0.6386&0.6488&0.6435\cr
  22. B&0.7667&0.7644&0.7646&0.6609&0.6687&0.6574\cr
  23. A&{\bf 0.8189}&{\bf 0.8139}&{\bf 0.8146}&{\bf 0.6971}&{\bf 0.6904}&{\bf 0.6935}\cr
  24. \bottomrule
  25. \end{tabular}
  26. \end{threeparttable}
  27. \end{table}

画了两个表格,存放在一个图片中。

    1. \renewcommand{\arraystretch}{1.2}
    2. \begin{figure}[]
    3. \centering
    4. \centerline{\bf (a). CDR samples}
    5. \vspace{1.5mm}
    6. \begin{tabular}{|l|c|c|}
    7. \hline
    8. \cline{1-1}
    9. \underline{\textbf{record-id}} & \textbf{caller-id} & \textbf{callee-id} \\\hline
    10. 1                                              & \#user-1           & \#user-2           \\\hline
    11. 2                                              & \#user-1           & \#user-4           \\\hline
    12. 3                                              & \#user-2           & \#user-1           \\\hline
    13. 4                                              & \#user3            & \#user-5\\\hline
    14. 5                                              & \#user1            & \#user-2\\\hline
    15. \vdots                                             & \vdots           & \vdots\\\hline
    16. \end{tabular}
    17. \vspace{3mm}
    18. \centering
    19. \centerline{\bf (b). DTR samples}
    20. \vspace{1.5mm}
    21. \begin{tabular}{|l|c|c|c|}
    22. \hline
    23. \cline{1-1}
    24. \textbf{record-id} & \textbf{user-id} & \textbf{online-time} & \textbf{offline-time} \\\hline
    25. 1    & \#user-1           & \#timestamp-1  & \#timestamp-2           \\\hline
    26. 2    & \#user-2           & \#timestamp-3  & \#timestamp-4           \\\hline
    27. 3    & \#user-2           & \#timestamp-5  & \#timestamp-6           \\\hline
    28. 4    & \#user3            & \#timestamp-7  & \#timestamp-8           \\\hline
    29. \vdots & \vdots           & \vdots          &\vdots\\\hline
    30. \end{tabular}
    31. \vspace{1.5mm}
    32. \caption{CDR (Call Detail Records) and DTR (Data Traffic Records) samples.}
    33. \end{figure}

Excel 转Latex 及tex表格的处理 总结的更多相关文章

  1. 用 Excel 生成和管理 Markdown 表格--转载

    Markdown 作为一种轻量级的标记语言,用来进行简单的文本排版,确实方便快捷.但 Markdown 标记语言的属性,也使得其在表格处理上略显繁琐且不直观.而 Excel 几乎就是表格的代名词,借助 ...

  2. Excel Interactive View - 让页面表格的功能更强大

    MS Office Excel Services提供了一个非常强大的功能,允许你只需要在页面上添加非常少量的JS references,就可以让你在页面上将表格的内容以Excel图表的方式呈现.这里是 ...

  3. EXCEL中把两列表格里的数字合成一列并且中间用逗号隔开

    背景:使用loadrunner做参数化时,往往需要在excel表格中做数据,比如:第一列是用户名,第二列是密码,格式如下: 再将用户名和密码合并成一列,以逗号分隔,需要用到的公式为: =A1& ...

  4. excel数据复制到html表格<textarea>中

    方案一 多行文本框接收到复制的excel值后,在文本框的chage事件中,将excel内容分割到二维数组中,然后填充到html的表格的input或textarea中. 数据格式: 单元格复制后的数据格 ...

  5. Java使用poi生成Excel,生成两种表格下拉框

    想要使用POI操作以xsl结尾的Excel,首先要下载poi相关的jar包,用到的jar有: poi-3.9.jar poi-ooxml-3.9.jar poi-ooxml-schemas-3.9.j ...

  6. python读取excel文件中所有sheet表格

    sales: store: """(1)用load_workbook函数打开excel文件,返回一个工作簿对象 (2)用工作簿对象获取所有的sheet (3)第一个for ...

  7. latex如何给表格添加注释

    在latex中,想给表格添加注释,可以使用threeparttable这个包 代码如下: \usepackage{threeparttable} \begin{table*} \begin{three ...

  8. excel wps access mysql数据表格的查询之路

    简直血崩,最近去做兼职,每天都有大量的表格数据要整理. 开始 还是 用 excel的用起来还算顺畅,慢慢慢慢的发现了各种弊端.大概类似于分组排序什么什么的好多啦~~~不过也确实是用了不到两个小时就能比 ...

  9. C# 将Excel转为PDF时自定义表格纸张大小

    通过后端程序将Excel表格转为PDF格式时,直接转换后的PDF效果可能出现表格页面过小或者过大,导致页面内容分布不均.要改善转换后的文档效果,只需在转换前自定义表格纸张大小,即可调整转换后的PDF页 ...

随机推荐

  1. Silicon Labs电视调谐器 si2151

    随着数字电视与数模混合电视在全球范围内的逐步普及,人们对于电视机的功能要求也随之不断攀升,进而对整个电视芯片行业造成了在价格与功耗等方面的强烈冲击. 而中国作为连续四年取得全球电视出货量第一的“电视大 ...

  2. sql中毫秒数与格式化时间的转换

    使用MYSQL自带的函数FROM_UNIXTIME(unix_timestamp,format). 如: SELECT FROM_UNIXTIME(1461201575895/1000,"% ...

  3. insertion sort(插入排序)

    #include<stdio.h> #include<time.h> int insertion_sort() { ; int a[max],i,j; srand((unsig ...

  4. Serial Port Programming using Win32 API(转载)

    In this tutorial we will learn How to communicate with an external device like a microcontroller boa ...

  5. NOIP2013货车运输[lca&&kruskal]

    题目描述 A 国有 n 座城市,编号从 1 到 n,城市之间有 m 条双向道路.每一条道路对车辆都有重量限制,简称限重.现在有 q 辆货车在运输货物, 司机们想知道每辆车在不超过车辆限重的情况下,最多 ...

  6. magnitude是精确距离,sqrMagnitude是节省CPU的粗略距离,精度有损失

    magnitude是精确距离,sqrMagnitude是节省CPU的粗略距离,精度有损失 CubeA坐标 x:0 y:0.844 z:0 CubeC坐标 x:0 y:0 z:0 Vector3 aaa ...

  7. 如何进行安全测试-XSS篇

    XSS分为三类:Stored XSS.Reflected XSS.Dom-Base XSS (1)Stored XSS,即存储式跨站攻击,存储式跨站攻击简单来说就是攻击者提交给网站的数据会提交并永久保 ...

  8. [No000080]右键解锁增强Chrome插件开发,破除防复制

    昨天用360极速(虽然我不喜欢360.)浏览器,登陆知乎查阅一些东西,突然感觉有些观点很赞同,想copy转载一下,我了个去,它丫的居然不让我复制. 地址:https://www.zhihu.com/q ...

  9. enumerate用法

    Return an enumerate object. sequence must be a sequence, an iterator, or some other object which sup ...

  10. (原创)JAVA多线程三锁

    前两章介绍了锁,那么现在我们介绍新的一个类,锁 一,简介 Lock是一个接口,实现它的类有读锁,写锁,和ReentrantLock,我们可以在类上点击ctrl+t来看看有哪些类实现了这个接口 使用方法 ...