
내 MWE는 다음과 같습니다.
\documentclass{book}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usepackage{subfig}
\usepackage{titletoc}
\begin{document}
\begin{figure}[h!]
\begin{center}{
\begin{tikzpicture}
\begin{axis}
\addplot[domain=0:360]({cos(x)},{sin(x)});
\end{axis}
\end{tikzpicture}
\caption{This was generated with PGFPlots.}
}
\end{center}
\label{fig-circle}
\end{figure}
See figure~\ref{fig-circle}.
\begin{figure}[h!]
\begin{center}{
\includegraphics{header.png}
}
\end{center}
\caption{This was read from a PNG file.}
\label{fig-image}
\end{figure}
See also figure~\ref{fig-image}.
\end{document}
이는 다음과 같이 컴파일됩니다.
documentclass를 사용하면 article
"그림 참조 ??"가 발생합니다. 인쇄 중입니다.
나는 PGFPlots로 그림을 만들고 이전에 텍스트에서 참조한 적이 있다고 100% 확신합니다. 이번에는 무엇이 잘못되었는지 전혀 모르겠습니다.
무슨 일이야?
titletoc
(보너스 포인트의 경우 패키지 및/또는 패키지를 제거하면 컴파일러에서 오류가 발생하는 이유는 무엇입니까 subfig
? 해당 MWE를 컴파일하는 데 둘 중 하나가 필요하지 않다고 확신합니다. 또한 이전에 해당 패키지 없이 컴파일한 적이 있는데, 차이점이 있다면 TeXShop 4.68을 사용하고 있습니다.)
답변1
귀하의 질문을 잘 이해하지 못했지만 레이블 참조 1에 문제가 있는 것 같습니다. 그렇다면 \label{fig-circle}
캡션 옆에 \caption{This was generated with PGFPlots.}
, 즉 을 배치하면 \caption{This was generated with PGFPlots.}\label{fig-circle}
문제가 해결될 수 있습니다. 두 번 컴파일하는 것을 잊지 마십시오.
답변2
글쎄, 나는 배치를 가지고 놀고 있었고 그것을 환경 내부에 배치하는 것(즉, 내 MWE의 위치보다 두 줄 위)이 트릭을 수행하는 것 \label{fig-circle}
같습니다 . center
그게 왜 중요한지 모르겠어요.