使用“tikzpicture”为带注释的图形添加标题和标签

使用“tikzpicture”为带注释的图形添加标题和标签

我想注释一个图形,因此我tikzpicture在图形环境中使用了如下代码

\documentclass[msom,nonblindrev]{informs3}
\usepackage[nodisplayskipstretch]{setspace}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.5\textwidth]{fig}};
\node[align=center,black] at (1,1) {annotation};
\end{tikzpicture}
\caption{figCaption}\label{figLabel}
\end{figure}
\end{document}

没有它也能很好地工作,\caption{figCaption}\label{figLabel}但是当我用这行代码运行它时,我得到了错误! Undefined control sequence.

有人可以帮忙吗?

答案1

使用与您的片段类似的 MWE,效果很好。您的.log文件中有什么错误?

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.5\textwidth]{example-image-a}};
\node[align=center,black] at (1,1) {annotation};
\end{tikzpicture}
\caption{figCaption}\label{figLabel}
\end{figure}
\end{document}

在此处输入图片描述

答案2

这与https://tex.stackexchange.com/a/612744/36296

您可以通过提供 的定义来解决此问题\@currsize。@DavidCarlisle 的以下内容不会对文档产生任何负面影响:

\documentclass[msom,nonblindrev]{informs3}

\makeatletter
\let\normalsize\relax
\let\@currsize\normalsize
\makeatother

\usepackage[nodisplayskipstretch]{setspace}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.5\textwidth]{example-image-duck}};
\node[align=center,black] at (1,1) {annotation};
\end{tikzpicture}
\caption{figCaption}\label{figLabel}
\end{figure}
\end{document}

在此处输入图片描述

相关内容