我在 Visual Studio 代码上使用 Latex Workshop。
我的 lualatex 工具是:
{
"name": "lualatex",
"command": "lualatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
],
"env": {}
}
我的食谱是:
{
"name": "lualatex x2",
"tools": [
"lualatex",
"lualatex"
]
},
我的代码是
\documentclass{article}
\usepackage{graphicx} % Pictures
\usepackage{amsmath} % Maths formulas
\usepackage{amssymb} %Maths symbols like R and N
\usepackage{subcaption} %Subfigures
\usepackage{float} % Float placement
\usepackage{wrapfig}
\usepackage{geometry}
\usepackage{tikz} % Pretty graphs
\usetikzlibrary{graphs, graphdrawing, positioning, quotes, decorations, decorations.pathmorphing, arrows, arrows.meta, shapes}
\usegdlibrary{trees, force, layered, circular}
\title{My title}
\author{}
\date{}
\begin{document}
\pagenumbering{arabic}
\maketitle
\section{}
\subsection*{a.}
Some text Here \ref{fig:first}.
\begin{flushleft}
\begin{figure}[h]
\begin{subfigure}[b]{0.25\textwidth}
\begin{tikzpicture}
\begin{scope}[every node/.style = {draw, circle}, semithick]
\node (s) at (3,3) {s};
\node (x) at (3,0) {x};
\node (y) at (0,3) {y};
\node (t) at (0,0) {t};
\end{scope}
\begin{scope}[->, >={Stealth}, semithick, auto=right]
\draw (s) edge ["1", swap] (x);
\draw (s) edge ["3"] (y);
\draw (x) edge ["1"] (y);
\draw (x) edge ["4", swap] (t);
\draw (y) edge ["1"] (t);
\end{scope}
\end{tikzpicture}
\caption*{A caption}
\label{fig:first}
\end{subfigure}
\begin{subfigure}[b]{0.25\textwidth}
\begin{tikzpicture}
\begin{scope}[every node/.style = {draw, circle}, semithick]
\node (s) at (3,3) {s};
\node (x) at (3,0) {x};
\node (y) at (0,3) {y};
\node (t) at (0,0) {t};
\end{scope}
\begin{scope}[->, >={Stealth}, semithick, auto=right]
\draw (s) edge ["1", swap] (x);
\draw (s) edge ["3"] (y);
\draw (x) edge ["1"] (y);
\draw (x) edge ["4", swap] (t);
\draw (y) edge ["1"] (t);
\end{scope}
\end{tikzpicture}
\caption*{Another caption}
\label{fig:second}
\end{subfigure}
\end{figure}
\end{flushleft}
\end{document}
我收到警告“引用 fig:first on p[age 1 undefined。”并且引用显示为未解析的引用“??”。我做错了什么?
答案1
您已使用\caption*
,因此没有号码可以参考。