0
\usepackage{algorithm}
\usepackage{algpseudocode}

\begin{document}
\begin{algorithm}
\caption{Brute-Force algorithm}

\begin{algorithmic}[1]

\For {$s'$ \in ${\mathbb{F}^n_2}$}{
    \If {$wt(As'+b)$ \leq $t$}{
        return $s'$}
    }
\end{algorithmic}
\end{algorithm}
\end{document}

\end{onehalfspacing}

Just want to remove this extra part that is marked with red pen Just want to remove this extra part that is marked with red pen

5
  • Your code doesn't compile like that. Even adding the required document environment and giving it a documentclass does not result in that output (but rather a series of errors. Are you sure, these are all the packages you are using?
    – Markus G.
    Jun 3, 2021 at 18:02
  • yes, I used all the required packages Jun 3, 2021 at 18:06
  • Can you maybe provide a combilable minimal working example of you code, which procudes this behaviour? Otherwise, it will be hard to tell what is going wrong here.
    – Markus G.
    Jun 3, 2021 at 18:08
  • ok I made a change in my doubt Jun 3, 2021 at 18:12
  • 2
    Hi. Just a hint (in addition to Markus): Please run the code that you provide here on your system before you post it: Open an empty LaTeX document and paste the code and run/compile it. Then you can see if the code actually produces the problem. Otherwise, the people here cannot help you efficiently. Jun 3, 2021 at 18:27

1 Answer 1

2

If the following is the output you were looking for, then you forgot to close the If and For blocks. Also, there are some issues, with using \leftarrow instead of the packages \gets and some other minor issues with your way of using math mode:

\documentclass{scrartcl}

\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{float}

\begin{document}
    \begin{minipage}{.6\linewidth}
        \begin{algorithm}[H]
            \caption{Brute-Force algorithm}
            \begin{algorithmic}[1]
                \State \textbf{Input:} dimension $d \in \mathbf{N}$, error rate $\tau \in \left[0,\frac{1}{2}\right)$
                \State \textbf{Output:} secret $\mathbf{s}$
                \State $n$ = $4d $(\( \frac{1}{2} \) - \(\tau\))$^{-2}$ ,
                \State $ (A,b) \gets Orc^n_{d,\tau} $
                \For {$s' \in \mathbf{F}^n_2$}
                    \If{$wt(As'+b) \leq t$}
                        return s'
                    \EndIf
                \EndFor
            \end{algorithmic}
        \end{algorithm}
    \end{minipage}
\end{document}

enter image description here

2
  • Thank you so much Jun 4, 2021 at 5:59
  • If this is what you are looking for and it answers your question, feel free to "accept" the answer by clicking the check-mark. This will also let others know that your question has been answered. If, however, there is still something that is not like you expect it to be, do let me know in a comment and I will try to adapt my answer or someone else may give it a go.
    – Markus G.
    Jun 4, 2021 at 7:40

You must log in to answer this question.

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