Latex之图片排列的简单使用(以MiKTeX工具为例)

news2024/10/5 19:20:33

一、参考资料

Latex如何插入图片
Latex 学术撰写工具推荐(在线、Windows、Mac、Linux)
关于Latex并排多张图片及加入图片说明的方法

二、准备工作

1. 在线LaTex工具

Overleaf

2. 本地LaTex工具

MiKTeX

3. 测试用例

\documentclass{article} 
\title{A Test for TeXstudio} 
\author{Dale} 
\begin{document} 
	\maketitle
	\tableofcontents 
	\section{Hello China} China is in East Asia. 
	\subsection{Hello Beijing} Beijing is the capital of China. 
	\subsubsection{Hello Dongcheng District} 
	\paragraph{Hello Tian'anmen Square}is in the center of Beijing 
	\subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square 
\end{document} 

输出结果

在这里插入图片描述

三、图片排列

图片路径:若图片与源代码在同一路径,则引用相对路径即可,否则引用绝对路径。通常将图片放在与latex文档相同的路径下。

图片格式:图片格式采用 .eps 矢量格式会更清晰;

1. 单张图片

\documentclass{article}
\usepackage{graphicx}  % 插入图片所需引入的宏包
\graphicspath{{Figures/}{logo/}}  % 图片文件夹
\begin{document}  
\begin{figure}[htbp]  % 调整图片排版位置选项
	\centering
	\begin{minipage}{0.9\linewidth} 
		\centerline{\includegraphics[width=\textwidth]{2.png}}  % 插入图片
		\centerline{image1}   % 插入图注
	\end{minipage}
	
	\caption{Visual comparisons of original models.  }
	\label{fig4}
\end{figure}
\end{document} 

参数解释

  • \usepackage{graphicx} 为插入图片所需引入的宏包;
  • [htbp] 为调整图片排版位置选项
    • [h] 当前位置。将图形放置在正文文本中给出该图形环境的地方。如果本页所剩的页面不够,这一参数将不起作用。
    • [t] 顶部。将图形放置在页面的顶部。
    • [b] 底部。将图形放置在页面的底部。
    • [p] 浮动页。将图形放置在一只允许有浮动对象的页面上。
  • \centering 为图片居中命令;
  • \includegraphics{1.jpg} 用于插入图片,可用 [ ] 添加图片尺寸,例如:\includegraphics[width=9.5cm,height=8cm]{1.png},花括号中为图片相对路径。若图片较多,可存放文件夹中,添加 \graphicspath{{Figures/}{logo/}}Figures 为与源代码相同路径的用于存放图片的文件夹,{logo/} 可省略,但 {/Figures} 仍要有大括号。;
  • \caption 用于插入图注,其应用在 \includegraphics 的下方即将图注插在图片下方,反之亦然。
  • /label{} 用于加标签,通过 /ref{} 于正文中引用。\label 要放在 \caption 之后,否则在引用过程中会出现引用错误。

输出结果

在这里插入图片描述

2. 一行多列

利用 \begin{minipage}{0.32\linewidth} 来进行分列。

\documentclass{article}
\usepackage{graphicx}  % 插入图片所需引入的宏包
\graphicspath{{Figures/}{logo/}}  % 图片文件夹
\begin{document}  
\begin{figure}[htbp]  % 调整图片排版位置选项
	\centering
	\begin{minipage}{0.32\linewidth}  % 分列
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}  % 插入图片
		\centerline{image1}   % 插入图注
	\end{minipage}
	\begin{minipage}{0.32\linewidth}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\centerline{image2}
	\end{minipage}
	\begin{minipage}{0.32\linewidth}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\centerline{image3}
	\end{minipage}
 
	\caption{Visual comparisons of original models.  }
	\label{fig4}
\end{figure}
\end{document} 

参数解释

  • \begin{minipage}{0.32\linewidth} 用于分列。{0.32\linewidth} 表示控制列的宽度,如果是两列,则是1除以2,然后减去0.1,切记多列的宽度加起来不要等于1,否则可能因为空间不足,latex会自动换行;

输出结果

在这里插入图片描述

3. 一列多行

\begin{minipage} 中放多个 \centerline{\includegraphics[width=\textwidth]{ablation/2.png}} 可以实现多行。

