我正在使用 PDFLATEX 进行编译,但出现的却是?? 而不是引用。
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}
\usepackage{amsmath,amsfonts,amssymb,latexsym,subcaption}
\usepackage{graphicx}
\usepackage[cm]{fullpage}
\usepackage[spanish]{cleveref} %para crear referencias
\usepackage{hyperref}
\hypersetup{colorlinks=true, urlcolor=blue}
\usepackage{mathpazo} % Fuente MathPazo
\begin{document}
Next you can see the \cref{fig:capitala}.
\begin{figure}[h!]
\centering
\includegraphics[width=.28\linewidth]{example-image-a.jpg}
\caption{Thi is capital a}\label{fig:capitala}
\end{figure}
%\vspace{1cm}
And the \cref{tab:one}, in the \cpageref{tab:twentyfour}
\begin{table}[h!]
\begin{subtable}{.19\linewidth}\centering
{\begin{tabular}{c|c}
$x_i$ & $f(x_i)$ \\
\hline
1 & 1.2\\
2 & 0.4\\
\end{tabular}}
\end{subtable}%
%
\begin{subtable}{.19\linewidth}\centering
{\begin{tabular}{c|c}
$x_i$ & $f(x_i)$ \\
\hline
23 & 6.8\\
24 & 4.0\\
\end{tabular}}
\end{subtable}%
%
%
\caption{24 values}\label{tab:twentyfour}
\end{table}
\end{document}
答案1
正如 Paul Gessler 所指出的,cleveref 是必须加载的包之一after hyperref
。另外,您有一个未由标签(子表)定义的引用,因此我添加了一个,或者说是两个,因为您有两个子表和一个\centering
命令(表格标题无论如何都会居中,因此如果表格不居中,看起来会很奇怪)。
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}
\usepackage{amsmath,amsfonts,amssymb,latexsym,subcaption}
\usepackage{graphicx}
\usepackage[cm]{fullpage}
\usepackage{hyperref}
\hypersetup{colorlinks=true, urlcolor=blue}
\usepackage[spanish]{cleveref} %para crear referencias
\usepackage{mathpazo} % Fuente MathPazo
\begin{document}
Next you can see \cref{fig:capitala}.
\begin{figure}[!h]
\centering
\includegraphics[width=.28\linewidth]{example-image-a.jpg}
\caption{This is capital a}\label{fig:capitala}
\end{figure}
%\vspace{1cm}
And \cref{tab:one}, \cpageref{tab:twentyfour}
\begin{table}[h!]
\centering
\begin{subtable}{.19\linewidth}\centering
{\begin{tabular}{c|c}
$x_i$ & $f(x_i)$ \\
\hline
1 & 1.2\\
2 & 0.4\\
\end{tabular}}
\caption{}\label{tab:one}
\end{subtable}%
%
\begin{subtable}{.19\linewidth}\centering
{\begin{tabular}{c|c}
$x_i$ & $f(x_i)$ \\
\hline
23 & 6.8\\
24 & 4.0\\
\end{tabular}}
\caption{}\label{tab:two}
\end{subtable}%
%
%
\caption{24 values}\label{tab:twentyfour}
\end{table}
\end{document}