当前位置:   article > 正文

latex表格使用总结_latex 表格

latex 表格

参考博客
https://blog.csdn.net/TH_guan/article/details/124878398

测试了一下latex里面表格的用法

\documentclass{article}
\usepackage{booktabs} % 导入三线表需要的宏包
\usepackage{booktabs} % 导入三线表需要的宏包
\usepackage{longtable}% 导入跨页表格所需宏包
\usepackage{graphics}
\usepackage{threeparttable}
\usepackage[UTF8]{ctex} 
\usepackage{multirow}
\usepackage{array}
\usepackage{diagbox}
\usepackage{amsmath}
\begin{document}
	
%%%%%%%%%%% 1 %%%%%%%%%%%%%%
	\begin{tabular}{ccc}% 其中,tabular是表格内容的环境;c表示centering,即文本格式居中;c的个数代表列的个数
		\toprule %[2pt]设置线宽     
		a & b  &  c \\ %换行
		\midrule %[2pt]  
		1 & 2 & 3 \\
		4 & 5 & 6 \\
		7 & 8 & 9 \\
		\bottomrule %[2pt]     
	\end{tabular}
	
%%%%%%%%%%% 2 %%%%%%%%%%%%%%
\begin{longtable}{ccc}% 其中,tabular是表格内容的环境;c表示centering,即文本格式居中;c的个数代表列的个数
	\toprule %[2pt]设置线宽     
	a & b  &  c \\ %换行
	\midrule %[2pt]  
	1 & 2 & 3 \\
	4 & 5 & 6 \\
	7 & 8 & 9 \\
	\bottomrule %[2pt]     
\end{longtable}


%%%%%%%%%%% 3 %%%%%%%%%%%%%%
\begin{tabular}{|c|c|c|c|r|l|} \hline % 其中,|c|表示文本居中,文本两边有竖直表线。
	aaaaa & bbbbb & ccccc & ddddd & eeeee & fffff  \\ \hline
	1 & 2 & 3 & 4 & 5 & 6  \\ \hline
	7 &	8 &	9 &	10 & 11 & 12\\ \hline
	13 & 14 & 15 & 16 &	17 & 18\\ \hline
\end{tabular}

%%%%%%%%%%%4 %%%%%%%%%%%%%%
\begin{table}[!ht] % [!ht]表格在文本中放置的位置参数(努力放在当前位置,实在放不下,将放在下一页的顶部)
	\centering % 表格整体居中
	\caption{表格标题}
	\begin{tabular}{|c|c|c|c|r|l|} \hline % 其中,|c|表示文本居中,文本两边有竖直表线。
		aaaaa & bbbbb & ccccc & ddddd & eeeee & fffff  \\ \hline
		1 & 2 & 3 & 4 & 5 & 6  \\ \hline
		7 &	8 &	9 &	10 & 11 & 12\\ \hline
		13 & 14 & 15 & 16 &	17 & 18\\ \hline
	\end{tabular}
\end{table}


%%%%%%%%%%%5 %%%%%%%%%%%%%%
\begin{table}[!ht]
	
	\resizebox{\textwidth}{!}{ % 表格环境外部设置(头)
		\begin{tabular}{|c|c|c|c|r|l|} \hline % 其中,|c|表示文本居中,文本两边有竖直表线。
			aaaaa & bbbbb & ccccc & ddddd & eeeee & fffff  \\ \hline
			1 & 2 & 3 & 4 & 5 & 6  \\ \hline
			7 &	8 &	9 &	10 & 11 & 12\\ \hline
			13 & 14 & 15 & 16 &	17 & 18\\ \hline
		\end{tabular}
	}% 外部环境设置(尾)
	
\end{table}

%%%%%%%%%%%6 %%%%%%%%%%%%%%

\centering
\begin{threeparttable}
	\begin{tabular}{|c|c|c|c|c|c|} \hline
		
		班级层次&平均值	&个案数	&标准偏差	&最小值&最大值\\ \hline
		1&	53.74&	77	&29.819&	4	&96\\ \hline
		2	&57.60	&119&	28.971&	4	&100\\ \hline
		3	&58.94&	119&	29.930	&0&	100\\ \hline
		总计	&57.16	&315	&29.520&	0&	100\\ \hline
	\end{tabular}
	注: 1代表学习成绩低的同学;2代表学习层次居中的同学;3代表学习层次较好的同学。
\end{threeparttable}


%%%%%%%%%%%7 %%%%%%%%%%%%%%
\begin{tabular}{|p{6cm}<{\raggedleft}|p{4cm}<{\raggedright}|p{4cm}<{\centering}|} \hline
	
	汉字文本文本文本文本&汉字文本文本文本文本汉字文本文本文本文本&汉字文本文本文本文本汉字文本文本文本文本汉字文本文本文本文本\\ \hline
	汉字文本&汉字文本&汉字文本\\ \hline
	aaaaaaaaa&aaaaaaaaa&aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\ \hline
	111111111&111111111&111111111111111111111111111111111111\\ \hline
	
