I've been trying to deploy subfigures in the MDPI article template using the subcaption package , however every time I attempt to deploy it , the figures overlap with the caption
Here is my tex file
\begin{figure}[ht ]
\centering
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 1}
\end{subfigure}%
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 1}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 2}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 3}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 4}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 5}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 6}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 7}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 8}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[height=1.2in]{frog.jpg}
\caption{Subfigure 9}
\end{subfigure}
\caption{Data Figures\label{dataex}}
\end{figure}```
Best Answer
I assume you downloaded the class
mdpi
and put it in a new directory. It should have a filetemplate.tex
and a Definitions subdirectory.The class
mdpi
defines\captionsetup
for figure but not for subfigure.Using a short
template.tex
and adding the packagesubcaption
and\captionsetup[sub]{...}
with the same style defined for figures, the issue is solved.Code for [26/08/2021 MDPI paper class]
UPDATE [20/12/2021 MDPI paper class]
Now the class MDPI loads the package
subfigure
.The complete code to get the above figure is