仅显示 6 张图片中的 4 张!

仅显示 6 张图片中的 4 张!

您好,我有 6 张图片,但输出只有 4 张图片。代码如下:我尝试通过 \clearpage 注释来解决问题,以将前三张图片分开。我的其他两张图片怎么了?谢谢!!

% RECOMMENDED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[graybox]{svmult}

% choose options for [] as required from the list
% in the Reference Guide

\usepackage{mathptmx}       % selects Times Roman as basic font
\usepackage{helvet}         % selects Helvetica as sans-serif font
\usepackage{courier}        % selects Courier as typewriter font
\usepackage{type1cm}        % activate if the above 3 fonts are
                            % not available on your system

\usepackage{epstopdf}       % Converts eps to pdf if your version of 
                            % Tex (or pdflatex) does not support eps

%
\usepackage{makeidx}         % allows index generation
\usepackage{graphicx}        % standard LaTeX graphics tool
                             % when including figure files
\usepackage{multicol}        % used for the two-column index
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{float}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{caption}
%\usepackage{subfigure}
\usepackage{subcaption}
\captionsetup{compatibility=false}
\usepackage{placeins}
\usepackage{epstopdf}
\usepackage{multirow}
\usepackage{romannum}
\usepackage{cite}
\usepackage{ragged2e} 
\usepackage{longtable}
\usepackage{lscape}


\usepackage[justification=centering]{caption}

% see the list of further useful packages
% in the Reference Guide

\makeindex             % used for the subject index
                       % please use the style svind.ist with
                       % your makeindex program

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{figure}[h!]
\begin{subfigure}[h!]{\textwidth}
     \includegraphics[width=\linewidth]{lena_image&histogram.jpg}
  \centering
  \label{fig:3_9_2}
    \caption*{Source: Image Databases, Standard Test Images \cite{data_lwpcmphlwj}}
   \caption{Lena Image and Histogram}
 \end{subfigure}
 \begin{subfigure}[h!]{\textwidth}
    \includegraphics[width=\linewidth]{barbara_image&histogram.jpg}
\centering
\label{fig:3_9_5}
\caption*{Source: Public-Domain Test Images for Homeworks and Projects \cite{data_bb}}
\caption{Barbara Image and Histogram} 
\end{subfigure}
\begin{subfigure}[h!]{\linewidth}
 \includegraphics[width=\linewidth]{cameraman_image&histogram.jpg}
 \centering
\label{fig:3_9_6}
\caption*{Source: Image Databases, Standard Test Images \cite{data_lwpcmphlwj}}
\caption{Cameraman Image and Histogram}
\end{subfigure}
\clearpage
\begin{subfigure}[h!]{\textwidth}
\includegraphics[width=\linewidth]{boat_image&histogram.jpg}
\label{fig:3_9_10}
\caption*{Source: Public-Domain Test Images for Homeworks and Projects \cite{data_bb}} 
\caption{Boat Image and Histogram}
\end{subfigure}
\begin{subfigure}[h!]{\textwidth}
\includegraphics[width=\linewidth]{jetplane_image&histogram.jpg}
\label{fig:3_9_14}
\caption*{Source: Image Databases, Standard Test Images \cite{data_lwpcmphlwj}}
\caption{Jet plane Image and Histogram}
\end{subfigure}
\begin{subfigure}[h!]{\textwidth}\ContinuedFloat
\includegraphics[width=\linewidth]{mri_image&histogram.jpg}
\label{fig:3_9_16}
\caption*{Source: Northern Arizona University, Gray Scale Images \cite{data_mri}}
\caption{MRI Image and Histogram}
\end{subfigure} 
\end{figure}
\end{document}

答案1

编辑需要明确的是,这并不是真正的答案......

此代码显示了如何操作subfigure位置。当然,您可能已经对图像(例如 6x1)的定位有了想法,但如果不能将所有内容放在同一页中,您也会失去观众……有时最好将信息分开(如果可能)以更清晰的方式显示。

\documentclass[]{article}
\usepackage{graphicx}       
\usepackage{caption}
\usepackage{subcaption}


\begin{document}
\begin{figure}[h!]
\centering
\begin{subfigure}[h!]{0.33\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-a.jpg}
 \end{subfigure}%
\begin{subfigure}[h!]{0.33\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-b.jpg}
 \end{subfigure}%
 \begin{subfigure}[h!]{0.33\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-c.jpg}
 \end{subfigure}
 \begin{subfigure}[h!]{0.33\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-a.jpg}
 \end{subfigure}%
 \begin{subfigure}[h!]{0.33\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-b.jpg}
 \end{subfigure}%
 \begin{subfigure}[h!]{0.33\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-c.jpg}
 \end{subfigure} 
\end{figure}
\begin{figure}[h!]
\centering
\begin{subfigure}[h!]{0.5\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-a.jpg}
 \end{subfigure}%
\begin{subfigure}[h!]{0.5\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-b.jpg}
 \end{subfigure}
 \begin{subfigure}[h!]{0.5\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-c.jpg}
 \end{subfigure}%
 \begin{subfigure}[h!]{0.5\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-a.jpg}
 \end{subfigure}
 \begin{subfigure}[h!]{0.5\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-b.jpg}
 \end{subfigure}%
 \begin{subfigure}[h!]{0.5\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-c.jpg}
 \end{subfigure} 
\end{figure}
\begin{figure}[h!]
\centering
\begin{subfigure}[h!]{\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-a.jpg}
 \end{subfigure}
