latex 算法显示问题:线条重叠

latex 算法显示问题:线条重叠

复制 我正在使用包(在下algorithm构建)来绘制我的算法。它在模板上运行良好,但当我切换到另一个模板时,它显示为如下所示的重叠线条。pdflatex -shell-escape -synctex=1 -interaction=nonstopmodeTexStudio

在此处输入图片描述

主要tex文件代码如下,请从以下位置下载模板源代码mdpi.com

\documentclass[journal,article,submit,moreauthors,pdftex,10pt,a4paper]{Definitions/mdpi} 

\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage[noend]{algpseudocode}

\firstpage{1} 
\makeatletter 
\setcounter{page}{\@firstpage} 
\makeatother
\pubvolume{xx}
\issuenum{1}
\articlenumber{1}
\pubyear{2018}
\copyrightyear{2018}
\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}
\begin{algorithm}[t]
    \caption{algorithm caption} 
    \hspace*{0.02in} {Input:} 
    input parameters A, B, C\\
    \hspace*{0.02in} {Output:} 
    output result
    \begin{algorithmic}[1]
        \State some description 
        \For{condition} 
        \State ...
        \If{condition} 
        \State ...
        \Else
        \State ...
        \EndIf
        \EndFor
        \While{condition} 
        \State ...
        \EndWhile
        \State \Return result
    \end{algorithmic}
\end{algorithm}
\end{document}

我已经在上建立了一个 git 项目github,请随意克隆它并尝试用它编译它pdflatex

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

有任何建议可以增加行间距吗?任何回复都值得赞赏!

答案1

在此处输入图片描述

这是与setspace软件包和其他使用的设置之间的一些奇怪的交互。我没有追踪所有内容,但你可以重置 baselineskip,这样它就不会那么拥挤:

\section{Hello}
\begin{algorithm}[t]
\setlength\baselineskip{13.5pt}

相关内容