Use \ref como parte de um gráfico

Use \ref como parte de um gráfico

É possível fazer uma referência como parte de um gráfico incluído em um documento LaTeX?
Em caso afirmativo, qual seria o formato preferido para tal gráfico (EPS, ...)?

Brincar:

Brincar

Estou usando o pdflatex para compilar.

Responder1

Uma maneira de fazer isso seria colocar o \includegraphics{...}interior de um TikZ nodee depois colocar outro nodeem cima da imagem com TikZ, onde este nó contém o \ref{...}ou o \label{...}comando, dependendo se você deseja uma referência ou um rótulo dentro do foto.

O código abaixo para sobrepor usando TikZ com o \includegrpahics{...}é retirado deessa questãoem TeX.SX.

O varwidthpacote é usado para colocar um enumerateambiente dentro de um TikZ node. Veresta respostapara uma explicação.

\documentclass{article}

\usepackage{tikz}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{varwidth}

\begin{document}

Here, we will reference a label that is set on top of the picture with \verb|tikz| (\ref{fig:1}).

\begin{figure}[h!]
\centering
\begin{tikzpicture}
    \node at (0,0) {\includegraphics[width=.6\textwidth]{example-image}};
    \node at (1.2,2) {\begin{varwidth}{2in}\begin{enumerate}[label={Fig.~\arabic*}]\item{Hi, let's reference this\label{fig:1}}\end{enumerate}\end{varwidth}};
\end{tikzpicture}
\end{figure}

Here, we will do the opposite of this; we will put the \verb|\ref{...}| inside the \verb|node|, as a reference to example 1:

\begin{enumerate}

    \item{\label{ex:1}Example 1}

\end{enumerate}

\begin{figure}[h!]
\centering
\begin{tikzpicture}
    \node at (0,0) {\includegraphics[width=.6\textwidth]{example-image}};
    \node at (1.2,2) {Look at example~\ref{ex:1}};
\end{tikzpicture}
\end{figure}

\end{document}

insira a descrição da imagem aqui

informação relacionada