\begin{subfigure}[h!]{\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-b.jpg}
 \end{subfigure}
 \begin{subfigure}[h!]{\textwidth}
    \centering
     \includegraphics[width=\linewidth]{example-image-c.jpg}
 \end{subfigure}%
\end{figure}
\end{document}

答案2

  • 您的图像太大,无法放在一页上。
  • 关于如何使用,subfigure你有两种选择:
    • 减小尺寸或
    • 将它们分成多个页面,但不要在尝试的过程中(一个浮点数不能分成两部分)
  • 对于第一种情况,请参见BambOo 的回答
  • 对于第二种情况,您可以利用包\ContinuedFloat中的宏\caption并手动将图像划分为浮点数:

    \documentclass[]{article}
    \usepackage[demo]{graphicx}
    \usepackage{caption}
    \usepackage{subcaption}
    
    \usepackage{lipsum}
    
    \begin{document}
    \lipsum[11]
        \begin{figure}[b!]
    \setkeys{Gin}{width=\linewidth}
    \begin{subfigure}{\linewidth}
         \includegraphics{lena_image&histogram.jpg}
    \caption*{Source: Image Databases, Standard Test Images \cite{data_lwpcmphlwj}}
    \caption{Lena Image and Histogram}
        \label{fig:3_9_1}
    \end{subfigure}
    
    \begin{subfigure}{\linewidth}
        \includegraphics{barbara_image&histogram.jpg}
    \caption*{Source: Public-Domain Test Images for Homeworks and Projects \cite{data_bb}}
    \caption{Barbara Image and Histogram}
        \label{fig:3_9_2}
    \end{subfigure}
    \begin{subfigure}{\linewidth}
        \includegraphics{cameraman_image&histogram.jpg}
    \caption*{Source: Image Databases, Standard Test Images \cite{data_lwpcmphlwj}}
    \caption{Cameraman Image and Histogram}
        \label{fig:3_9_6}
    \end{subfigure}
    \caption{common caption}
        \label{fig:3 9}
        \end{figure}
    %
        \begin{figure}[!t]
    \ContinuedFloat                % <---
    \setkeys{Gin}{width=\linewidth}
    \begin{subfigure}{\linewidth}
        \includegraphics{boat_image&histogram.jpg}
    \caption*{Source: Public-Domain Test Images for Homeworks and Projects \cite{data_bb}}
    \caption{Boat Image and Histogram}
        \label{fig:3_9_10}
    \end{subfigure}
    \begin{subfigure}{\linewidth}
        \includegraphics{jetplane_image&histogram.jpg}
    \caption*{Source: Image Databases, Standard Test Images \cite{data_lwpcmphlwj}}
    \caption{Jet plane Image and Histogram}
        \label{fig:3_9_14}
    \end{subfigure}
    \begin{subfigure}{\linewidth}
        \includegraphics{mri_image&histogram.jpg}
    \caption*{Source: Northern Arizona University, Gray Scale Images \cite{data_mri}}
    \caption{MRI Image and Histogram}
    \label{fig:3_9_16}
        \end{subfigure}
    \caption{common caption (cont.)}
        \end{figure}
    

在此处输入图片描述 在此处输入图片描述

使用键Gin在一个浮点数中设置所有图像的宽度,因此代码 id 稍微短一点

无关:

  • 标签必须始终位于标题之后,而不是之前
  • [!h]的位置选项subfigure没有意义。子图始终在浮动内,如果一行中有两个或多个子图,则可以figure使用选项t或垂直对齐它们到顶部或底部b
  • \centeringsubfigure图像宽度相等时,使用\linewidth也没有意义
  • 关于引用图片来源,请查看copyrightbox您是否可以接受:

    \documentclass[]{article}
    \usepackage[demo]{graphicx}
    \usepackage{caption}
    \usepackage{subcaption}
    \captionsetup[sub]{skip=-6pt}
    \usepackage{copyrightbox}
    
    \usepackage{lipsum}
    %---------------- show page layout. don't use in a real document!
    \usepackage{showframe}
    \renewcommand\ShowFrameLinethickness{0.15pt}
    \renewcommand*\ShowFrameColor{\color{red}}
    %---------------------------------------------------------------%
    
    \begin{document}
        \begin{figure}[!b]
    \setkeys{Gin}{width=\linewidth}
    \begin{subfigure}{\linewidth}
    \copyrightbox[b]{\includegraphics{lena_image&histogram.jpg}}{Source: Image Databases, Standard Test Images \cite{data_lwpcmphlwj}}
    \caption{Lena Image and Histogram}
        \label{fig:3_9_1}
    \end{subfigure}
    
    \bigskip
    \begin{subfigure}{\linewidth}
    \copyrightbox[b]{\includegraphics{barbara_image&histogram.jpg}}{Source: Public-Domain Test Images for Homeworks and Projects \cite{data_bb}}
    \caption{Barbara Image and Histogram}
        \label{fig:3_9_2}
    \end{subfigure}
    
    \bigskip
    \begin{subfigure}{\linewidth}
    \copyrightbox[b]{\includegraphics{cameraman_image&histogram.jpg}}{Source: Image Databases, Standard Test Images \cite{data_lwpcmphlwj}}
    \caption{Cameraman Image and Histogram}
        \label{fig:3_9_6}
    \end{subfigure}
    \caption{common caption}
        \label{fig:3 9}
        \end{figure}
    \lipsum[1]
    \end{document}
    

在此处输入图片描述

(红线表示文本边框)。

上面的例子中也改变了subcaption设置。

相关内容