0

I am using the following code to list 3 figures in one line. It is working well and showing the figure if I remove the \subcaption for each figure. However, when I include the (\subcaption)s, it shows the figure with the subcaptions but with error shown in the image below. Any suggestion(s)?

enter image description here

\begin{figure}[H]
    %A
    \centering
    \begin{minipage}[t]{\dimexpr.355\textwidth-1em} % 0.335 represents the horizontal spacing
        \centering
        \includegraphics[width=\textwidth]{Fig14_VOL1_Annotated}
        \subcaption{ CA $ < \ang{90}$}
        \label{Fig14:A}
    \end{minipage}\hfill
    %B
    \begin{minipage}[t]{\dimexpr.355\textwidth-1em}
        \centering
        \includegraphics[width=\textwidth]{Fig14_volumegreater90Annotated}  
        \subcaption{CA $ > \ang{90}$}
        \label{Fig14:B}
    \end{minipage}\hfill
    %C
    \begin{minipage}[t]{\dimexpr.355\textwidth-1em}
        \centering
        \includegraphics[width=\textwidth]{Fig14_vmiddlev1withannotation}
         \subcaption{CA $=\ang{90}$}
        \label{Fig14:C}
    \end{minipage}\hfill
    \caption{Volume and contact angle calculations according to CA value }
    \label{Fig.14}
\end{figure} 
4
  • 1
    You should use subfigure instead of minipage. Did you do \usepackage{subcaption}?
    – egreg
    Commented Oct 25, 2018 at 13:14
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.
    – dexteritas
    Commented Oct 25, 2018 at 13:21
  • According to the error message you get, you are already using the subfig package. The subfig package does not offer a \subcaption command, and you cannot load both, subfig and subcaption. So instead of using minipage plus \subcaption, use \subfloat instead. See subfig documentation for details about the syntax of \subfloat.
    – user2574
    Commented Oct 26, 2018 at 18:37
  • what I have is a platform for editing theses and dissertations. I tried all the possible solutions you could imagine but unfortunately, no one worked. That is why I just transfer it to image. Commented Oct 29, 2018 at 15:01

1 Answer 1

1

Try the following:

\documentclass[12pt]{article}
\usepackage{graphicx,subcaption,mwe}
\usepackage{amsmath}
\begin{document}
\begin{figure}[htb]
    \begin{minipage}[t]{0.2\textwidth}
    \centering
    \includegraphics[width=1cm]{example-image-A}
    \subcaption{CA1}
    \label{Fig14:a}
    \end{minipage}\hfill
    \begin{minipage}[t]{0.2\textwidth}
    \centering
    \includegraphics[width=1cm]{example-image-B}
    \subcaption{CA2}
    \label{Fig14:b}
    \end{minipage}\hfill
    \begin{minipage}[t]{0.2\textwidth}
    \centering
    \includegraphics[width=1cm]{example-image-C}
    \subcaption{CA3}
    \label{Fig14:c}
    \end{minipage}
\end{figure} 
\end{document}

enter image description here

0

You must log in to answer this question.

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