The \ref
command for one of my figures is outputtig question marks ("??") instead of the reference, but it's working fine for the other figures.
Code:
\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}
Output:
Any idea why?
\caption
, not before, i.e\caption{...}\label{bad-figure}