tikzpicture 字幕问题

tikzpicture 字幕问题

我正在尝试使用 tikzpicture。下面提供了我这边的设置模型。下面提供的代码可能不是最好的方法,但这就是我现在所拥有的。

\begin{figure*}[t!]
\centering%
\begin{tikzpicture}

\node [draw] at (0,0){\includegraphics[width=.090\textheight]{Image 1} };
\node [draw] at (3,2) {\includegraphics[width=.100\textheight]{Image 2} };

% For the numbering of the images because I have to refer these individual images later in the text. 
\node at (-1,-1.1){\colorbox{white}{\ref{f:Image 1}}};
\node at (1.9,0.7){\colorbox{white}{\ref{f:Image 2}}};

\end{tikzpicture}
\caption{Caption text.}
\cl{%
\item\label{f:Image 1}
\item\label{f:Image 2}
}%
}%
\label{f:Main_Method}
\end{figure*}

我的目标是从底部的主标题文本中删除多余的 (a) (b)。有人能帮忙吗?

非常感谢

更新(工作代码)

我有一个庞大的 latex 文档,因此我在此提供一个简化的示例。我在很多地方都使用 tikzpicture,我更愿意坚持使用相同的方法,以避免进行大的更改。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage[inline]{enumitem}
\usepackage{xspace}


\providecommand{\cl}[1]{\begin{enumerate*}[label=(\alph*)]#1\end{enumerate*}}


\begin{document}

\begin{figure*}[t!]
\centering%
\begin{tikzpicture}

\node [draw] at (0,0){\includegraphics[width=.5\textwidth]{Image 1.png} };
\node [draw] at (8,0) {\includegraphics[width=.5\textwidth]{Image 2.png} };

% For the numbering of the images because I have to refer these individual images later in the text. 
\node at (-2.5,-1){\colorbox{white}{\ref{f:Image 1}}};
\node at (5.5,-1){\colorbox{white}{\ref{f:Image 2}}};

\end{tikzpicture}

\caption{Caption text.
\cl{%
\item\label{f:Image 1}%
\item\label{f:Image 2}%
}%
}%
\label{f:Main_Method}
\end{figure*}

\end{document}

输出 - -

在此处输入图片描述

我的目标是从底部的主标题文本中删除多余的 (a) (b)。

答案1

您或许可以将\cl其完全移除,然后\phantomsubcaptionsubcaption包装中使用它。

加载包并使用设置参考格式

\usepackage{subcaption}
\captionsetup{subrefformat=parens}

为每个子图添加{\phantomsubcaption\label{...}}。每个子图\phantomsubcaption都应位于其自己的组中。

最后在制作标签的节点中使用\subref而不是。\ref

在下面的代码中,我还添加了第二个图形,演示了如何在没有任何明确坐标的情况下制作类似的东西。如果你已经有一堆这样的图形,那么改变它们可能没有任何意义,只是为了展示一个想法。第二幅图像相对于第一幅图像放置,子图标签使用中描述的技术放置https://tex.stackexchange.com/a/106836/

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning} % added for the second example, remove if you don't use it
\usepackage[inline]{enumitem}
\usepackage{xspace}
\usepackage{subcaption}
\captionsetup{subrefformat=parens}


% this style is just an example for an alternative method of adding subcaptions like this
% the first argument is for adding additional node options to the node with the subfigure label
% can be used if you want to move the label somewhere else
\tikzset{
  addsubcap/.style 2 args={
    append after command={(\tikzlastnode.south west) node[above right=15pt,fill=white,#1] {\subref{#2}}}
  }
}

\begin{document}

% figure with minimal changes
\begin{figure*}[t!]
\centering%
\begin{tikzpicture}

\node [draw] at (0,0){\includegraphics[width=.5\textwidth]{example-image-a}};
\node [draw] at (8,0) {\includegraphics[width=.5\textwidth]{example-image-b}};

% For the numbering of the images because I have to refer these individual images later in the text. 

% use \subref insteaf of \ref
\node at (-2.5,-1){\colorbox{white}{\subref{f:Image 1}}};
\node at (5.5,-1){\colorbox{white}{\subref{f:Image 2}}};

% note that each subcaption has to be in a group ({...}) or environment
{\phantomsubcaption\label{f:Image 1}}%
{\phantomsubcaption\label{f:Image 2}}%

\end{tikzpicture}
\caption{Caption text.}%
\label{f:Main_Method}
\end{figure*}


% alternative which you can ignore
\begin{figure*}[t!]
\centering%
\begin{tikzpicture}

\node [draw, name=img1, addsubcap={}{f:Image 3}] {\includegraphics[width=.5\textwidth]{example-image}};
% an example using yshift to move the label up
\node [draw,right=of img1, addsubcap={yshift=1cm}{f:Image 4}] {\includegraphics[width=.5\textwidth]{example-image}};

\end{tikzpicture}%
% note that each subcaption has to be in a group ({...}) or environment
{\phantomsubcaption\label{f:Image 3}}%
{\phantomsubcaption\label{f:Image 4}}%
\caption{Caption text.}
\label{f:Main_Method}
\end{figure*}
\end{document}

在此处输入图片描述

相关内容