usando etiqueta dentro de la tabla

usando etiqueta dentro de la tabla

Digamos que escribo una tabla dos veces y quiero que la segunda tabla tenga la misma numeración que la primera. Con ecuaciones, sé cómo hacerlo. Sin embargo, con las tablas esto no funciona. Lo siguiente es lo que pensé que sería, pero da un error:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{equation}
 x = 1
\label{eq1}
\end{equation}

\begin{equation}
 x \not= 2
\tag{\ref{eq1}}
\end{equation}

\begin{table}[h]
\begin{tabular}{c}
 hello
\end{tabular}
\caption{this is a talbe}
\label{table}
\end{table}

\begin{table}[h]
\begin{tabular}{c}
 hello
\end{tabular}
\caption{this is a talbe}
\tag{\ref{table}}
\end{table}

\end{document}

¿Alguien tiene alguna idea de cómo hacer referencia correctamente?

Respuesta1

Aquí tienes un truco. usar \tabtag{table}antes \caption.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\tabtag}[1]{%
\renewcommand{\thetable}{\ref{#1}}%
\addtocounter{table}{-1}}

\begin{document}

\begin{equation}
 x = 1
\label{eq1}
\end{equation}

\begin{equation}
 x \not= 2
\tag{\ref{eq1}}
\end{equation}

\begin{table}
\begin{tabular}{c}
 hello
\end{tabular}
\caption{this is a table}
\label{table}
\end{table}

\begin{table}
\begin{tabular}{c}
 hello
\end{tabular}
\tabtag{table}
\caption{this is a table}
\end{table}

\begin{table}
\begin{tabular}{c}
 hello
\end{tabular}
\caption{this is a table}
\end{table}


\end{document}

información relacionada