赞
踩
参考博客
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}
结果如下
注意最后两个例子,其实我用latex识别公式识别出的内容
\begin{array)
*****
\end{array}
这其中的部分,使用
$$
\begin{array)
*****
\end{array}
$$
还是
\begin{table}
\begin{array)
*****
\end{array}
\end{table}
把这部分内容包起来看自己需要,我目前发现前者没有办法给表加标题和引用,所以使用后者会更好一点
记录一个自己补充的表格,结果如下
\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}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。