[Tex/LaTex] side by side figures in MDPI class

floatsmdpi

I am using mdpi class to prepare a manuscript. (you can find MDPI_template.zip at mdpi latex class download)

I need two figures to appear side by side on the page. After times of search in Google, I finally use the following code which is the best one for now. But still it does not work rightly. The second caption appears under the first figure.

Do you know how to make the following code work. PS. I don't use subfigures.

\documentclass[journal,article,submit,pdftex,10pt,a4paper,sensors]{mdpi} 
\usepackage{graphicx}
\usepackage{caption}

\Title{Hello side by side}
\Author{Eric Ben$^1$}
\address{%
$^{1}$ \quad My address.
}
\begin{document}

\begin{figure}[!htb]
  \centering
  \begin{minipage}[c]{.5\textwidth}
    \centering
    \includegraphics[width=0.8\linewidth]{example-image-a}
    \caption{example a}
    \label{fig:prob1_6_2}
  \end{minipage}%
  \begin{minipage}[c]{0.5\textwidth}
    \centering
    \includegraphics[width=0.8\linewidth]{example-image-b}
    \caption{example b}
    \label{fig:prob1_6_1}
  \end{minipage}
\end{figure}
\end{document}

The current results:

enter image description here

Best Answer

Journal style files reflect 'house' styles. They are designed to impose a common format on contributions from many people. As such, you need to abide by the style guidelines (i.e. read the instructions) and not do stuff which tramples all over the journal's efforts. This is true whether the style is coded brilliantly, terribly or indifferently. With very, very, very few exceptions - and these are never because you want it to look different.

So, don't load caption. Whatever you want to do with this package, you aren't meant to do. In this case, the journal uses it anyway, so little harm is (probably) done, but loading it is, in any case, at best pointless.

template.tex shows you how to typeset figures. They are not supposed to float, so they want H for all figures. They want sub-numbering for multi-panel figures.

That said, if you are certain that you are allowed to set this the way you want - and you should assume not, if in any doubt - then, since they load caption and don't want floats anyway, you could try something like the following. But note that this is probably not how to do it and you will probably just annoy whoever has to undo your customisations.

\documentclass[journal,article,submit,pdftex,10pt,a4paper,sensors]{mdpi} 
\Title{Hello side by side}
\Author{Eric Ben$^1$}
\address{%
$^{1}$ \quad My address.
}
\begin{document}
\begin{minipage}[c]{.5\textwidth}
  \centering
  \includegraphics[width=0.8\linewidth]{example-image-a}
  \captionof{figure}{example a}\label{fig:prob1_6_2}
\end{minipage}%
\begin{minipage}[c]{0.5\textwidth}
  \centering
  \includegraphics[width=0.8\linewidth]{example-image-b}
  \captionof{figure}{example b}\label{fig:prob1_6_1}
\end{minipage}
\end{document}

probably not how they want it

Related Question