회고록의 하위 그림에 Tikz 오버레이

회고록의 하위 그림에 Tikz 오버레이

문서 조판에 다음 코드가 있다고 가정해 보겠습니다 memoir.

\begin{figure}
\centering
\subbottom[]{
\label{sub1}
\includegraphics[width=0.4\linewidth]{test.png}}%
\subbottom[]{
\label{sub2}
\includegraphics[width=0.4\linewidth]{test.png}}%
\caption{\subcaptionref{sub1}: Left of the figure. \subcaptionref{sub2}: Right of the figure}
\end{figure}

그러면 다음 그림이 생성됩니다.

여기에 이미지 설명을 입력하세요

각 이미지에 일부 텍스트와 수학 공식을 오버레이할 수 있기를 원합니다(각 이미지에 대한 좌표 포함).

나는 다음 두 게시물을 읽었습니다.

나는 그 중 첫 번째에서 설명한 솔루션, 즉 tikz명령을 사용하여 텍스트와 수식을 오버레이하는 솔루션을 정말 좋아합니다.

그러나 그들이 제공하는 예제에는 환경을 사용해야 하므로 회고록의 하위 그림에 tikzpicture사용할 수 없는 것 같습니다 .\subbottom[]

tikzpicture and함께 범위를 어떻게 사용할 수 있나요 ?subbottommemoir

예를 들어 $\phi$왼쪽 하위 그림 중앙에 기호를 오버레이하고 $\psi$오른쪽 하위 그림 중앙에 기호를 오버레이한다고 가정해 보겠습니다(둘 다 작은 흰색 상자 안에 있음).

답변1

tikz 방식을 요청하셨는데 여기에 하나가 있습니다. 물론 코드를 많이 정리하고 명령 등을 만들 수 있지만 아래 예에서는 가능한 방법을 보여줍니다.

\documentclass{memoir}

\usepackage{graphicx}
\newsubfloat{figure}
\usepackage{tikz}

\begin{document}

\begin{figure}
\centering
\subbottom[]{%
\label{sub1}
\begin{tikzpicture}[inner sep=0pt,remember picture]
\node at (0,0) {\includegraphics[width=0.4\linewidth]{test.jpg}};
\node[fill=green!20] (a) at (1,1) {A node};
\end{tikzpicture}
}%
\subbottom[]{
\label{sub2}
\begin{tikzpicture}[inner sep=0pt,remember picture]
\node at (0,0) {\includegraphics[width=0.4\linewidth]{test.jpg}};
\node[fill=red!20] (b) at (0.5,0.5) {A node};
\end{tikzpicture}
}%
\begin{tikzpicture}[remember picture,overlay]
 \draw[->,red,very thick] (a) to[bend right] (b);
\end{tikzpicture}

\caption{\subcaptionref{sub1}: Left of the figure. \subcaptionref{sub2}: Right
of the figure}
\end{figure}

\end{document}

기본적으로 당신은 노드의 그림을 제외하고 상단에 다른 노드를 제외하고는 할 수 있습니다. tikz에게 노드를 기억하라고 지시하면 나중에 해당 노드를 연결할 수 있습니다.

여기에 이미지 설명을 입력하세요

답변2

이를 위해 실제로 TikZ가 필요하지 않습니다. 그러나 그래픽 오버레이 측면에서 더 많은 자유와 가변성을 허용합니다. 있는 그대로 다음을 통해 오버레이가 가능합니다 \ooalign.

여기에 이미지 설명을 입력하세요

\documentclass{memoir}% http://ctan.org/pkg/memoir
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\newsubfloat{figure}% Allows \subbottom and \subtop in figure
\newsavebox{\myfig}
\begin{document}
\begin{figure}
  \centering
  \savebox{\myfig}{\includegraphics[width=0.4\linewidth]{tiger}}% Store image
  \subbottom[]{%
    \label{sub1}%
    \ooalign{\usebox{\myfig}\cr\hss\raisebox{\dimexpr.5\ht\myfig-.5\baselineskip}{\colorbox{white}{\Huge$\phi$}}\hss}}%
  \subbottom[]{%
    \label{sub2}%
    \usebox{\myfig}}%
  \caption{\subcaptionref{sub1}:~Left of the figure. \subcaptionref{sub2}:~Right of the figure}
\end{figure}
\end{document}

\myfig이미지는 적절한 높이를 얻기 위해( 를 통해) 상자( )에 설정됩니다 \ht\myfig. \ooalign이중 콘텐츠(이미지 및 수식)를 오버레이하는 동시에 \raisebox수식을 수직 위치로 이동합니다.

보다이 답변에 대한 빠른 강좌를 원하시면 \ooalign.

관련 정보