Latex 中图形子面板的自动引用

Latex 中图形子面板的自动引用

我正在尝试将图例添加到多面板图形中,并从文本中引用各个子面板。当我重新排列面板时,我不想浏览所有文本并更改面板引用。所以我尝试使用计数器。但是似乎有一个错误,这取决于计数器命令之前的字符数。如果字符太多,计数器将不会从 A 开始,而是如果图中有两个子面板,则从 C 开始,如果有三个子面板,则从 D 开始计数,等等。有人知道这个特定错误的解决方案吗,或者一般如何自动引用图形子面板?

谢谢你!

\documentclass{article}

\begin{document}

\newcounter{FigI}[figure]
\renewcommand{\theFigI}{\Alph{FigI}}

\begin{figure}
\caption{ManyCharactersManyCharactersManyCharactersManyCharacters
\protect\refstepcounter{FigI} \Alph{FigI} \label{mySubPanel_1}  Panel caption
\protect\refstepcounter{FigI} \Alph{FigI} \label{mySubPanel_2} Panel caption} 
\end{figure}


\begin{figure}
\caption{FewCharactersFewCharacters
\protect\refstepcounter{FigI} \Alph{FigI} \label{mySubPanel_3}  Panel caption  
\protect\refstepcounter{FigI} \Alph{FigI} \label{mySubPanel_4} Panel caption} 
\end{figure}

Text: These are references to Figure 1 \ref{mySubPanel_2} and to panel \ref{mySubPanel_1}.

And a ref to Figure 2\ref{mySubPanel_4}.

\end{document}

相关内容