LaTeX各种表格

article/2025/10/23 23:19:54

微笑彩色表格

[plain]  view plain  copy
  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}  
要记得引入包
[plain]  view plain  copy
  1. \usepackage{xcolor}%定义了一些颜色  
  2. \usepackage{colortbl,booktabs}%第二个包定义了几个*rule  
效果:

微笑设置表格总长

[plain]  view plain  copy
  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,前两行剩下的都是第三行的
效果图


微笑表格内自动换行

[plain]  view plain  copy
  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,超出部分要换行。
效果:


微笑设置表格宽度

[plain]  view plain  copy
  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}  




微笑设置表格中间某列的宽度

[plain]  view plain  copy
  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}  

记得引入包
[plain]  view plain  copy
  1. \usepackage{tabularx}  



微笑改变任一列宽

[plain]  view plain  copy
  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包用法

[plain]  view plain  copy
  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}  

不要忘记引入包
[plain]  view plain  copy
  1. \usepackage{tabu}  




微笑水平居中显示

[plain]  view plain  copy
  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}  


微笑

[plain]  view plain  copy
  1. \usepackage{multicol}  
  2. \usepackage{multirow}  



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



微笑 三线表法


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



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


[plain]  view plain  copy
  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.   
  18. \vspace{3mm}  
  19. \centering  
  20. \centerline{\bf (b). DTR samples}  
  21. \vspace{1.5mm}  
  22. \begin{tabular}{|l|c|c|c|}  
  23. \hline  
  24. \cline{1-1}  
  25. \textbf{record-id} & \textbf{user-id} & \textbf{online-time} & \textbf{offline-time} \\\hline  
  26. 1    & \#user-1           & \#timestamp-1  & \#timestamp-2           \\\hline  
  27. 2    & \#user-2           & \#timestamp-3  & \#timestamp-4           \\\hline  
  28. 3    & \#user-2           & \#timestamp-5  & \#timestamp-6           \\\hline  
  29. 4    & \#user3            & \#timestamp-7  & \#timestamp-8           \\\hline  
  30. \vdots & \vdots           & \vdots          &\vdots\\\hline  
  31. \end{tabular}  
  32. \vspace{1.5mm}  
  33. \caption{CDR (Call Detail Records) and DTR (Data Traffic Reco

http://chatgpt.dhexx.cn/article/KqeCjuhU.shtml

相关文章

LaTeX中常用表格制作方法总结

文章目录 前言最基本的无线表格: tabbing基本语法 一般表格: tabular/array基本语法基本调整命令 科研论文: 三线表(toprule)基本语法 广泛应用: 定宽表(tabularx)简单介绍基本语法 跨页长表格(longtable)MISC参考 前言 很多 LaTeX \LaTeX LATE​X初学者对于表格的制作都比较抵…

Latex 表格问题

在用latex做图片的时候发现问题没有很多,但是做表格的问题就非常多了,因此记录一下 首先导包需要 \usepackage{array} \usepackage{booktabs} \usepackage{caption} % 可有可无 然后制作简单表格参考该处: Latex基本表格绘制_爱摸鱼的派…

LaTeX表格制作

一些LaTeX中表格的使用方法如下: 1.table \documentclass{article}\begin{document}\begin{table}[h]\centering\begin{tabular}{|l|c|c|}\hlineSetting&\multicolumn{2}{c|}{A4 size paper}\\\hline&mm&inches\\Top&25&1.0\\Bottom&25&a…

LaTex中表格常用设置

推荐一个在线生成各种表格命令的工具:https://tablesgenerator.com/。 1.表格参数 table 后面加*表示双栏表格,如\begin{table*}...\end{table*}。 表格中常用选项[htbp]是浮动格式: h当前位置。将图形放置在正文文本中给出该图形环境的地…

Latex中的表格(2)

Latex中的表格 一、一个加脚注的三线表的例子二、一个表格中加注释的例子三、两个并排的两个表格的例子3.1 使用小页环境并排表格3.2 使用子表格并排表格 四、一个格式复杂的表格的例子五、一个长表格的例子 这篇文章主要罗列一些特殊的表格例子。内容来自:一篇北师…

【教程】在线生成LaTeX中的表格

【教程】在线生成LaTeX中的表格 当我们写论文时不可避免要用表格总结自己的实验结果。但是LaTeX中的表格操作实在是太麻烦了,所以有一个在线生成LaTex中的表格能大大提高生产力 本教程展示从Excel表格到LaTeX表格的整个过程,简单易用,不用自己…

LaTex(1):使用在线表格生成器工具生成LaTex表格及latex相关工具网站

目录 0 在线工具 1 常用命令: 1.0 编辑表格 1.1 Table—set size可以改变表格大小: 1.2 合并表格和拆分表格: 1.3 生成latex代码与复制代码: 2 示例 3. 相关工具网站 3.1 latex公式编辑器 0 在线工具 表格生成器网页&a…

latex表格手把手超详细教程(table, tabular, multirow, multicolumn)

最近写论文要用latex,实验部分需要画表格,于是百度看了两个多小时的博客,一无所获,全都写的乱七八糟的,越看越烦躁,于是谷歌五分钟,就学会了怎么画表格,下面是我最终画出来的表格&am…

Latex基本表格绘制

Latex基本表格绘制 文章目录 Latex基本表格绘制1.基本格式2.添加竖线和横线3.设置每一列的单元格格式4.常见的三线表5.table环境6.单元格合并7.斜线表头8.其他(2018.11.23)1.基本格式 \documentclass{article}\begin{document}\begin{tabular}{cc}%一个c表示有一列,格式为居中…

LaTeX表格Table使用解析

推荐一个在线生成表格命令的工具:LaTeX Table Generator 常用选项[htbp]是浮动格式: h当前位置。将图形放置在正文文本中给出该图形环境的地方。如果本页所剩的页面不够,这一参数将不起作用。 t顶部。将图形放置在页面的顶部。 b底部。将图形…

在 LaTeX 中插入表格

原  文:在 LaTeX 中插入表格 译  者:Xovee 翻译时间:2020-1024 在 LaTeX 中插入表格 在科研论文中,表格是最重要的内容之一。LaTeX 提供了许多定制化表格的功能,包括调整表格大小,合并单元格&#xf…

LaTeX表格处理

关于LaTeX中对表格的一些处理 在使用latex撰写文档时,可能会遇到表格太大超过页面范围,表格太小显示不美观,以及生成跨行表格,表头斜线等问题,以下是一些调整表格的命令。 调整表格大小 使用以下的latex命令之前&am…

latex画表格(自用)

绘制 latex 表格需要用到 table 和 tabular 环境。 其中table环境里写表格的标题(caption)、表格的偏移之类的。 tabular环境则是绘制表格的内容。 首先是table环境部分,\begin{center} 让表格居中,\caption{Table name.} 写表格…

Latex论文表格画法

参考 Latex论文表格画法 - 云社区 - 腾讯云 1、基本表格画法 \begin{table}[htbp] 表示表格的开始。中括号中的 htbp 表示的是表格的浮动格式。当然这个基本参数不仅仅只是对表格有用。需要注意的是,一般使用 [htb] 这样的组合,这样组合的意思就是Latex会…

LaTeX中的表格

LaTeX中的表格 这一节我们主要讨论LaTeX中表格的制作和排版问题。 (1)在LaTeX中,可以使用tabular环境生成表格。 (2)tabular环境需要一个指定列排版格式的必选参数。可以用l指定左对齐,用c指定居中对齐&a…

Latex 制作表格

Latex 制作表格 前言一、Latex三线表1、普通三线表2、跨页三线表 二、简单表1、基本需求表2、表格整体相关设置【表名及位置、表宽、注解、字号】1. 表格标题及位置2. 表宽设置3. 表格注解4. 字号设置 三、复杂表1、合并单元格2、斜线表头 五、常用表格模板代码总结 前言 Late…

Qt学习c++

Qt学习C 平台及版本Day01 HelloWorld程序生成Day02 分析第一个Qt程序1) main.cpp2) mainwindow.h和mainwindow.cpp Day03 Qt控件和事件Day04 信号和槽基本理解connect()函数实现信号和槽实例演示信号和槽机制 Day05 Qt QLabel文本框的使用QLabel文本框的信号和槽QLabel的常用方…

Qt学习基础

1. Qt是什么? Qt是一个基于C语言的图形用户界面(GUI)开发框架,Qt不仅仅可以进行GUI开发,除此之外Qt也能进行很多其它功能开发,包括但不限于多线程、数据库、图像处理、音视频处理、网络通信与文件IO等。 Qt…

Qt学习心得体会

Qt是一种跨平台C图形界面程序开发框架,在社会中各种行业都有着举足轻重的地位。 Qt为了实现对象与对象之间的通信,提出了信号与槽的概念。当一个对象发生改变会发送一个信号通知另一个对象执行一个函数,这个函数称为槽,信号只需要…

QT 学习笔记(二)

文章目录 一、标准信号和槽1. 准备工作1.1 main.c1.2 widget.cpp 2. 添加按钮2.1 widget.h2.2 widget.cpp2.3 运行结果 3. 信号和槽(重点)3.1 信号3.2 自定义槽3.3 widget.h3.4 widget.cpp3.5 运行结果 二、两个独立窗口1. 添加新窗口2. 自定义信号3. 窗…