다음 코드를 사용하여 이 닫힌 영역을 외부 파일에 저장된 패턴으로 동봉된 패턴으로 채우는 방법은 무엇입니까?
\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{tikzpicture}[scale=.9, transform shape]
\node [thin, black] at (0,0) (i){x};
\draw [very thick, blue] (i.center) node (ii){} to [out=5, in=170] ++(0.:7.cm) -- +(-90:2.2cm) to [out=130, in=-170, looseness=.6] (ii.center) -- cycle;
\end{tikzpicture}
\end{frame}
\end{document}
답변1
Beamer가 graphicx
패키지를 로드하는 경우 이 패키지에서 사용할 수 있는 예제 이미지를 사용합니다.
path picture
섹션에 정의된 옵션을 사용합니다.일반화된 채우기: 임의의 그림을 사용하여 경로 채우기TikZ 매뉴얼의 내용입니다.
\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{tikzpicture}[scale=.9, transform shape]
\node [thin, black] at (0,0) (i){};
\draw [very thick, blue] (i.center) node (ii){} to [out=5, in=170] ++(0.:7.cm) -- +(-90:2.2cm) to [out=130, in=-170, looseness=.6] (ii.center) -- cycle
[path picture={\node at (path picture bounding box.center) {\includegraphics{example-image}};}];
\end{tikzpicture}
\end{frame}
\end{document}
이미지 크기
@zarko가 올바르게 지적했듯이 이미지가 경로보다 커야 합니다. 그렇지 않으면 구멍이 있습니다.
해결책은 여기에서 배율 계수를 사용하는 것입니다 scale=1.4
.
\documentclass{article}
\usepackage[margin=10mm]{geometry}
\usepackage{graphicx,mwe,tikz}
\begin{document}
\Huge{SCALE=1}
\smallskip
\newcommand{\facteur}{1}
\begin{tikzpicture}
\node [thin, black] at (0,0) (i){};
\node[] at (i.center){\includegraphics[scale=\facteur]{example-image}};
\draw [very thick, blue,fill=cyan!80,fill opacity=.5] (-2.7,1) node (ii){} to [out=5, in=170] ++(0.:7.cm) -- +(-90:2.2cm) to [out=130, in=-170, looseness=.6] (ii.center) -- cycle
[path picture={\node at (path picture bounding box.center) {\includegraphics[scale=\facteur]{example-image}};}];
\draw(current bounding box.south east)rectangle(current bounding box.north west);
\end{tikzpicture}
\bigskip
\Huge{SCALE=1}
\smallskip
\begin{tikzpicture}
\node [thin, black] at (0,0) (i){};
\node[] at (i.center){\includegraphics[scale=\facteur]{example-image-duck}};
\draw [very thick, blue,fill=cyan!80,fill opacity=.5] (-2.7,1) node (ii){} to [out=5, in=170] ++(0.:7.cm) -- +(-90:2.2cm) to [out=130, in=-170, looseness=.6] (ii.center) -- cycle
[path picture={\node at (path picture bounding box.center) {\includegraphics[scale=\facteur]{example-image-duck}};}];
\draw(current bounding box.south east)rectangle(current bounding box.north west);
\end{tikzpicture}
\renewcommand{\facteur}{1.4}
\bigskip
\Huge{SCALE=1.4}
\smallskip
\begin{tikzpicture}
\node [thin, black] at (0,0) (i){};
\node[] at (i.center){\includegraphics[scale=\facteur]{example-image-duck}};
\draw [very thick, blue,fill=cyan!80,fill opacity=.5] (-2.7,1) node (ii){} to [out=5, in=170] ++(0.:7.cm) -- +(-90:2.2cm) to [out=130, in=-170, looseness=.6] (ii.center) -- cycle
[path picture={\node at (path picture bounding box.center) {\includegraphics[scale=\facteur]{example-image-duck}};}];
\draw(current bounding box.south east)rectangle(current bounding box.north west);
\end{tikzpicture}
\end{document}
답변2
이와 같이?
귀하의 패턴 파일이 없기 때문에 패키지 example-image-duck
에 정의되어 있습니다 graphicx
.
MWE:
\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{frame}
\frametitle{}
\begin{tikzpicture}[scale=.9, transform shape]
\coordinate (i);
\path[preaction={draw=blue!50, ultra thick},clip]
(i) to [out=5, in=170] ++(0.:7.cm) -- +(-90:2.2cm)
to [out=130, in=-170, looseness=.6] (i);
\node (j) [minimum width=\linewidth, minimum height=0.5\linewidth,
right=-5mm of i]
{\includegraphics[width=\linewidth]{example-image-duck}};
\end{tikzpicture}
\end{frame}
\end{document}