子图的编号标题

子图的编号标题

我有两个图形需要添加到单个figure环境中。当我使用时subfigure,出现以下错误:

! Missing number, treated as zero.
<to be read again> 
                   }
l.25         \begin{subfigure}{0.49\textwidth}

我搜索了互联网并尝试使用包captionsubcaption使用subfloat包中的环境,subfig它们对于图形来说工作得很好,但是subfigcaptionsubcaption包都覆盖了格式,listoffigures这是意料之外的。所以我使用了minipage环境,如下例所示。但我无法摆脱数字子图。

在此处输入图片描述

我想要拥有ab的子图,但没有它们listoffigures,只是Figure 1.1拥有所有的子图。

样式文件fbe_tez.sty可以在以下链接中找到:http://www.fbe.boun.edu.tr/en/downloads/fbe_thesis.zip

\documentclass[a4paper,onesided,12pt]{report}    
\usepackage{styles/fbe_tez}
\usepackage[utf8x]{inputenc} % To use Unicode (e.g. Turkish) characters
\renewcommand{\labelenumi}{(\roman{enumi})}
\usepackage{amsmath, amsthm, amssymb}
\usepackage[bottom]{footmisc}
\usepackage{cite}
\usepackage{graphicx}
\usepackage{longtable}
\graphicspath{{figures/}} % Graphics will be here

\usepackage{multirow}
\usepackage{subfigure}
\usepackage{algorithm}
\usepackage{algorithmic}

\renewcommand{\thesubfigure}{\alph{subfigure}}

\begin{document}

  \listoffigures

  \chapter{Chapter name}  

  \begin{figure}[!ht]
    \centering
    \begin{minipage}{0.49\textwidth}
      \centering
      \includegraphics[width=\linewidth]{sample_figure1.png}
      \caption{1.graph caption.}
    \end{minipage}%
    \begin{minipage}{0.49\textwidth}
      \centering
      \includegraphics[width=\linewidth]{sample_figure2.png}
      \caption{2. graph caption.}
    \end{minipage}%
    \caption{Figure caption.}
    \vskip\baselineskip % Leave a vertical skip below the figure
    \label{fig:sample}
  \end{figure}

\end{document}

答案1

试试这个。它会忽略你的样式文件,但你可以尝试使用它。

如果您不想要子图的编号,请不要使用标题。这里有两个带有小页面和子图的版本。

 \documentclass[a4paper,onesided,12pt]{report}    
%\usepackage{styles/fbe_tez}
\usepackage[utf8x]{inputenc} % To use Unicode (e.g. Turkish) characters
\usepackage[usenames,dvipsnames]{xcolor}

\usepackage{caption}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{subcaption} 

\usepackage{graphicx}


\renewcommand{\thesubfigure}{\alph{subfigure}}

\begin{document}

  \listoffigures

  \chapter{Chapter name}  

  \begin{figure}[!ht]
    \centering
    \begin{minipage}{0.49\textwidth}
      \centering
      \includegraphics[width=\linewidth]{sample_figure1.png}
      %\caption{1.graph caption.}
      1. graph caption.
    \end{minipage}%
    \begin{minipage}{0.49\textwidth}
      \centering
      \includegraphics[width=\linewidth]{sample_figure2.png}
      %\caption{2. graph caption.}
      2. graph caption.
    \end{minipage}%
    \caption{Figure 1 caption.}
    \vskip\baselineskip % Leave a vertical skip below the figure
    \label{fig:sample}
  \end{figure}


  \begin{figure}
    \begin{subfigure}[b]{0.49\textwidth}
        \centering
        \resizebox{\linewidth}{!}{

        \includegraphics[width=\linewidth]{sample_figure1.png}
        }
        \caption{Subfigure A}
        %\label{fig:subfig8}
    \end{subfigure}
    \begin{subfigure}[b]{0.49\textwidth}
        \centering
        \resizebox{\linewidth}{!}{
\includegraphics[width=\linewidth]{sample_figure2.png}
        }
        \caption{Subfigure B}   
        %   \label{fig:subfig9}
    \end{subfigure}

    \caption{Figure 2 caption.} 
    \label{fig:estfin}
  \end{figure}

\end{document}

带子图的结果 在此处输入图片描述

带子图的结果 在此处输入图片描述

答案2

对罗伯特的回答的补充(见我的评论):

以这种方式加载style/fbe_tez

\makeatletter
\let\ORI@caption\@caption
\let\ORI@makecaption\@makecaption
\makeatother
\usepackage{styles/fbe_tez}
\makeatletter
\let\@caption\ORI@caption
\let\@makecaption\ORI@makecaption
\makeatother