\end{tabular}



%%%%%%%%%%8%%%%%%%%%%%%%%

\begin{table}[!ht]
	
	\center
	\begin{tabular}{|c|c|c|c|}\hline
		\multicolumn{1}{|c|}{\multirow{2}{*}{aaaa}} & \multicolumn{3}{c|}{bbbb}\\ \cline{2-4}
		& cccc  & dddd & eeee \\ \hline
		\multirow{2}{*}{aaaa}& 50 & 86 & 122  \\ \cline{2-4}
		\multirow{2}{*}{ }& 5 & 78  & 107   \\ \hline
		3& 25 & 48  & 101  \\ \hline
		4& 28 & 60 & 106  \\ \hline
	\end{tabular}
	
\end{table}


%%%%%%%%%%9%%%%%%%%%%%%%%
\centering
\begin{threeparttable}
	\begin{tabular}{|c|c|c|c|c|c|} \hline
		
		\diagbox{班级层次}{班级层次}&平均值	&个案数	&标准偏差	&最小值&最大值\\ \hline
		1&	53.74&	77	&29.819&	4	&96\\ \hline
		2	&57.60	&119&	28.971&	4	&100\\ \hline
		3	&58.94&	119&	29.930	&0&	100\\ \hline
		总计	&57.16	&315	&29.520&	0&	100\\ \hline
	\end{tabular}
	注: 1代表学习成绩低的同学;2代表学习层次居中的同学;3代表学习层次较好的同学。
\end{threeparttable}

	
%%%%%%%%%%%% 10 %%%%%%%%%%%%%%%%
\begin{table*}[!ht]
	%\usepackage{multirow}
	\center
	\caption{不同层次学生显著性分析}
	\begin{threeparttable}
		\resizebox{\linewidth}{!}{ 
			\begin{tabular}{|c|c|c|c|c|c|c|c|} \hline
				
				
				\multirow{2}{*}{} &\multirow{2}{*}{(I) 班级层次} &\multirow{2}{*}{(J) 班级层次} &\multirow{2}{*}{平均值差值 (I-J)} &\multirow{2}{*}{标准 错误} &\multirow{2}{*}{显著性} &\multicolumn{2}{c|}{95\% 置信区间}\\ \cline{7-8}
				
				\multirow{2}{*}{}&\multirow{2}{*}{} &\multirow{2}{*}{} &\multirow{2}{*}{} &\multirow{2}{*}{} &\multirow{2}{*}{} &上限&下限   \\ \hline
				
				\multirow{6}{*}{塔姆黑尼}&\multirow{2}{*}{1} &2&	-3.856	&4.313	&.753&	-14.26&	6.55  \\ \cline{3-8}
				\multirow{6}{*}{}&\multirow{2}{*}{} & 3	&-5.201&4.368&	.553&	-15.74&	5.34 \\ \cline{2-8}
				
				\multirow{6}{*}{}&\multirow{2}{*}{2} &1&	3.856&	4.313&	.753&	-6.55&	14.26  \\ \cline{3-8}
				\multirow{6}{*}{}&\multirow{2}{*}{} &  3&	-1.345	&3.819&	.979	&-10.53&	7.84\\ \cline{2-8}
				
				\multirow{6}{*}{}&\multirow{2}{*}{3} &1&	5.201&	4.368&	.553	&-5.34&	15.74  \\ \cline{3-8}
				\multirow{6}{*}{}&\multirow{2}{*}{} & 2	&1.345&	3.819&	.979&	-7.84	&10.53 \\ \hline
				
				\multirow{2}{*}{邓尼特 t(双侧)} & 1&	3	&-5.201&4.321	&.384&	-14.83	&4.43 \\ \cline{2-8}
				\multirow{2}{*}{} & 2&	3&	-1.345	&3.830	&.917	&-9.88	&7.19\\ \hline
				
			\end{tabular}
		}	
		\begin{tablenotes}
			\item[1] 1代表学习成绩低的同学;2代表学习层次居中的同学;3代表学习层次较好的同学。
		\end{tablenotes}
	\end{threeparttable}
\end{table*}