\documentclass{article}
\usepackage{graphicx}  % 插入图片所需引入的宏包
\usepackage{float}  %设置图片浮动位置的宏包
\graphicspath{{Figures/}{logo/}}  % 图片文件夹
\begin{document}  
\begin{figure}[H]  % 调整图片排版位置选项
	\centering  %图片全局居中
	\vspace{3pt} %设置整体与上面正文的距离
	\begin{minipage}{0.7\linewidth}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\centerline{image1}
		%\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\centerline{image2}
		%\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\centerline{image3}
	\end{minipage}

	\caption{Visual comparisons of original models.  }
	\label{fig4}
\end{figure} 
\end{document} 

在这里插入图片描述

4. 两列多行

\documentclass{article}
\usepackage{graphicx}  % 插入图片所需引入的宏包
\usepackage{float}  %设置图片浮动位置的宏包
\graphicspath{{Figures/}{logo/}}  % 图片文件夹
\begin{document}  
\begin{figure}[H]  % 调整图片排版位置选项
	\centering  %图片全局居中
	\vspace{3pt} %设置整体与上面正文的距离
	 \begin{minipage}{0.48\linewidth}
	     \centerline{\includegraphics[width=\textwidth]{2.png}}
		 \vspace{3pt}
	     \centerline{\includegraphics[width=\textwidth]{2.png}}
		 \vspace{3pt}
	     \centerline{\includegraphics[width=\textwidth]{2.png}}
		 \vspace{3pt}
	     \centerline{\includegraphics[width=\textwidth]{2.png}}
		 \vspace{3pt}
	     \centerline{\includegraphics[width=\textwidth]{2.png}}
		 \vspace{3pt}
	     \centerline{\includegraphics[width=\textwidth]{2.png}}
	     \centerline{image1}
	 \end{minipage}
	  \begin{minipage}{0.48\linewidth}
	     \centerline{\includegraphics[width=\textwidth]{2.png}}
		 \vspace{3pt}
	     \centerline{\includegraphics[width=\textwidth]{2.png}}
		 \vspace{3pt}
	     \centerline{\includegraphics[width=\textwidth]{2.png}}
		 \vspace{3pt}
	     \centerline{\includegraphics[width=\textwidth]{2.png}}
		 \vspace{3pt}
	     \centerline{\includegraphics[width=\textwidth]{2.png}}
		 \vspace{3pt}
	     \centerline{\includegraphics[width=\textwidth]{2.png}}
	     \centerline{image2}
	 \end{minipage}

	\caption{Visual comparisons of original models (SCRN)  }
	\label{fig4}
\end{figure}
\end{document}   

输出结果

在这里插入图片描述

5. 多列多行

\documentclass{article}
\usepackage{graphicx}  % 插入图片所需引入的宏包
\usepackage{float}  %设置图片浮动位置的宏包
\graphicspath{{Figures/}{logo/}}  % 图片文件夹
\begin{document}  
\begin{figure}[H]  % 调整图片排版位置选项
	\begin{minipage}{0.32\linewidth}
	 	\vspace{3pt}
	 	\centerline{\includegraphics[width=\textwidth]{2.png}}
	 	\vspace{3pt}
	 	\centerline{\includegraphics[width=\textwidth]{2.png}}
	 	\vspace{3pt}
	 	\centerline{\includegraphics[width=\textwidth]{2.png}}
	 	\vspace{3pt}
	 	\centerline{\includegraphics[width=\textwidth]{2.png}}
	 	\vspace{3pt}
	 	\centerline{\includegraphics[width=\textwidth]{2.png}}
	 	\vspace{3pt}
	 	\centerline{\includegraphics[width=\textwidth]{2.png}}
	 	\vspace{3pt}
	 	\centerline{Image}
	 \end{minipage}
	 \begin{minipage}{0.32\linewidth}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\vspace{3pt}
		\centerline{Image}
	\end{minipage}
	\begin{minipage}{0.32\linewidth}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\vspace{3pt}
		\centerline{\includegraphics[width=\textwidth]{2.png}}
		\vspace{3pt}
		\centerline{Image}
	\end{minipage}
\end{figure}
\end{document} 

输出结果

在这里插入图片描述

四、Subfigure

subfigure官方文档:The subfigure Package
LATEX使用subfigure命令插入多行多列图片并且为子图模式 修改子图与子图、子标题的距离

