VS Code를 사용한 테이블 참조

VS Code를 사용한 테이블 참조

저는 LaTeX 문서를 처음 접했고 테이블 참조에 문제가 있습니다. 이전에는 Atom.io 편집기에서 컴파일하고 빌드했으며 최근에는 VS Code로 전환했습니다. 이전에는 작동했지만 이제는 테이블에서 참조 오류가 발생합니다!

콘솔이 계속 말해요

2페이지의 'tab:table1' 참조가 정의되지 않았습니다.

이전에는 작동했지만 지금은 작동하지 않는 이유를 이해할 수 없습니다.

???가치 를 보여줍니다 \ref.

아래는 이 문제를 재현하기 위한 최소한의 코드입니다. IEEEtran내 문서에 템플릿을 사용했습니다 .

\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}

여기에 이미지 설명을 입력하세요

답변1

참조가 정확하려면 문서를 최소한 두 번 컴파일해야 합니다. 귀하의 코드는 Overleaf에서 매력처럼 작동했습니다.

그러나 패키지를 로드하는 것이 좋습니다.클레레프, 훨씬 더 나은 참조를 얻는 데 도움이 될 것입니다. 패키지도 로드해요정렬.

또한 코드를 정리하고 감가상각 명령인 \bf\를 로 변경 \bfseries하고 세 번째 열을 p-column으로 변경했습니다. 또한 4개의 열을 정의했지만 3개만 사용했습니다. 결과적으로 네 번째 열을 제거했습니다.

또한 내가 사용하는 예제 2도 포함했습니다.책꽂이수직선 없이 훨씬 더 멋진 표를 만들 수 있습니다. 출판사의 요구 사항이 아니라면 캡션을 표 위로 이동하고 패키지를 사용했을 것입니다.표제포맷을 하려고 합니다. 또한 다음을 사용하는 것이 좋습니다.세 부분으로 나눌 수 있는, 표의 오른쪽 여백에 캡션과 표를 올바르게 정렬하려면(추가로,세 부분으로 나눌 수 있는테이블 메모를 올바르게 처리합니다.)

실시예 1

여기에 이미지 설명을 입력하세요

\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}

예시 2 –책꽂이,표제그리고세 부분으로 나눌 수 있는 여기에 이미지 설명을 입력하세요

\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}

관련 정보