%%%%%%%%%%%% 11 %%%%%%%%%%%%%%%%
$$
\begin{array}{|c|c|c|c|}
	\hline   \text { 序号 }& \text { 对比方法 } & \text { 方法版本 } & \text { 方法官方地址 } \\
	\hline  1& \text { FastMNN } & 1.10 .0 & \begin{array}{l}
		\text { https://bioconductor.org/packages/ } \\
		\text { release/bioc/html/batchelor.html }
	\end{array}  \\
	\hline 2 &\text { Harmony } & 0.1 .0 & \begin{array}{l}
		\text { https://github.com/immunogenomics/harmony } \\
	\end{array}  \\
	\hline 3 & \text { Seurat }3 & 4.1 .1 & \text { https://satijalab.org/seurat/ }  \\
	\hline 4 &\text { Liger } & 1.0 .0 & \text { https://github.com/welch-lab/liger }  \\
	\hline 5 &\text { INSCT } & 0.0 .2 & \text { https://github.com/lkmklsmn/insct } \\
	\hline 6 &\text { BERMUDA } & \text {无版本号 } & \begin{array}{l}
		\text { https://github.com/txWang/BERMUDA } \\
	\end{array}  \\
	\hline 7 &\text { BBKNN } & 1.5 .1 & \text { https://github.com/Teichlab/bbknn } \\
	\hline 8 & \text { Scanorama } & 1.7 .2 & \begin{array}{l}
		\text { https://github.com/brianhie/scanorama } \\
	\end{array}  \\
	\hline 9 &\mathrm{scVI} & 0.8 .1 & \begin{array}{l}
		\text { https://github.com/scverse/scvi-tools } \\
	\end{array}  \\
	\hline 10 & \text { carDEC } & 1.0 .3 & \begin{array}{l}
		\text { https://github.com/jlakkis/CarDEC } \\
	\end{array} \\
	\hline 11 & \text { scDML } & 0.0 .1 & \begin{array}{l}
		\text { https://github.com/eleozzr/scDML } \\
	\end{array} \\
	\hline
\end{array}
$$

%%%%%%%%%%%%%%% 12%%%%%%%%%%%%%%%%%%%%%%%%%%%

{
	\renewcommand{\arraystretch}{1.2}
	\begin{table}
		\caption{测试表格
			\label{Table:测试}}
		$\begin{array}{|c|c|c|c|}
			\hline   \text { 序号 }& \text { 对比方法 } & \text { 方法版本 } & \text { 方法官方地址 } \\
			\hline  1& \text { FastMNN } & 1.10 .0 & \begin{array}{l}
				\text { https://bioconductor.org/packages/ } \\
				\text { release/bioc/html/batchelor.html }
			\end{array}  \\
			\hline 2 &\text { Harmony } & 0.1 .0 & \begin{array}{l}
				\text { https://github.com/immunogenomics/harmony } \\
			\end{array}  \\
			\hline 3 & \text { Seurat }3 & 4.1 .1 & \text { https://satijalab.org/seurat/ }  \\
			\hline 4 &\text { Liger } & 1.0 .0 & \text { https://github.com/welch-lab/liger }  \\
			\hline 5 &\text { INSCT } & 0.0 .2 & \text { https://github.com/lkmklsmn/insct } \\
			\hline 6 &\text { BERMUDA } & \text {无版本号 } & \begin{array}{l}
				\text { https://github.com/txWang/BERMUDA } \\
			\end{array}  \\
			\hline 7 &\text { BBKNN } & 1.5 .1 & \text { https://github.com/Teichlab/bbknn } \\
			\hline 8 & \text { Scanorama } & 1.7 .2 & \begin{array}{l}
				\text { https://github.com/brianhie/scanorama } \\
			\end{array}  \\
			\hline 9 &\mathrm{scVI} & 0.8 .1 & \begin{array}{l}
				\text { https://github.com/scverse/scvi-tools } \\
			\end{array}  \\
			\hline 10 & \text { carDEC } & 1.0 .3 & \begin{array}{l}
				\text { https://github.com/jlakkis/CarDEC } \\
			\end{array} \\
			\hline 11 & \text { scDML } & 0.0 .1 & \begin{array}{l}
				\text { https://github.com/eleozzr/scDML } \\
			\end{array} \\
			\hline
		\end{array}$
	\end{table}
}




\end{document}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245

结果如下
在这里插入图片描述在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

注意最后两个例子,其实我用latex识别公式识别出的内容

\begin{array)
*****
\end{array}
  • 1
  • 2
  • 3

这其中的部分,使用

$$
\begin{array)
*****
\end{array}
$$
  • 1
  • 2
  • 3
  • 4
  • 5

还是

\begin{table}
\begin{array)
*****
\end{array}
\end{table}
  • 1
  • 2
  • 3
  • 4
  • 5

把这部分内容包起来看自己需要,我目前发现前者没有办法给表加标题和引用,所以使用后者会更好一点

记录一个自己补充的表格,结果如下

\begin{array}{lll}
	\text { Leiden Group } & \text { Markers } & \text { Cell Type } \\
	\hline 0 & \text { IL7R } & \text { CD4 T cells } \\
	\hline 1 & \text { CD14, LYZ } & \text { CD14+ Monocytes } \\
	\hline 2 & \text { MS4A1 } & \text { B cells } \\
	\hline 3 & \text { CD8A } & \text { CD8 T cells } \\
	\hline 4 & \text { GNLY, NKG7 } & \text { NK cells } \\
	\hline 5 & \text { FCGR3A, MS4A7 } & \text { FCGR3A+ Monocytes } \\
	\hline 6 & \text { FCER1A, CST3 } & \text { Dendritic Cells } \\
	\hline 7 & \text { PPBP } & \text { Megakaryocytes } \\
	\hline
\end{array}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/寸_铁/article/detail/816484
推荐阅读
相关标签
  

闽ICP备14008679号