I am using overleaf and I have inserted an algorithm into an template for a conference. Unfortunately, the algorithm is not displayed in the way I like: -the caption should be above the steps -there should be two lines before the caption "Algorithm" above - there should be a line at the end of the algorithm

Basically it should look similar to this examples (line numbers are not necessary): https://math-linux.com/latex-26/faq/latex-faq/article/how-to-write-algorithm-and-pseudocode-in-latex-usepackage-algorithm-usepackage-algorithmic

I tried to do this like they did, but it did not work out and I had to use the "algorithmic" \usepackage{algorithmic}

I'd appreciate every comment. Thanks for your help in advance.

EDIT: Here is the Latex Code

% The preceding line is only needed to identify funding in the first footnote. If that is unneeded, please comment it out.
\usepackage[options ]{algorithm2e}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em

\title{Title \\
{\footnotesize \textsuperscript{}}

\IEEEauthorblockA{\textit{} \\
\IEEEauthorblockA{\textit{} \\
\IEEEauthorblockA{\textit{} \\




component, formatting, style, styling, insert


\section{Optimization Problem}

\label{section: Methodology}

\subsection{Method 1}

 \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}

\subsection{Method 2}


  • Welcome to TeX.se. Here overleaf support is off-topic. Moreover, please do not add links in the question (they'll be dead soon) instead add a MWE that explains your problem. – Raaja May 3 at 16:18
  • Thanks for the comments. I added the Latex code. Looking forward for your answers – Vanny May 4 at 7:35

Your Answer

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

Browse other questions tagged or ask your own question.