duplicate I am using algorithm package (built with pdflatex -shell-escape -synctex=1 -interaction=nonstopmode under TexStudio) to draw my algorithm. It works well on a template, but when I switch to another template, it is presented with lines overlapped as below.

enter image description here

The main tex file code is described below, please download the template source from mdpi.com:


\usepackage{algorithm}% http://ctan.org/pkg/algorithms

\externaleditor{Academic Editor: name}
\history{Received: date; Accepted: date; Published: date}
% 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.)
    $^{1}$ \quad Affiliation 1; e-mail@e-mail.com\\
    $^{2}$ \quad Affiliation 2; e-mail@e-mail.com}
\corres{Correspondence: e-mail@e-mail.com; Tel.: +x-xxx-xxx-xxxx}
\firstnote{Current address: Affiliation 3} 
\secondnote{These authors contributed equally to this work.}
    \caption{algorithm caption} 
    \hspace*{0.02in} {Input:} 
    input parameters A, B, C\\
    \hspace*{0.02in} {Output:} 
    output result
        \State some description 
        \State ...
        \State ...
        \State ...
        \State ...
        \State \Return result

I have set up an git project on github, please feel free to clone it and try compiling it with pdflatex,

git clone https://github.com/qorost/latex-demo-algorithm.git

Any suggestions to increase the space between lines? any reply are appreciated!

  • Please make a small example document and add it inline to your question. this question and its answers are archived forever and will not make sense unless you also keep that github project unchanged forever. – David Carlisle Jul 5 '18 at 6:38
  • @DavidCarlisle Just updated this question with my demo tex code as well as a link to download the template files. The styling files are too big and it is beyond my ability to make it inline. – Qoros Jul 5 '18 at 6:52
  • better thanks (a MWE would be better still, but this will do:-) incidentally \bf isn't supposed to be used in latex – David Carlisle Jul 5 '18 at 6:57
  • @DavidCarlisle Thanks for the suggestions. updated with \bf removed. – Qoros Jul 5 '18 at 7:13

enter image description here

It's some strange interaction with setspace package and the other settings used. I didn't trace everything but you can reset the baselineskip so it isn't so cramped:

  • Thanks for your reply. It works. Actually, I also get a reply from MDPI editor, they shared a similar answer. – Qoros Jul 5 '18 at 8:43
  • +1 I am also using the MDPI template and I am encountering the same problem. This got me through. – Jimmy R. Jul 28 '19 at 11:57

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.