如何在不使用标题的情况下引用子图

Moh*_*lat 5 latex

图解释了我到底想做什么

我使用以下代码在文本主体中添加数字。我需要参考主体中的图,如图1a、图2a。但我不想在乳胶代码中添加图时添加图 1a 的标题。

\usepackage{graphicx}
\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}

\begin{figure}[!h]
\begin{subfigure}{0.5\textwidth}  
  \caption{``Conversation Starter'' of March}
  \label{fig:csmarch}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
  \caption{``Conversation Starter'' of April}
  \label{fig:csapril}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
  \caption{``Conversation Starter'' of May}
  \label{fig:csmay}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
  \caption{``Conversation Starter'' of June}
  \label{fig:csjune}
\end{subfigure} 
\begin{subfigure}{.5\textwidth}
  \caption{``Conversation Starter'' of July}
  \label{fig:csjuly}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
  \caption{``Conversation Starter'' of the \#NigeriaDecides}
  \label{fig:csds}
\end{subfigure}
Run Code Online (Sandbox Code Playgroud)

小智 10

subcaption软件包解决了\\phantomsubcaption此类问题。从手册中:

\n
\n

如果您不想给子图添加标题,因为图片本身已经包含标题,或者由于其他原因,您可以使用命令\n \\phantomsubcaption\而不是\\subcaption,或 \xe2\x80 \x93 当在subfigureorsubtable环境中时\n\xe2\x80\x93\\phantomcaption而不是\\caption. \\phantomsubcaption和 \n\\phantomcaption没有任何参数,并且它们不生成任何输出,\n但为您提供了一个\\label可以在以后放置的命令的锚点。此外,\nit 还增加了子图。分表计数器。

\n
\n

微量元素:

\n
\\documentclass{article}\n\\usepackage{mwe}\n\\usepackage{graphicx}\n\\usepackage{caption}\n\\usepackage{subcaption}\n\n\\begin{document}\n    \n    Hello world! I am referencing to figures \\ref{fig:a}, \\ref{fig:b}, \\ref{fig:c} and \\ref{fig:img}.\n    \n\\begin{figure}\n    \\begin{subfigure}{0.45\\textwidth}\n        \\centering\n        \\includegraphics[width=\\linewidth]{example-image-a}\n        \\phantomsubcaption\n        \\label{fig:a}\n    \\end{subfigure}\n\\hfill\n    \\begin{subfigure}{.45\\textwidth}\n        \\centering\n        \\includegraphics[width=\\linewidth]{example-image-b}\n        \\phantomsubcaption\n        \\label{fig:b}\n    \\end{subfigure}\n\\\\\n    \\begin{subfigure}{.45\\textwidth}\n        \\centering\n        \\includegraphics[width=\\linewidth]{example-image-c}\n        \\phantomsubcaption\n        \\label{fig:c}\n    \\end{subfigure}\n\\hfill\n    \\begin{subfigure}{.45\\textwidth}\n        \\centering\n        \\includegraphics[width=\\linewidth]{example-image}\n        \\phantomsubcaption\n        \\label{fig:img}\n    \\end{subfigure}\n\\end{figure}\n\n\\end{document}\n
Run Code Online (Sandbox Code Playgroud)\n

查看输出

\n


Moh*_*lat 1

问题已解决。我已经用以下内容更改了子图代码。

\captionsetup[subfigure]{labelformat=empty}
\begin{subfigure}{0pt}
\caption{\label{fig:csmarch}}
\end{subfigure}
Run Code Online (Sandbox Code Playgroud)