0

I usually use subfigure. But this time I am forced to use minipage.However, subfigures captions are appear to be Figure 1, Figure 2..... However, I want figure 1a, 1b.... Can anyone suggest a solution ? I also tried subfloat but the error message I am getting is Missing \endcsname inserted. \subfloat

Thanks

    \begin{minipage}{.49\columnwidth}
        \caption{Subfigure (\alph{figure})}
        \includegraphics[width=\textwidth]{example-image-a}
        \label{fig:subfig1}
    \end{minipage}
    \begin{minipage}{.49\columnwidth}
        \caption{Subfigure (\alph{figure})}
        \includegraphics[width=\textwidth]{example-image-b}
        \label{fig:subfig2}
    \end{minipage}
    \begin{minipage}{.49\columnwidth}
        \caption{Subfigure (\alph{figure})}
        \includegraphics[width=\textwidth]{example-image-c}
        \label{fig:subfig3}
    \end{minipage}
    \begin{minipage}{.49\columnwidth}
        \caption{Subfigure (\alph{figure})}
        \includegraphics[width=\textwidth]{example-image}
        \label{fig:subfig4}
    \end{minipage}
Jae H
  • 81

1 Answers1

1

enter image description here

\documentclass{article}
\usepackage{subcaption}
\usepackage{pgffor}
\usepackage{alphalph}

\renewcommand\thesubfigure{1\alphalph{\value{subfigure}}}

\begin{document} \begin{figure} \foreach \i in {1,...,20}{ \begin{minipage}[b]{.3\linewidth} \centering\large A\i \subcaption{A subfigure}\label{fig:1A\i} \end{minipage}% \begin{minipage}[b]{.3\linewidth} \centering\large B\i \subcaption{A subfigure}\label{fig:1b\i} \end{minipage} \begin{minipage}[b]{.3\linewidth} \centering\large C\i \subcaption{A subfigure}\label{fig:1c\i} \end{minipage}\ } \end{figure} \end{document}

OR

\documentclass{article}
\usepackage{subcaption}
\usepackage{pgffor}
\usepackage{alphalph}
\usepackage[demo]{graphicx}

\renewcommand\thesubfigure{1\alphalph{\value{subfigure}}}

\begin{document} \begin{figure} \begin{minipage}[b]{.3\linewidth} \centering \includegraphics[width=\textwidth]{example-image-a} \subcaption{A subfigure} \end{minipage}% \end{figure} \end{document}

enter image description here

js bibra
  • 21,280
  • Thank you but nothing is running well. The following is the error message I am getting.

    Missing \endcsname inserted. \subcaption{ \

    https://www.mdpi.com/authors/latex is the latex style I am using

    – Jae H Apr 09 '21 at 05:36
  • must be something in your preamble since you have not declared the minimal code – js bibra Apr 09 '21 at 05:58
  • Can you try to run your example in the template https://www.mdpi.com/authors/latex ? It is a bit strange for me. Thanks – Jae H Apr 09 '21 at 06:00
  • is the output shown above meeting the requirement of your original question -- if yes you could show your appreciation by accepting/ upvoting the answer since it takes time to search for a solution -- the additional query to match a solution for the mdpi.cls can be a new question since the solution above may not be applicable -- and to attract a larger audience – js bibra Apr 09 '21 at 06:04
  • js bibra, that is exactly what I am looking for and I voted the answer to express my appreciation. I don't know if I can do it the other way. – Jae H Apr 09 '21 at 06:08
  • accepting the answer is by clicking the green tick on the left side of the answer – js bibra Apr 09 '21 at 06:21
  • I did that but it is not green in my end. It is brown. – Jae H Apr 09 '21 at 06:30