\documentclass{article}
\usepackage{graphicx}  %插入图片的宏包
\usepackage{float}  %设置图片浮动位置的宏包
\usepackage{subfigure}  %插入多图时用子图显示的宏包
\graphicspath{{Figures/}{logo/}}  % 图片文件夹
\begin{document}  
\begin{figure}[H] %设置图片浮动
	\centering  %图片全局居中
	\vspace{-0.35cm} %设置整体与上面正文的距离
	\subfigtopskip=2pt %设置子图与上面正文的距离
	\subfigbottomskip=2pt %设置第二行子图与第一行子图的距离,即下面的头与上面的脚的距离
	\subfigcapskip=-5pt %设置子图与子标题之间的距离
	\subfigure[image1]{
		\label{1}
		\includegraphics[width=0.32\linewidth]{2.png}}
	\quad %默认情况下两个子图之间空的较少,使用这个命令加大宽度
	\subfigure[image2]{
		\label{2}
		\includegraphics[width=0.32\linewidth]{2.png}}
	  %这里空一行,能够实现强制将四张图分成两行两列显示,而不是放不下图了再换行
	\subfigure[image3]{
		\label{3}
		\includegraphics[width=0.32\linewidth]{2.png}}
	\quad
	\subfigure[image4]{
		\label{4}
		\includegraphics[width=0.32\linewidth]{2.png}}

	\caption{Visual comparisons of original models.  }
	\label{level}
\end{figure}
\end{document} 

输出结果

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1793989.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

AWS EC2服务器开启root密码,SSH登录

1) EC2 Instance Connect连接,更改root密码 sudo passwd root 2)接着切换到切换到 root 身份,编辑 SSH 配置文件 $ sudo -i$ vi /etc/ssh/sshd_configPasswordAuthentication no,把 no 改成 yes #PermitRootLogin prohibit-passw…

SSM旅游论坛(前后分离源码+论文)

该旅游论坛是基于Spring、SpringMVC、Mybatis框架开发出来的 用户信息管理 此页面提供给管理员的功能有:用户信息的查询管理,可以删除用户信息、修改用户信息、新增用户信息, 还进行了对用户名称的模糊查询的条件 景点信息管理 论坛类型管理…

体验SmartEDA:颠覆传统,设计流程更流畅,超越Multisim与Proteus!

在电子设计自动化(EDA)领域,传统软件如Multisim和Proteus一直是工程师们的得力助手。然而,随着科技的飞速发展和用户需求的不断升级,一个全新的EDA平台——SmartEDA正崭露头角,凭借其更为流畅的设计流程&am…

Github Copilot登录账号,完美支持chat

Github Copilot 代码补全等功能,提高写代码的效率 https://web.52shizhan.cn/activity/copilot 登录授权后,已经可以使用,完美。如图

虚拟处理器和线程

本文主要介绍以下内容: 线程及多线程结构描述UNIX 下的虚拟处理器是如何实现的列出和解释虚拟处理器类别描述服务器如何处理网络连接设置与 VP 和线程相关的服务器配置参数动态添加和移除虚拟处理器 1. 线程 线程是程序中正在执行的一段指令序列。 当多个线程在一…

学习请求接口

axios的方法 方法一 方法二 方式三 方式四 ajax请求 fetch请求 学习一下

前复权、后复权,技术分析看哪个?价值投资呢?

先说结论, 前复权可以实现技术指标的连续性,适合技术分析, 后复权可以实现股价走势的连续性,适合价值投资者 ​ 从头来说,一家公司盈利后,可以选择用盈利购买新的生产设备或者拓展生产,但是…

【打印功能】js简单实现表格样式的数据打印,按样式打印出来

效果图 代码部分&#xff0c;简单三步 1&#xff0c;html部分&#xff1a;写一个表格&#xff0c;然后数据填进去 <div id"printable-area" v-show"false"><div><div style"text-align: center;height: 40px;line-height: 40px;font…

联想Y410P跑大模型

安装vs 2017 查看GPU版本 查看支持哪个版本的cuda windows cuda更新教程_cuda 12.0-CSDN博客 下载并安装cuda tookit 10.1 CUDA Toolkit 10.1 Update 2 Archive | NVIDIA Developer 找到下载的文件&#xff0c;安装 参考安装链接 Win10 Vs2017 CUDA10.1安装&#xff08;避坑…

金融科技赋能跨境支付:便捷与安全并驾齐驱

