考慮下面的程式碼。
\documentclass[14pt,reqno,a4paper]{amsart}
\usepackage{extsizes}
\usepackage{blindtext}
\textheight 9.3in \textwidth 6.5in
\calclayout
\usepackage{amsmath,amsthm,amsfonts,amssymb}
\usepackage{hyperref}
\usepackage{mathrsfs}
\usepackage[all]{xy}
\usepackage[normalem]{ulem}
\usepackage{tikz-cd}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\newcommand{\uMor}[1]{\operatorname{\underline{Mor_{#1}}}}
\usepackage{color}
\pagestyle{myheadings}
\begin{document}
\begin{tikzcd}
(\mathcal{C}/U)^{\text{op}} \arrow[rrr, "{\uMor{\mathcal{F}}(x,y)}"{name=U}, bend left=49] \arrow[rrr, "{\uMor{\mathcal{G}}(\Psi(x),\Psi(y))}"'{name=D}, bend right=49] & & & (\text{Set})
\arrow[Rightarrow, from=U, to=D, shorten >=2pt, shorten <=2pt]
\end{tikzcd}
\end{document}
我想在 tikzcd 程式碼中為圖表添加標題。
我想將該圖命名為“圖 1”
有哪些方法可以做到這一點?
答案1
\documentclass[14pt,reqno,a4paper]{amsart}
\usepackage{extsizes}
\textheight 9.3in \textwidth 6.5in
\calclayout
\usepackage{tikz-cd}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\newcommand{\uMor}[1]{\operatorname{\underline{Mor_{#1}}}}
\usepackage{capt-of}
\pagestyle{myheadings}
\begin{document}
\begin{figure}
\begin{tikzcd}
(\mathcal{C}/U)^{\text{op}} \arrow[rrr, "{\uMor{\mathcal{F}}(x,y)}"{name=U}, bend left=49] \arrow[rrr, "{\uMor{\mathcal{G}}(\Psi(x),\Psi(y))}"'{name=D}, bend right=49] & & & (\text{Set})
\arrow[Rightarrow, from=U, to=D, shorten >=2pt, shorten <=2pt]
\end{tikzcd}
\caption{my caption text}
\end{figure}
\begin{center}
\begin{tikzcd}
(\mathcal{C}/U)^{\text{op}} \arrow[rrr, "{\uMor{\mathcal{F}}(x,y)}"{name=U}, bend left=49] \arrow[rrr, "{\uMor{\mathcal{G}}(\Psi(x),\Psi(y))}"'{name=D}, bend right=49] & & & (\text{Set})
\arrow[Rightarrow, from=U, to=D, shorten >=2pt, shorten <=2pt]
\end{tikzcd}
\captionof{figure}{my caption text}
\end{center}
\end{document}
與問題無關,但您可能需要記住,該hyperref
包通常(有少數例外)應該是您加載的最後一個包。