\listoffigures は \subfig では動作しないようです。エラーは表示されませんが、コンパイルがメッセージとともに停止します...amsfonts/umsb.fd
。どうすれば修正できますか?
\documentclass[12pt,twoside]{report}
\usepackage{graphicx,subfig}
\begin{document}
\listoffigures
\begin{figure}
\centering
\subfloat[sample A]{\includegraphics[width=0.48\textwidth]{./figure/a.png}}
\subfloat[sample B]{\includegraphics[width=0.48\textwidth]{./figure/n.png}}\\
\caption{Sample.}
\label{fig:sample}
\end{figure}
\end{document}
答え1
通常、図のリストにはサブキャプションを含めません。
\documentclass[12pt,twoside]{report}
\usepackage{graphicx,subfig}
\begin{document}
\setcounter{lofdepth}{2}% include subcaptions
\listoffigures
\begin{figure}
\centering
\subfloat[sample A]{\includegraphics[width=0.48\textwidth]{example-image-a}}\hfil
\subfloat[sample B]{\includegraphics[width=0.48\textwidth]{example-image-b}}% automatic \par from \caption
\caption{Sample.}
\label{fig:sample}
\end{figure}
\end{document}
答え2
すでに答えが出ていることは承知していますが、ご存知のとおり、{subfig} は今日では最善の方法ではありません。{subcaption} に置き換える方がよいでしょう。私がいつも使用している例を挙げると、次のようになります。
\documentclass{scrreprt}%
\RequirePackage{graphicx}%
\RequirePackage[hypcap=true]{caption}%
\RequirePackage[list=true,hypcap=true]{subcaption}% list=true ... print in List of Figures
\RequirePackage{hyperref}%
\captionsetup{hypcap=true}% -- hyperref
\captionsetup{rule=false}% reset make@caption to KOMA-Script,%
\captionsetup[subtable]{labelformat=simple,labelsep=period,listformat=simple}%
\captionsetup[subfigure]{labelformat=simple,labelsep=period,listformat=simple}%
\captionsetup{format=plain}%
\makeatletter%
\renewcommand\p@subfigure{\thefigure.}%
\renewcommand\p@subtable{\thetable.}%
\makeatother%
\begin{document}%
\chapter{Sample}%
\label{chap:Sample}%
\section{Sample section}%
\label{sec:Sample:Sample section}%
\begin{figure}[h]%
\captionsetup{justification=centering}% raggedright, justified, ...
\subcaptionbox{sample A\label{subfig:Sample:sample A}}{\includegraphics[width=0.48\textwidth]{example-image-a}}%
\hfill%
\subcaptionbox{sample B\label{subfig:Sample:sample B}}{\includegraphics[width=0.48\textwidth]{example-image-b}}%
\caption{Sample}%
\label{fig:Sample}%
\end{figure}%
\listoffigures%
\end{document}
これは次のようになります (scrpreprt-class に置き換えたくない場合は、report-class で使用できます)。