\documentclass[11pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[left=3.00cm, right=3.00cm, top=3.00cm, bottom=3.00cm]{geometry}
\usepackage{blindtext}
%%Color/Tikz
\usepackage{xcolor}
\definecolor{myRed}{HTML}{ff6347}
\definecolor{myOrange}{rgb}{1,0.5,0}
\usepackage{tikz}
\usepackage{float}
\begin{document}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] at (.15\columnwidth,0) {\includegraphics[width=.7\columnwidth]{froggy}};
\draw[black,ultra thick,rounded corners] (7.5,5.3) circle (.35\columnwidth);
\end{tikzpicture}
\end{document}
虽然它在某种程度上“有效”,但并不完美。有人能帮我吗?这是我做错的部分:
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] at (.15\columnwidth,0) {\includegraphics[width=.7\columnwidth]{froggy}};
\draw[black,ultra thick,rounded corners] (7.5,5.3) circle (.35\columnwidth);
\end{tikzpicture}
问题:边框几乎正确覆盖了图像。但是左上角和左下角有 1 毫米左右的空白。这个小东西让我抓狂。
图像问题
答案1
skins
库中添加了允许使用定义的图像或图片填充路径 tcolorbox
的选项:TikZ
\documentclass[11pt,a4paper]{report}
\usepackage{tikz}
\usepackage[skins]{tcolorbox}
\begin{document}
\begin{tikzpicture}
\draw[black,ultra thick,fill zoom image=frog] (7.5,5.3) circle (.35\columnwidth);
\end{tikzpicture}
\begin{tikzpicture}
\draw[black,ultra thick,fill zoom image=frog, rounded corners] (0,0)--(45:3cm)-|++(3,-5)--cycle;
\end{tikzpicture}
\end{document}
答案2
我没有完全理解你的问题,因为我没有图片froggy
。在这里我删除了未使用的代码并替换froggy
为example-image-a
。通过制作outer sep=0
并从圆直径中减去线宽,它完美地覆盖了图像:
\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[anchor=south west, inner sep=0, outer sep=0] at (0, 0) {\includegraphics[width=.7\columnwidth]{example-image-a}};
\draw[ultra thick] (.35\columnwidth, .35\columnwidth) circle (.35\columnwidth-0.5\pgflinewidth);
\end{tikzpicture}
\end{document}