
Quero fazer referência a uma subtabela no meu texto. Porém, quando utilizo o ref
comando, o número da tabela e da subtabela são apresentados sem nenhuma separação. Isso está fora da minha expectativa porque espero que haja um ponto ou espaço entre dois números, por exemplo, gostaria que mostrasse"Tabela I.(a)"em vez de"Mesa Ia". Portanto, existe alguma solução possível para resolver 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}
Responder1
Você deveria ter fornecidoMWE completo.
No entanto, aqui está a solução:
\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}