TikZ 创建的移动标签

TikZ 创建的移动标签

我是 TikZ 新手。我手上有一张图像,使用 TikZ 创建了标签。如何使用 TikZ 将标签移动到图像顶部?以下是我使用的代码:

\documentclass{article}
\usepackage[usenames,dvipsnames,pdftex]{xcolor}
\usepackage{tikz,ifthen}
\usepackage{pinlabel, xcolor,vruler}  
\pdfcompresslevel=0
\pdfobjcompresslevel=0

\begin{document}

\begin{figure}[ht!]

\centering
\psfig{file=fig1,scale=85}
%\caption{A concordance between $K$ and the unknot}
\label{fig:cobo}
\end{figure}
%%following code is the label code 
%I have to move the label to top of the image   
\centering
\begin{tikzpicture}
\draw (-12,12) node {A};
\draw (-9,14) node {$\alpha$};
\draw (-5,11) node {$\beta$};
\draw (-3,16) node {$\gamma$};

\end{tikzpicture}
\end{document}

有什么解决办法吗?

答案1

作为纯粹的猜测并有助于改进您的问题......

\documentclass{article}
\usepackage[usenames,dvipsnames,pdftex]{xcolor}
\usepackage{tikz}
\usepackage{graphicx}
%\pdfcompresslevel=0
%\pdfobjcompresslevel=0

\begin{document}

\begin{figure}[ht!]
\centering
\begin{tikzpicture}\Large
\node (n1) [inner sep=0pt] {\includegraphics[width=\textwidth]{example-image}};
\draw
    (n1.north west) --  node[pos=0.25,above]  {$\alpha$}
                        node[pos=0.50,above]  {$\beta$}
                        node[pos=0.75,above]  {$\gamma$}
    (n1.north east);
\end{tikzpicture}

\caption{A concordance between $K$ and the unknot}
\label{fig:cobo}
\end{figure}
%%following code is the label code
%I have to move the label to top of the image
\centering
\end{document}

在此处输入图片描述

相关内容