2

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

  • Please do not link directly to a zip without warning. Link to the download page instead. I've deleted the zip, since you're an untrusted source.. A download page might persuade me of the download's legitimacy. An unsolicited download from some random internet user I regard as highly suspect. EDIT: Make that highly suspicious. Attempting to view parent or top level URLs gets me either an unformatted login or a 403. Is this really a legitimate site? – cfr Dec 10 '17 at 3:24
  • Thanks. Got it. Have you read the instructions in template.tex? They don't want you to do figures like this. For one thing, they want you to use H so they don't float. For another, they want sub-figure numbering for multiple panels within a figure. And they probably don't want you to use caption either. – cfr Dec 10 '17 at 4:13
  • Actually, they load caption with the settings they want already. Probably loading again is harmless, but it is bad practice, so should be avoided. They are probably loading graphicx, too. – cfr Dec 10 '17 at 4:16
3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.