带有数字标签的单个子图

带有数字标签的单个子图

我正在使用subfigure并希望figure使用一个(a),(b)编号标签来代替标签,例如(1),(2)子图环境中的子图编号(子标题包)演示如何使用 获取罗马数字\renewcommand\thesubfigure{\roman{subfigure}}。我可以调整它来提供数字吗?

另外,我只想让这个影响一个图。所以把它\renewcommand放在文档开头的序言部分并不是我想要的。我想也许我需要把它放在我的图之前,然后我必须立即切换回\renewcommand\thesubfigure{\alph{subfigure}}给出字母标签的图。这是最好的方法吗?

平均能量损失

\documentclass[a4paper,oneside,10pt]{scrartcl}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}

Test: \subref{sfig:a1}, \subref{sfig:a}, \subref{sfig:a3}

\begin{figure}[h]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
            \centering
            {\rule{3cm}{2cm}}
            \caption{Picture 1}
             \label{sfig:a1}
    \end{subfigure}%
    \begin{subfigure}[b]{0.3\textwidth}
            \centering
            {\rule{3cm}{2cm}}
            \caption{Picture 2}
             \label{sfig:b1}
    \end{subfigure}
    \caption{Two picures; a black picture (\subref{sfig:a1}) and another black picture (\subref{sfig:b1}).}
\end{figure}

\renewcommand\thesubfigure{\roman{subfigure}}
\begin{figure}[h]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
            \centering
            {\rule{3cm}{2cm}}
            \caption{Picture 1}
             \label{sfig:a}
    \end{subfigure}%
    \begin{subfigure}[b]{0.3\textwidth}
            \centering
            {\rule{3cm}{2cm}}
            \caption{Picture 2}
             \label{sfig:b}
    \end{subfigure}
    \caption{Two picures; a black picture (\subref{sfig:a}) and another black picture (\subref{sfig:b}).}
\end{figure}
\renewcommand\thesubfigure{\alph{subfigure}}

\begin{figure}[h]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
            \centering
            {\rule{3cm}{2cm}}
            \caption{Picture 1}
             \label{sfig:a3}
    \end{subfigure}%
    \begin{subfigure}[b]{0.3\textwidth}
            \centering
            {\rule{3cm}{2cm}}
            \caption{Picture 2}
             \label{sfig:b3}
    \end{subfigure}
    \caption{Two picures; a black picture (\subref{sfig:a3}) and another black picture (\subref{sfig:b3}).}
\end{figure}

\end{document}

答案1

\renewcommand\thesubfigure{\arabic{subfigure}}在这里:在相关的后面插入\begin{figure}。这样,修改将仅限于此图形环境:

\documentclass[a4paper,oneside,10pt]{scrartcl}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}

Test: \subref{sfig:a1}, \subref{sfig:a}, \subref{sfig:a3}

\begin{figure}[h]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
            \centering
            {\rule{3cm}{2cm}}
            \caption{Picture 1}
             \label{sfig:a1}
    \end{subfigure}%
    \begin{subfigure}[b]{0.3\textwidth}
            \centering
            {\rule{3cm}{2cm}}
            \caption{Picture 2}
             \label{sfig:b1}
    \end{subfigure}
    \caption{Two pictures; a black picture (\subref{sfig:a1}) and another black picture (\subref{sfig:b1}).}
\end{figure}

\begin{figure}[h]
\renewcommand\thesubfigure{\arabic{subfigure}}
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
            \centering
            {\rule{3cm}{2cm}}
            \caption{Picture 1}
             \label{sfig:a}
    \end{subfigure}%
    \begin{subfigure}[b]{0.3\textwidth}
            \centering
            {\rule{3cm}{2cm}}
            \caption{Picture 2}
             \label{sfig:b}
    \end{subfigure}
    \caption{Two pictures; a black picture (\subref{sfig:a}) and another black picture (\subref{sfig:b}).}
\end{figure}

\begin{figure}[h]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
            \centering
            {\rule{3cm}{2cm}}
            \caption{Picture 1}
             \label{sfig:a3}
    \end{subfigure}%
    \begin{subfigure}[b]{0.3\textwidth}
            \centering
            {\rule{3cm}{2cm}}
            \caption{Picture 2}
             \label{sfig:b3}
    \end{subfigure}
    \caption{Two pictures; a black picture (\subref{sfig:a3}) and another black picture (\subref{sfig:b3}).}
\end{figure}

\end{document} 

在此处输入图片描述

相关内容