当前位置:网站首页>latex图片排版技巧总结
latex图片排版技巧总结
2022-08-10 05:30:00 【LIAN_U】
目录
两图并排
两图竖直排放,共享标题
\begin{figure}[htbp]
\centering
\includegraphics[width=0.2\textwidth]{number_1.jpg} \\
\includegraphics[width=0.2\textwidth]{number_2.jpg}
\caption{两图竖直摆放,共享标题}
\label{fig:ver_2figs_1cap}
\end{figure}
两图水平排放,共享标题
\begin{figure}
\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics[width=2.2in]{number_1.jpg}
\end{minipage}
\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics[width=2.2in]{number_2.jpg}
\end{minipage}
\caption{两图水平摆放,共享标题}
\label{fig:hor_2figs_1cap}
\end{figure}
两图竖直排放,独立标题
\begin{figure}
\centering
\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics[width=2.2in]{number_1.jpg}
\caption{标题一}
\label{fig:ver_2figs_2cap_1}
\end{minipage}
\\
\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics[width=2.2in]{number_2.jpg}
\caption{标题二}
\label{fig:ver_2figs_2cap_2}
\end{minipage}
\end{figure}
两图水平排放,独立标题
\begin{figure}
\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics[width=2.2in]{number_1.jpg}
\caption{标题一}
\label{fig:hor_2figs_2cap_1}
\end{minipage}
\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics[width=2.2in]{number_2.jpg}
\caption{标题二}
\label{fig:hor_2figs_2cap_2}
\end{minipage}
\end{figure}
两图水平排放,统一大标题,独立子标题
\begin{figure}
\centering
\subfigure[子标题一]{
\begin{minipage}[b]{0.2\textwidth}
\includegraphics[width=1\textwidth]{number_1.jpg}
\end{minipage}
\label{fig:hor_2figs_1cap_2subcap_1}
}
\subfigure[子标题二]{
\begin{minipage}[b]{0.2\textwidth}
\includegraphics[width=1\textwidth]{number_2.jpg}
\end{minipage}
\label{fig:hor_2figs_1cap_2subcap_2}
}
\caption{两图水平排放,统一大标题,独立子标题}
\label{fig:hor_2figs_1cap_2subcap}
\end{figure}
四图并排
四图水平摆放,统一大标题,两两独立子标题
\begin{figure}
\centering
\begin{minipage}[b]{0.45\textwidth}
\subfigure[标题一]{
\includegraphics[width=0.4\textwidth]{number_1.jpg}
\includegraphics[width=0.4\textwidth]{number_2.jpg}
\label{fig:hor_4figs_1cap_2subcap_1}
}
\end{minipage}
\begin{minipage}[b]{0.45\textwidth}
\subfigure[标题二]{
\includegraphics[width=0.4\textwidth]{number_3.jpg}
\includegraphics[width=0.4\textwidth]{number_4.jpg}
\label{fig:hor_4figs_1cap_2subcap_2}
}
\end{minipage}
\caption{四图水平摆放,统一大标题,两两独立子标题}
\label{fig:hor_4figs_1cap_2subcap}
\end{figure}
四图栅格摆放,统一大标题,两两独立子标题
\ref{fig:grid_4figs_1cap_2subcap_2}。
\begin{figure}
\centering
\subfigure[标题一]{
\begin{minipage}[b]{0.5\textwidth}
\includegraphics[width=0.4\textwidth]{number_1.jpg}
\includegraphics[width=0.4\textwidth]{number_2.jpg}
\end{minipage}
\label{fig:grid_4figs_1cap_2subcap_1}
}
\subfigure[标题二]{
\begin{minipage}[b]{0.5\textwidth}
\includegraphics[width=0.4\textwidth]{number_3.jpg}
\includegraphics[width=0.4\textwidth]{number_4.jpg}
\end{minipage}
\label{fig:grid_4figs_1cap_2subcap_2}
}
\caption{四图栅格摆放,统一大标题,两两独立子标题}
\label{fig:grid_4figs_1cap_2subcap}
\end{figure}
四图栅格摆放,统一大标题,独立子标题
\begin{figure}
\centering
\subfigure[标题一]{
\begin{minipage}[b]{0.3\textwidth}
\includegraphics[width=1\textwidth]{number_1.jpg}
\end{minipage}
\label{fig:grid_4figs_1cap_4subcap_1}
}
\subfigure[标题二]{
\begin{minipage}[b]{0.3\textwidth}
\includegraphics[width=1\textwidth]{number_2.jpg}
\end{minipage}
\label{fig:grid_4figs_1cap_4subcap_2}
}
\\
\subfigure[标题三]{
\begin{minipage}[b]{0.3\textwidth}
\includegraphics[width=1\textwidth]{number_3.jpg}
\end{minipage}
\label{fig:grid_4figs_1cap_4subcap_3}
}
\subfigure[标题四]{
\begin{minipage}[b]{0.3\textwidth}
\includegraphics[width=1\textwidth]{number_4.jpg}
\end{minipage}
\label{fig:grid_4figs_1cap_4subcap_4}
}
\caption{四图栅格布局摆放,统一大标题,独立子标题}
\label{fig:grid_4figs_1cap_4subcap}
\end{figure}
并排摆放,统一大标题,独立子标题
总结
如果想要两幅并排的图片共享一个标题,并各有自己的子标题,一般有两种办法。但需要特别注意:这两种方法不互相兼容,即在同一份文档中,你只能选择其中的一种方法使用。
方法一:使用宏包subfig(不推荐)
使用subfig宏包提供的\subfloat命令,需要使用宏包\usepackage{graphicx}和\usepackage{subfig}。subfloat命令缺少宽度参数,虽然可以用\hspace命令调整子图的距离,子标题却只能和子图本身一样宽,会出现折行。为了避免子标题折行,一般在\subfloat里再嵌套个minipage,因为后者是有宽度的。
\begin{figure}[htbp]
\centering
\subfloat[子标题一]{
\label{fig:1}
\begin{minipage}[c]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{number_1.jpg}
\end{minipage}
}
\subfloat[子标题二]{
\label{fig:2}
\begin{minipage}[c]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{number_2.jpg}
\end{minipage}
}
\caption{两图水平排放,统一大标题,独立子标题}
\label{fig:2figs}
\end{figure}
方法二:使用宏包subfigure(推荐)
使用subfigure宏包提供的\subfigure命令,需要使用宏包\usepackage{graphicx}和\usepackage{subfigure},subfigure不支持\换行,可以把minipage放在subfigure{}中,在minipage{}里换行。
\begin{figure}
\centering
\subfigure[子标题一]{
\begin{minipage}[b]{0.2\textwidth}
\includegraphics[width=1\textwidth]{number_1.jpg}
\end{minipage}
\label{fig:hor_2figs_1cap_2subcap_1}
}
\subfigure[子标题二]{
\begin{minipage}[b]{0.2\textwidth}
\includegraphics[width=1\textwidth]{number_2.jpg}
\end{minipage}
\label{fig:hor_2figs_1cap_2subcap_2}
}
\caption{两图水平排放,统一大标题,独立子标题}
\label{fig:hor_2figs_1cap_2subcap}
\end{figure}
以上显示在单列。如果希望跨列显示,并且修改相应的宽度参数。
原文:https://vvingerfly.github.io/2018/02-16-Tex-imageTypesetting/
原文很好,在此收藏保留
边栏推荐
- 清览题库--C语言程序设计第五版编程题解析(1)
- pytorch框架学习(3)torch.nn.functional模块和nn.Module模块
- pytorch框架学习(5)torchvision模块&训练一个简单的自己的CNN (二)
- 【YOLOv5训练错误】权重文件出错?
- FPGA engineer interview questions collection 1~10
- Nexus_Warehouse Type
- Guys, the test in the idea uses FlinkCDC SQL to read Mysql data and write it into Kafka. The code creates
- GtkD开发之路
- FPGA engineer interview questions collection 21~30
- 实战小技巧19:List转Map List的几种姿势
猜你喜欢
随机推荐
OneFlow源码解析:算子指令在虚拟机中的执行
FPGA工程师面试试题集锦21~30
FPGA engineer interview questions collection 11~20
Transforming into a product, is it reliable to take the NPDP test?
手把手带你写嵌入式物联网的第一个项目
Order table delete, insert and search operations
8.STM32F407之HAL库——PWM笔记
An article to master the entire JVM, JVM ultra-detailed analysis!!!
What are the common commands of mysql
OpenGauss source code, is it maintained with VSCode in the window system?
FPGA engineer interview questions collection 41~50
Ask you guys.The FlinkCDC2.2.0 version in the CDC community has a description of the supported sqlserver version, please
基于Qiskit——《量子计算编程实战》读书笔记(三)
strongest brain (1)
How to simulate the background API call scene, very detailed!
Matlab simulation of multi-factor house price prediction based on BP neural network
Flutter development: error The following assertion was thrown resolving an image codec: Solution for Unable to...
SQL database field to append to main table
Talk about API Management - Open Source Edition to SaaS Edition
scikit-learn机器学习 读书笔记(一)