有一次用 \ref 显示问号

有一次用 \ref 显示问号

我的一个图形的命令\ref是输出问号(“??”)而不是参考,但它对其他图形来说工作正常。

代码:

\documentclass[10pt,a4paper]{article}

\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage[labelfont=bf]{caption}
\usepackage{tikz}
\usepackage{calc}
\usepackage{array}
\usepackage{multirow}
\usepackage{listings}
\usepackage{framed}
\usepackage{lmodern}

\lstset{
basicstyle=\ttfamily,
columns=fullflexible,
frame=single,
breaklines=true,
postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space},
}

\usepackage{float}
\usepackage{xcolor}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{array}

\newcolumntype{L}[1]{> 
{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{> 
{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{> 
{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\usepackage{makecell}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{ragged2e}
\usepackage{amssymb}
\usepackage{longtable}
\usepackage{graphicx}


\usepackage{chngcntr}
\counterwithin{figure}{section}
\counterwithin{equation}{section}

\newcommand\ddfrac[2]{\frac{\displaystyle #1}{\displaystyle #2}}


\usetikzlibrary{calc}
\usetikzlibrary{quotes, angles, arrows}

\newcommand{\degre}{\ensuremath{^\circ}}

\begin{document}

The ``proof'' from the Journal of Irreproducible Results breaks down at the very last equality: if we construct a figure following the instructions given in that text, the segment $\overline{AD}$ will always land on the left of both $\overline{AD}$ and %
$\overline{AP}$---see figure \ref{quadrilateral}---, and thus $x\neq\angle PAD-\angle PAB$, but $x=360\degre-\angle PAD-\angle PAB$. In fact, the figure shown in the problem statement is incorrect, since it corresponds to a quadrilateral whose $|\overline{AD}|\neq|\overline{BC}|$ %
(see figure \ref{bad-figure}), while the ``proof'' requires  $|\overline{AD}|=|\overline{BC}|$ in order to work.

\begin{figure}
\caption{...}
\label{quadrilateral}
\end{figure}

\begin{figure}
\label{bad-figure}
\caption{...}
\end{figure}

\end{document}

输出:

文件输出

知道为什么吗?

答案1

作为@ChristianHupfer说了,\label必须去\caption您所指的图形。

相关内容