\@caption这样,和的定义\@makecaption将被保存和恢复,因此 style/fbe_tez 对这两个宏的重新定义将丢失。这让 caption 包感到高兴,因为它不必处理这些宏的未知修改。

之后,您可以尝试使用 caption 包提供的常规命令来模拟(丢失的)修改,例如

\usepackage{caption}
\captionsetup{labelsep=period}
\DeclareCaptionListFormat{figure}{Figure #2.}
\DeclareCaptionListFormat{table}{Table #2.}
\captionsetup[figure]{listformat=figure}
\captionsetup[table]{listformat=table}

或(使用 caption3.sty v1.7 或更新版本时)

\usepackage{caption}
\DeclareCaptionListFormat{fbe_tez}{\csname\captionlisttype name\endcsname\space#2.}
\captionsetup{labelsep=period,listformat=fbe_tez}

因此,总的来说,我们有经过修改的 Roberts 答案代码:

\documentclass[a4paper,onesided,12pt]{report}
\makeatletter
\let\ORI@caption\@caption
\let\ORI@makecaption\@makecaption
\makeatother
\usepackage{styles/fbe_tez}
\makeatletter
\let\@caption\ORI@caption
\let\@makecaption\ORI@makecaption
\makeatother
\usepackage[utf8x]{inputenc} % To use Unicode (e.g. Turkish) characters
\usepackage[usenames,dvipsnames]{xcolor}

\usepackage{caption}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{subcaption}

\usepackage{graphicx}

\captionsetup{labelsep=period}
\DeclareCaptionListFormat{figure}{Figure #2.}
\DeclareCaptionListFormat{table}{Table #2.}
\captionsetup[figure]{listformat=figure}
\captionsetup[table]{listformat=table}

% When using caption3.sty v1.7 (or newer) the last five lines could
% get shortened to these two lines instead:
% \DeclareCaptionListFormat{fbe_tez}{\csname\captionlisttype name\endcsname\space#2.}
% \captionsetup{labelsep=period,listformat=fbe_tez}

\renewcommand{\thesubfigure}{\alph{subfigure}}

\begin{document}

  \listoffigures

  \chapter{Chapter name}  

  \begin{figure}[!ht]
    \centering
    \begin{minipage}{0.49\textwidth}
      \centering
      \includegraphics[width=\linewidth]{sample_figure1.png}
      %\caption{1.graph caption.}
      1. graph caption.
    \end{minipage}%
    \begin{minipage}{0.49\textwidth}
      \centering
      \includegraphics[width=\linewidth]{sample_figure2.png}
      %\caption{2. graph caption.}
      2. graph caption.
    \end{minipage}%
    \caption{Figure 1 caption.}
    \vskip\baselineskip % Leave a vertical skip below the figure
    \label{fig:sample}
  \end{figure}


  \begin{figure}
    \begin{subfigure}[b]{0.49\textwidth}
        \centering
        \resizebox{\linewidth}{!}{

        \includegraphics[width=\linewidth]{sample_figure1.png}
        }
        \caption{Subfigure A}
        %\label{fig:subfig8}
    \end{subfigure}
    \begin{subfigure}[b]{0.49\textwidth}
        \centering
        \resizebox{\linewidth}{!}{
\includegraphics[width=\linewidth]{sample_figure2.png}
        }
        \caption{Subfigure B}   
        %   \label{fig:subfig9}
    \end{subfigure}

    \caption{Figure 2 caption.} 
    \label{fig:estfin}
  \end{figure}

\end{document}

答案3

您的问题可以通过使用包subcaptionbox中定义的环境简单解决subcaption

\documentclass[a4paper,onesided,12pt]{report}
\usepackage[utf8x]{inputenc} % To use Unicode (e.g. Turkish) characters
\usepackage{graphicx}
\usepackage[labelsep=period]{caption}
\usepackage{subcaption}
\renewcommand{\thesubfigure}{\alph{subfigure}}

\begin{document}

\listoffigures

\chapter{Chapter name}

    \begin{figure}[!ht]
    \centering
    \setkeys{Gin}{width=0.48\linewidth}
\subcaptionbox{1. sub graph caption. \label{subfig:1a}}
              {\includegraphics{example-image-a}}
\hfill
\subcaptionbox{2. sub graph caption. \label{subfig:1b}}
              {\includegraphics{example-image-b}}
\caption{Figure caption.}
\label{fig:sample}
    \end{figure}

\end{document}

在此处输入图片描述

在此处输入图片描述

相关内容