LaTeX使用tikz-imagelabels宏包在图片上添加标签、文字等

本文参考Package documentationhttp://mirrors.ctan.org/graphics/pgf/contrib/tikz-imagelabels/tikz-imagelabels.pdf

 (2019年6月27日版本的文档)

如果需要添加更复杂的元素,如矩形等,可参考我的下一篇博文

LaTeX在图片上面使用onimage宏包画TikZ(如矩形、文字)的方法icon-default.png?t=L892https://blog.csdn.net/yihuajack/article/details/120383009

目录

1. 简介

2. 用法

2.1 包含图像

2.2 添加标签

2.3 添加标注

3. 风格设置


1. 简介

案例:

 代码如下:

\begin{annotationimage}{width=6cm}{pleiades.jpg}
\draw[annotation left = {Atlas at 0.3}] to (0.11,0.4);
\draw[annotation left = {Pleione at 0.55}] to (0.11,0.49);
\draw[annotation left = {Alcyone at 0.8}] to (0.39,0.45);
\draw[annotation below = {Merope at 0.5}] to (0.58,0.28);
\draw[annotation right = {Electra at 0.3}] to (0.84,0.45);
\draw[annotation right = {Caleano at 0.75}] to (0.85,0.64);
\draw[annotation above = {Maia at 0.4}] to (0.67,0.72);
\draw[annotation above = {Taygeta at 0.9}] to (0.78,0.82);
\draw[image label = {M45 at south east}];
\end{annotationimage}

2. 用法

2.1 包含图像

annotationimage[<grid>]{<options>}{<file name>}

<grid> 选项可以在原图上加上网格:>

 <option> 选项可以是 \includegraphics 命令的任何选项,如 width=、height= 等。

2.2 添加标签

方法是使用 \draw 宏:

\draw[image label = {<text> at <placement>}];

placement 可以是 north west, north, north east, east, south east, south, south west 或 west,如图所示:

或者可以使用坐标来打标签:

\draw[coordinate label = {<text> at (<coordinate>)}];

例如:

代码为

\draw[coordinate label = {1 at (0.1,0.3)}];
\draw[coordinate label = {2 at (0.4,0.6)}];
\draw[coordinate label = {3 at (0.65,0.25)}];
\draw[coordinate label = {4 at (0.9,0.4)}];
\draw[coordinate label = {5 at (0.62,0.62)}];
\draw[coordinate label = {6 at (0.83,0.8)}];
\draw[image label = {M45 at south east}];

2.3 添加标注

语法为:

\draw[annotation <placement> = {<text> at <position>}] to (<x>, <y>);

<placement> 选项尾:above, right, below 或 left。例如

\draw[annotation left = {Atlas at 0.3}] to (0.11,0.4);

会把文字“Atlas”标注在图像是左手边,y=0.3 的位置处,箭头指向 (0.11, 0.4)。

3. 风格设置

 默认风格为:

\imagelabelset{
coarse grid color = red,
fine grid color = gray,
image label font = \sffamily\bfseries\small,
image label distance = 2mm,
image label back = black,
image label text = white,
coordinate label font = \sffamily\bfseries\scriptsize,
coordinate label distance = 2mm,
coordinate label back = black,
coordinate label text = white,
annotation font = \normalfont\small,
arrow distance = 1.5mm,
border thickness = 0.6pt,
arrow thickness = 0.4pt,
tip size = 1.2mm,
outer dist = 0.5cm,
}
  • 3
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Ayka

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

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

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

打赏作者

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

抵扣说明:

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

余额充值