I am currently adapting an article to the MDPI template and I have encountered some problems with the algorithm package. Code lines overlap and the last code line appears below the end horizontal line. This is my main file:




 \makeatother \pubvolume{xx} 
\issuenum{1} \articlenumber{1}
\externaleditor{Academic Editor: name} 
\history{Received: date; Accepted: date; Published: date} 
\Title{Title} % Author Orchid ID: enter ID or remove command \newcommand{\orcidauthorA}{0000-0000-000-000X} % Add \orcidA{} behind the author's name %\newcommand{\orcidauthorB}{0000-0000-000-000X} % Add \orcidB{} behind the author's name

% Authors, for the paper (add full first names) \Author{Firstname Lastname $^{1,\dagger,\ddagger}$\orcidA{}, Firstname Lastname $^{1,\ddagger}$ and Firstname Lastname $^{2,}$*}

% Authors, for metadata in PDF \AuthorNames{Firstname Lastname, Firstname Lastname and Firstname Lastname}

% Affiliations / Addresses (Add [1] after \address if there is only one affiliation.) \address{%
    $^{1}$ \quad Affiliation 1; [email protected]\\
    $^{2}$ \quad Affiliation 2; [email protected]} \corres{Correspondence: [email protected]; Tel.: +x-xxx-xxx-xxxx} \firstnote{Current address: Affiliation 3}  \secondnote{These authors contributed equally to this work.} \begin{document} \section{Hello}

    \caption{: do something \label{alg:1}}
    \begin{algorithmic}[1] % The number tells where the line numbering should start
    \Procedure {Do}{something $n$}
         \If {connected}
           \State send 
           \State store 
    \end{algorithmic} \end{algorithm}


My conf-simple.sty file:



This is my desired output: enter image description here

If I change documentclass to \documentclass{article} it is generated. However what I get with the mpdi template is: enter image description here

I have found this question and I have tried to follow the proposed solution. However, adding \setlength\baselineskip{20pt} has no effect on my output. It only has effect if I comment my configuration line that sets the font size to scriptsize. Then, it solves the overlapping lines problem but not the problem with the final horizontal line. This is the output: enter image description here

However, I would rather maintain the scriptsize.

Is there any way to obtain my desired output?

1 Answer 1


I haven't figured out where this incompatibility comes from. But I have a solution. Use the spacing environment to increase the spacing:

    \caption{: do something \label{alg:1}}
    \begin{spacing}{2} %% you can adjust the amount of spacing here
    \Procedure {Do}{something $n$}
         \If {connected}
           \State send 
           \State store 
    \end{spacing} %% end of the spacing environment

You must log in to answer this question.

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