図のないキャプション

図のないキャプション

私は LaTeX エディタでレポートを作成しています。列に 2 つの画像で構成されたキャプションがあります。下の画像は上の画像よりも大きいため、画像を揃えるために「figure」なしで center 環境を使用しています。\includegraphics のみを使用しています。figure 環境を使用せずに (a)、(b) のように画像を「サブキャプション」として配置する方法をご存知の方はいませんか? それを使用すると、下の画像は揃えられていないように見えます。よろしくお願いします。

答え1

ここでは2つの異なるパッケージが使用されsubcaptionsubfigデモンストレーションに使用されています。figure環境がない場合は、minipage環境をcolumnwidth設定して使用し、

\makeatletter
\def\@captype{figure}
\makeatother

List of Figures必要な場合は\caption{...}\listofiguresコマンドを使用して 2 回コンパイルし、適切なレンダリングを取得します。

ここに画像の説明を入力してください

コード

\documentclass[]{report}
\usepackage[showframe,margin=2cm]{geometry}
   \usepackage[utf8]{inputenc}
   \usepackage[T1]{fontenc}
   \usepackage{multicol}
   \columnsep=10pt 
   \columnseprule=3pt 
%   \usepackage{subfig}       % for subfloat
   \usepackage{subcaption}    % for subcaptionbox
   \usepackage{graphicx} 
   %\usepackage{amsfonts, amsmath, amsthm, amssymb} 
   \usepackage{lipsum}


\begin{document}
\listoffigures

\begin{multicols}{2} 

\lipsum[1-3]
\vfill
\columnbreak

% to run this session, please disable `sufig` package and enable `subcaption` package

\subsection*{Subcaptionbox section}
\noindent
\begin{minipage}{\columnwidth}
\makeatletter
\def\@captype{figure}
\makeatother
  \centering
  \subcaptionbox{Above  \label{fig:above}}{%
  \includegraphics[width=0.5\columnwidth]{example-image-a}}\\
  \subcaptionbox{Below  \label{fig:below}}{%
  \includegraphics[width=0.8\columnwidth]{example-image-b} }
  \caption{Two figures}\label{Fig}
\end{minipage}

% to run this session, please disable `subcaption` package and enable `subfig` package

%\subsection*{Subfloat section}
%
%\noindent
%\begin{minipage}{\columnwidth}
%\makeatletter
%\def\@captype{figure}
%\makeatother
% \centering
%  \subfloat[Above]{%
%  \includegraphics[width=0.5\columnwidth]{example-image-a}
%  \label{fig:above}
%}\\
%  \subfloat[Below]{%
%  \includegraphics[width=0.8\columnwidth]{example-image-b}
%  \label{fig:below}
%}
%  \caption{Two figures,\label{Fig}}
%\end{minipage}
\end{multicols}
\end{document}

関連情報