我缺少什么数字?当我想为我的子图添加子标题时,系统会告诉我由于某种原因缺少一个数字。如果我删除罗马计数器选项,错误也会消失。
\documentclass[a4paper,UKenglish]{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\renewcommand{\thesubfigure}{\roman{counter}}
\begin{document}
asdfasdf
\begin{figure}
\centering
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[scale=0.5]{example-grid-100x100pt}
\caption{asdfsfad}
\end{subfigure}
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[scale=0.5]{example-grid-100x100pt}
\end{subfigure}
\caption{Caption}
\end{figure}
\end{document}
\end{document}
答案1
您使用了错误的subfigure
标题编号名称。 而必须counter
是subfigure
(参见@Dr. Manuel Kuehner回答)我猜你想获得以下结果:
完整的 MWE 是:
\documentclass[a4paper,UKenglish]{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\renewcommand\thesubfigure{\roman{subfigure}}
\usepackage{lipsum} % added for generation of dummy text
\begin{document}
\lipsum[11]
\begin{figure}[ht]
\centering
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[scale=0.5]{example-grid-100x100pt}
\caption{first subfigure}
\end{subfigure}
\hfil
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[scale=0.5]{example-grid-100x100pt}
\caption{second subfigure}
\end{subfigure}
\caption{Caption}
\end{figure}
\end{document}