3

I used this code:

\begin{figure*}
    \centering
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=0.45\textwidth]{Figs/fig7.eps}
        \caption[Network2]%
        {{\small Network 1}}
        \label{fig:mean and std of net14}
    \end{subfigure}
    \hfill
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=0.45\textwidth]{Figs/fig8.eps}
        \caption[]%
        {{\small Network 2}}
        \label{fig:mean and std of net24}
    \end{subfigure}
    \vskip\baselineskip
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=0.45\textwidth]{Figs/fig9.eps}
        \caption[]%
        {{\small Network 3}}
        \label{fig:mean and std of net34}
    \end{subfigure}
    \quad
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=0.45\textwidth]{Figs/fig10.eps}
        \caption[]%
        {{\small Network 4}}
        \label{fig:mean and std of net44}
    \end{subfigure}
    \caption[ The average and standard deviation of critical parameters ]
    {\small The average and standard deviation of critical parameters: Region R4}
    \label{fig:mean and std of nets}
\end{figure*}

But I don't know why in the line

\includegraphics[width=0.45\textwidth]{Figs/fig7.eps}

and the other three similar lines for fig8, fig9 and fig10 I have the following error:

! Missing number, treated as zero

I do not know what's the problem.

2
  • Couple of points. 1. Next time, please provide an MWE. 2. I'd use \subcaptionbox of the subcaption-pkg for constructions such as this one, it is way more comfortable. It's only \subcaption{Caption text.}{Path to image file} That's it! 3. You can also globally define the text size of all captions in your document. Either use the built-in commands of KOMA (in case you use a KOMA class) or the caption-package. 4. You do not need to give the lof-brackets ([]) for the \caption-command.
    – henry
    Oct 5, 2014 at 15:01
  • 1
    Isn't this a duplicate of tex.stackexchange.com/questions/196481/problem-on-subfigure-2x2 Sep 14, 2015 at 16:05

2 Answers 2

4

I'm not sure about the problem you get; however, you should realize that inside subfigure, \textwidth refers to the size reserved for the whole subfigure, so you want width=\textwidth or the image will be further halved down.

Also don't use \small inside \caption, but better change the layout with \captionsetup.

Don't say \vskip\baselineskip, but \bigskip or \vspace{...} preceding it with a blank line.

\documentclass[twocolumn]{article}
\usepackage{subcaption}
\usepackage[demo]{graphicx}

\captionsetup{font=small}
\captionsetup[subfigure]{font=footnotesize}

\begin{document}
\begin{figure*}
\centering

\begin{subfigure}[t]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{Figs/fig7.eps}
\caption{Network 1}
\label{fig:mean and std of net14}
\end{subfigure}%
%
\hfill
%
\begin{subfigure}[t]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{Figs/fig8.eps}
\caption{Network 2}
\label{fig:mean and std of net24}
\end{subfigure}

\bigskip 

\begin{subfigure}[t]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{Figs/fig9.eps}
\caption{Network 3}
\label{fig:mean and std of net34}
\end{subfigure}%
%
\hfill
%
\begin{subfigure}[t]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{Figs/fig10.eps}
\caption{Network 4}
\label{fig:mean and std of net44}
\end{subfigure}

\caption{The average and standard deviation of critical parameters: Region R4}
\label{fig:mean and std of nets}
\end{figure*}

\end{document}

enter image description here

1

I'm not familiar with subfigure in your MWE, so I propose another possibility to arrange subfigures. In such cases I rather use subfig package:

documentclass{article}
    \usepackage{graphicx}
    \usepackage[labelsep=space,
                labelfont={sf,bf},
                textfont=sf]{subfig}
    \usepackage[labelsep=colon,
                labelfont={sf,bf},
                textfont=sf]{caption}
%---------------------------------------------------------------%
\usepackage[active,floats,tightpage]{preview}% just for generating 
                                             % provided image
\setlength\PreviewBorder{1em}
%---------------------------------------------------------------%
\begin{document}
    \begin{figure*}\centering
\subfloat[Network 1 \label{fig:mean and std of net14}]
        {\includegraphics[width=0.45\textwidth]{example-image}}
    \hfill
\subfloat[Network 2 \label{fig:mean and std of net24}]
         {\includegraphics[width=0.45\textwidth]{example-image}}

\subfloat[Network 2 \label{fig:mean and std of net34}]
         {\includegraphics[width=0.45\textwidth]{example-image}}
    \hfill
\subfloat[Network 1 \label{fig:mean and std of ne44}]
        {\includegraphics[width=0.45\textwidth]{example-image}}
\caption[The average and standard deviation of critical parameters]
        {The average and standard deviation of critical parameters: Region R4}
    \label{fig:mean and std of nets}
    \end{figure*}
\end{document} 

enter image description here

2
  • Avoid commands that are not documented in LaTeX; instead of \vskip\baselineskip use \bigskip with a blank line before it (and one following will also visually represent the skip).
    – egreg
    Oct 5, 2014 at 18:00
  • I agree. I just copied this from given MWE without any thinking. I edit my answer.
    – Zarko
    Oct 5, 2014 at 18:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .