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

参照を正しくするには、ドキュメントを少なくとも 2 回コンパイルする必要があります。コードは Overleaf でうまく動作しました。

ただし、パッケージをロードすることをお勧めします賢い、より良い参照を得るのに役立ちます。また、パッケージをロードします配列

また、コードをクリーンアップし、廃止されたコマンド\bf\ を に変更し\bfseries、3 番目の列をp-column に変更しました。さらに、4 つの列を定義していましたが、実際に使用されたのは 3 つだけでした。そのため、4 番目の列を削除しました。

また、私が使用している例2も記載しました。ブックタブ縦線のない、より見栄えの良い表にするために。出版社の要件がない限り、キャプションを表の上に移動し、パッケージを使用することをお勧めします。キャプションフォーマットするには、3つの部分から成るテーブル、表題と表を表の右端に正しく揃える(さらに、3つの部分から成るテーブル表の注釈を正しく処理します。

例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 –ブックタブキャプションそして3つの部分から成るテーブル ここに画像の説明を入力してください

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

関連情報