Latex插入以及引用图片,和图片的相关操作

1 导入宏包

在 LaTeX 中导入图片通常使用 graphicx 宏包中的 \includegraphics 命令。

\usepackage{graphicx}

2 导入图片

我的tex和imgs同级,1.jpg在imgs里面。

\begin{figure}[h]
  \centering
  \includegraphics[width=0.5\textwidth]{imgs/1} %后面写图片路径,基本路径或者相对路径。直接写图片名字,不需要后缀
  \caption{示例图片}
  \label{exampleId}
\end{figure}

%图片引用
图\ref{exampleId}

将图片放置在页面当前位置(h)(非强制性的),页面的顶部(t),或者在页面的底部(b),或者单独放置在一页(p)

设置图片路径

或者提取图片的路径,编辑器将会自己搜索

\documentclass[UTF8]{article}
\usepackage{CTEX}


\usepackage{graphicx}
\graphicspath{ {imgs} }
%\graphicspath{ {imgs} {imgs1} }  %多个图片路径声明

\title{测试图片位置}
\author{song}
\date{2024-4-8}
\begin{document}
   \maketitle
   Hello world!
   
   
\begin{figure}[h]
  \centering
  \includegraphics[width=0.5\textwidth]{1} % 直接写图片名字,不需要后缀
  \caption{示例图片}
  \label{exampleId}
\end{figure}

图片引用 图\ref{exampleId} (自动编号)

\end{document}

3 图片引用

%图片引用
\ref{exampleId}

在这里插入图片描述

4 相关操作

多个操作用英文逗号间隔

大小

宽度相关参数

单位意义单位意义
\textwidth栏宽\textheight栏高
\linewidth行宽\columnwidth列宽
\oddsidemargin奇数页页边距宽度\evensidemargin偶数页页边距宽度
\marginparwidth边注的宽度\marginparsep边注与正文之间的间距
\paperwidth纸张的宽度
\includegraphics[width=0.5\textwidth]{1}  
\includegraphics[height=0.2\textheight]{1}
\includegraphics[width=0.5\textwidth,height=0.2\textheight]{1}

旋转

\includegraphics[angle=45]{1}   % 逆时针旋转45度
\includegraphics[angle=-45]{1}  % 顺时针旋转45度

裁剪

trim必须和clip一起用才会生效

trim = <left> <bottom> <right> <top>, clip
  \includegraphics[width=0.5\textwidth, trim=2cm 4cm 2cm 2cm, clip]{1}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

不当菜虚困

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

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

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

打赏作者

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

抵扣说明:

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

余额充值