首页 > 其他分享 >表格列等宽--latex

表格列等宽--latex

时间:2022-10-16 19:12:32浏览次数:27  
标签:bigstrut latex begin end 表格 -- sideways hline cline

因写论文的需要,想要做一个这样的表格:
image

使用Excel2Latex(github上有下载)将做的Excel转为latex代码,发现使用texstudio编译运行后得到的是:
image
其中highAA和low这两列的宽度不同,试了好多网上的方法,发现这一个满足要求,便记录下来。
得到的效果如下:
image

原latex代码:

\begin{table*}[htbp]
	\centering
	\caption{Add caption}
	\begin{tabular}{|c|c|c|c|c|c|c|c|}
		\hline
		&       & \multicolumn{2}{c|}{A} & \multicolumn{2}{c|}{B} & \multicolumn{2}{c|}{C} \bigstrut\\
		\hline
		&       & highAA & low   & highAA & low   & highAA & low \bigstrut\\
		\hline
		\multirow{3}[6]{*}{\begin{sideways}V1\end{sideways}} & m1    & 1     & 1     & 1     & 1     & 1     & 1 \bigstrut\\
		\cline{2-8}          & m2    & 2     & 2     & 2     & 2     & 2     & 2 \bigstrut\\
		\cline{2-8}          & m3    & 3     & 3     & 3     & 3     & 3     & 3 \bigstrut\\
		\hline
		\multirow{3}[6]{*}{\begin{sideways}V2\end{sideways}} & m1    & 4     & 4     & 4     & 4     & 4     & 4 \bigstrut\\
		\cline{2-8}          & m2    & 5     & 5     & 5     & 5     & 5     & 5 \bigstrut\\
		\cline{2-8}          & m3    & 6     & 6     & 6     & 6     & 6     & 6 \bigstrut\\
		\hline
		\multirow{3}[6]{*}{\begin{sideways}V3\end{sideways}} & m1    & 7     & 7     & 7     & 7     & 7     & 7 \bigstrut\\
		\cline{2-8}          & m2    & 8     & 8     & 8     & 8     & 8     & 8 \bigstrut\\
		\cline{2-8}          & m3    & 9     & 9     & 9     & 9     & 9     & 9 \bigstrut\\
		\hline
	\end{tabular}%
	\label{tab:addlabel}%
\end{table*}%

修改后的:

\begin{table*}[htbp]
	\centering
	\caption{Add caption}
	\begin{tabularx}{.5\textwidth}{|c|c|*{6}{Y|}} %可以调整宽度
		\hline
		&       & \multicolumn{2}{c|}{A} & \multicolumn{2}{c|}{B} & \multicolumn{2}{c|}{C} \bigstrut\\
		\hline
		&       & highAA & low   & highAA & low   & highAA & low \bigstrut\\
		\hline
		\multirow{3}[6]{*}{\begin{sideways}V1\end{sideways}} & m1    & 1     & 1     & 1     & 1     & 1     & 1 \bigstrut\\
		\cline{2-8}          & m2    & 2     & 2     & 2     & 2     & 2     & 2 \bigstrut\\
		\cline{2-8}          & m3    & 3     & 3     & 3     & 3     & 3     & 3 \bigstrut\\
		\hline
		\multirow{3}[6]{*}{\begin{sideways}V2\end{sideways}} & m1    & 4     & 4     & 4     & 4     & 4     & 4 \bigstrut\\
		\cline{2-8}          & m2    & 5     & 5     & 5     & 5     & 5     & 5 \bigstrut\\
		\cline{2-8}          & m3    & 6     & 6     & 6     & 6     & 6     & 6 \bigstrut\\
		\hline
		\multirow{3}[6]{*}{\begin{sideways}V3\end{sideways}} & m1    & 7     & 7     & 7     & 7     & 7     & 7 \bigstrut\\
		\cline{2-8}          & m2    & 8     & 8     & 8     & 8     & 8     & 8 \bigstrut\\
		\cline{2-8}          & m3    & 9     & 9     & 9     & 9     & 9     & 9 \bigstrut\\
		\hline
	\end{tabularx}%
	\label{tab:addlabel}%
\end{table*}%

标签:bigstrut,latex,begin,end,表格,--,sideways,hline,cline
From: https://www.cnblogs.com/cowei/p/16796811.html

相关文章

  • 206. 反转链表
    206.反转链表来自<https://leetcode.cn/problems/reverse-linked-list/>/***Definitionforsingly-linkedlist.*structListNode{*intval;*......
  • flask搭建平台入门教程二:用户注册和登录
    这一篇主要实现用户注册和登录编写接口并设置URL根目录添加api文件夹,添加auth.py注册auth蓝图为根路径fromflaskimportBlueprint,jsonifyauthbp=Blueprint('au......
  • CSP-S模拟19
    这两天好累,不想改题T1木棍题意:有$a_1$个$2$,$a_2$个$3$,$a_3$个$4$,问最多能拼出多少个$10$题解:首先有这么几种方案$2$$3$$4$......
  • 最近的oj
    对最近OJ的反思最近学会了Markdown!写这篇文为了试试手而已,以后博客并不会把这么简单的东西放上来......最近c语言学的相当痛苦啊,虽然基本语法、惯用法都已经早早预习过......
  • vue 的常用指令以及作用 ·
    1、v-model多用于表单元素实现双向数据绑定(同angular中的ng-model)2、v-for格式:v-for="字段名in(of)数组json"循环数组或json(同angular中的ng-repeat),需......
  • taskk
    task5#include<stdio.h> intmain(){intage1,age2;chargender1,gender2;scanf("%d%c%d%c",&age1,&ge......
  • 递归与分治法实现快速排序算法
    ​本人CSDN链接:http://t.csdn.cn/Wt0Nm提示:首先了解并明白递归与分治法的快速排序文章目录 前言递归与分治法实现快速排序算法,输入一串以英文字符逗号隔开的数......
  • Spring的依赖注入两种方式之二:构造器注入
     1.构造器注入引用类型第一步,在类的构造方法中调用引用类型,如下的构造方法:publicBookServiceImpl(BookDaobookDao1)JavaBeanpackagecom.oxygen.service.impl;......
  • C语言实例2
    题目:企业发放的奖金根据利润提成。利润(I)低于或等于10万元时,奖金可提10%;利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,提成7.5%;利润20万到4......
  • 使用conda/pip命令实现anaconda 虚拟环境的导入导出
    一.使用conda命令实现虚拟环境的导入导出1.从计算机a中导出虚拟环境test的相关信息condaactivatetest #先切换到test虚拟环境condaenvexport>C:\users\sgj\des......