子图定位错误

子图定位错误

我正在使用“subfigure”包。使用它时出现以下错误。

\documentclass[a4paper,twocolumn]{article}
\usepackage{graphicx}
\usepackage{subfigure}
\begin{document}

\begin{figure}[htb!]
    \subfigure[Input Image]{{\includegraphics[width = 0.45\linewidth]{images/input_image.eps}}}
    \subfigure[Histogram of Input Image]{\includegraphics[width = 0.45\linewidth]{images/input_image_hist.eps}}
    \subfigure[Shuffled Image]{\includegraphics[width = 0.45\linewidth]{images/shuff_img.eps}}
    \subfigure[Histogram of Shuffled Image]{\includegraphics[width = 0.45\linewidth]{images/shuff_img_hist.eps}}
    \subfigure[Encrypted Image]{{\label{zelda}}{\includegraphics[width = 0.45\linewidth]{images/enc_img.eps}}}
    \subfigure[Histogram of Encrypted Image]{\includegraphics[width = 0.45\linewidth]{images/enc_img_hist.eps}}
    \subfigure[Decrypted Image]{\includegraphics[width = 0.45\linewidth]{images/Dec_img.eps}} 
    \subfigure[Histogram of Decrypted Image]{\includegraphics[width = 0.45\linewidth]{images/Dec_img_hist.eps}}
    \hfill
    \caption{Test images}
    \label{enc and hist}
\end{figure}
\end{document}

在此处输入图片描述

问题是,

  1. 所有的子图都没有水平对齐。
  2. 子图(a)、(c)、(e)和(g)的子标题与子图垂直距离较远。
  3. 子图(g)和(h)未水平对齐。

\subfigure由于我在文章的其他区域使用了该命令,因此我无法更改该包\usepackage{subfigure}

我已经尝试过这些包\usepackage{subcaption}\usepackage{subfig}但它们与该包不兼容\usepackage{subfigure}

请在这方面帮助我,而无需更改包裹\usepackage{subfigure}

答案1

  • subfigure已贬值。最好使用subfig和他们的环境subfloat
  • \hfill你的结尾有杂散 subfigures。删除它们或将它们放在图像之间(请参阅下面的 MWE)

使用demo选项,即\usepackage[demo]{graphicx}我获得以下结果:

在此处输入图片描述

梅威瑟:

\documentclass[a4paper,twocolumn]{article}
\usepackage[demo]{graphicx}
\usepackage{subfigure}
\begin{document}

\begin{figure}[htb!]
    \subfigure[Input Image]{{\includegraphics[width = 0.45\linewidth]{images/input_image.eps}}}\hfill
    \subfigure[Histogram of Input Image]{\includegraphics[width = 0.45\linewidth]{images/input_image_hist.eps}}

    \subfigure[Shuffled Image]{\includegraphics[width = 0.45\linewidth]{images/shuff_img.eps}}\hfill
    \subfigure[Histogram of Shuffled Image]{\includegraphics[width = 0.45\linewidth]{images/shuff_img_hist.eps}}

    \subfigure[Encrypted Image]{{\label{zelda}}{\includegraphics[width = 0.45\linewidth]{images/enc_img.eps}}}\hfill
    \subfigure[Histogram of Encrypted Image]{\includegraphics[width = 0.45\linewidth]{images/enc_img_hist.eps}}

    \subfigure[Decrypted Image]{\includegraphics[width = 0.45\linewidth]{images/Dec_img.eps}}\hfill
    \subfigure[Histogram of Decrypted Image]{\includegraphics[width = 0.45\linewidth]{images/Dec_img_hist.eps}}

    \caption{Test images}
    \label{enc and hist}
\end{figure}
\end{document}

相关内容