Referencia de tablas con código VS

Referencia de tablas con código VS

Soy bastante nuevo en los documentos LaTeX y tengo un problema con las referencias a tablas. Anteriormente compilé y construí el editor Atom.io y recientemente cambié a VS Code. Funcionó anteriormente, pero ahora genera un error de referencia con la tabla.

La consola sigue diciendo

Referencia 'tab:table1' en la página 2 indefinida.

No entiendo por qué esto funcionaba antes y ahora no.

Se nota ???por \refsu valor.

A continuación se muestra un código mínimo para la reproducción de este problema. Usé IEEEtranuna plantilla para mi documento.

\documentclass[conference,compsoc]{IEEEtran}

\begin{document}

\section{Introduction}

See \ref{tab:table1}\.

\begin{table}[ht] {\renewcommand\arraystretch{1.25}
    \begin{tabular}{|l|l|l|l|} \hline
    \bf Task & \bf Assignee & \bf \multicolumn{1}{l}{Description} \\ \hline
    Project Manager & Alice & \multicolumn{1}{p{3.3cm}|}{\raggedright Schedule overall development plan and assign proper jobs to team members} \\ \hline
    Consumer & Bob & \multicolumn{1}{p{3.3cm}|}{\raggedright Test and try out a prototype application, gather the potential improvement} \\ \hline
    User & Chris & \multicolumn{1}{p{3.3cm}|}{\raggedright Gather basic feature requirement for this project by asking qeustioaires the eldery near the university.} \\ \hline
    Developer & Daniel & \multicolumn{1}{p{3.3cm}|}{\raggedright Prepare a development environment for this project and build up the application} \\ \hline
    \end{tabular}} \\
    \caption{Task distribution  for each participants of this project}
    \label{tab:table1}
\end{table}

\end{document}

ingrese la descripción de la imagen aquí

Respuesta1

Hay que compilar el documento al menos dos veces para que las referencias sean correctas. Su código funcionó a las mil maravillas en Overleaf.

Sin embargo, le sugiero que cargue el paquete.inteligente, lo que le ayudará a obtener referencias mucho mejores. También cargo el paqueteformación.

También limpié su código, cambié el comando depreciado \bf\ a \bfseriesy cambié la tercera columna a una pcolumna. Además, había definido cuatro columnas, pero solo utilizó tres. En consecuencia, eliminé la cuarta columna.

También he incluido un ejemplo 2 donde usopestañaspara tener una tabla mucho más bonita sin líneas verticales. A menos que sea un requisito de su editor, habría movido el título encima de la tabla y habría usado el paquete.subtítulopara formatearlo. Además, sugiero utilizarmesa de tres partes, para alinear el título y la tabla correctamente en el margen derecho de la tabla (además,mesa de tres partesmaneja correctamente las notas de la tabla).

Ejemplo 1

ingrese la descripción de la imagen aquí

\documentclass[conference,compsoc]{IEEEtran}
\usepackage{cleveref, array}

\begin{document}

\section{Introduction}

See \cref{tab:table1}.

\begin{table}[ht] \renewcommand\arraystretch{1.25}
    \begin{tabular}{|l|l|>{\raggedright\arraybackslash}p{3.3cm}|}
    \hline
    \bfseries Task & \bfseries Assignee & \multicolumn{1}{l|}{\bfseries Description} \\
    \hline
    Project Manager & Alice & Schedule overall development plan and assign proper jobs to team members \\
    \hline
    Consumer & Daniel & Test and try out a prototype application, gather the potential improvement \\
    \hline
    User & Bob & Gather basic feature requirement for this project by asking questionnaires the elderly near the university. \\
    \hline
    Developer & Chris & Prepare a development environment for this project and build up the application \\
    \hline
    \end{tabular} \\
    \caption{Task distribution  for each participants of this project%
    \label{tab:table1}}  %% Label inside caption
    \end{table}

\end{document}

Ejemplo 2 –pestañas,subtítuloymesa de tres partes ingrese la descripción de la imagen aquí

\documentclass[conference,compsoc]{IEEEtran}
\usepackage{cleveref, array, booktabs, threeparttable}
\usepackage[labelsep=period, font={footnotesize, sc}]{caption}


\begin{document}

\section{Introduction}

See \cref{tab:table1}.

\begin{table}[ht!] \renewcommand\arraystretch{1.25}

\begin{threeparttable}

    \caption{Task distribution  for each participants of this project%
    \label{tab:table1}}    %% Caption above tabular, label inside caption
    \begin{tabular}{@{}l l>{\raggedright\arraybackslash}p{3.3cm}@{}}
    \toprule
    \bfseries Task & \bfseries Assignee & \multicolumn{1}{l}{\bfseries Description} \\
    \midrule
    Project Manager & Alice & Schedule overall development plan and assign proper jobs to team members \\ 
    Consumer & Bob & Test and try out a prototype application, gather the potential improvement \\ 
    User & Chris & Gather basic feature requirement for this project by asking questionnaires the elderly near the university. \\ 
    Developer & Daniel & Prepare a development environment for this project and build up the application \\
    \bottomrule
    \end{tabular}
\end{threeparttable}
    \end{table}
\end{document}

información relacionada