我在 Latex 中遇到了图形和表格之间的标签冲突。
文档类别:https://drive.google.com/file/d/1vDS_jDmvIuVtHzpa_Ms5cz2VgtiWwvdv/view
这是我当前的代码。
\documentclass[sort&compress, numbers]{chart}
\usepackage[varg]{txfonts}
\usepackage{multicol}
\usepackage{tabularray}
\usepackage{mathtools}
\usepackage[labelformat=simple]{subcaption}
\usepackage{chemformula}
\usepackage{siunitx}
\usepackage{graphicx}
\usepackage{lipsum}
\renewcommand\thesubfigure{(\alph{subfigure})}
\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000
\makeatletter
\newcommand{\@captype}{figure}
\makeatother
\centering
\geometry{margin=1.5cm}
\graphicspath{{Images/}}
\begin{document}
Table \ref{tab:histogram tab1} shows some experiments.
\begin{table}[h]
\begin{center}
\caption{Test \cite{Singh10}}
\label{tab:histogram tab1}
\begin{tblr}{|c|c|X[j,c]|X[j,c]|X[j,c]|}
\hline
Day & Min Temp & Max Temp & Summary \\ \hline
Monday & 11C & 22C & A clear day with lots of sunshine.
However, the strong breeze will bring down the temperatures. \\ \hline
Tuesday & 9C & 19C & Cloudy with rain, across many northern regions. Clear spells
across most of Scotland and Northern Ireland,
but rain reaching the far northwest. \\ \hline
Wednesday & 10C & 21C & Rain will still linger for the morning.
Conditions will improve by early afternoon and continue
throughout the evening. \\
\hline
\end{tblr}
\end{center}
\end{table}
\begin{multicols}{2}
Figure \ref{fig:evaluation:revenue} shows some experiments. \lipsum[2]
\noindent
\begin{minipage}{\columnwidth}
\subfloat[Market revenue]{%
\includegraphics[width=8cm]{example-image-a}%
\label{fig:evaluation:revenue}%
}\qquad%
\subfloat[Average price]{%
\includegraphics[width=8cm]{example-image-b}%
\label{fig:evaluation:avgPrice}%
}
\caption{Simulation results}
\end{minipage}
\end{multicols}
\end{document}
我目前的数字结果不符。图 0(a)代替图 1(a)我的表格结果是正确的。这是怎么回事?这很奇怪。
答案1
你会得到更好的结果
\begin{multicols}{2}
Subfigure~\subref{fig:evaluation:revenue} in Figure~\ref{fig:full} shows some experiments. \lipsum[2]
\noindent
\begin{minipage}{\columnwidth}
\subfloat[Market revenue\label{fig:evaluation:revenue}]{%
\includegraphics[width=8cm]{example-image-a}%
}\qquad%
\subfloat[Average price\label{fig:evaluation:avgPrice}]{%
\includegraphics[width=8cm]{example-image-b}%
}
\caption{Simulation results}\label{fig:full}%
\end{minipage}
\end{multicols}
(1)将标签放在标题旁边或标题里面;
(2)用 引用子图\subref{<sub label>}
。
(3)为了得到图 1(a),使用 Figure~\ref{fig:full}\subref{fig:evaluation:revenue}