
Quiero hacer referencia a una subtabla en mi texto. Sin embargo, cuando uso el ref
comando, el número de la tabla y la subtabla se presentan sin ninguna separación. Esto está fuera de mis expectativas porque espero que haya un punto o espacio entre dos números, por ejemplo, desearía que se mostrara."Cuadro I.(a)"en vez de"Mesa Ia". Por tanto, ¿existe alguna solución posible para solucionar este problema?
\ref{tab:week2}
\begin{table}[h]
\begin{subtable}[h]{0.45\textwidth}
\centering
\begin{tabular}{l | l | l}
Day & Max Temp & Min Temp \\
\hline \hline
Mon & 20 & 13\\
Tue & 22 & 14\\
\end{tabular}
\caption{First Week}
\label{tab:week1}
\end{subtable}
\hfill
\begin{subtable}[h]{0.45\textwidth}
\centering
\begin{tabular}{l | l | l}
Day & Max Temp & Min Temp \\
\hline \hline
Mon & 17 & 11\\
Tue & 16 & 10\\
\end{tabular}
\caption{Second Week}
\label{tab:week2}
\end{subtable}
\caption{Max and min temps recorded in the first two weeks of July}
\label{tab:temps}
\end{table}
Respuesta1
Deberías haber proporcionadoMWE completo.
Sin embargo, aquí está la solución:
\documentclass{article}
\usepackage[labelformat=simple]{subcaption} % packages subfigure and subfig are obsolete
\renewcommand\thesubtable{(\alph{subtable})}
\makeatletter
\renewcommand\p@subtable{\thetable.}
\makeatother
\begin{document}
\ref{tab:week2}
\begin{table}[h]
\begin{subtable}[h]{0.45\textwidth}
\centering
\begin{tabular}{l | l | l}
Day & Max Temp & Min Temp \\
\hline \hline
Mon & 20 & 13\\
Tue & 22 & 14\\
\end{tabular}
\caption{First Week}
\label{tab:week1}
\end{subtable}
\hfill
\begin{subtable}[h]{0.45\textwidth}
\centering
\begin{tabular}{l | l | l}
Day & Max Temp & Min Temp \\
\hline \hline
Mon & 17 & 11\\
Tue & 16 & 10\\
\end{tabular}
\caption{Second Week}
\label{tab:week2}
\end{subtable}
\caption{Max and min temps recorded in the first two weeks of July}
\label{tab:temps}
\end{table}
\end{document}