我正在使用 overleaf,并将算法插入到会议模板中。不幸的是,算法没有以我喜欢的方式显示:-标题应该位于步骤上方 -上面的标题“算法”之前应该有两行 -算法末尾应该有一行
基本上它应该看起来与这个例子类似(行号不是必需的): https://math-linux.com/latex-26/faq/latex-faq/article/how-to-write-algorithm-and-pseudocode-in-latex-usepackage-algorithm-usepackage-algorithmic
我尝试像他们那样做,但没有成功,我不得不使用“算法” \usepackage{algorithmic}
我会很感激每一条评论。提前感谢你的帮助。
编辑:这是乳胶代码
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
% The preceding line is only needed to identify funding in the first footnote. If that is unneeded, please comment it out.
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{gensymb}
\usepackage{xcolor}
\usepackage[options ]{algorithm2e}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}
\title{Title \\
{\footnotesize \textsuperscript{}}
}
\author{\IEEEauthorblockN{}
\IEEEauthorblockA{\textit{} \\
\textit{}\\
\\
}
\and
\IEEEauthorblockN{}
\IEEEauthorblockA{\textit{} \\
\textit{}\\
\\
}
\and
\IEEEauthorblockN{}
\IEEEauthorblockA{\textit{} \\
\textit{}\\
\\
}
}
\maketitle
\begin{abstract}
Abstract
\end{abstract}
\begin{IEEEkeywords}
component, formatting, style, styling, insert
\end{IEEEkeywords}
\section{Introduction}
\section{Optimization Problem}
\section{Methodology}
\label{section: Methodology}
\subsection{Method 1}
\begin{algorithm}[h]
\SetAlgoLined
\While{$t < Z$}{
\If{$T^{min} \leq T_t^{BS} \leq T^{max}$}{
Set $x_t = x_t^S$\;
}
\If{$T_t^{BS} > T^{max}$}{
Set $x_t = mDeg^{min}$\;
}
\If{$T_t^{BS} < T^{min}$}{
Set $x_t = 1$ \;
}
Set $t=t+1$\;
}
\caption{Algorithm 1}
\label{algo:BS}
\end{algorithm}
\subsection{Method 2}
\bibliography{bibtex}
\end{document}