LaTeX中的插图

LaTeX中的插图

在LaTeX中,是使用graphicx宏包实现插图的。

我们需要用“usepackage”来引入“graphicx”宏包。

然后在文档中用includegraphics插入图像。

该命令的必选参数,用于指定需要插入的图像文件的文件名,其可选参数用于指定图像的缩放比例,旋转等。

当使用XeLaTeX编译时,graphicx宏包支持多种图像文件格式。

还可以使用graphicspath指定图像文件的搜索路径。将图像等资源文件进行分门别类管理。

(1)将图片存放的文件夹figures与pics与tex文件夹放在同一个目录下。

image-20220203233033850

(2)用graphicspath命令来指定搜索路径为当前路径下的figures文件夹。

也可以添加其他路径,要用大括号实现分组。

image-20220203233151312

(3)用includegraphics命令来插入图像。

暂时不需要第一个可选参数。用第二个必选参数指定文件名。

image-20220203233524809

编译运行,查看结果:

image-20220203234028856

也可以加上文件的后缀名。

image-20220203234436399

(4)调整图片大小

我们可以看到,图片太大,显示不完全。

我们可以为includegraphics引入可选参数。

可选参数用方括号[ ]表示。

image-20220203235302670

版型文本高度0.1倍的图像高度。

image-20220203235651062

版型文本宽度0.2倍的图像宽度。

image-20220203235810854

也可以同时指定多个参数。不同参数之间用逗号进行分割。

image-20220204000049923

运行结果:

image-20220204000532990

image-20220204000552451

image-20220204000607850

image-20220204000625664

关于这些命令的细节,我们可以打开dos命令(WIn+R输入cmd),然后输入“texdoc graphicx”。

image-20220204000921349

可以自行查阅,只不过全是英文哈哈。

image-20220204001000977

最后附上全部代码,供大家学习使用!

% 导言区
\documentclass{ctexart}

%usepackage{ctex}

%导言区:\usepackage{graphicx}
%语法:\includegraphics[<选项>]{<文件名>}
%格式:EPS,PDF,PNG,JPEG,BMP
\usepackage{graphicx}
\graphicspath{{figures/},{pics/}} %图片在当前目录下的figures目录


%正文区(文稿区)
\begin{document}
    \LaTeX{}中的插图:

    \includegraphics{one.jpeg}
    \includegraphics{two.png}

    \includegraphics[scale=0.3]{one}
    \includegraphics[scale=0.03]{two}

    \includegraphics[height=2cm]{one}
    \includegraphics[height=2cm]{two}

    \includegraphics[width=2cm]{one}
    \includegraphics[width=2cm]{two}

    \includegraphics[height=0.1\textheight]{one}
    \includegraphics[height=0.1\textheight]{two}

    \includegraphics[width=0.2\textwidth]{one}
    \includegraphics[width=0.2\textwidth]{two}

    \includegraphics[angle=-45,width=0.2 \textwidth]{one}
    \includegraphics[angle=45,width=0.2\textwidth]{two}
\end{document}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

雨翼轻尘

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值