latex图表

本文介绍了如何使用LaTeX创建各种类型的表格,包括加边框、3线表、虚线表、合并多列以及实现奇偶行背景色交替的表格。同时,还讲解了如何利用float宏包禁止图表浮动,确保其在文档中的精确定位。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

latex表格

给图表加边框

使用宏包\usepackage{fancybox},使用命令\fbox,\doublebox,\shadowbox 等等5种
此处拿\doublebox说明
内框线厚0 .75\fboxrule
外框线厚1.5\fboxrule
内外框之间的距离  1.5\fboxrule+0.5pt
边框与图形间的距离  \fboxsep
 
\begin{figure}[H]
\centering
 \setlength{\fboxsep}{0pt}
 %\setlength{\fboxrule}{0.2pt}
\doublebox{\includegraphics[width=12cm]{graph.pdf}}
\caption{Topological order of paper network}
\label{fig:gra}
\end{figure}




3线表

需要宏包:\usepackage{booktabs}
为了色彩需要,使用了如下宏包:colortbl,xcolor
颜色说明:\definecolor{spec}{rgb}{.121,.562,.996}
\begin{tabular}{ccc}
\arrayrulecolor{spec}
\toprule[1.5pt]
Destination Subnet & Next Router& \#Hopes to Destination \\
\midrule
w & A&2 \\
y & B&2\\
z & A&6 \\
x & --&1 \\
...&...&...\\
\bottomrule[1.5pt]
\end{tabular}

效果如下:

虚线表与合并多列

虚线主要是吧原来| 表示的实线用:代替
使用宏包:arydash
\usepackage{arydshln}
\setlength\dashlinedash{1pt}
\setlength\dashlinegap{2pt} %设置黑白间隔
\begin{document}
\begin{tabular}{:c:c:c:c:c:c:}
\hdashline
\cellcolor{spec!20} 实验人:& xxx&\cellcolor{spec!20}  学号:& 12345678& \cellcolor{spec!20} 日期& 2014-1-7 \\
\hdashline
\cellcolor{spec!20} 院(系):& \multicolumn{2}{c:}{xx学院} & \cellcolor{spec!20} 专业(班级): & \multicolumn{2}{c:}{xx班} \\
\hdashline
\cellcolor{spec!20} 实验题目:& \multicolumn{5}{c:}{Part IV:Configuration Vulnerabilities } \\
\hdashline
\end{tabular}
\end{document}

dashlinedash 和dashlinegap表示分别虚线的黑白长度
效果如下:

奇偶行不同背景色交替的表格

使用宏包:colortbl,或者给xcolor加上table选项
\begin{table}[htbp]
\centering
\rowcolors{2}{regular!20}{regular!10}
\caption{报文格式}
\begin{tabular}{ccc}
 \rowcolor{regular!30} 属性 & 类型\\
  srcID & string\\
  dstID & string\\
  type & string\\
  time & string\\
 content & dict(字典)\\
 \end{tabular}
\end{table} 


效果如下:

latex插图表禁止浮动体

float宏包为标准的浮动环境提供新的H位置选项产生没有浮动效果的图标环境

 \begin{figure}[H]
\centering  
\includegraphics[width=7in,height=4in]{1.jpg}  
\centering  
\caption{Sum influence of movie actors with different p value}  
\end{figure}

注意:H选项不能与h,t,b,p位置选项混用


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值