一、引言 在全球经济一体化的背景下,跨境支付作为国际贸易和金融活动的重要组成部分,正迎来金融科技浪潮的洗礼。金融科技以其独特的创新性和颠覆性,正在重塑跨境支付市场的格局,使其更加便捷、高效且安全。本文旨在探讨金融科技如何助力跨境支付,实现便捷与安全并存,并…

Linux进程无法被kill

说明&#xff1a;记录一次应用进程无法被kill的错误&#xff1b; 场景 在一次导出MySQL数据时&#xff0c;使用下面的命令&#xff0c;将数据库数据导出为.sql文件&#xff0c;数据量大&#xff0c;导出时间长&#xff0c;于是我就将服务器重启了。 mysqldump -u username -…

C++:list模拟实现

hello&#xff0c;各位小伙伴&#xff0c;本篇文章跟大家一起学习《C&#xff1a;list模拟实现》&#xff0c;感谢大家对我上一篇的支持&#xff0c;如有什么问题&#xff0c;还请多多指教 &#xff01; 如果本篇文章对你有帮助&#xff0c;还请各位点点赞&#xff01;&#xf…

Python接口自动化测试:Json 数据处理实战

&#x1f345; 视频学习&#xff1a;文末有免费的配套视频可观看 &#x1f345; 点击文末小卡片 &#xff0c;免费获取软件测试全套资料&#xff0c;资料在手&#xff0c;涨薪更快 上一篇说了关于json数据处理&#xff0c;是为了断言方便&#xff0c;这篇就带各位小伙伴实战一下…

vue3+elementPlus实现Radio单选切换显示不同内容

el-radio-group 组件方法&#xff1a; <template><el-radio-group v-model"radio"><el-radio :value"0">阶梯达标</el-radio><el-radio :value"1">限时达标</el-radio></el-radio-group> </templ…

ElementUI之el-tooltip显示多行内容

ElementUI之el-tooltip显示多行内容 文章目录 ElementUI之el-tooltip显示多行内容1. 多行文本实现2. 实现代码3. 展示效果 1. 多行文本实现 展示多行文本或者是设置文本内容的格式&#xff0c;使用具名 slot 分发content&#xff0c;替代tooltip中的content属性。 2. 实现代码 …

​谁用谁知道,教师实用工具分享​

老师们面临着日益增长的教学和管理任务。为了有效提升工作效率&#xff0c;一些实用的工具成为了老师们不可或缺的助手。给大家分享几款教师必备的工具&#xff0c;帮助教师们在教学和管理工作中更加得心应手。 1. 知乎&#xff1a;知识的海洋 知乎是一个中文问答社区&#xf…

在Jenkins 中使用 NVM 管理 Node.js 部署项目的自动化脚本

在Jenkins 中使用 NVM 管理 Node.js 部署项目的自动化脚本 人生旅途&#xff0c;总有人不断地走来&#xff0c;有人不断地离去。当新名字变成老名字&#xff0c;当老的名字渐渐模糊&#xff0c;又是一个故事的结束和另一个故事的开始。 在现代软件开发中&#xff0c;持续集成/持…

线上虚拟展厅的6大优势

随着科技的日新月异&#xff0c;线上VR虚拟展厅已崭露头角&#xff0c;成为企业创新的营销利器。它凭借沉浸式的交互体验、全球市场的无缝拓展以及显著降低的营销成本&#xff0c;为企业的营销活动带来了颠覆性的变革。那么&#xff0c;视创云展的线上VR虚拟展厅究竟具备哪些引…

NSSCTF-Web题目5

目录 [SWPUCTF 2021 新生赛]error 1、题目 2、知识点 3、思路 [LitCTF 2023]作业管理系统 1、题目 2、知识点 3、思路 [HUBUCTF 2022 新生赛]checkin 1、题目 2、知识点 3、思路 [SWPUCTF 2021 新生赛]error 1、题目 2、知识点 数据库注入、报错注入 3、思路 首先…

UE4 使用样条线做鱼儿封闭路径动画

描述&#xff1a;鱼儿的游动动画的特点 1.通常是始终保持Y (Pitch)轴角度不变 2.调头的时候改变的是Z轴角度 效果&#xff1a;调头的时候比较自然 蓝图&#xff1a; 为了让鱼儿有恒定的游动速度&#xff0c;增加以下蓝图节点&#xff0c;游动速度为50 最后&#xff0c;让鱼…