我有在 TpX 中生成的 Tikz 代码:
\begin{figure}
\centering
\begin{tikzpicture}[x=1.00mm, y=1.00mm, inner xsep=0pt, inner ysep=0pt, outer xsep=0pt, outer ysep=0pt]
\path[line width=0mm] (-32.00,-5.73) rectangle +(175.14,83.73);
\definecolor{L}{rgb}{1,0,0}
\path[line width=0.30mm, draw=L] (101.00,73.00) ellipse (5.00mm and 3.00mm);
\path[line width=0.30mm, draw=L] (110.00,73.00) -- (106.50,73.00);
\definecolor{F}{rgb}{1,0,0}
\path[line width=0.30mm, draw=L, fill=F] (106.50,73.00) -- (107.90,72.30) -- (106.50,73.00) -- (107.90,73.70) -- (106.50,73.00) -- cycle;
\definecolor{T}{rgb}{0,0,1}
\draw[T] (110.50,72.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{Page number where}};
\draw[T] (110.50,68.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{content can be found}};
\draw[T] (110.50,64.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{in the textbook}};
\path[line width=0.30mm, draw=L] (25.50,20.00) ellipse (8.50mm and 3.00mm);
\path[line width=0.30mm, draw=L] (0.00,30.00) -- (17.00,21.00);
\path[line width=0.30mm, draw=L, fill=F] (17.00,21.00) -- (16.09,22.27) -- (17.00,21.00) -- (15.44,21.04) -- (17.00,21.00) -- cycle;
\draw[T] (-30.00,30.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{If I indicate a Table}};
\draw[T] (-30.00,26.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{in my slides you}};
\draw[T] (-30.00,22.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{need to know the }};
\draw[T] (-30.00,18.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{contents of the table}};
\draw[T] (-30.00,14.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{or, in this case, know}};
\draw[T] (-30.00,10.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{what the information}};
\draw[T] (-30.00,6.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{means.}};
\path[line width=0.30mm, draw=L] (49.50,12.00) ellipse (8.50mm and 3.00mm);
\path[line width=0.30mm, draw=L] (110.00,32.00) -- (57.50,13.00);
\path[line width=0.30mm, draw=L, fill=F] (57.50,13.00) -- (59.05,12.82) -- (57.50,13.00) -- (58.58,14.13) -- (57.50,13.00) -- cycle;
\draw[T] (110.50,30.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{The figures tell a}};
\draw[T] (110.50,26.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{story. You need to }};
\draw[T] (110.50,22.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{know that story,}};
\draw[T] (110.50,18.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{especially if I take}};
\draw[T] (110.50,14.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{the time to point the}};
\draw[T] (110.50,10.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{figure out to you in}};
\draw[T] (110.50,6.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{my slides.}};
\end{tikzpicture}%
\end{figure}
代码运行良好。我只是不知道如何将注释放在图像上,使其看起来像这样:
我看过其他示例并尝试复制它们,但对 Tikz 的了解不够,无法正确地做到这一点。
非常感谢您的帮助!
PS 我知道 TpX 已经过时了……如果有人能推荐一个更新的所见即所得界面,可以生成 Tikz 代码,我可以将其插入到我的 tex 文件中,那我也将不胜感激。TpX 无法处理 png 等……因此才有上述问题。
答案1
\node
要使用 TpX 代码,您只需要在的开头添加图像tikzpicture
:
\node [anchor=south west] at (0,-3.5) {\includegraphics[width=10.5cm]{diagram}};
需要经过反复试验才能找到合适的图像坐标和大小。
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[x=1.00mm, y=1.00mm, inner xsep=0pt, inner ysep=0pt, outer xsep=0pt, outer ysep=0pt]
% add only this line
\node [anchor=south west] at (0,-3.5) {\includegraphics[width=10.5cm]{diagram}};
\path[line width=0mm] (-32.00,-5.73) rectangle +(175.14,83.73);
\definecolor{L}{rgb}{1,0,0}
\path[line width=0.30mm, draw=L] (101.00,73.00) ellipse (5.00mm and 3.00mm);
\path[line width=0.30mm, draw=L] (110.00,73.00) -- (106.50,73.00);
\definecolor{F}{rgb}{1,0,0}
\path[line width=0.30mm, draw=L, fill=F] (106.50,73.00) -- (107.90,72.30) -- (106.50,73.00) -- (107.90,73.70) -- (106.50,73.00) -- cycle;
\definecolor{T}{rgb}{0,0,1}
\draw[T] (110.50,72.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{Page number where}};
\draw[T] (110.50,68.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{content can be found}};
\draw[T] (110.50,64.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{in the textbook}};
\path[line width=0.30mm, draw=L] (25.50,20.00) ellipse (8.50mm and 3.00mm);
\path[line width=0.30mm, draw=L] (0.00,30.00) -- (17.00,21.00);
\path[line width=0.30mm, draw=L, fill=F] (17.00,21.00) -- (16.09,22.27) -- (17.00,21.00) -- (15.44,21.04) -- (17.00,21.00) -- cycle;
\draw[T] (-30.00,30.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{If I indicate a Table}};
\draw[T] (-30.00,26.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{in my slides you}};
\draw[T] (-30.00,22.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{need to know the }};
\draw[T] (-30.00,18.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{contents of the table}};
\draw[T] (-30.00,14.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{or, in this case, know}};
\draw[T] (-30.00,10.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{what the information}};
\draw[T] (-30.00,6.00) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{means.}};
\path[line width=0.30mm, draw=L] (49.50,12.00) ellipse (8.50mm and 3.00mm);
\path[line width=0.30mm, draw=L] (110.00,32.00) -- (57.50,13.00);
\path[line width=0.30mm, draw=L, fill=F] (57.50,13.00) -- (59.05,12.82) -- (57.50,13.00) -- (58.58,14.13) -- (57.50,13.00) -- cycle;
\draw[T] (110.50,30.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{The figures tell a}};
\draw[T] (110.50,26.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{story. You need to }};
\draw[T] (110.50,22.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{know that story,}};
\draw[T] (110.50,18.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{especially if I take}};
\draw[T] (110.50,14.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{the time to point the}};
\draw[T] (110.50,10.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{figure out to you in}};
\draw[T] (110.50,6.50) node[anchor=base west]{\fontsize{11.38}{13.66}\selectfont \textcolor[rgb]{0, 0, 1}{my slides.}};
\end{tikzpicture}
\end{document}
答案2
谢谢,Ignasi,
虽然没有一个所见即所得提供解决方案(没有一个允许我围绕 png 构建 Tikz 绘图,然后导出以可包含 png 为中心的代码)但我确实学到了足够的知识来解决我自己的问题,从头开始构建图片:
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=8.5cm]{image.png}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
% \draw[help lines,xstep=.05,ystep=.05] (0,0) grid (1,1);
% \foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
% \foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
\path[color=black,draw=red,miter limit=4.00,nonzero rule,line width=1pt] (0.965,0.975) ellipse (0.5cm and 0.25cm);
\draw[color=red,line width=1pt] (1.021,0.975) -- (1.07,0.975);
\node[text width=3cm,text=blue] at (1.25,0.975) {Some text.};
\path[color=black,draw=red,miter limit=4.00,nonzero rule,line width=1pt] (0.47,0.198) ellipse (0.8cm and 0.27cm);
\draw[color=red,line width=1pt] (0.565,0.198) -- (1.07,0.25);
\node[text width=3cm,text=blue] at (1.25,0.2) {Some more text.};
\path[color=black,draw=red,miter limit=4.00,nonzero rule,line width=1pt] (0.24,0.3) ellipse (0.8cm and 0.2cm);
\draw[color=red,line width=1pt] (0.145,0.3) -- (-0.02,0.3);
\node[text width=3cm,text=blue] at (-.2,0.3) {Still some more text.};
\end{scope}
\end{tikzpicture}
我仍然想知道如何使用 TpX 生成的代码来做到这一点,因为对于我需要做的事情来说,这是一个非常容易使用的程序。