2

I have encountered a simple problem. I use "xelatex" and code my tables as below. I want to cite this table, but it turns "??". How can I solve it? Thanks in advance!

\documentclass[12pt,a4paper]{article}
\usepackage{microtype}
\usepackage{sectsty}
\allsectionsfont{\centering}
\usepackage{indentfirst,amsmath,multicol,amssymb,booktabs,threeparttable,caption}
\usepackage{setspace} 
\usepackage{bm}
\usepackage{geometry}
\usepackage[sort]{natbib}
\begin{document}
\begin{table}
\caption {Moments}\label{Comparison}
\centering

\resizebox{\columnwidth}{!}{
\begin{tabular}{lllllllllll} 
\toprule
& Data & \multicolumn{9}{c}{Model}  \\
\midrule \\
\bottomrule
\end{tabular}
}
\end{table} 

\end{document}
  • 1
    Your example code doesn't have a \ref{Comparison}, but it sounds like you just need to run xelatex again. – TH. Jun 20 '17 at 3:18
  • Thanks for your answer. I forget to code a line as \ref{Comparison}. But it still returns "??". That means I cannot call my table? Thanks again! – Carl Jun 20 '17 at 4:15
1

I cut your example code down to a minimal one maintaining the table and the \resizebox (for which graphicx is needed).

\documentclass{article}
\usepackage{graphicx}
\usepackage{booktabs}
\begin{document}
\begin{table}
\caption {Moments}\label{Comparison}
\centering

\resizebox{\columnwidth}{!}{
\begin{tabular}{lllllllllll}
\toprule
& Data & \multicolumn{9}{c}{Model}  \\
\midrule \\
\bottomrule
\end{tabular}
}
\end{table}

See Table~\ref{Comparison}.

\end{document}

The first time I compile this by running xelatex, I get the following.

enter image description here

The output of XeLaTeX informs you of what to do.

LaTeX Warning: There were undefined references.


LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

After running xelatex a second time, the reference is correctly resolved.

enter image description here

  • Thanks for your answer! But it still can not resolve my problem. \documentclass[12pt,a4paper]{article} \usepackage{microtype} \usepackage{sectsty} \allsectionsfont{\centering} \usepackage{indentfirst,amsmath,multicol,amssymb,booktabs,threeparttable,caption} \usepackage{setspace} \usepackage{bm} \usepackage{geometry} \usepackage[sort]{natbib} \setlength{\bibsep}{2pt} \geometry{top=1.4in,bottom=1.in,left=1in,right=1in} \numberwithin{equation}{section} \usepackage{grffile} %\usepackage[section]{placeins} \usepackage{graphicx,subfig} \usepackage{epstopdf} \usepackage{floatrow} – Carl Jun 20 '17 at 5:06
  • @ChYh - Did you run XeLaTeX twice? – Mico Jun 20 '17 at 5:45
  • @ChYh if my answer doesn't solve your problem, then you need to edit your example such that it demonstrates the problem. What you posted doesn't compile as is and also contains a lot of unnecessary stuff. Try to produce a piece of code that compiles, does not contain extra packages, and still exhibits the problem. Otherwise, there's nothing we can do. – TH. Jun 20 '17 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.